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:
parent
87e1ee4700
commit
89f31e9782
18
Gemfile
18
Gemfile
|
@ -12,15 +12,17 @@ gem 'omniauth', '~> 1.0.3'
|
||||||
gem 'omniauth-openid', '~> 1.0.1'
|
gem 'omniauth-openid', '~> 1.0.1'
|
||||||
gem 'cancan', '~> 1.6.7'
|
gem 'cancan', '~> 1.6.7'
|
||||||
|
|
||||||
gem 'ancestry', '~> 1.2.4'
|
gem 'ancestry', '~> 1.2.5'
|
||||||
gem 'paperclip', '~> 2.7.0'
|
gem 'paperclip', '~> 2.7.0'
|
||||||
gem 'delayed_job_active_record', '~> 0.3.2'
|
gem 'delayed_job_active_record', '~> 0.3.2'
|
||||||
gem 'russian', '~> 0.6.0'
|
gem 'russian', '~> 0.6.0'
|
||||||
gem 'highline', '~> 1.6.11'
|
gem 'highline', '~> 1.6.11'
|
||||||
gem 'rails-xmlrpc', '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git'
|
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 '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
|
# Wiki
|
||||||
gem "gollum", "1.3.1"
|
gem "gollum", "1.3.1"
|
||||||
|
@ -31,8 +33,9 @@ gem 'rdiscount'
|
||||||
gem 'RedCloth'
|
gem 'RedCloth'
|
||||||
gem 'wikicloth'
|
gem 'wikicloth'
|
||||||
|
|
||||||
gem 'unicorn', '~> 4.2.0'
|
gem 'unicorn', '~> 4.2.0', :platforms => [:mri, :rbx]
|
||||||
gem 'newrelic_rpm', '~> 3.3.2'
|
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
|
||||||
|
gem 'newrelic_rpm', '~> 3.3.2', :platforms => [:mri, :rbx]
|
||||||
gem 'whenever', '~> 0.7.3', :require => false
|
gem 'whenever', '~> 0.7.3', :require => false
|
||||||
|
|
||||||
gem 'rails3-jquery-autocomplete', '~> 1.0.6'
|
gem 'rails3-jquery-autocomplete', '~> 1.0.6'
|
||||||
|
@ -42,11 +45,12 @@ gem "haml-rails", '~> 0.3.4'
|
||||||
gem 'jquery-rails', '~> 2.0.1'
|
gem 'jquery-rails', '~> 2.0.1'
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
gem 'sass-rails', '~> 3.2.4'
|
gem 'sass-rails', '~> 3.2.5'
|
||||||
gem 'coffee-rails', '~> 3.2.2'
|
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 '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
|
end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
|
|
65
Gemfile.lock
65
Gemfile.lock
|
@ -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
|
GIT
|
||||||
remote: git://github.com/chipiga/redhillonrails_core.git
|
remote: git://github.com/chipiga/redhillonrails_core.git
|
||||||
revision: 5f58167c41882890c223168b0a5521d99e8d92aa
|
revision: 5f58167c41882890c223168b0a5521d99e8d92aa
|
||||||
|
@ -6,16 +15,6 @@ GIT
|
||||||
redhillonrails_core (2.0.0.pre)
|
redhillonrails_core (2.0.0.pre)
|
||||||
activerecord (>= 3.1.0.rc)
|
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
|
GIT
|
||||||
remote: git://github.com/rdblue/grack.git
|
remote: git://github.com/rdblue/grack.git
|
||||||
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
|
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
|
||||||
|
@ -26,6 +25,7 @@ GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
RedCloth (4.2.9)
|
RedCloth (4.2.9)
|
||||||
|
RedCloth (4.2.9-java)
|
||||||
actionmailer (3.2.2)
|
actionmailer (3.2.2)
|
||||||
actionpack (= 3.2.2)
|
actionpack (= 3.2.2)
|
||||||
mail (~> 2.4.0)
|
mail (~> 2.4.0)
|
||||||
|
@ -58,10 +58,11 @@ GEM
|
||||||
builder
|
builder
|
||||||
albino (1.3.3)
|
albino (1.3.3)
|
||||||
posix-spawn (>= 0.3.6)
|
posix-spawn (>= 0.3.6)
|
||||||
ancestry (1.2.4)
|
ancestry (1.2.5)
|
||||||
activerecord (>= 2.2.2)
|
activerecord (>= 2.2.2)
|
||||||
arel (3.0.2)
|
arel (3.0.2)
|
||||||
bcrypt-ruby (3.0.1)
|
bcrypt-ruby (3.0.1)
|
||||||
|
bcrypt-ruby (3.0.1-java)
|
||||||
bluepill (0.0.60)
|
bluepill (0.0.60)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
daemons (~> 1.1.4, <= 1.1.6)
|
daemons (~> 1.1.4, <= 1.1.6)
|
||||||
|
@ -77,6 +78,7 @@ GEM
|
||||||
net-ssh (>= 2.0.14)
|
net-ssh (>= 2.0.14)
|
||||||
net-ssh-gateway (>= 1.1.0)
|
net-ssh-gateway (>= 1.1.0)
|
||||||
capistrano_colors (0.5.5)
|
capistrano_colors (0.5.5)
|
||||||
|
charlock_holmes (0.6.8)
|
||||||
chronic (0.6.7)
|
chronic (0.6.7)
|
||||||
chunky_png (1.2.5)
|
chunky_png (1.2.5)
|
||||||
cocaine (0.2.1)
|
cocaine (0.2.1)
|
||||||
|
@ -87,12 +89,12 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.2.0)
|
coffee-script-source (1.2.0)
|
||||||
compass (0.12.rc.1)
|
compass (0.12.1)
|
||||||
chunky_png (~> 1.2)
|
chunky_png (~> 1.2)
|
||||||
fssm (>= 0.2.7)
|
fssm (>= 0.2.7)
|
||||||
sass (~> 3.1)
|
sass (~> 3.1)
|
||||||
compass-rails (1.0.0.rc.3)
|
compass-rails (1.0.1)
|
||||||
compass (~> 0.12.rc.0)
|
compass (~> 0.12.0)
|
||||||
creole (0.4.2)
|
creole (0.4.2)
|
||||||
daemons (1.1.6)
|
daemons (1.1.6)
|
||||||
delayed_job (3.0.1)
|
delayed_job (3.0.1)
|
||||||
|
@ -108,10 +110,11 @@ GEM
|
||||||
diff-lcs (1.1.3)
|
diff-lcs (1.1.3)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
eventmachine (0.12.10)
|
eventmachine (0.12.10)
|
||||||
|
eventmachine (0.12.10-java)
|
||||||
execjs (1.3.0)
|
execjs (1.3.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
expression_parser (0.9.0)
|
expression_parser (0.9.0)
|
||||||
factory_girl (2.6.1)
|
factory_girl (2.6.4)
|
||||||
activesupport (>= 2.3.9)
|
activesupport (>= 2.3.9)
|
||||||
factory_girl_rails (1.7.0)
|
factory_girl_rails (1.7.0)
|
||||||
factory_girl (~> 2.6.0)
|
factory_girl (~> 2.6.0)
|
||||||
|
@ -136,16 +139,18 @@ GEM
|
||||||
hashie (1.2.0)
|
hashie (1.2.0)
|
||||||
highline (1.6.11)
|
highline (1.6.11)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
hirb (0.6.0)
|
hirb (0.6.2)
|
||||||
i18n (0.6.0)
|
i18n (0.6.0)
|
||||||
journey (1.0.3)
|
journey (1.0.3)
|
||||||
jquery-rails (2.0.1)
|
jquery-rails (2.0.1)
|
||||||
railties (>= 3.2.0, < 5.0)
|
railties (>= 3.2.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
|
jruby-rack (1.1.4)
|
||||||
json (1.6.5)
|
json (1.6.5)
|
||||||
kgio (2.7.2)
|
json (1.6.5-java)
|
||||||
|
kgio (2.7.3)
|
||||||
libv8 (3.3.10.4)
|
libv8 (3.3.10.4)
|
||||||
mail (2.4.3)
|
mail (2.4.4)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
|
@ -160,7 +165,7 @@ GEM
|
||||||
thin (~> 1.2)
|
thin (~> 1.2)
|
||||||
meta-tags (1.2.6)
|
meta-tags (1.2.6)
|
||||||
actionpack
|
actionpack
|
||||||
mime-types (1.17.2)
|
mime-types (1.18)
|
||||||
multi_json (1.1.0)
|
multi_json (1.1.0)
|
||||||
mustache (0.99.4)
|
mustache (0.99.4)
|
||||||
net-scp (1.0.4)
|
net-scp (1.0.4)
|
||||||
|
@ -170,8 +175,9 @@ GEM
|
||||||
net-ssh (2.3.0)
|
net-ssh (2.3.0)
|
||||||
net-ssh-gateway (1.1.0)
|
net-ssh-gateway (1.1.0)
|
||||||
net-ssh (>= 1.99.1)
|
net-ssh (>= 1.99.1)
|
||||||
newrelic_rpm (3.3.2)
|
newrelic_rpm (3.3.2.1)
|
||||||
nokogiri (1.5.0)
|
nokogiri (1.5.2)
|
||||||
|
nokogiri (1.5.2-java)
|
||||||
omniauth (1.0.3)
|
omniauth (1.0.3)
|
||||||
hashie (~> 1.2)
|
hashie (~> 1.2)
|
||||||
rack
|
rack
|
||||||
|
@ -245,7 +251,7 @@ GEM
|
||||||
sanitize (2.0.3)
|
sanitize (2.0.3)
|
||||||
nokogiri (>= 1.4.4, < 1.6)
|
nokogiri (>= 1.4.4, < 1.6)
|
||||||
sass (3.1.15)
|
sass (3.1.15)
|
||||||
sass-rails (3.2.4)
|
sass-rails (3.2.5)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
|
@ -271,6 +277,7 @@ GEM
|
||||||
state_machine (1.1.2)
|
state_machine (1.1.2)
|
||||||
therubyracer (0.9.10)
|
therubyracer (0.9.10)
|
||||||
libv8 (~> 3.3.10)
|
libv8 (~> 3.3.10)
|
||||||
|
therubyrhino (1.73.1)
|
||||||
thin (1.3.1)
|
thin (1.3.1)
|
||||||
daemons (>= 1.0.9)
|
daemons (>= 1.0.9)
|
||||||
eventmachine (>= 0.12.6)
|
eventmachine (>= 0.12.6)
|
||||||
|
@ -280,6 +287,10 @@ GEM
|
||||||
treetop (1.4.10)
|
treetop (1.4.10)
|
||||||
polyglot
|
polyglot
|
||||||
polyglot (>= 0.3.1)
|
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)
|
tzinfo (0.3.32)
|
||||||
uglifier (1.2.3)
|
uglifier (1.2.3)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
|
@ -299,19 +310,21 @@ GEM
|
||||||
will_paginate (3.0.3)
|
will_paginate (3.0.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
java
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
RedCloth
|
RedCloth
|
||||||
airbrake (~> 3.0.9)
|
airbrake (~> 3.0.9)
|
||||||
ancestry (~> 1.2.4)
|
ancestry (~> 1.2.5)
|
||||||
bluepill (~> 0.0.60)
|
bluepill (~> 0.0.60)
|
||||||
cancan (~> 1.6.7)
|
cancan (~> 1.6.7)
|
||||||
cape
|
cape
|
||||||
capistrano
|
capistrano
|
||||||
capistrano_colors
|
capistrano_colors
|
||||||
|
charlock_holmes (~> 0.6.8)
|
||||||
coffee-rails (~> 3.2.2)
|
coffee-rails (~> 3.2.2)
|
||||||
compass-rails (~> 1.0.0.rc.3)
|
compass-rails (~> 1.0.1)
|
||||||
creole
|
creole
|
||||||
daemons (= 1.1.6)
|
daemons (= 1.1.6)
|
||||||
delayed_job_active_record (~> 0.3.2)
|
delayed_job_active_record (~> 0.3.2)
|
||||||
|
@ -341,10 +354,12 @@ DEPENDENCIES
|
||||||
rr (~> 1.0.4)
|
rr (~> 1.0.4)
|
||||||
rspec-rails (~> 2.8.1)
|
rspec-rails (~> 2.8.1)
|
||||||
russian (~> 0.6.0)
|
russian (~> 0.6.0)
|
||||||
sass-rails (~> 3.2.4)
|
sass-rails (~> 3.2.5)
|
||||||
shotgun
|
shotgun
|
||||||
shoulda
|
shoulda
|
||||||
therubyracer (~> 0.9.10)
|
therubyracer (~> 0.9.10)
|
||||||
|
therubyrhino (~> 1.73.1)
|
||||||
|
trinidad (~> 1.0.2)
|
||||||
uglifier (~> 1.2.1)
|
uglifier (~> 1.2.1)
|
||||||
unicorn (~> 4.2.0)
|
unicorn (~> 4.2.0)
|
||||||
whenever (~> 0.7.3)
|
whenever (~> 0.7.3)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Git::BaseController < ApplicationController
|
class Git::BaseController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
load_and_authorize_resource :project
|
||||||
|
|
||||||
before_filter :find_project
|
before_filter :find_project
|
||||||
before_filter :find_git_repository
|
before_filter :find_git_repository
|
||||||
|
@ -10,11 +11,9 @@ class Git::BaseController < ApplicationController
|
||||||
before_filter :set_current_tag
|
before_filter :set_current_tag
|
||||||
before_filter :set_current_branch
|
before_filter :set_current_branch
|
||||||
|
|
||||||
load_and_authorize_resource :project
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def find_project
|
def find_project
|
||||||
@project = Project.find(params[:project_id] || params[:id])
|
@project ||= Project.find(params[:project_id] || params[:id]) # TODO remove?
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_git_repository
|
def find_git_repository
|
||||||
|
@ -30,7 +29,7 @@ class Git::BaseController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_treeish
|
def set_treeish
|
||||||
@treeish = params[:treeish].present? ? params[:treeish] : @project.default_branch
|
@treeish = params[:treeish].presence || @project.default_branch
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_tag
|
def set_current_tag
|
||||||
|
|
|
@ -2,29 +2,25 @@
|
||||||
class Git::BlobsController < Git::BaseController
|
class Git::BlobsController < Git::BaseController
|
||||||
before_filter :find_tree
|
before_filter :find_tree
|
||||||
before_filter :find_branch
|
before_filter :find_branch
|
||||||
before_filter :set_commit_hash
|
|
||||||
before_filter :set_path_blob
|
before_filter :set_path_blob
|
||||||
|
|
||||||
def show
|
def show
|
||||||
redirect_to project_path(@project) and return unless @blob.present?
|
redirect_to project_path(@project) and return unless @blob.present?
|
||||||
if params[:raw]
|
if params[:raw]
|
||||||
image_url = Rails.root.to_s + "/" + @path
|
|
||||||
|
|
||||||
response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
|
response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
|
||||||
response.headers['Content-Type'] = @blob.mime_type
|
response.headers['Content-Type'] = @blob.mime_type
|
||||||
response.headers['Content-Disposition'] = 'inline'
|
response.headers['Content-Disposition'] = 'inline'
|
||||||
|
render(:text => @blob.data) and return
|
||||||
render(:text => open(image_url).read) and return
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
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
|
authorize! :write, @project
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
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
|
authorize! :write, @project
|
||||||
# Here might be callbacks for notification purposes:
|
# Here might be callbacks for notification purposes:
|
||||||
# @git_repository.after_update_file do |repo, sha|
|
# @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", ''),
|
res = @git_repository.update_file(params[:path], params[:content].gsub("\r", ''),
|
||||||
:message => params[:message].gsub("\r", ''), :actor => current_user, :head => @treeish)
|
:message => params[:message].gsub("\r", ''), :actor => current_user, :head => @treeish)
|
||||||
if res
|
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
|
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
|
end
|
||||||
redirect_to :action => :show
|
redirect_to :action => :show
|
||||||
end
|
end
|
||||||
|
@ -45,40 +41,24 @@ class Git::BlobsController < Git::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw
|
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}"]
|
headers["Content-Disposition"] = %[attachment;filename="#{@blob.name}"]
|
||||||
render :text => @blob.data, :content_type => @blob.mime_type
|
render :text => @blob.data, :content_type => @blob.mime_type
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def find_branch
|
def find_branch
|
||||||
@branch = @project.branch(@treeish)
|
@branch = @project.branch(@treeish)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_path_blob
|
def set_path_blob
|
||||||
@path = params[:path]
|
@path = params[:path]
|
||||||
@unenc_path = @path.dup
|
|
||||||
@path.force_encoding(Encoding::ASCII_8BIT)
|
|
||||||
puts @path.inspect
|
|
||||||
@blob = @tree / @path
|
@blob = @tree / @path
|
||||||
puts @blob.inspect
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_commit_hash
|
|
||||||
@commit_hash = params[:commit_hash].present? ? params[:commit_hash] : nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_tree
|
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)
|
@tree = @git_repository.tree(@treeish)
|
||||||
@commit = @git_repository.log(@treeish, @path, :max_count => 1).first # TODO WTF nil ?
|
@commit = @git_repository.log(@treeish, @path, :max_count => 1).first # TODO WTF nil ?
|
||||||
end
|
end
|
||||||
puts @tree.inspect
|
|
||||||
puts @commit.inspect
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Git::CommitsController < Git::BaseController
|
class Git::CommitsController < Git::BaseController
|
||||||
|
|
||||||
helper_method :split_commits_by_date
|
helper_method :split_commits_by_date
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -22,7 +21,7 @@ class Git::CommitsController < Git::BaseController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
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" }
|
format.patch { render :text => (@commit.to_patch rescue ''), :content_type => "text/plain" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,5 +39,4 @@ class Git::CommitsController < Git::BaseController
|
||||||
end
|
end
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
|
@ -1,26 +1,18 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Git::TreesController < Git::BaseController
|
class Git::TreesController < Git::BaseController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if params[:treeish].present? and @treeish.dup.encode_to_default == @project.default_branch
|
redirect_to project_path(@project) and return if params[:treeish] == @project.default_branch and params[:path].blank?
|
||||||
redirect_to project_path(@project) and return
|
|
||||||
end
|
|
||||||
|
|
||||||
@path = params[:path]
|
@path = params[:path]
|
||||||
|
|
||||||
@tree = @git_repository.tree(@treeish)
|
@tree = @git_repository.tree(@treeish)
|
||||||
@branch = @project.branch(@treeish)
|
@branch = @project.branch(@treeish)
|
||||||
|
|
||||||
# @commit = @git_repository.commits(@treeish, 1).first
|
# @commit = @git_repository.commits(@treeish, 1).first
|
||||||
# Raises Grit::Git::GitTimeout
|
# Raises Grit::Git::GitTimeout
|
||||||
@commit = @branch.present? ? @branch.commit() : @git_repository.log(@treeish, @path, :max_count => 1).first
|
@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
|
@tree = @tree / @path if @path
|
||||||
@path.force_encoding(Encoding::ASCII_8BIT)
|
render :template => "git/trees/show"
|
||||||
@tree = @tree / @path
|
|
||||||
end
|
|
||||||
|
|
||||||
render :template => "git/repositories/show"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module CommitHelper
|
||||||
res = ["<table class='commit_stats'>"]
|
res = ["<table class='commit_stats'>"]
|
||||||
stats.files.each do |filename, adds, deletes, total|
|
stats.files.each do |filename, adds, deletes, total|
|
||||||
res << "<tr>"
|
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 << "<td class='diffstat'>"
|
||||||
res << I18n.t("layout.projects.inline_changes_count", :count => total).strip +
|
res << I18n.t("layout.projects.inline_changes_count", :count => total).strip +
|
||||||
" (" +
|
" (" +
|
||||||
|
@ -17,7 +17,7 @@ module CommitHelper
|
||||||
end
|
end
|
||||||
res << "</table>"
|
res << "</table>"
|
||||||
|
|
||||||
res.join("\n").encode_to_default.html_safe
|
res.join("\n").html_safe.default_encoding!
|
||||||
end
|
end
|
||||||
|
|
||||||
# def format_commit_message(message)
|
# def format_commit_message(message)
|
||||||
|
@ -38,11 +38,11 @@ module CommitHelper
|
||||||
|
|
||||||
def short_commit_message(message)
|
def short_commit_message(message)
|
||||||
# Why 42? Because it is the Answer!
|
# Why 42? Because it is the Answer!
|
||||||
truncate(message, :length => 42, :omission => "...").encode_to_default
|
truncate(message, :length => 42, :omission => "...")
|
||||||
end
|
end
|
||||||
|
|
||||||
def commit_author_link(author)
|
def commit_author_link(author)
|
||||||
name = author.name.encode_to_default
|
name = author.name
|
||||||
email = author.email
|
email = author.email
|
||||||
u = User.where(:email => email).first
|
u = User.where(:email => email).first
|
||||||
u.present? ? link_to(name, user_path(u)) : mail_to(email, name)
|
u.present? ? link_to(name, user_path(u)) : mail_to(email, name)
|
||||||
|
|
|
@ -8,11 +8,11 @@ module DiffHelper
|
||||||
|
|
||||||
res = "<table class='diff inline' cellspacing='0' cellpadding='0'>"
|
res = "<table class='diff inline' cellspacing='0' cellpadding='0'>"
|
||||||
res += "<tbody>"
|
res += "<tbody>"
|
||||||
res += diff_display.render(Git::Diff::InlineCallback.new).encode_to_default
|
res += diff_display.render(Git::Diff::InlineCallback.new)
|
||||||
res += "</tbody>"
|
res += "</tbody>"
|
||||||
res += "</table>"
|
res += "</table>"
|
||||||
|
|
||||||
res.html_safe.encode_to_default
|
res.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,15 +26,7 @@ module GitHelper
|
||||||
res = "#{link_to @project.name, tree_path(@project)} /"
|
res = "#{link_to @project.name, tree_path(@project)} /"
|
||||||
end
|
end
|
||||||
|
|
||||||
res.encode_to_default.html_safe
|
res.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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_line_numbers(n)
|
def render_line_numbers(n)
|
||||||
|
@ -45,22 +37,19 @@ module GitHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_blob(blob)
|
def render_blob(blob)
|
||||||
res = ""
|
blob.data.split("\n").collect do |line|
|
||||||
blob.data.encode_to_default.split("\n").collect do |line|
|
content_tag :div, line.present? ? h(line) : tag(:br)
|
||||||
"<div>#{line.present? ? h(line) : "<br>"}</div>"
|
end.join.html_safe
|
||||||
end.join
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def choose_render_way(blob)
|
def choose_render_way(blob)
|
||||||
return :image if blob.mime_type.match(/image/)
|
case
|
||||||
return :binary if blob.binary?
|
when blob.mime_type.match(/image/); :image
|
||||||
|
when blob.binary?; :binary
|
||||||
|
else
|
||||||
|
@text = @blob.data.split("\n")
|
||||||
:text
|
:text
|
||||||
# return :text if blob.mime_type.match(/text|xml|json/)
|
|
||||||
# :binary
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def force_encoding_to_site(string)
|
|
||||||
string.dup.encode_to_default
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def iterate_path(path, &block)
|
def iterate_path(path, &block)
|
||||||
|
@ -76,21 +65,16 @@ module GitHelper
|
||||||
|
|
||||||
# TODO This is very dirty hack. Maybe need to be changed.
|
# TODO This is very dirty hack. Maybe need to be changed.
|
||||||
def branch_selector_options(project)
|
def branch_selector_options(project)
|
||||||
tmp = params.dup
|
p = params.dup
|
||||||
unless tmp['treeish'].present?
|
p.delete(:path) if p[:path].present? # to root path
|
||||||
tmp.merge!('project_id' => project.id, 'treeish' => project.default_branch).delete('id')
|
p.merge!(:project_id => project.id, :treeish => project.default_branch).delete(:id) unless p[:treeish].present?
|
||||||
end
|
current = url_for(p).split('?', 2).first
|
||||||
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']
|
|
||||||
|
|
||||||
res = project.branches.inject(res) do |h, branch|
|
res = []
|
||||||
h[truncate(branch.name, :length => 20)] = url_for(tmp.merge('treeish' => branch.name)).split('?', 2).first
|
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)
|
||||||
h
|
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]}]
|
||||||
end
|
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]}]
|
||||||
res.merge!(tmp['commit_hash'] || tmp['treeish'] => current)
|
|
||||||
|
|
||||||
options_for_select(res.sort, current).html_safe
|
grouped_options_for_select(res, current)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,7 +82,7 @@ module WikiHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def author
|
def author
|
||||||
@page.version.author.name.encode_to_default
|
@page.version.author.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def author_email
|
def author_email
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
||||||
:user => subscribe.user,
|
:user => subscribe.user,
|
||||||
:kind => 'new_comment_commit_notification',
|
: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,
|
: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}
|
:project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,8 +51,6 @@ class Git::Repository
|
||||||
#
|
#
|
||||||
# Returns commits sha if committing was successful and false otherwise
|
# Returns commits sha if committing was successful and false otherwise
|
||||||
def update_file(path, data, options = {})
|
def update_file(path, data, options = {})
|
||||||
path.force_encoding(Encoding::ASCII_8BIT) # some magic
|
|
||||||
|
|
||||||
head = options[:head].to_s || 'master'
|
head = options[:head].to_s || 'master'
|
||||||
actor = get_actor(options[:actor])
|
actor = get_actor(options[:actor])
|
||||||
filename = File.split(path).last
|
filename = File.split(path).last
|
||||||
|
|
|
@ -118,11 +118,11 @@ class Project < ActiveRecord::Base
|
||||||
# ... and add it to result.
|
# ... and add it to result.
|
||||||
h[entry] = c
|
h[entry] = c
|
||||||
# find another files, that linked to this commit and set them their commit
|
# 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|
|
# c.diffs.map{|diff| diff.b_path.split(File::SEPARATOR, 2).first}.each do |name|
|
||||||
h.each_pair do |k, v|
|
# h.each_pair do |k, v|
|
||||||
h[k] = c if k.name == name and v.nil?
|
# h[k] = c if k.name == name and v.nil?
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,7 +59,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
|
||||||
@committer_link ||= if committer.is_a? User
|
@committer_link ||= if committer.is_a? User
|
||||||
link_to committer.uname, user_path(committer)
|
link_to committer.uname, user_path(committer)
|
||||||
else
|
else
|
||||||
mail_to committer.email.encode_to_default, committer.name.encode_to_default
|
mail_to committer.email, committer.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_message
|
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?
|
@caption = 'empty message' unless @caption.present?
|
||||||
if @caption.length > 72
|
if @caption.length > 72
|
||||||
tmp = '...' + @caption[69..-1]
|
tmp = '...' + @caption[69..-1]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
(#{commit_author_link(committer)})
|
(#{commit_author_link(committer)})
|
||||||
%br
|
%br
|
||||||
%span.date= commit_date(elem[0].committed_date)
|
%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
|
%td.lines
|
||||||
= index
|
= index
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
%td.code.cm-s-default
|
%td.code.cm-s-default
|
||||||
%pre
|
%pre
|
||||||
%div= elem[1].first.encode_to_default
|
%div= elem[1].first
|
||||||
|
|
||||||
- elem[1][1..-1].each do |line|
|
- elem[1][1..-1].each do |line|
|
||||||
%tr
|
%tr
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
- index += 1
|
- index += 1
|
||||||
%td.code.cm-s-default
|
%td.code.cm-s-default
|
||||||
%pre
|
%pre
|
||||||
%div= line.encode_to_default
|
%div= line
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
@ -4,43 +4,20 @@
|
||||||
= render :partial => 'git/shared/fork'
|
= render :partial => 'git/shared/fork'
|
||||||
.both
|
.both
|
||||||
|
|
||||||
= form_tag blob_file_path, :name => 'blob-editor', :method => :put do
|
= form_tag blob_path(@project, @treeish, @path), :name => 'blob-editor', :method => :put do
|
||||||
.file
|
.file= text_area_tag :content, @blob.data, :id => 'code'
|
||||||
= text_area_tag :content, @blob.data.encode_to_default, :id => 'code'
|
|
||||||
|
|
||||||
.both
|
.both
|
||||||
= t("layout.enter_commit_message")
|
= 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
|
||||||
%br
|
%br
|
||||||
= submit_tag t("layout.save"), :title => t("layout.save")
|
= submit_tag t("layout.save"), :title => t("layout.save")
|
||||||
= t("layout.or")
|
= t("layout.or")
|
||||||
= link_to t("layout.cancel"), blob_file_path, :class => 'button'
|
= link_to t("layout.cancel"), blob_path(@project, @treeish, @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'
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
$(function() {
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {lineNumbers: true, mode: '#{@blob.raw_mime_type.content_type}', theme: 'eclipse'});
|
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'
|
|
||||||
|
|
|
@ -6,21 +6,7 @@
|
||||||
|
|
||||||
- render_way = choose_render_way(@blob)
|
- render_way = choose_render_way(@blob)
|
||||||
.file
|
.file
|
||||||
.top
|
.top= render 'top', :render_way => render_way
|
||||||
.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
|
|
||||||
.data
|
.data
|
||||||
- case render_way
|
- case render_way
|
||||||
- when :image
|
- when :image
|
||||||
|
@ -33,13 +19,12 @@
|
||||||
<center> <img src='?raw=true'/></center>
|
<center> <img src='?raw=true'/></center>
|
||||||
<br/>
|
<br/>
|
||||||
- when :text
|
- when :text
|
||||||
.gutter
|
.gutter= render_line_numbers(@text.length)
|
||||||
= render_line_numbers(text.length)
|
|
||||||
#output.formatted.cm-s-default
|
#output.formatted.cm-s-default
|
||||||
%pre#code
|
%pre#code
|
||||||
=#{render_blob(@blob)}
|
=#{render_blob(@blob)}
|
||||||
:preserve
|
:preserve
|
||||||
#{h(@blob.data.encode_to_default).html_safe}
|
#{h(@blob.data).html_safe}
|
||||||
.both
|
.both
|
||||||
- when :binary
|
- when :binary
|
||||||
%table.table.blob
|
%table.table.blob
|
||||||
|
@ -48,7 +33,7 @@
|
||||||
%td.blob
|
%td.blob
|
||||||
:plain
|
:plain
|
||||||
<br/>
|
<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/>
|
<br/>
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
@ -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
|
|
@ -16,81 +16,10 @@
|
||||||
#repo-wrapper
|
#repo-wrapper
|
||||||
%h3= t("layout.projects.files_in_project")
|
%h3= t("layout.projects.files_in_project")
|
||||||
.files
|
.files
|
||||||
.l
|
.l= render :partial => 'git/shared/whereami'
|
||||||
= render :partial => 'git/shared/whereami'
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- render_way = choose_render_way(@blob)
|
- render_way = choose_render_way(@blob)
|
||||||
.file
|
.file
|
||||||
.top
|
.top= render 'top', :render_way => render_way
|
||||||
.l
|
.blame_data= render 'blame_table'
|
||||||
= @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')
|
|
||||||
|
|
|
@ -1,21 +1 @@
|
||||||
= render :partial => "git/blobs/editor", :layout => 'projects/show'
|
= 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')
|
|
||||||
-#
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
- commit_id = commit_diff.deleted_file ? @commit.parents.first.id : @commit.id
|
||||||
.file
|
.file
|
||||||
%a{ :name => h(commit_diff.a_path.encode_to_default) }
|
%a{:name => h(commit_diff.a_path)}
|
||||||
.top
|
.top
|
||||||
.l= h(commit_diff.a_path.encode_to_default)
|
.l= h(commit_diff.a_path)
|
||||||
- if commit_diff.b_path.present?
|
- if commit_diff.b_path.present?
|
||||||
.r
|
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path)
|
||||||
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@project, @commit.id, commit_diff.b_path.encode_to_default))
|
|
||||||
.clear
|
.clear
|
||||||
|
|
||||||
.diff_data
|
.diff_data= render_diff(commit_diff) unless (@git_repository.tree(commit_id) / commit_diff.b_path).binary?
|
||||||
= render_diff(commit_diff)
|
|
|
@ -9,37 +9,10 @@
|
||||||
- by_month.each_pair do |month, by_day|
|
- by_month.each_pair do |month, by_day|
|
||||||
- by_day.each_pair do |day, commits|
|
- by_day.each_pair do |day, commits|
|
||||||
.date-block
|
.date-block
|
||||||
.date
|
.date= raw l(commits.first.authored_date, :format => :date_block_format)
|
||||||
= raw l(commits.first.authored_date, :format => :date_block_format)
|
|
||||||
.messages
|
.messages
|
||||||
- commits.each_with_index do |commit|
|
- commits.each_with_index do |commit|
|
||||||
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
|
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
|
||||||
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => counter}
|
= render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => counter}
|
||||||
- counter += 1
|
- counter += 1
|
||||||
.both
|
.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)}
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
.pagination.tmargin30
|
.pagination.tmargin30
|
||||||
- if @page == 1
|
- if @page == 1
|
||||||
%span.previous_page.disabled « Previous
|
%span.previous_page.disabled= t('will_paginate.previous_label')
|
||||||
- else
|
- 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
|
- if @last_page
|
||||||
%span.next_page.disabled Next »
|
%span.next_page.disabled= t('will_paginate.next_label')
|
||||||
- else
|
- 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')
|
|
@ -2,16 +2,4 @@
|
||||||
= render :partial => 'projects/repo_block', :locals => {:project => @project}
|
= render :partial => 'projects/repo_block', :locals => {:project => @project}
|
||||||
|
|
||||||
= render :partial => 'git/commits/commits', :object => @commits
|
= render :partial => 'git/commits/commits', :object => @commits
|
||||||
- if @render_paginate
|
= render 'git/commits/paginate' 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')
|
|
||||||
|
|
|
@ -17,43 +17,3 @@
|
||||||
|
|
||||||
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
|
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}
|
||||||
= render :partial => "comments/add", :locals => {: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
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
= render :partial => "git/repositories/show", :layout => 'projects/show'
|
|
|
@ -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)
|
|
|
@ -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
|
|
|
@ -1,4 +0,0 @@
|
||||||
.block.notice
|
|
||||||
%h3= t("layout.projects.current_project_header")
|
|
||||||
.content
|
|
||||||
%p= link_to @project.name, project_path(@project)
|
|
|
@ -1,10 +1,10 @@
|
||||||
%p#file-name1
|
%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
|
= File::SEPARATOR
|
||||||
- if @path.present?
|
- if @path.present?
|
||||||
- paths = File.split(@path)
|
- paths = File.split(@path)
|
||||||
- if paths.size > 1 and paths.first != '.'
|
- if paths.size > 1 and paths.first != '.'
|
||||||
- iterate_path(paths.first) do |path, name|
|
- 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
|
= File::SEPARATOR
|
||||||
= paths.last.encode_to_default
|
= paths.last
|
||||||
|
|
|
@ -16,27 +16,22 @@
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
.pic= image_tag 'folder.png'
|
.pic= image_tag 'folder.png'
|
||||||
.name
|
.name= link_to "..", tree_path(@project, @treeish, File.join([@path, ".."].compact))
|
||||||
= link_to "..", tree_path(@project, @treeish, File.join([@path.dup.encode_to_default, ".."].compact).encode_to_default)
|
|
||||||
%td==
|
%td==
|
||||||
%td==
|
%td==
|
||||||
%td==
|
%td==
|
||||||
- @project.tree_info(@tree, @treeish, @path).each_pair do |entry, commit|
|
- @project.tree_info(@tree, @treeish, @path).each_pair do |entry, commit|
|
||||||
%tr
|
%tr
|
||||||
%td
|
%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
|
- if entry.is_a? Grit::Blob
|
||||||
.pic= image_tag 'code.png'
|
.pic= image_tag 'code.png'
|
||||||
.name
|
.name= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see')
|
||||||
= link_to(entry.name, blob_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
|
|
||||||
- else
|
- else
|
||||||
.pic= image_tag 'folder.png'
|
.pic= image_tag 'folder.png'
|
||||||
.name
|
.name= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see')
|
||||||
= link_to(entry.name, tree_path(@project, @treeish, entry_path), :class => 'files-see').encode_to_default
|
|
||||||
%td
|
%td
|
||||||
%span{:style => "display: none;"}= commit.committed_date || commit.authored_date#> Dec 31, 2011
|
%span{:style => "display: none;"}= commit.committed_date || commit.authored_date
|
||||||
= l(commit.committed_date || commit.authored_date, :format => :short) #31 декабря 2011
|
= l(commit.committed_date || commit.authored_date, :format => :short)
|
||||||
%td
|
%td= commit.short_message
|
||||||
= commit.short_message.encode_to_default #Redo autostart script to start from user
|
%td= (commit.committer || commit.author).name
|
||||||
%td
|
|
||||||
= (commit.committer || commit.author).name.encode_to_default #chipiga
|
|
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
%h3= t("layout.projects.files_in_project")
|
%h3= t("layout.projects.files_in_project")
|
||||||
.files
|
.files
|
||||||
.l
|
.l= render :partial => 'git/shared/whereami'
|
||||||
= render :partial => 'git/shared/whereami'
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
|
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
|
|
@ -0,0 +1 @@
|
||||||
|
= render :partial => "git/trees/show", :layout => 'projects/show'
|
|
@ -2,7 +2,7 @@
|
||||||
= select_tag :branch, branch_selector_options(project), :id => 'branch_selector', :class => 'sel80'
|
= 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
|
.fork
|
||||||
%p= t("layout.projects.#{params[:commit_hash].present? ? 'current_commit' : 'current_branch'}")+':'
|
%p #{t('layout.projects.current_branch')}:
|
||||||
.both
|
.both
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
|
|
|
@ -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}"}
|
|
||||||
/ = 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
|
|
|
@ -1,18 +1,13 @@
|
||||||
- act = controller.action_name.to_sym
|
- act = controller.action_name.to_sym
|
||||||
- if [:new, :create].include? act
|
- if [:new, :create].include? act
|
||||||
.leftlist
|
.leftlist= f.label :name, t("activerecord.attributes.project.name"), :class => :label
|
||||||
= f.label :name, t("activerecord.attributes.project.name"), :class => :label
|
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
||||||
.rightlist
|
|
||||||
= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
|
|
||||||
.both
|
.both
|
||||||
.leftlist
|
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label
|
||||||
= f.label :description, t("activerecord.attributes.project.description"), :class => :label
|
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
|
||||||
.rightlist
|
|
||||||
= f.text_area :description, :class => 'text_field', :cols => 80
|
|
||||||
.both
|
.both
|
||||||
- if ['new', 'create'].include? controller.action_name
|
- if ['new', 'create'].include? controller.action_name
|
||||||
.leftlist
|
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
|
||||||
= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
|
|
||||||
.rightlist
|
.rightlist
|
||||||
= label_tag t("activerecord.attributes.project.who_owns.me")
|
= label_tag t("activerecord.attributes.project.who_owns.me")
|
||||||
- if Group.can_own_project(current_user).count > 0
|
- if Group.can_own_project(current_user).count > 0
|
||||||
|
@ -27,13 +22,10 @@
|
||||||
= hidden_field_tag :who_owns, :me
|
= hidden_field_tag :who_owns, :me
|
||||||
.both
|
.both
|
||||||
-#- if [:new, :create].include? act
|
-#- if [:new, :create].include? act
|
||||||
-# .leftlist
|
-# .leftlist= f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label
|
||||||
-# = 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
|
||||||
-# .rightlist
|
|
||||||
-# = f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true
|
|
||||||
-# .both
|
-# .both
|
||||||
.leftlist
|
.leftlist= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label
|
||||||
= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label
|
|
||||||
.rightlist
|
.rightlist
|
||||||
=# f.select :visibility, Project::VISIBILITIES
|
=# f.select :visibility, Project::VISIBILITIES
|
||||||
- Project::VISIBILITIES.each do |visibility|
|
- Project::VISIBILITIES.each do |visibility|
|
||||||
|
@ -45,30 +37,23 @@
|
||||||
= t("activerecord.attributes.project.visibilities.#{visibility}")
|
= t("activerecord.attributes.project.visibilities.#{visibility}")
|
||||||
.both
|
.both
|
||||||
- if [:edit, :update].include? act
|
- if [:edit, :update].include? act
|
||||||
.leftlist
|
.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'
|
||||||
.rightlist
|
|
||||||
= f.select :default_branch, options_from_collection_for_select(@project.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector'
|
|
||||||
.both
|
.both
|
||||||
- if [:edit, :update].include? act
|
- if [:edit, :update].include? act
|
||||||
.leftlist
|
.leftlist
|
||||||
\
|
\
|
||||||
.rightlist
|
.rightlist
|
||||||
.check
|
.check
|
||||||
%span#niceCheckbox1.niceCheck-main
|
%span#niceCheckbox1.niceCheck-main= f.check_box :is_rpm#, :class => 'niceCheckbox1'
|
||||||
= f.check_box :is_rpm#, :class => 'niceCheckbox1'
|
.forcheck= t("activerecord.attributes.project.is_rpm")
|
||||||
.forcheck
|
|
||||||
Проект является пакетом
|
|
||||||
.both
|
.both
|
||||||
.both
|
.both
|
||||||
- if [:new, :create].include? act
|
- if [:new, :create].include? act
|
||||||
.leftlist
|
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
|
||||||
= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
|
.rightlist= f.file_field :srpm, :class => 'file_field'
|
||||||
.rightlist
|
|
||||||
= f.file_field :srpm, :class => 'file_field'
|
|
||||||
.both
|
.both
|
||||||
.leftlist
|
.leftlist
|
||||||
\
|
\
|
||||||
.rightlist
|
.rightlist= submit_tag t("layout.save"), :class => 'button'
|
||||||
= submit_tag t("layout.save"), :class => 'button'
|
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
%table.table
|
|
||||||
%tr
|
|
||||||
%th= t("activerecord.attributes.project.name")
|
|
||||||
%th= t("activerecord.attributes.project.owner")
|
|
||||||
%th.last
|
|
||||||
- @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
|
|
|
@ -1,8 +1,6 @@
|
||||||
.description-top
|
.description-top
|
||||||
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name',
|
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
|
||||||
:type => 'text',:spellcheck => 'false', :readonly => true
|
.role= t("layout.read_write_access")
|
||||||
.role
|
|
||||||
= t("layout.read_write_access")
|
|
||||||
= render :partial => 'projects/branch_select', :locals => {:project => project}
|
= render :partial => 'projects/branch_select', :locals => {:project => project}
|
||||||
.both
|
.both
|
||||||
:javascript
|
:javascript
|
||||||
|
|
|
@ -7,61 +7,8 @@
|
||||||
- if can? :edit, @project
|
- if can? :edit, @project
|
||||||
%li{:class => (act == :edit && contr == :projects) ? 'active' : ''}
|
%li{:class => (act == :edit && contr == :projects) ? 'active' : ''}
|
||||||
= link_to t("layout.projects.edit"), edit_project_path(@project)
|
= link_to t("layout.projects.edit"), edit_project_path(@project)
|
||||||
- if can? :manage_collaborators, @project
|
|
||||||
%li{:class => (act == :sections && contr == :projects) ? 'active' : ''}
|
%li{:class => (act == :sections && contr == :projects) ? 'active' : ''}
|
||||||
= link_to t("layout.projects.sections"), sections_project_path(@project)
|
= link_to t("layout.projects.sections"), sections_project_path(@project)
|
||||||
- if can? :manage_collaborators, @project
|
- if can? :manage_collaborators, @project
|
||||||
%li{:class => (act == :edit && contr == :collaborators) ? 'active' : ''}
|
%li{:class => (act == :edit && contr == :collaborators) ? 'active' : ''}
|
||||||
= link_to t("layout.projects.edit_collaborators"), edit_project_collaborators_path(@project)
|
= 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)
|
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
= render :partial => "form", :locals => {:f => f}
|
= render :partial => "form", :locals => {:f => f}
|
||||||
|
|
||||||
.hr
|
.hr
|
||||||
.leftside
|
.leftside= t("layout.projects.delete_warning")
|
||||||
= 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
|
||||||
.rightside
|
|
||||||
= link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- content_for :sidebar, render('sidebar')
|
- content_for :sidebar, render('sidebar')
|
||||||
|
|
|
@ -2,25 +2,20 @@
|
||||||
|
|
||||||
= form_for @project, :url => sections_project_path(@project), :method => :post, :html => { :class => :form, :multipart => true } do |f|
|
= form_for @project, :url => sections_project_path(@project), :method => :post, :html => { :class => :form, :multipart => true } do |f|
|
||||||
.leftside.w25
|
.leftside.w25
|
||||||
%span.niceCheck-main{:onclick => "changeCheck(this)"}
|
%span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_issues
|
||||||
= f.check_box :has_issues
|
|
||||||
.leftside.w420
|
.leftside.w420
|
||||||
= t("activerecord.attributes.project.has_issues")
|
= t("activerecord.attributes.project.has_issues")
|
||||||
%br
|
%br
|
||||||
%span{:style => "font-size: 11px;"}
|
%span{:style => "font-size: 11px;"}= t("layout.projects.has_issue_description")
|
||||||
= t("layout.projects.has_issue_description")
|
|
||||||
.both
|
.both
|
||||||
.leftside.w25
|
.leftside.w25
|
||||||
%span.niceCheck-main{:onclick => "changeCheck(this)"}
|
%span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_wiki, :class => 'niceCheck-main'
|
||||||
= f.check_box :has_wiki, :class => 'niceCheck-main'
|
|
||||||
.leftside.w420
|
.leftside.w420
|
||||||
= t("activerecord.attributes.project.has_wiki")
|
= t("activerecord.attributes.project.has_wiki")
|
||||||
%br
|
%br
|
||||||
%span{:style => "font-size: 11px;"}
|
%span{:style => "font-size: 11px;"}= t("layout.projects.has_wiki_description")
|
||||||
= t("layout.projects.has_wiki_description")
|
|
||||||
.both
|
.both
|
||||||
.padd25
|
.padd25= submit_tag t("layout.save"), :class => 'button'
|
||||||
= submit_tag t("layout.save"), :class => 'button'
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- content_for :sidebar, render('sidebar')
|
- content_for :sidebar, render('sidebar')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.blob_header
|
.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
|
.clear
|
||||||
.diff_data.highlight= render_diff(diff)
|
.diff_data.highlight= render_diff(diff)
|
|
@ -10,14 +10,14 @@
|
||||||
- user = User.where(:email => v.author.email).first
|
- user = User.where(:email => v.author.email).first
|
||||||
.avatar
|
.avatar
|
||||||
= link_to user_path_by_user(user) do
|
= 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
|
.name
|
||||||
= link_to user_path_by_user(user) do
|
= 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
|
.both
|
||||||
%td.td3
|
%td.td3
|
||||||
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
|
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
|
||||||
= v.message.encode_to_default
|
= v.message
|
||||||
- if @name
|
- if @name
|
||||||
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("wiki.view_commit")}]"
|
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("wiki.view_commit")}]"
|
||||||
- else
|
- else
|
||||||
|
|
|
@ -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)
|
|
|
@ -2,7 +2,5 @@
|
||||||
# Load the rails application
|
# Load the rails application
|
||||||
require File.expand_path('../application', __FILE__)
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
Encoding.default_external = Encoding::UTF_8
|
|
||||||
Encoding.default_internal = Encoding::UTF_8
|
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Rosa::Application.initialize!
|
Rosa::Application.initialize!
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# -*- encoding : utf-8 -*-
|
|
||||||
require './lib/gollum1'
|
|
|
@ -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
|
|
|
@ -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_after ::Rails::Rack::Logger, ::Grack::Handler, config
|
||||||
Rosa::Application.config.middleware.insert_before ::Grack::Handler, ::Grack::Auth
|
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}
|
Dir[Rails.root.join("lib/ext/**/*.rb")].each {|f| require f}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ en:
|
||||||
message: Message
|
message: Message
|
||||||
author: Author
|
author: Author
|
||||||
|
|
||||||
current_branch: Current branch
|
current_branch: Current branch/tag
|
||||||
current_commit: Current commit
|
current_commit: Current commit
|
||||||
files_in_project: Files in
|
files_in_project: Files in
|
||||||
|
|
||||||
|
@ -77,3 +77,5 @@ en:
|
||||||
who_owns:
|
who_owns:
|
||||||
me: I
|
me: I
|
||||||
group: Group
|
group: Group
|
||||||
|
default_branch: Default branch
|
||||||
|
is_rpm: Project is a packet
|
||||||
|
|
|
@ -40,7 +40,7 @@ ru:
|
||||||
message: Сообщение
|
message: Сообщение
|
||||||
author: Автор
|
author: Автор
|
||||||
|
|
||||||
current_branch: Текущая ветка
|
current_branch: Текущая ветка/тег
|
||||||
current_commit: Текущий коммит
|
current_commit: Текущий коммит
|
||||||
files_in_project: Файлы в
|
files_in_project: Файлы в
|
||||||
|
|
||||||
|
@ -77,3 +77,5 @@ ru:
|
||||||
who_owns:
|
who_owns:
|
||||||
me: Я
|
me: Я
|
||||||
group: Группа
|
group: Группа
|
||||||
|
default_branch: Ветка по умолчанию
|
||||||
|
is_rpm: Проект является пакетом
|
||||||
|
|
|
@ -133,10 +133,10 @@ ru:
|
||||||
repositories:
|
repositories:
|
||||||
empty: "Репозиторий пуст. Если вы клонировали(Fork) проект или импортировали пакет, данные скоро появятся"
|
empty: "Репозиторий пуст. Если вы клонировали(Fork) проект или импортировали пакет, данные скоро появятся"
|
||||||
source: Source
|
source: Source
|
||||||
commits: Commits
|
commits: Коммиты
|
||||||
commit_diff_too_big: Извините, коммит слишком большой!
|
commit_diff_too_big: Извините, коммит слишком большой!
|
||||||
tags: Tags
|
tags: Теги
|
||||||
branches: Branches
|
branches: Ветки
|
||||||
project_versions: Версии
|
project_versions: Версии
|
||||||
|
|
||||||
product_build_lists:
|
product_build_lists:
|
||||||
|
|
|
@ -137,7 +137,6 @@ Rosa::Application.routes.draw do
|
||||||
post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
|
post "labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
|
||||||
post "labels/:label_id/update" => "issues#update_label", :as => :issues_update_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
|
resources :build_lists, :only => [:index, :new, :create] do
|
||||||
collection { post :search }
|
collection { post :search }
|
||||||
end
|
end
|
||||||
|
@ -202,36 +201,27 @@ Rosa::Application.routes.draw do
|
||||||
match 'product_status', :to => 'product_build_lists#status_build'
|
match 'product_status', :to => 'product_build_lists#status_build'
|
||||||
|
|
||||||
# Tree
|
# 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
|
# 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
|
get '/projects/:project_id/commits/:treeish(/*path)' => "git/commits#index", :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
|
get '/projects/:project_id/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
||||||
# Commit Comments
|
# Commit comments
|
||||||
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :edit, :as => :edit_project_commit_comment, :via => :get
|
post '/projects/:project_id/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
|
||||||
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :update, :as => :project_commit_comment, :via => :put
|
get '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
|
||||||
match '/projects/:project_id/git/commit/:commit_id/comments/:id(.:format)', :controller => "comments", :action => :destroy, :via => :delete
|
put '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
||||||
match '/projects/:project_id/git/commit/:commit_id/comments(.:format)', :controller => "comments", :action => :create, :as => :project_commit_comments, :via => :post
|
delete '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
||||||
|
# Commit subscribes
|
||||||
# Commits subscribe
|
post '/projects/:project_id/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
||||||
match '/projects/:project_id/git/commit/:commit_id/subscribe', :controller => "commit_subscribes", :action => :create, :defaults => { :format => :html }, :as => :subscribe_commit, :via => :post
|
delete '/projects/:project_id/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
||||||
match '/projects/:project_id/git/commit/:commit_id/unsubscribe', :controller => "commit_subscribes", :action => :destroy, :defaults => { :format => :html }, :as => :unsubscribe_commit, :via => :delete
|
|
||||||
|
|
||||||
# Editing files
|
# 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
|
get '/projects/:project_id/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
|
||||||
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
|
put '/projects/:project_id/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
|
||||||
|
|
||||||
# Blobs
|
# 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
|
get '/projects/:project_id/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :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
|
|
||||||
|
|
||||||
# Blame
|
# 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
|
get '/projects/:project_id/blame/:treeish/*path' => "git/blobs#blame", :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
|
|
||||||
|
|
||||||
# Raw
|
# 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
|
get '/projects/:project_id/raw/:treeish/*path' => "git/blobs#raw", :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
|
|
||||||
|
|
||||||
root :to => "activity_feeds#index"
|
root :to => "activity_feeds#index"
|
||||||
match '/forbidden', :to => 'platforms#forbidden', :as => 'forbidden'
|
match '/forbidden', :to => 'platforms#forbidden', :as => 'forbidden'
|
||||||
|
|
114
db/schema.rb
114
db/schema.rb
|
@ -23,8 +23,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
|
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.integer "user_id"
|
||||||
t.string "provider"
|
t.string "provider"
|
||||||
t.string "uid"
|
t.string "uid"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
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 "arch_id"
|
||||||
t.integer "pl_id"
|
t.integer "pl_id"
|
||||||
t.integer "bpl_id"
|
t.integer "bpl_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "build_list_items", :force => true do |t|
|
create_table "build_list_items", :force => true do |t|
|
||||||
|
@ -54,8 +54,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.integer "level"
|
t.integer "level"
|
||||||
t.integer "status"
|
t.integer "status"
|
||||||
t.integer "build_list_id"
|
t.integer "build_list_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "version"
|
t.string "version"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "arch_id"
|
t.integer "arch_id"
|
||||||
t.datetime "notified_at"
|
t.datetime "notified_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "is_circle", :default => false
|
t.boolean "is_circle", :default => false
|
||||||
t.text "additional_repos"
|
t.text "additional_repos"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -94,16 +94,16 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "ancestry"
|
t.string "ancestry"
|
||||||
t.integer "projects_count", :default => 0, :null => false
|
t.integer "projects_count", :default => 0, :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "comments", :force => true do |t|
|
create_table "comments", :force => true do |t|
|
||||||
t.string "commentable_type"
|
t.string "commentable_type"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.decimal "commentable_id", :precision => 50, :scale => 0
|
t.decimal "commentable_id", :precision => 50, :scale => 0
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
end
|
end
|
||||||
|
@ -112,8 +112,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.integer "owner_id", :null => false
|
t.integer "owner_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "delayed_jobs", :force => true do |t|
|
create_table "delayed_jobs", :force => true do |t|
|
||||||
|
@ -125,8 +125,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
t.datetime "failed_at"
|
t.datetime "failed_at"
|
||||||
t.string "locked_by"
|
t.string "locked_by"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "queue"
|
t.string "queue"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "distro"
|
t.string "distro"
|
||||||
t.string "platform"
|
t.string "platform"
|
||||||
t.integer "counter", :default => 0
|
t.integer "counter", :default => 0
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "event_logs", :force => true do |t|
|
create_table "event_logs", :force => true do |t|
|
||||||
|
@ -154,14 +154,14 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "controller"
|
t.string "controller"
|
||||||
t.string "action"
|
t.string "action"
|
||||||
t.text "message"
|
t.text "message"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "groups", :force => true do |t|
|
create_table "groups", :force => true do |t|
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.integer "own_projects_count", :default => 0, :null => false
|
t.integer "own_projects_count", :default => 0, :null => false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
@ -174,8 +174,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
t.string "status", :default => "open"
|
t.string "status", :default => "open"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "creator_id"
|
t.integer "creator_id"
|
||||||
t.datetime "closed_at"
|
t.datetime "closed_at"
|
||||||
t.integer "closed_by"
|
t.integer "closed_by"
|
||||||
|
@ -206,8 +206,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "parent_platform_id"
|
t.integer "parent_platform_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "released", :default => false
|
t.boolean "released", :default => false
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
t.string "owner_type"
|
t.string "owner_type"
|
||||||
|
@ -220,8 +220,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.integer "platform_id"
|
t.integer "platform_id"
|
||||||
t.string "login"
|
t.string "login"
|
||||||
t.string "password"
|
t.string "password"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -229,8 +229,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.integer "product_id"
|
t.integer "product_id"
|
||||||
t.integer "status", :default => 2, :null => false
|
t.integer "status", :default => 2, :null => false
|
||||||
t.datetime "notified_at"
|
t.datetime "notified_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
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 "platform_id", :null => false
|
||||||
t.integer "build_status", :default => 2, :null => false
|
t.integer "build_status", :default => 2, :null => false
|
||||||
t.string "build_path"
|
t.string "build_path"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.text "build_script"
|
t.text "build_script"
|
||||||
t.text "counter"
|
t.text "counter"
|
||||||
t.text "ks"
|
t.text "ks"
|
||||||
|
@ -261,8 +261,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "version"
|
t.string "version"
|
||||||
t.datetime "file_mtime"
|
t.datetime "file_mtime"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "platform_id"
|
t.integer "platform_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -271,14 +271,14 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
create_table "project_to_repositories", :force => true do |t|
|
create_table "project_to_repositories", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "repository_id"
|
t.integer "repository_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "projects", :force => true do |t|
|
create_table "projects", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
t.string "owner_type"
|
t.string "owner_type"
|
||||||
t.string "visibility", :default => "open"
|
t.string "visibility", :default => "open"
|
||||||
|
@ -286,11 +286,11 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "ancestry"
|
t.string "ancestry"
|
||||||
t.boolean "has_issues", :default => true
|
t.boolean "has_issues", :default => true
|
||||||
|
t.boolean "has_wiki", :default => false
|
||||||
t.string "srpm_file_name"
|
t.string "srpm_file_name"
|
||||||
t.string "srpm_content_type"
|
t.string "srpm_content_type"
|
||||||
t.integer "srpm_file_size"
|
t.integer "srpm_file_size"
|
||||||
t.datetime "srpm_updated_at"
|
t.datetime "srpm_updated_at"
|
||||||
t.boolean "has_wiki", :default => false
|
|
||||||
t.string "default_branch", :default => "master"
|
t.string "default_branch", :default => "master"
|
||||||
t.boolean "is_rpm", :default => true
|
t.boolean "is_rpm", :default => true
|
||||||
end
|
end
|
||||||
|
@ -304,8 +304,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "token"
|
t.string "token"
|
||||||
t.boolean "approved", :default => false
|
t.boolean "approved", :default => false
|
||||||
t.boolean "rejected", :default => false
|
t.boolean "rejected", :default => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "interest"
|
t.string "interest"
|
||||||
t.text "more"
|
t.text "more"
|
||||||
end
|
end
|
||||||
|
@ -318,16 +318,16 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "object_type"
|
t.string "object_type"
|
||||||
t.integer "target_id"
|
t.integer "target_id"
|
||||||
t.string "target_type"
|
t.string "target_type"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "role"
|
t.string "role"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "repositories", :force => true do |t|
|
create_table "repositories", :force => true do |t|
|
||||||
t.string "description", :null => false
|
t.string "description", :null => false
|
||||||
t.integer "platform_id", :null => false
|
t.integer "platform_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -335,8 +335,8 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.integer "arch_id", :null => false
|
t.integer "arch_id", :null => false
|
||||||
t.integer "project_id", :null => false
|
t.integer "project_id", :null => false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
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_comment_reply", :default => true
|
||||||
t.boolean "new_issue", :default => true
|
t.boolean "new_issue", :default => true
|
||||||
t.boolean "issue_assign", :default => true
|
t.boolean "issue_assign", :default => true
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "new_comment_commit_owner", :default => true
|
t.boolean "new_comment_commit_owner", :default => true
|
||||||
t.boolean "new_comment_commit_repo_owner", :default => true
|
t.boolean "new_comment_commit_repo_owner", :default => true
|
||||||
t.boolean "new_comment_commit_commentor", :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|
|
create_table "subscribes", :force => true do |t|
|
||||||
t.string "subscribeable_type"
|
t.string "subscribeable_type"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "status", :default => true
|
t.boolean "status", :default => true
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.decimal "subscribeable_id", :precision => 50, :scale => 0
|
t.decimal "subscribeable_id", :precision => 50, :scale => 0
|
||||||
|
@ -369,16 +369,16 @@ ActiveRecord::Schema.define(:version => 20120321130436) do
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :default => "", :null => false
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
|
t.datetime "reset_password_sent_at"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.text "ssh_key"
|
t.text "ssh_key"
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.string "role"
|
t.string "role"
|
||||||
t.string "language", :default => "en"
|
t.string "language", :default => "en"
|
||||||
t.datetime "reset_password_sent_at"
|
|
||||||
t.integer "own_projects_count", :default => 0, :null => false
|
t.integer "own_projects_count", :default => 0, :null => false
|
||||||
t.text "professional_experience"
|
t.text "professional_experience"
|
||||||
t.string "site"
|
t.string "site"
|
||||||
|
|
|
@ -17,4 +17,6 @@ Add to /etc/rc.d/rc.sysinit
|
||||||
. /etc/rc.local
|
. /etc/rc.local
|
||||||
fi
|
fi
|
||||||
|
|
||||||
==
|
=== Tips
|
||||||
|
gem install charlock_holmes -- --with-icu-dir=/opt/local
|
||||||
|
git config --global core.quotepath false
|
||||||
|
|
|
@ -1,6 +1,27 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
|
require 'charlock_holmes/string'
|
||||||
|
# require 'iconv'
|
||||||
|
|
||||||
class String
|
class String
|
||||||
def encode_to_default
|
def default_encoding!
|
||||||
|
if ascii_only?
|
||||||
force_encoding(Encoding.default_internal || Encoding::UTF_8)
|
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
|
||||||
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
|
||||||
|
|
|
@ -1,27 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# # -*- encoding : utf-8 -*-
|
||||||
module Gollum
|
module Gollum
|
||||||
class Wiki
|
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,
|
# 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
|
# the reverse diff will be taken from its parent (^SHA...SHA). If two SHAs
|
||||||
# are given, the reverse diff is taken from SHA1...SHA2.
|
# are given, the reverse diff is taken from SHA1...SHA2.
|
||||||
|
@ -91,12 +70,5 @@ module Gollum
|
||||||
revert_page_with_committer(nil, sha1, sha2, commit)
|
revert_page_with_committer(nil, sha1, sha2, commit)
|
||||||
end
|
end
|
||||||
alias_method_chain :revert_commit, :committer
|
alias_method_chain :revert_commit, :committer
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def force_grit_encoding(str)
|
|
||||||
str.dup.force_encoding(Encoding::ASCII_8BIT)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -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
|
|
|
@ -1,4 +0,0 @@
|
||||||
# -*- encoding : utf-8 -*-
|
|
||||||
Dir.glob(File.join('.', 'lib', 'gollum', '*.rb')) do |file|
|
|
||||||
require file
|
|
||||||
end
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,4 +0,0 @@
|
||||||
# -*- encoding : utf-8 -*-
|
|
||||||
require './lib/grit/repo.rb'
|
|
||||||
require './lib/grit/diff.rb'
|
|
||||||
require './lib/grit/blob.rb'
|
|
Loading…
Reference in New Issue