Minor gems update. Prepare gemfile for jruby and rbx tests. Remove encoding hacks. Apply grit fixes for encoding support. Recode incorrect encodings. Refactor, cleanup and fix lots bugs in git section. Refactor and remove unused git routes. Translate some untranslated parts. Redo branch/tags selector. Fix files tree last commit message. Project section templates refactor and cleanup. Refs #190

This commit is contained in:
Pavel Chipiga 2012-03-21 21:55:14 +02:00
parent 87e1ee4700
commit 89f31e9782
63 changed files with 326 additions and 860 deletions

18
Gemfile
View File

@ -12,15 +12,17 @@ gem 'omniauth', '~> 1.0.3'
gem 'omniauth-openid', '~> 1.0.1'
gem 'cancan', '~> 1.6.7'
gem 'ancestry', '~> 1.2.4'
gem 'ancestry', '~> 1.2.5'
gem 'paperclip', '~> 2.7.0'
gem 'delayed_job_active_record', '~> 0.3.2'
gem 'russian', '~> 0.6.0'
gem 'highline', '~> 1.6.11'
gem 'rails-xmlrpc', '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git'
# gem 'rugged', '~> 0.16.0'
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
gem "grit", :git => 'git://github.com/mojombo/grit.git', :branch => 'master'
gem "grit", :git => 'git://github.com/chipiga/grit.git'
gem 'charlock_holmes', '~> 0.6.8' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
# Wiki
gem "gollum", "1.3.1"
@ -31,8 +33,9 @@ gem 'rdiscount'
gem 'RedCloth'
gem 'wikicloth'
gem 'unicorn', '~> 4.2.0'
gem 'newrelic_rpm', '~> 3.3.2'
gem 'unicorn', '~> 4.2.0', :platforms => [:mri, :rbx]
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
gem 'newrelic_rpm', '~> 3.3.2', :platforms => [:mri, :rbx]
gem 'whenever', '~> 0.7.3', :require => false
gem 'rails3-jquery-autocomplete', '~> 1.0.6'
@ -42,11 +45,12 @@ gem "haml-rails", '~> 0.3.4'
gem 'jquery-rails', '~> 2.0.1'
group :assets do
gem 'sass-rails', '~> 3.2.4'
gem 'sass-rails', '~> 3.2.5'
gem 'coffee-rails', '~> 3.2.2'
gem 'compass-rails', '~> 1.0.0.rc.3'
gem 'compass-rails', '~> 1.0.1'
gem 'uglifier', '~> 1.2.1'
gem 'therubyracer', '~> 0.9.10'
gem 'therubyracer', '~> 0.9.10', :platforms => [:mri, :rbx]
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
end
group :production do

View File

@ -1,3 +1,12 @@
GIT
remote: git://github.com/chipiga/grit.git
revision: 696b0967cb7e6bac044569d898e5acef431d4f97
specs:
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
GIT
remote: git://github.com/chipiga/redhillonrails_core.git
revision: 5f58167c41882890c223168b0a5521d99e8d92aa
@ -6,16 +15,6 @@ GIT
redhillonrails_core (2.0.0.pre)
activerecord (>= 3.1.0.rc)
GIT
remote: git://github.com/mojombo/grit.git
revision: 3fc864f3c637e06e2fa7a81f6b48a5df58a9bc5b
branch: master
specs:
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
GIT
remote: git://github.com/rdblue/grack.git
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
@ -26,6 +25,7 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
RedCloth (4.2.9-java)
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
@ -58,10 +58,11 @@ GEM
builder
albino (1.3.3)
posix-spawn (>= 0.3.6)
ancestry (1.2.4)
ancestry (1.2.5)
activerecord (>= 2.2.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-java)
bluepill (0.0.60)
activesupport (>= 3.0.0)
daemons (~> 1.1.4, <= 1.1.6)
@ -77,6 +78,7 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano_colors (0.5.5)
charlock_holmes (0.6.8)
chronic (0.6.7)
chunky_png (1.2.5)
cocaine (0.2.1)
@ -87,12 +89,12 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
compass (0.12.rc.1)
compass (0.12.1)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
compass-rails (1.0.0.rc.3)
compass (~> 0.12.rc.0)
compass-rails (1.0.1)
compass (~> 0.12.0)
creole (0.4.2)
daemons (1.1.6)
delayed_job (3.0.1)
@ -108,10 +110,11 @@ GEM
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
eventmachine (0.12.10-java)
execjs (1.3.0)
multi_json (~> 1.0)
expression_parser (0.9.0)
factory_girl (2.6.1)
factory_girl (2.6.4)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
@ -136,16 +139,18 @@ GEM
hashie (1.2.0)
highline (1.6.11)
hike (1.2.1)
hirb (0.6.0)
hirb (0.6.2)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jruby-rack (1.1.4)
json (1.6.5)
kgio (2.7.2)
json (1.6.5-java)
kgio (2.7.3)
libv8 (3.3.10.4)
mail (2.4.3)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
@ -160,7 +165,7 @@ GEM
thin (~> 1.2)
meta-tags (1.2.6)
actionpack
mime-types (1.17.2)
mime-types (1.18)
multi_json (1.1.0)
mustache (0.99.4)
net-scp (1.0.4)
@ -170,8 +175,9 @@ GEM
net-ssh (2.3.0)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
newrelic_rpm (3.3.2)
nokogiri (1.5.0)
newrelic_rpm (3.3.2.1)
nokogiri (1.5.2)
nokogiri (1.5.2-java)
omniauth (1.0.3)
hashie (~> 1.2)
rack
@ -245,7 +251,7 @@ GEM
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.1.15)
sass-rails (3.2.4)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
@ -271,6 +277,7 @@ GEM
state_machine (1.1.2)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
therubyrhino (1.73.1)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@ -280,6 +287,10 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
trinidad (1.0.5)
jruby-rack (>= 1.0.2)
trinidad_jars (>= 0.3.0)
trinidad_jars (1.0.2)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
@ -299,19 +310,21 @@ GEM
will_paginate (3.0.3)
PLATFORMS
java
ruby
DEPENDENCIES
RedCloth
airbrake (~> 3.0.9)
ancestry (~> 1.2.4)
ancestry (~> 1.2.5)
bluepill (~> 0.0.60)
cancan (~> 1.6.7)
cape
capistrano
capistrano_colors
charlock_holmes (~> 0.6.8)
coffee-rails (~> 3.2.2)
compass-rails (~> 1.0.0.rc.3)
compass-rails (~> 1.0.1)
creole
daemons (= 1.1.6)
delayed_job_active_record (~> 0.3.2)
@ -341,10 +354,12 @@ DEPENDENCIES
rr (~> 1.0.4)
rspec-rails (~> 2.8.1)
russian (~> 0.6.0)
sass-rails (~> 3.2.4)
sass-rails (~> 3.2.5)
shotgun
shoulda
therubyracer (~> 0.9.10)
therubyrhino (~> 1.73.1)
trinidad (~> 1.0.2)
uglifier (~> 1.2.1)
unicorn (~> 4.2.0)
whenever (~> 0.7.3)

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class Git::BaseController < ApplicationController
before_filter :authenticate_user!
load_and_authorize_resource :project
before_filter :find_project
before_filter :find_git_repository
@ -10,11 +11,9 @@ class Git::BaseController < ApplicationController
before_filter :set_current_tag
before_filter :set_current_branch
load_and_authorize_resource :project
protected
def find_project
@project = Project.find(params[:project_id] || params[:id])
@project ||= Project.find(params[:project_id] || params[:id]) # TODO remove?
end
def find_git_repository
@ -30,7 +29,7 @@ class Git::BaseController < ApplicationController
end
def set_treeish
@treeish = params[:treeish].present? ? params[:treeish] : @project.default_branch
@treeish = params[:treeish].presence || @project.default_branch
end
def set_current_tag

View File

@ -2,29 +2,25 @@
class Git::BlobsController < Git::BaseController
before_filter :find_tree
before_filter :find_branch
before_filter :set_commit_hash
before_filter :set_path_blob
def show
redirect_to project_path(@project) and return unless @blob.present?
if params[:raw]
image_url = Rails.root.to_s + "/" + @path
response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
response.headers['Content-Type'] = @blob.mime_type
response.headers['Content-Disposition'] = 'inline'
render(:text => open(image_url).read) and return
render(:text => @blob.data) and return
end
end
def edit
redirect_to project_repo_path(@project) and return unless @blob.present?
redirect_to project_path(@project) and return unless @blob.present?
authorize! :write, @project
end
def update
redirect_to project_repo_path(@project) and return unless @blob.present?
redirect_to project_path(@project) and return unless @blob.present?
authorize! :write, @project
# Here might be callbacks for notification purposes:
# @git_repository.after_update_file do |repo, sha|
@ -33,9 +29,9 @@ class Git::BlobsController < Git::BaseController
res = @git_repository.update_file(params[:path], params[:content].gsub("\r", ''),
:message => params[:message].gsub("\r", ''), :actor => current_user, :head => @treeish)
if res
flash[:notice] = t("flash.blob.successfully_updated", :name => params[:path].encode_to_default)
flash[:notice] = t("flash.blob.successfully_updated", :name => params[:path])
else
flash[:notice] = t("flash.blob.updating_error", :name => params[:path].encode_to_default)
flash[:notice] = t("flash.blob.updating_error", :name => params[:path])
end
redirect_to :action => :show
end
@ -45,40 +41,24 @@ class Git::BlobsController < Git::BaseController
end
def raw
redirect_to project_repo_path(@project) and return unless @blob.present?
redirect_to project_path(@project) and return unless @blob.present?
headers["Content-Disposition"] = %[attachment;filename="#{@blob.name}"]
render :text => @blob.data, :content_type => @blob.mime_type
end
protected
def find_branch
@branch = @project.branch(@treeish)
end
def set_path_blob
@path = params[:path]
@unenc_path = @path.dup
@path.force_encoding(Encoding::ASCII_8BIT)
puts @path.inspect
@blob = @tree / @path
puts @blob.inspect
end
def find_branch
@branch = @project.branch(@treeish)
end
def set_commit_hash
@commit_hash = params[:commit_hash].present? ? params[:commit_hash] : nil
end
def set_path_blob
@path = params[:path]
@blob = @tree / @path
end
def find_tree
if @commit_hash
puts "1"
@tree = @git_repository.tree(@commit_hash)
@commit = @git_repository.commits(@treeish, 1).first
else
puts "2"
@tree = @git_repository.tree(@treeish)
@commit = @git_repository.log(@treeish, @path, :max_count => 1).first # TODO WTF nil ?
end
puts @tree.inspect
puts @commit.inspect
end
def find_tree
@tree = @git_repository.tree(@treeish)
@commit = @git_repository.log(@treeish, @path, :max_count => 1).first # TODO WTF nil ?
end
end

View File

@ -1,6 +1,5 @@
# -*- encoding : utf-8 -*-
class Git::CommitsController < Git::BaseController
helper_method :split_commits_by_date
def index
@ -22,7 +21,7 @@ class Git::CommitsController < Git::BaseController
respond_to do |format|
format.html
format.diff { render :text => (@commit.diffs.map{|d| d.diff}.join("\n") rescue ''), :content_type => "text/plain" }
format.diff { render :text => (@commit.diffs.map(&:diff).join("\n") rescue ''), :content_type => "text/plain" }
format.patch { render :text => (@commit.to_patch rescue ''), :content_type => "text/plain" }
end
end
@ -40,5 +39,4 @@ class Git::CommitsController < Git::BaseController
end
return res
end
end

View File

@ -1,11 +0,0 @@
# -*- encoding : utf-8 -*-
class Git::RepositoriesController < Git::BaseController
def show
@commit = @git_repository.master
@tree = @commit ? @commit.tree : nil
render :template => "git/repositories/empty" unless @tree
end
end

View File

@ -1,26 +1,18 @@
# -*- encoding : utf-8 -*-
class Git::TreesController < Git::BaseController
def show
if params[:treeish].present? and @treeish.dup.encode_to_default == @project.default_branch
redirect_to project_path(@project) and return
end
redirect_to project_path(@project) and return if params[:treeish] == @project.default_branch and params[:path].blank?
@path = params[:path]
@tree = @git_repository.tree(@treeish)
@branch = @project.branch(@treeish)
# @commit = @git_repository.commits(@treeish, 1).first
# Raises Grit::Git::GitTimeout
@commit = @branch.present? ? @branch.commit() : @git_repository.log(@treeish, @path, :max_count => 1).first
render :template => "git/repositories/empty" and return unless @commit
render :template => "git/trees/empty" and return unless @commit
if @path
@path.force_encoding(Encoding::ASCII_8BIT)
@tree = @tree / @path
end
render :template => "git/repositories/show"
@tree = @tree / @path if @path
render :template => "git/trees/show"
end
end

View File

@ -5,7 +5,7 @@ module CommitHelper
res = ["<table class='commit_stats'>"]
stats.files.each do |filename, adds, deletes, total|
res << "<tr>"
res << "<td><a href='##{h(filename)}'>#{h(filename)}</a></td>".encode_to_default
res << "<td><a href='##{h(filename)}'>#{h(filename)}</a></td>"
res << "<td class='diffstat'>"
res << I18n.t("layout.projects.inline_changes_count", :count => total).strip +
" (" +
@ -17,7 +17,7 @@ module CommitHelper
end
res << "</table>"
res.join("\n").encode_to_default.html_safe
res.join("\n").html_safe.default_encoding!
end
# def format_commit_message(message)
@ -38,11 +38,11 @@ module CommitHelper
def short_commit_message(message)
# Why 42? Because it is the Answer!
truncate(message, :length => 42, :omission => "...").encode_to_default
truncate(message, :length => 42, :omission => "...")
end
def commit_author_link(author)
name = author.name.encode_to_default
name = author.name
email = author.email
u = User.where(:email => email).first
u.present? ? link_to(name, user_path(u)) : mail_to(email, name)

View File

@ -8,11 +8,11 @@ module DiffHelper
res = "<table class='diff inline' cellspacing='0' cellpadding='0'>"
res += "<tbody>"
res += diff_display.render(Git::Diff::InlineCallback.new).encode_to_default
res += diff_display.render(Git::Diff::InlineCallback.new)
res += "</tbody>"
res += "</table>"
res.html_safe.encode_to_default
res.html_safe
end
end

View File

@ -26,15 +26,7 @@ module GitHelper
res = "#{link_to @project.name, tree_path(@project)} /"
end
res.encode_to_default.html_safe
end
def blob_file_path
if @commit_hash.present?
blob_commit_path(@project, @commit_hash, @path)
else
blob_path(@project, @treeish, @path)
end
res.html_safe
end
def render_line_numbers(n)
@ -45,22 +37,19 @@ module GitHelper
end
def render_blob(blob)
res = ""
blob.data.encode_to_default.split("\n").collect do |line|
"<div>#{line.present? ? h(line) : "<br>"}</div>"
end.join
blob.data.split("\n").collect do |line|
content_tag :div, line.present? ? h(line) : tag(:br)
end.join.html_safe
end
def choose_render_way(blob)
return :image if blob.mime_type.match(/image/)
return :binary if blob.binary?
:text
# return :text if blob.mime_type.match(/text|xml|json/)
# :binary
end
def force_encoding_to_site(string)
string.dup.encode_to_default
case
when blob.mime_type.match(/image/); :image
when blob.binary?; :binary
else
@text = @blob.data.split("\n")
:text
end
end
def iterate_path(path, &block)
@ -76,21 +65,16 @@ module GitHelper
# TODO This is very dirty hack. Maybe need to be changed.
def branch_selector_options(project)
tmp = params.dup
unless tmp['treeish'].present?
tmp.merge!('project_id' => project.id, 'treeish' => project.default_branch).delete('id')
end
tmp.delete('treeish') if tmp['commit_hash'].present?
res = {}
current = url_for(tmp).split('?', 2).first
tmp['commit_hash'] = truncate(tmp['commit_hash'], :length => 20) if tmp['commit_hash']
p = params.dup
p.delete(:path) if p[:path].present? # to root path
p.merge!(:project_id => project.id, :treeish => project.default_branch).delete(:id) unless p[:treeish].present?
current = url_for(p).split('?', 2).first
res = project.branches.inject(res) do |h, branch|
h[truncate(branch.name, :length => 20)] = url_for(tmp.merge('treeish' => branch.name)).split('?', 2).first
h
end
res.merge!(tmp['commit_hash'] || tmp['treeish'] => current)
res = []
res << [I18n.t('layout.git.repositories.commits'), [truncate(params[:treeish], :length => 20)]] unless (project.branches + project.tags).map(&:name).include?(params[:treeish] || project.default_branch)
res << [I18n.t('layout.git.repositories.branches'), project.branches.map{|b| [truncate(b.name, :length => 20), url_for(p.merge :treeish => b.name).split('?', 2).first]}]
res << [I18n.t('layout.git.repositories.tags'), project.tags.map{|t| [truncate(t.name, :length => 20), url_for(p.merge :treeish => t.name).split('?', 2).first]}]
options_for_select(res.sort, current).html_safe
grouped_options_for_select(res, current)
end
end

View File

@ -82,7 +82,7 @@ module WikiHelper
end
def author
@page.version.author.name.encode_to_default
@page.version.author.name
end
def author_email

View File

@ -62,7 +62,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
:user => subscribe.user,
:kind => 'new_comment_commit_notification',
:data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body,
:commit_message => record.commentable.message.encode_to_default, :commit_id => record.commentable.id,
:commit_message => record.commentable.message, :commit_id => record.commentable.id,
:project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname}
)
end

View File

@ -51,8 +51,6 @@ class Git::Repository
#
# Returns commits sha if committing was successful and false otherwise
def update_file(path, data, options = {})
path.force_encoding(Encoding::ASCII_8BIT) # some magic
head = options[:head].to_s || 'master'
actor = get_actor(options[:actor])
filename = File.split(path).last

View File

@ -118,11 +118,11 @@ class Project < ActiveRecord::Base
# ... and add it to result.
h[entry] = c
# find another files, that linked to this commit and set them their commit
c.diffs.map{|diff| diff.b_path.split(File::SEPARATOR, 2).first}.each do |name|
h.each_pair do |k, v|
h[k] = c if k.name == name and v.nil?
end
end
# c.diffs.map{|diff| diff.b_path.split(File::SEPARATOR, 2).first}.each do |name|
# h.each_pair do |k, v|
# h[k] = c if k.name == name and v.nil?
# end
# end
end
h
end

View File

@ -59,7 +59,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
@committer_link ||= if committer.is_a? User
link_to committer.uname, user_path(committer)
else
mail_to committer.email.encode_to_default, committer.name.encode_to_default
mail_to committer.email, committer.name
end
end
@ -68,7 +68,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
end
def prepare_message
(@caption, @content) = @commit.message.encode_to_default.split("\n\n", 2)
(@caption, @content) = @commit.message.split("\n\n", 2)
@caption = 'empty message' unless @caption.present?
if @caption.length > 72
tmp = '...' + @caption[69..-1]

View File

@ -12,7 +12,7 @@
(#{commit_author_link(committer)})
%br
%span.date= commit_date(elem[0].committed_date)
%span.message{:title => elem[0].message.encode_to_default}= short_commit_message(elem[0].message)
%span.message{:title => elem[0].message}= short_commit_message(elem[0].message)
%td.lines
= index
@ -20,7 +20,7 @@
%td.code.cm-s-default
%pre
%div= elem[1].first.encode_to_default
%div= elem[1].first
- elem[1][1..-1].each do |line|
%tr
@ -29,7 +29,7 @@
- index += 1
%td.code.cm-s-default
%pre
%div= line.encode_to_default
%div= line
:javascript
$(document).ready(function() {

View File

@ -4,43 +4,20 @@
= render :partial => 'git/shared/fork'
.both
= form_tag blob_file_path, :name => 'blob-editor', :method => :put do
.file
= text_area_tag :content, @blob.data.encode_to_default, :id => 'code'
= form_tag blob_path(@project, @treeish, @path), :name => 'blob-editor', :method => :put do
.file= text_area_tag :content, @blob.data, :id => 'code'
.both
= t("layout.enter_commit_message")
= text_area_tag :message, "Updated #{@blob.name.encode_to_default}", :class => 'commit-message'
= text_area_tag :message, "Updated #{@blob.name}", :class => 'commit-message'
%br
%br
= submit_tag t("layout.save"), :title => t("layout.save")
= t("layout.or")
= link_to t("layout.cancel"), blob_file_path, :class => 'button'
-##gollum-editor.edit{:'data-escaped-name' => @path.encode_to_default}
= form_tag blob_file_path, :name => 'blob-editor', :method => :put do
%fieldset#gollum-editor-fields
= text_area_tag :content, @blob.data.encode_to_default, :id => "gollum-editor-body"
#gollum-editor-edit-summary.singleline
= label_tag :message, t("wiki.edit_commit_message"), :class => "jaws"
= text_field_tag :message, t("wiki.commit_message_placeholder"), :id => "editor-commit-message-field"
%span.jaws
%br
= submit_tag t("wiki.save_button"), :id => "gollum-editor-submit", :title => t("wiki.save_changes")
= link_to t("layout.cancel"), blob_file_path, :class => 'minibutton', :id => 'gollum-editor-preview'
= link_to t("layout.cancel"), blob_path(@project, @treeish, @path), :class => 'button'
:javascript
$(function() {
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {lineNumbers: true, mode: '#{@blob.raw_mime_type.content_type}', theme: 'eclipse'});
});
/ - content_for :javascripts do
/ = javascript_include_tag 'gollum/gollum.placeholder.js', 'blob.editor.js'
/
/ - content_for :stylesheets do
/ = stylesheet_link_tag 'gollum/editor.css'
});

View File

@ -6,21 +6,7 @@
- render_way = choose_render_way(@blob)
.file
.top
.l
= @blob.mode + ' | '
- if (render_way == :text)
- text = @blob.data.split("\n")
= "#{text.length} lines (#{text.select{|s| s.strip.length > 0}.length} sloc) | "
= "#{(@blob.size / 1024.0).round(3)} Kb"
.r
- if render_way == :text and can? :write, @project and @treeish.in? @project.branches.map(&:name)
= raw "#{link_to "Edit", edit_blob_path(@project, @treeish, @path) } | "
= raw "#{link_to "Raw", raw_path(@project, @treeish, @path)} | "
- if render_way == :text
= raw "#{link_to "Blame", blame_path(@project, @treeish, @path)} | "
= link_to "History", commits_path(@project, @treeish, @path)
.both
.top= render 'top', :render_way => render_way
.data
- case render_way
- when :image
@ -33,13 +19,12 @@
<center> <img src='?raw=true'/></center>
<br/>
- when :text
.gutter
= render_line_numbers(text.length)
.gutter= render_line_numbers(@text.length)
#output.formatted.cm-s-default
%pre#code
=#{render_blob(@blob)}
:preserve
#{h(@blob.data.encode_to_default).html_safe}
#{h(@blob.data).html_safe}
.both
- when :binary
%table.table.blob
@ -48,7 +33,7 @@
%td.blob
:plain
<br/>
<pre>#{ link_to @blob.basename.encode_to_default, raw_path(@project, @treeish, @path) }</pre>
<pre>#{ link_to @blob.basename, raw_path(@project, @treeish, @path) }</pre>
<br/>
:javascript
$(document).ready(function() {

View File

@ -0,0 +1,21 @@
.l
= @blob.mode
\|
- if render_way == :text
#{@text.length} lines (#{@text.select{|s| s.strip.length > 0}.length} sloc)
\|
= number_to_human_size @blob.size
.r
- if render_way == :text and can? :write, @project and @treeish.in? @project.branches.map(&:name)
= link_to "Edit", edit_blob_path(@project, @treeish, @path)
\|
- if render_way == :text and params[:action] != 'show'
= link_to "Normal", blob_path(@project, @treeish, @path)
\|
= link_to "Raw", raw_path(@project, @treeish, @path)
\|
- if render_way == :text and params[:action] != 'blame'
= link_to "Blame", blame_path(@project, @treeish, @path)
\|
= link_to "History", commits_path(@project, @treeish, @path)
.both

View File

@ -16,81 +16,10 @@
#repo-wrapper
%h3= t("layout.projects.files_in_project")
.files
.l
= render :partial => 'git/shared/whereami'
.l= render :partial => 'git/shared/whereami'
.both
- render_way = choose_render_way(@blob)
.file
.top
.l
= @blob.mode + ' | '
- if (render_way == :text)
- text = @blob.data.split("\n")
= "#{text.length} lines (#{text.select{|s| s.strip.length > 0}.length} sloc) | "
= "#{(@blob.size / 1024.0).round(3)} Kb"
.r
= raw "#{link_to "Normal", blob_path(@project, @treeish, @path) } | "
= raw "#{link_to "Raw", raw_path(@project, @treeish, @path)} | "
=# raw "#{link_to "Blame", blame_path(@project, @treeish, @path)} | "
= link_to "History", commits_path(@project, @treeish, @path)
.both
.blame_data
= render :partial => 'blame_table'
-#.block
= render :partial => "git/shared/navigation"
= render :partial => "git/shared/info"
-#- if @commit
.block
.content
.inner
= render :partial => "git/commits/commits", :object => [@commit]
-#.block
.content
.inner
%h3= render_path
.blob_header
.size #{(@blob.size / 1024.0).round(3)} Kb
.buttons
- if @commit_hash
#{link_to "Raw", raw_commit_path(@project, @commit_hash, @path)} #{link_to "Normal", blob_commit_path(@project, @commit_hash, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
- else
#{link_to "Raw", raw_path(@project, @treeish, @path)} #{link_to "Normal", blob_path(@project, @treeish, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
.clear
.blame_data
%table.table.blame
- index = 1
- @blame.each do |elem|
%tr
%td.message{ :rowspan => elem[1].length }
.commit
#{link_to shortest_hash_id(elem[0].id), commit_path(@project, elem[0].id)} by
#{elem[0].author.to_s.encode_to_default} #{elem[0].author != elem[0].committer ? "(#{elem[0].committer.to_s.encode_to_default})" : "" }
.message
%span.date= commit_date(elem[0].committed_date)
%span.message= short_commit_message(elem[0].message)
%td.lines
= index
- index += 1
%td.code
%pre
%div= elem[1].first.encode_to_default
- elem[1][1..-1].each do |line|
%tr
%td.lines
= index
- index += 1
%td.code
%pre
%div= line.encode_to_default
-#- content_for :sidebar, render(:partial => 'git/shared/sidebar')
.top= render 'top', :render_way => render_way
.blame_data= render 'blame_table'

View File

@ -1,21 +1 @@
= render :partial => "git/blobs/editor", :layout => 'projects/show'
-#.block
-# = render :partial => "git/shared/navigation"
-#
-# = render :partial => "git/shared/info"
-#
-#- if @commit
-# .block
-# .content
-# .inner
-# = render :partial => "git/commits/commits", :object => [@commit]
-#
-#.block
-# .content
-# .inner
-# %h3 #{render_path} (#{@blob.mime_type})
-#
-# = render :partial => 'editor'
-#
-#- content_for :sidebar, render(:partial => 'git/shared/sidebar')
-#

View File

@ -1,11 +1,10 @@
- commit_id = commit_diff.deleted_file ? @commit.parents.first.id : @commit.id
.file
%a{ :name => h(commit_diff.a_path.encode_to_default) }
%a{:name => h(commit_diff.a_path)}
.top
.l= h(commit_diff.a_path.encode_to_default)
.l= h(commit_diff.a_path)
- if commit_diff.b_path.present?
.r
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@project, @commit.id, commit_diff.b_path.encode_to_default))
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path)
.clear
.diff_data
= render_diff(commit_diff)
.diff_data= render_diff(commit_diff) unless (@git_repository.tree(commit_id) / commit_diff.b_path).binary?

View File

@ -9,37 +9,10 @@
- by_month.each_pair do |month, by_day|
- by_day.each_pair do |day, commits|
.date-block
.date
= raw l(commits.first.authored_date, :format => :date_block_format)
.date= raw l(commits.first.authored_date, :format => :date_block_format)
.messages
- commits.each_with_index do |commit|
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => counter}
- counter += 1
.both
-#%ul.list.commits
- commits.each do |commit|
%li.commit
%table
%tr
%td.committers
.author #{commit.author.to_s.encode_to_default}, #{commit_date(commit.authored_date)}
- if commit.committer != commit.author
.committer
(committed by: #{commit.committer.to_s.encode_to_default}, #{commit_date(commit.committed_date)})
%td.message
%p= link_to commit.message.encode_to_default, commit_path(@project, commit.id)
%td.trees
.commit
Commit:
%span{ :style => "float: right;"}
#{link_to short_hash_id(commit.id), commit_path(@project, commit.id)}
.tree
Tree:
%span{ :style => "float: right;"}
#{link_to short_hash_id(commit.tree.id), tree_path(@project, :treeish => commit.tree.id)}
- commit.parents.each do |parent|
.parent
Parent:
%span{ :style => "float: right;"}
#{link_to short_hash_id(parent.id), tree_path(@project, :treeish => parent.id)}
.both

View File

@ -1,10 +1,10 @@
.pagination.tmargin30
- if @page == 1
%span.previous_page.disabled « Previous
%span.previous_page.disabled= t('will_paginate.previous_label')
- else
%a.previous_page{ :rel => "prev", :href => commits_path(@project, :treeish => @treeish, :page => (@page - 1)) } « Previous
%a.previous_page{:rel => "prev", :href => commits_path(@project, :treeish => @treeish, :page => (@page - 1))}= t('will_paginate.previous_label')
- if @last_page
%span.next_page.disabled Next »
%span.next_page.disabled= t('will_paginate.next_label')
- else
%a.next_page{ :rel => "next", :href => commits_path(@project, :treeish => @treeish, :page => (@page + 1)) } Next »
%a.next_page{:rel => "next", :href => commits_path(@project, :treeish => @treeish, :page => (@page + 1))}= t('will_paginate.next_label')

View File

@ -2,16 +2,4 @@
= render :partial => 'projects/repo_block', :locals => {:project => @project}
= render :partial => 'git/commits/commits', :object => @commits
- if @render_paginate
= render :partial => 'git/commits/paginate'
-#.block
.content
.inner
= render :partial => "git/commits/commits", :object => @commits
- if @render_paginate
.actions-bar.wat-cf
.pagination
= render :partial => "git/commits/paginate"
-# content_for :sidebar, render(:partial => 'git/shared/sidebar')
= render 'git/commits/paginate' if @render_paginate

View File

@ -17,43 +17,3 @@
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
= render :partial => "comments/add", :locals => {:project => @project, :commentable => @commit}
-#.block
= render :partial => "git/shared/navigation"
= render :partial => "git/shared/info"
-#.block
.content
.inner
= render :partial => "git/commits/commits", :object => [@commit]
-#- begin
.block
.content
.inner
.patch_and_diff
= link_to "raw diff", commit_path(@project, @commit.id, :diff)
\|
= link_to "patch", commit_path(@project, @commit.id, :patch)
.clear
= render_commit_stats(@commit.stats)
= render :partial => "git/commits/commit_diff", :collection => @commit.diffs
-#- rescue Grit::Git::GitTimeout
.block
.content
.inner
%p= t 'layout.git.repositories.commit_diff_too_big'
-#- content_for :sidebar, render(:partial => 'git/shared/sidebar')
-#= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
-#%p
%b
= t('layout.issues.subscribe')
\:
- if Subscribe.subscribed_to_commit?(@project, current_user, @commit)
= link_to t('layout.commits.unsubscribe_btn'), unsubscribe_commit_path(@project, @commit), :method => :delete
- else
= link_to t('layout.commits.subscribe_btn'), subscribe_commit_path(@project, @commit), :method => :post

View File

@ -1 +0,0 @@
= render :partial => "git/repositories/show", :layout => 'projects/show'

View File

@ -1,23 +0,0 @@
.content
.inner
%p
%b
= t("activerecord.models.project")
\:
= @project.name
%p
%b
= t("activerecord.attributes.project.repository")
\:
= git_repo_url @project.git_repo_name
- if @current_tag.present?
%p
%b Tag:
= link_to @current_tag.name, tree_path(@project, :treeish => @current_tag.name)
- if @current_branch.present?
%p
%b Branch:
= link_to @current_branch.name, tree_path(@project, :treeish => @current_branch.name)

View File

@ -1,29 +0,0 @@
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), projects_path
%li= link_to t("layout.projects.new"), new_project_path
%li= link_to t("layout.projects.show"), project_path(@project)
%li.active= link_to t("layout.git.repositories.source"), project_repo_path(@project)
- if can? :write, @project
%li= link_to t("layout.projects.build"), new_project_build_list_path(@project)
%ul#git_submenu.sub-wat-cf.wat-cf
%li= link_to t("layout.git.repositories.commits"), commits_path(@project, :treeish => @treeish)
%li
%a{ :href => "#", :onmouseover => "menu.open('branches')", :onmouseout => "menu.close_time()" } Branches
#branches{ :onmouseover => "menu.cancel_close_time()", :onmouseout => "menu.close_time()" }
- @branches.each do |branch|
- if branch.name == @treesh
%span.current= branch.name
- else
= link_to branch.name, tree_path(@project, :treeish => branch.name)
%li
%a{ :href => "#", :onmouseover => "menu.open('tags')", :onmouseout => "menu.close_time()" } Tags
#tags{ :onmouseover => "menu.cancel_close_time()", :onmouseout => "menu.close_time()" }
- @tags.each do |tag|
- if tag.name == @treeish
%span.current= tag.name
- else
= link_to tag.name, tree_path(@project, :treeish => tag.name)
.clear

View File

@ -1,4 +0,0 @@
.block.notice
%h3= t("layout.projects.current_project_header")
.content
%p= link_to @project.name, project_path(@project)

View File

@ -1,10 +1,10 @@
%p#file-name1
= link_to @project.name, tree_path(@project, :treeish => @treeish.encode_to_default)
= link_to @project.name, tree_path(@project, :treeish => @treeish)
= File::SEPARATOR
- if @path.present?
- paths = File.split(@path)
- if paths.size > 1 and paths.first != '.'
- iterate_path(paths.first) do |path, name|
= link_to(name, tree_path(@project, @treeish, path)).encode_to_default
= link_to(name, tree_path(@project, @treeish, path))
= File::SEPARATOR
= paths.last.encode_to_default
= paths.last

View File

@ -16,27 +16,22 @@
%tr
%td
.pic= image_tag 'folder.png'
.name
= link_to "..", tree_path(@project, @treeish, File.join([@path.dup.encode_to_default, ".."].compact).encode_to_default)
.name= link_to "..", tree_path(@project, @treeish, File.join([@path, ".."].compact))
%td== &nbsp;
%td== &nbsp;
%td== &nbsp;
- @project.tree_info(@tree, @treeish, @path).each_pair do |entry, commit|
%tr
%td
- entry_path = File.join([@path.present? ? @path : nil, entry.name].compact).encode_to_default
- entry_path = File.join([@path.present? ? @path : nil, entry.name].compact)
- if entry.is_a? Grit::Blob
.pic= image_tag 'code.png'
.name
= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
.name= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see')
- else
.pic= image_tag 'folder.png'
.name
= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
.name= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see')
%td
%span{:style => "display: none;"}= commit.committed_date || commit.authored_date#> Dec 31, 2011
= l(commit.committed_date || commit.authored_date, :format => :short) #31 декабря 2011
%td
= commit.short_message.encode_to_default #Redo autostart script to start from user
%td
= (commit.committer || commit.author).name.encode_to_default #chipiga
%span{:style => "display: none;"}= commit.committed_date || commit.authored_date
= l(commit.committed_date || commit.authored_date, :format => :short)
%td= commit.short_message
%td= (commit.committer || commit.author).name

View File

@ -12,8 +12,7 @@
%h3= t("layout.projects.files_in_project")
.files
.l
= render :partial => 'git/shared/whereami'
.l= render :partial => 'git/shared/whereami'
.both
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}

View File

@ -0,0 +1 @@
= render :partial => "git/trees/show", :layout => 'projects/show'

View File

@ -1,8 +1,8 @@
.lineForm.fork
= select_tag :branch, branch_selector_options(project), :id => 'branch_selector', :class => 'sel80'
%form{ :action => '', :method => :get, :id => 'branch_changer', :'data-action' => "#{controller_name}"}
%form{:action => '', :method => :get, :id => 'branch_changer', :'data-action' => "#{controller_name}"}
.fork
%p= t("layout.projects.#{params[:commit_hash].present? ? 'current_commit' : 'current_branch'}")+':'
%p #{t('layout.projects.current_branch')}:
.both
:javascript
@ -12,4 +12,4 @@
$form.attr('action', $(this).val());
$form.submit();
});
});
});

View File

@ -1,19 +0,0 @@
.activity
.top
.image
%img{:alt => "avatar", :src => presenter.image}
.text.imaged
%span.name= presenter.header
%br/
%span.date= presenter.date
%br/
%span.subject
= presenter.caption
- if presenter.expandable? and presenter.content?
%span.data-expander.collapsed{:id => "expand#{item_no}"} &nbsp;
/ = image_tag 'expand-gray.png', :class => 'activity-full', :id => 'expand1', :onclick => "showActivity(4)"
.both
- if presenter.content?
.fulltext{:class => presenter.expandable? ? "hidden" : '',
:id => presenter.expandable? ? "content-expand#{item_no}" : ''}
= presenter.content

View File

@ -1,18 +1,13 @@
- act = controller.action_name.to_sym
- if [:new, :create].include? act
.leftlist
= f.label :name, t("activerecord.attributes.project.name"), :class => :label
.rightlist
= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
.leftlist= f.label :name, t("activerecord.attributes.project.name"), :class => :label
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
.both
.leftlist
= f.label :description, t("activerecord.attributes.project.description"), :class => :label
.rightlist
= f.text_area :description, :class => 'text_field', :cols => 80
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
.both
- if ['new', 'create'].include? controller.action_name
.leftlist
= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
.rightlist
= label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0
@ -27,13 +22,10 @@
= hidden_field_tag :who_owns, :me
.both
-#- if [:new, :create].include? act
-# .leftlist
-# = f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label
-# .rightlist
-# = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true
-# .leftlist= f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label
-# .rightlist= f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true
-# .both
.leftlist
= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label
.leftlist= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label
.rightlist
=# f.select :visibility, Project::VISIBILITIES
- Project::VISIBILITIES.each do |visibility|
@ -45,30 +37,23 @@
= t("activerecord.attributes.project.visibilities.#{visibility}")
.both
- if [:edit, :update].include? act
.leftlist
Ветка по умолчанию:
.rightlist
= f.select :default_branch, options_from_collection_for_select(@project.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector'
.leftlist= t("activerecord.attributes.project.default_branch")
.rightlist= f.select :default_branch, options_from_collection_for_select(@project.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector'
.both
- if [:edit, :update].include? act
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main
= f.check_box :is_rpm#, :class => 'niceCheckbox1'
.forcheck
Проект является пакетом
%span#niceCheckbox1.niceCheck-main= f.check_box :is_rpm#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_rpm")
.both
.both
- if [:new, :create].include? act
.leftlist
= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
.rightlist
= f.file_field :srpm, :class => 'file_field'
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
.rightlist= f.file_field :srpm, :class => 'file_field'
.both
.leftlist
\ 
.rightlist
= submit_tag t("layout.save"), :class => 'button'
.rightlist= submit_tag t("layout.save"), :class => 'button'
.both

View File

@ -1,13 +0,0 @@
%table.table
%tr
%th= t("activerecord.attributes.project.name")
%th= t("activerecord.attributes.project.owner")
%th.last &nbsp;
- @projects.each do |project|
%tr{:class => cycle("odd", "even")}
%td= link_to "#{project.name}", project
%td= link_to "#{project.owner.name} (#{project.owner.uname})", project.owner
%td
= link_to t("layout.edit"), edit_project_path(project) if can? :update, project
|
= link_to t("layout.delete"), project_path(project), :method => :delete, :confirm => t("layout.projects.confirm_delete") if can? :destroy, project

View File

@ -1,8 +1,6 @@
.description-top
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name',
:type => 'text',:spellcheck => 'false', :readonly => true
.role
= t("layout.read_write_access")
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
.role= t("layout.read_write_access")
= render :partial => 'projects/branch_select', :locals => {:project => project}
.both
:javascript
@ -10,4 +8,4 @@
$('#url').live('click', function() {
$(this).select();
});
});
});

View File

@ -7,61 +7,8 @@
- if can? :edit, @project
%li{:class => (act == :edit && contr == :projects) ? 'active' : ''}
= link_to t("layout.projects.edit"), edit_project_path(@project)
- if can? :manage_collaborators, @project
%li{:class => (act == :sections && contr == :projects) ? 'active' : ''}
= link_to t("layout.projects.sections"), sections_project_path(@project)
- if can? :manage_collaborators, @project
%li{:class => (act == :edit && contr == :collaborators) ? 'active' : ''}
= link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project)
-#.block.notice
-# %h3= t("layout.projects.members")
-# .content
-# %p
-# %b
-# = "#{t("layout.projects.collaborators")}:"
-# %ul
-# - @project.collaborators.each do |user|
-# %li
-# - if can? :read, user
-# = link_to user.name, user_path(user)
-# - else
-# = user.name
-# - if (@project.owner == user)
-# = '(' + t("layout.owner") + ')'
-# /%br
-# -# if can? :update, @project
-# %p
-# %b
-# = "#{t("layout.projects.groups")}:"
-# %ul
-# - @project.groups.each do |group|
-# %li
-# = link_to group.name, group_path(group)
-# - if (@project.owner == group)
-# = '(' + t("layout.owner") + ')'
-# %br
-# = link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project) if can? :manage_collaborators, @project
-#
-# / %p
-# / %b
-# / = "#{t("layout.projects.groups")}:"
-# / %ul
-# / - @project.groups.each do |group|
-# / %li
-# / = link_to group.name, group_path(group)
-# / - if (@project.owner == group)
-# / = '(' + t("layout.owner") + ')'
-# / %br
-# / = link_to t("layout.projects.add_groups"), '#' #add_collaborators_project_path(@project)
-#
-#/ .block.notice
-#/ %h3= t("layout.platforms.current_platform_header")
-#/ .content
-#/ %p= link_to @platform.name, platform_path(@platform)
-#/
-#/ .block.notice
-#/ %h3= t("layout.repositories.current_repository_header")
-#/ .content
-#/ %p= link_to @repository.name + repository_name_postfix(@platform), platform_repository_path(@platform, @repository)
= link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project)

View File

@ -4,10 +4,8 @@
= render :partial => "form", :locals => {:f => f}
.hr
.leftside
= t("layout.projects.delete_warning")
.rightside
= link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project
.leftside= t("layout.projects.delete_warning")
.rightside= link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project
.both
- content_for :sidebar, render('sidebar')

View File

@ -2,25 +2,20 @@
= form_for @project, :url => sections_project_path(@project), :method => :post, :html => { :class => :form, :multipart => true } do |f|
.leftside.w25
%span.niceCheck-main{:onclick => "changeCheck(this)"}
= f.check_box :has_issues
%span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_issues
.leftside.w420
= t("activerecord.attributes.project.has_issues")
%br
%span{:style => "font-size: 11px;"}
= t("layout.projects.has_issue_description")
%span{:style => "font-size: 11px;"}= t("layout.projects.has_issue_description")
.both
.leftside.w25
%span.niceCheck-main{:onclick => "changeCheck(this)"}
= f.check_box :has_wiki, :class => 'niceCheck-main'
%span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_wiki, :class => 'niceCheck-main'
.leftside.w420
= t("activerecord.attributes.project.has_wiki")
%br
%span{:style => "font-size: 11px;"}
= t("layout.projects.has_wiki_description")
%span{:style => "font-size: 11px;"}= t("layout.projects.has_wiki_description")
.both
.padd25
= submit_tag t("layout.save"), :class => 'button'
.padd25= submit_tag t("layout.save"), :class => 'button'
.both
- content_for :sidebar, render('sidebar')

View File

@ -1,4 +1,4 @@
.blob_header
.size= h(diff.deleted_file ? diff.a_path : diff.b_path).encode_to_default
.size= h(diff.deleted_file ? diff.a_path : diff.b_path)
.clear
.diff_data.highlight= render_diff(diff)

View File

@ -10,14 +10,14 @@
- user = User.where(:email => v.author.email).first
.avatar
= link_to user_path_by_user(user) do
%img.mini-gravatar{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name.encode_to_default}"}
%img.mini-gravatar{:src => gravatar_url(v.author.email), :alt => "avatar: #{v.author.name}"}
.name
= link_to user_path_by_user(user) do
%span.username= user.present? ? "#{user.uname} (#{user.name})" : v.author.name.encode_to_default
%span.username= user.present? ? "#{user.uname} (#{user.name})" : v.author.name
.both
%td.td3
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
= v.message.encode_to_default
= v.message
- if @name
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("wiki.view_commit")}]"
- else
@ -38,4 +38,4 @@
cbx.removeAttr('checked');
}
}
});
});

View File

@ -1,24 +0,0 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), projects_path
%li= link_to t("layout.projects.new"), new_project_path
%li= link_to t("layout.projects.show"), project_path(@project)
%li= link_to t("layout.git.repositories.source"), project_repo_path(@project)
- if can? :write, @project
%li= link_to t("layout.projects.build"), new_project_build_list_path(@project)
%li= link_to t("layout.projects.issues"), project_issues_path(@project)
%li.active= link_to t("layout.projects.wiki"), project_wiki_index_path(@project)
.content
.inner
%p
%b
= t("activerecord.attributes.project.name")
\:
= @project.name
%p
%b
= t("activerecord.attributes.project.owner")
\:
= link_to @project.owner.try(:name), url_for(@project.owner)

View File

@ -2,7 +2,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
# Initialize the rails application
Rosa::Application.initialize!

View File

@ -1,2 +0,0 @@
# -*- encoding : utf-8 -*-
require './lib/gollum1'

View File

@ -1,9 +0,0 @@
# -*- encoding : utf-8 -*-
require './lib/grit1'
GAP_REPO_PATH = '/tmp/gap_repo.git'
unless File.directory? GAP_REPO_PATH
Grit::Repo.init_bare(GAP_REPO_PATH)
# FileUtils.chmod "a-w", GAP_REPO_PATH
end

View File

@ -10,7 +10,13 @@ config = {:project_root => File.join(APP_CONFIG['root_path'], 'git_projects'), :
Rosa::Application.config.middleware.insert_after ::Rails::Rack::Logger, ::Grack::Handler, config
Rosa::Application.config.middleware.insert_before ::Grack::Handler, ::Grack::Auth
# Grit::Git.git_timeout = 60
Grit::Git.git_timeout = 60
# Grit.debug = true
GAP_REPO_PATH = '/tmp/gap_repo.git'
unless File.directory? GAP_REPO_PATH
Grit::Repo.init_bare(GAP_REPO_PATH)
# FileUtils.chmod "a-w", GAP_REPO_PATH
end
Dir[Rails.root.join("lib/ext/**/*.rb")].each {|f| require f}

View File

@ -40,7 +40,7 @@ en:
message: Message
author: Author
current_branch: Current branch
current_branch: Current branch/tag
current_commit: Current commit
files_in_project: Files in
@ -77,3 +77,5 @@ en:
who_owns:
me: I
group: Group
default_branch: Default branch
is_rpm: Project is a packet

View File

@ -40,7 +40,7 @@ ru:
message: Сообщение
author: Автор
current_branch: Текущая ветка
current_branch: Текущая ветка/тег
current_commit: Текущий коммит
files_in_project: Файлы в
@ -77,3 +77,5 @@ ru:
who_owns:
me: Я
group: Группа
default_branch: Ветка по умолчанию
is_rpm: Проект является пакетом

View File

@ -133,10 +133,10 @@ ru:
repositories:
empty: "Репозиторий пуст. Если вы клонировали(Fork) проект или импортировали пакет, данные скоро появятся"
source: Source
commits: Commits
commits: Коммиты
commit_diff_too_big: Извините, коммит слишком большой!
tags: Tags
branches: Branches
tags: Теги
branches: Ветки
project_versions: Версии
product_build_lists:

View File

@ -137,7 +137,6 @@ Rosa::Application.routes.draw do
post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
post "labels/:label_id/update" => "issues#update_label", :as => :issues_update_label
resource :repo, :controller => "git/repositories", :only => [:show]
resources :build_lists, :only => [:index, :new, :create] do
collection { post :search }
end
@ -202,36 +201,27 @@ Rosa::Application.routes.draw do
match 'product_status', :to => 'product_build_lists#status_build'
# Tree
match '/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
get '/projects/:project_id/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree
# Commits
match '/projects/:project_id/git/commits/:treeish(/*path)', :controller => "git/commits", :action => :index, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :commits, :format => false
match '/projects/:project_id/git/commit/:id(.:format)', :controller => "git/commits", :action => :show, :defaults => { :format => :html }, :as => :commit
# Commit Comments
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :edit, :as => :edit_project_commit_comment, :via => :get
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :update, :as => :project_commit_comment, :via => :put
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :destroy, :via => :delete
match '/projects/:project_id/git/commit/:commit_id/comments(.:format)', :controller => "comments", :action => :create, :as => :project_commit_comments, :via => :post
# Commits subscribe
match '/projects/:project_id/git/commit/:commit_id/subscribe', :controller => "commit_subscribes", :action => :create, :defaults => { :format => :html }, :as => :subscribe_commit, :via => :post
match '/projects/:project_id/git/commit/:commit_id/unsubscribe', :controller => "commit_subscribes", :action => :destroy, :defaults => { :format => :html }, :as => :unsubscribe_commit, :via => :delete
get '/projects/:project_id/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false
get '/projects/:project_id/commit/:id(.:format)' => "git/commits#show", :as => :commit
# Commit comments
post '/projects/:project_id/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
get '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
put '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
delete '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
# Commit subscribes
post '/projects/:project_id/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
delete '/projects/:project_id/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
# Editing files
match '/projects/:project_id/git/blob/:treeish/*path/edit', :controller => "git/blobs", :action => :edit, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :edit_blob, :via => :get
match '/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :update, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :via => :put, :format => false
get '/projects/:project_id/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
put '/projects/:project_id/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
# Blobs
match '/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob, :via => :get, :format => false
match '/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :project_id => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit, :via => :get, :format => false
get '/projects/:project_id/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :format => false
# Blame
match '/projects/:project_id/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame, :format => false
match '/projects/:project_id/git/commit/blame/:commit_hash/*path', :controller => "git/blobs", :action => :blame, :as => :blame_commit
get '/projects/:project_id/blame/:treeish/*path' => "git/blobs#blame", :defaults => {:treeish => :master}, :as => :blame, :format => false
# Raw
match '/projects/:project_id/git/raw/:treeish/*path', :controller => "git/blobs", :action => :raw, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :raw, :format => false
match '/projects/:project_id/git/commit/raw/:commit_hash/*path', :controller => "git/blobs", :action => :raw, :as => :raw_commit
get '/projects/:project_id/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
root :to => "activity_feeds#index"
match '/forbidden', :to => 'platforms#forbidden', :as => 'forbidden'

View File

@ -23,8 +23,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
create_table "arches", :force => true do |t|
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
@ -33,8 +33,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "user_id"
t.string "provider"
t.string "uid"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
@ -45,8 +45,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "arch_id"
t.integer "pl_id"
t.integer "bpl_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "build_list_items", :force => true do |t|
@ -54,8 +54,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "level"
t.integer "status"
t.integer "build_list_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "version"
end
@ -69,8 +69,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "project_id"
t.integer "arch_id"
t.datetime "notified_at"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "is_circle", :default => false
t.text "additional_repos"
t.string "name"
@ -94,16 +94,16 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "name"
t.string "ancestry"
t.integer "projects_count", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "comments", :force => true do |t|
t.string "commentable_type"
t.integer "user_id"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.decimal "commentable_id", :precision => 50, :scale => 0
t.integer "project_id"
end
@ -112,8 +112,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "name", :null => false
t.integer "project_id", :null => false
t.integer "owner_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "delayed_jobs", :force => true do |t|
@ -125,8 +125,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "queue"
end
@ -138,8 +138,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "distro"
t.string "platform"
t.integer "counter", :default => 0
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "event_logs", :force => true do |t|
@ -154,14 +154,14 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "controller"
t.string "action"
t.text "message"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups", :force => true do |t|
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "uname"
t.integer "own_projects_count", :default => 0, :null => false
t.text "description"
@ -174,8 +174,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "title"
t.text "body"
t.string "status", :default => "open"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "creator_id"
t.datetime "closed_at"
t.integer "closed_by"
@ -206,8 +206,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "description"
t.string "name"
t.integer "parent_platform_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "released", :default => false
t.integer "owner_id"
t.string "owner_type"
@ -220,8 +220,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "platform_id"
t.string "login"
t.string "password"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "user_id"
end
@ -229,8 +229,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "product_id"
t.integer "status", :default => 2, :null => false
t.datetime "notified_at"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
@ -240,8 +240,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.integer "platform_id", :null => false
t.integer "build_status", :default => 2, :null => false
t.string "build_path"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "build_script"
t.text "counter"
t.text "ks"
@ -261,8 +261,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "name"
t.string "version"
t.datetime "file_mtime"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "platform_id"
end
@ -271,14 +271,14 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
create_table "project_to_repositories", :force => true do |t|
t.integer "project_id"
t.integer "repository_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "projects", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "owner_id"
t.string "owner_type"
t.string "visibility", :default => "open"
@ -286,11 +286,11 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master"
t.boolean "is_rpm", :default => true
end
@ -304,8 +304,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "token"
t.boolean "approved", :default => false
t.boolean "rejected", :default => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "interest"
t.text "more"
end
@ -318,16 +318,16 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "object_type"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "role"
end
create_table "repositories", :force => true do |t|
t.string "description", :null => false
t.integer "platform_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "name", :null => false
end
@ -335,8 +335,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "name", :null => false
t.integer "arch_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
@ -349,8 +349,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.boolean "new_comment_reply", :default => true
t.boolean "new_issue", :default => true
t.boolean "issue_assign", :default => true
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "new_comment_commit_owner", :default => true
t.boolean "new_comment_commit_repo_owner", :default => true
t.boolean "new_comment_commit_commentor", :default => true
@ -359,8 +359,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
create_table "subscribes", :force => true do |t|
t.string "subscribeable_type"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "status", :default => true
t.integer "project_id"
t.decimal "subscribeable_id", :precision => 50, :scale => 0
@ -368,18 +368,18 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
create_table "users", :force => true do |t|
t.string "name"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.datetime "reset_password_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience"
t.string "site"
t.string "company"
@ -388,7 +388,7 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
t.integer "failed_attempts", :default => 0
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
end

View File

@ -17,4 +17,6 @@ Add to /etc/rc.d/rc.sysinit
. /etc/rc.local
fi
==
=== Tips
gem install charlock_holmes -- --with-icu-dir=/opt/local
git config --global core.quotepath false

View File

@ -1,6 +1,27 @@
# -*- encoding : utf-8 -*-
require 'charlock_holmes/string'
# require 'iconv'
class String
def encode_to_default
force_encoding(Encoding.default_internal || Encoding::UTF_8)
def default_encoding!
if ascii_only?
force_encoding(Encoding.default_internal || Encoding::UTF_8)
else
force_encoding((detected = detect_encoding and detected[:encoding]) || Encoding.default_internal || Encoding::UTF_8).encode!
end
end
# def enforce_utf8(from = nil)
# begin
# is_utf8? ? self : ::Iconv.iconv('utf8', from, self).first
# rescue
# converter = ::Iconv.new('UTF-8//IGNORE//TRANSLIT', 'ASCII//IGNORE//TRANSLIT')
# # If Ruby 1.9, else another RubyEngine (ree, Ruby 1.8)
# begin
# converter.iconv(self).unpack('U*').select{|cp| cp < 127}.pack('U*').force_encoding('utf-8')
# rescue
# converter.iconv(self).unpack('U*').select{|cp| cp < 127}.pack('U*')
# end
# end
# end
end

View File

@ -1,27 +1,6 @@
# -*- encoding : utf-8 -*-
# # -*- encoding : utf-8 -*-
module Gollum
class Wiki
def page_with_forced_encoding(name, version = @ref)
page_without_forced_encoding(force_grit_encoding(name), version)
end
alias_method_chain :page, :forced_encoding
def file_with_forced_encoding(name, version = @ref)
file_without_forced_encoding(force_grit_encoding(name), version)
end
alias_method_chain :file, :forced_encoding
def write_page_with_forced_encoding(name, format, data, commit = {})
write_page_without_forced_encoding(force_grit_encoding(name), format, data, commit)
end
alias_method_chain :write_page, :forced_encoding
def update_page_with_forced_encoding(page, name, format, data, commit = {})
update_page_without_forced_encoding(page, force_grit_encoding(name), format, data, commit)
end
alias_method_chain :update_page, :forced_encoding
# Public: Applies a reverse diff for a given page. If only 1 SHA is given,
# the reverse diff will be taken from its parent (^SHA...SHA). If two SHAs
# are given, the reverse diff is taken from SHA1...SHA2.
@ -91,12 +70,5 @@ module Gollum
revert_page_with_committer(nil, sha1, sha2, commit)
end
alias_method_chain :revert_commit, :committer
private
def force_grit_encoding(str)
str.dup.force_encoding(Encoding::ASCII_8BIT)
end
end
end

View File

@ -1,11 +0,0 @@
# -*- encoding : utf-8 -*-
module Gollum
class Page
def name_with_encoding
name_without_encoding.encode_to_default
end
alias_method_chain :name, :encoding
end
end

View File

@ -1,4 +0,0 @@
# -*- encoding : utf-8 -*-
Dir.glob(File.join('.', 'lib', 'gollum', '*.rb')) do |file|
require file
end

View File

@ -1,56 +0,0 @@
# -*- encoding : utf-8 -*-
module Grit
class Diff
def self.list_from_string(repo, text)
lines = text.split("\n")
diffs = []
while !lines.empty?
m, a_path, b_path = *lines.shift.match(%r{^diff --git "{0,1}a/(.+?)"{0,1} "{0,1}b/(.+?)"{0,1}$})
if lines.first =~ /^old mode/
m, a_mode = *lines.shift.match(/^old mode (\d+)/)
m, b_mode = *lines.shift.match(/^new mode (\d+)/)
end
if lines.empty? || lines.first =~ /^diff --git/
diffs << Diff.new(repo, a_path, b_path, nil, nil, a_mode, b_mode, false, false, nil)
next
end
sim_index = 0
new_file = false
deleted_file = false
renamed_file = false
if lines.first =~ /^new file/
m, b_mode = lines.shift.match(/^new file mode (.+)$/)
a_mode = nil
new_file = true
elsif lines.first =~ /^deleted file/
m, a_mode = lines.shift.match(/^deleted file mode (.+)$/)
b_mode = nil
deleted_file = true
elsif lines.first =~ /^similarity index (\d+)\%/
sim_index = $1.to_i
renamed_file = true
2.times { lines.shift } # shift away the 2 `rename from/to ...` lines
end
m, a_blob, b_blob, b_mode = *lines.shift.match(%r{^index ([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+) ?(.+)?$})
b_mode.strip! if b_mode
diff_lines = []
while lines.first && lines.first !~ /^diff/
diff_lines << lines.shift
end
diff = diff_lines.join("\n")
diffs << Diff.new(repo, a_path, b_path, a_blob, b_blob, a_mode, b_mode, new_file, deleted_file, diff, renamed_file, sim_index)
end
diffs
end
end
end

View File

@ -1,17 +0,0 @@
# -*- encoding : utf-8 -*-
module Grit
class Repo
def diff_with_encoding(a, b, *paths)
diff = self.git.native('diff', {}, a, b, '--', *paths).encode_to_default
if diff =~ /diff --git "{0,1}a/
diff = diff.sub(/.*?(diff --git "{0,1}a)/m, '\1')
else
diff = ''
end
Diff.list_from_string(self, diff)
end
alias_method_chain :diff, :encoding
end
end

View File

@ -1,4 +0,0 @@
# -*- encoding : utf-8 -*-
require './lib/grit/repo.rb'
require './lib/grit/diff.rb'
require './lib/grit/blob.rb'