Disable bluepill. Update gems. Github project style URLs. Fix project load. Fix abilities. Fic urls generation. Fix some specs. Refs #263
This commit is contained in:
parent
5efabc9d4e
commit
701da7e1f9
18
Gemfile
18
Gemfile
|
@ -1,6 +1,6 @@
|
||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '3.2.2' #, :git => 'git://github.com/rails/rails.git'
|
gem 'rails', '3.2.3' #, :git => 'git://github.com/rails/rails.git'
|
||||||
|
|
||||||
gem 'pg', '~> 0.13.2'
|
gem 'pg', '~> 0.13.2'
|
||||||
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
|
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
|
||||||
|
@ -13,7 +13,7 @@ gem 'omniauth-openid', '~> 1.0.1'
|
||||||
gem 'cancan', '~> 1.6.7'
|
gem 'cancan', '~> 1.6.7'
|
||||||
|
|
||||||
gem 'ancestry', '~> 1.2.5'
|
gem 'ancestry', '~> 1.2.5'
|
||||||
gem 'paperclip', '~> 2.7.0'
|
gem 'paperclip', '~> 3.0.2'
|
||||||
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'
|
||||||
|
@ -35,30 +35,30 @@ gem 'rdiscount'
|
||||||
gem 'RedCloth'
|
gem 'RedCloth'
|
||||||
gem 'wikicloth'
|
gem 'wikicloth'
|
||||||
|
|
||||||
gem 'unicorn', '~> 4.2.1', :platforms => [:mri, :rbx]
|
gem 'unicorn', '~> 4.3.0', :platforms => [:mri, :rbx]
|
||||||
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
|
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
|
||||||
gem 'newrelic_rpm', '~> 3.3.2', :platforms => [:mri, :rbx]
|
gem 'newrelic_rpm', '~> 3.3.3', :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.7'
|
||||||
gem 'will_paginate', '~> 3.0.3'
|
gem 'will_paginate', '~> 3.0.3'
|
||||||
gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
|
gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
|
||||||
gem "haml-rails", '~> 0.3.4'
|
gem "haml-rails", '~> 0.3.4'
|
||||||
gem 'jquery-rails', '~> 2.0.1'
|
gem 'jquery-rails', '~> 2.0.2'
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
gem 'sass-rails', '~> 3.2.5'
|
gem 'sass-rails', '~> 3.2.5'
|
||||||
gem 'coffee-rails', '~> 3.2.2'
|
gem 'coffee-rails', '~> 3.2.2'
|
||||||
gem 'compass-rails', '~> 1.0.1'
|
gem 'compass-rails', '~> 1.0.1'
|
||||||
gem 'uglifier', '~> 1.2.4'
|
gem 'uglifier', '~> 1.2.4'
|
||||||
gem 'therubyracer', '~> 0.10.0', :platforms => [:mri, :rbx]
|
gem 'therubyracer', '~> 0.10.1', :platforms => [:mri, :rbx]
|
||||||
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
|
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
|
||||||
end
|
end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem "airbrake", '~> 3.0.9'
|
gem "airbrake", '~> 3.0.9'
|
||||||
gem 'bluepill', '~> 0.0.60', :require => false
|
gem 'bluepill', '~> 0.0.60', :require => false
|
||||||
gem 'daemons', '1.1.6' # for DJ
|
gem 'daemons', '1.1.6' # Try to upgrade 1.1.8 to avoid tons DJ bugs?
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
@ -74,7 +74,7 @@ end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'rspec-rails', '~> 2.9.0', :group => 'development'
|
gem 'rspec-rails', '~> 2.9.0', :group => 'development'
|
||||||
gem 'factory_girl_rails', '~> 3.0.0'
|
gem 'factory_girl_rails', '~> 3.1.0'
|
||||||
gem 'rr', '~> 1.0.4'
|
gem 'rr', '~> 1.0.4'
|
||||||
gem 'shoulda'
|
gem 'shoulda'
|
||||||
end
|
end
|
||||||
|
|
117
Gemfile.lock
117
Gemfile.lock
|
@ -26,31 +26,31 @@ GEM
|
||||||
specs:
|
specs:
|
||||||
RedCloth (4.2.9)
|
RedCloth (4.2.9)
|
||||||
RedCloth (4.2.9-java)
|
RedCloth (4.2.9-java)
|
||||||
actionmailer (3.2.2)
|
actionmailer (3.2.3)
|
||||||
actionpack (= 3.2.2)
|
actionpack (= 3.2.3)
|
||||||
mail (~> 2.4.0)
|
mail (~> 2.4.4)
|
||||||
actionpack (3.2.2)
|
actionpack (3.2.3)
|
||||||
activemodel (= 3.2.2)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.1)
|
journey (~> 1.0.1)
|
||||||
rack (~> 1.4.0)
|
rack (~> 1.4.0)
|
||||||
rack-cache (~> 1.1)
|
rack-cache (~> 1.2)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.1.2)
|
sprockets (~> 2.1.2)
|
||||||
activemodel (3.2.2)
|
activemodel (3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.2)
|
activerecord (3.2.3)
|
||||||
activemodel (= 3.2.2)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
arel (~> 3.0.2)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.2)
|
activeresource (3.2.3)
|
||||||
activemodel (= 3.2.2)
|
activemodel (= 3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
activesupport (3.2.2)
|
activesupport (3.2.3)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
airbrake (3.0.9)
|
airbrake (3.0.9)
|
||||||
|
@ -72,7 +72,7 @@ GEM
|
||||||
builder (3.0.0)
|
builder (3.0.0)
|
||||||
cancan (1.6.7)
|
cancan (1.6.7)
|
||||||
cape (1.4.0)
|
cape (1.4.0)
|
||||||
capistrano (2.11.2)
|
capistrano (2.12.0)
|
||||||
highline
|
highline
|
||||||
net-scp (>= 1.0.0)
|
net-scp (>= 1.0.0)
|
||||||
net-sftp (>= 2.0.0)
|
net-sftp (>= 2.0.0)
|
||||||
|
@ -89,7 +89,7 @@ GEM
|
||||||
coffee-script (2.2.0)
|
coffee-script (2.2.0)
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.2.0)
|
coffee-script-source (1.3.1)
|
||||||
compass (0.12.1)
|
compass (0.12.1)
|
||||||
chunky_png (~> 1.2)
|
chunky_png (~> 1.2)
|
||||||
fssm (>= 0.2.7)
|
fssm (>= 0.2.7)
|
||||||
|
@ -98,7 +98,7 @@ GEM
|
||||||
compass (~> 0.12.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.2)
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
delayed_job_active_record (0.3.2)
|
delayed_job_active_record (0.3.2)
|
||||||
activerecord (> 2.1.0)
|
activerecord (> 2.1.0)
|
||||||
|
@ -116,13 +116,13 @@ GEM
|
||||||
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 (3.0.0)
|
factory_girl (3.1.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
factory_girl_rails (3.0.0)
|
factory_girl_rails (3.1.0)
|
||||||
factory_girl (~> 3.0.0)
|
factory_girl (~> 3.1.0)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
fssm (0.2.8.1)
|
fssm (0.2.9)
|
||||||
github-markup (0.7.1)
|
github-markup (0.7.2)
|
||||||
gollum (1.3.1)
|
gollum (1.3.1)
|
||||||
albino (~> 1.3.2)
|
albino (~> 1.3.2)
|
||||||
github-markup (>= 0.4.0, < 1.0.0)
|
github-markup (>= 0.4.0, < 1.0.0)
|
||||||
|
@ -147,10 +147,10 @@ GEM
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
blankslate (>= 2.1.2.4)
|
blankslate (>= 2.1.2.4)
|
||||||
journey (1.0.3)
|
journey (1.0.3)
|
||||||
jquery-rails (2.0.1)
|
jquery-rails (2.0.2)
|
||||||
railties (>= 3.2.0, < 5.0)
|
railties (>= 3.2.0, < 5.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
jruby-rack (1.1.4)
|
jruby-rack (1.1.5)
|
||||||
json (1.6.6)
|
json (1.6.6)
|
||||||
json (1.6.6-java)
|
json (1.6.6-java)
|
||||||
kgio (2.7.4)
|
kgio (2.7.4)
|
||||||
|
@ -171,7 +171,7 @@ GEM
|
||||||
meta-tags (1.2.6)
|
meta-tags (1.2.6)
|
||||||
actionpack
|
actionpack
|
||||||
mime-types (1.18)
|
mime-types (1.18)
|
||||||
multi_json (1.2.0)
|
multi_json (1.3.2)
|
||||||
mustache (0.99.4)
|
mustache (0.99.4)
|
||||||
net-scp (1.0.4)
|
net-scp (1.0.4)
|
||||||
net-ssh (>= 1.99.1)
|
net-ssh (>= 1.99.1)
|
||||||
|
@ -180,7 +180,7 @@ 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.1)
|
newrelic_rpm (3.3.3)
|
||||||
nokogiri (1.5.2)
|
nokogiri (1.5.2)
|
||||||
nokogiri (1.5.2-java)
|
nokogiri (1.5.2-java)
|
||||||
omniauth (1.0.3)
|
omniauth (1.0.3)
|
||||||
|
@ -190,9 +190,10 @@ GEM
|
||||||
omniauth (~> 1.0)
|
omniauth (~> 1.0)
|
||||||
rack-openid (~> 1.3.1)
|
rack-openid (~> 1.3.1)
|
||||||
orm_adapter (0.0.7)
|
orm_adapter (0.0.7)
|
||||||
paperclip (2.7.0)
|
paperclip (3.0.2)
|
||||||
activerecord (>= 2.3.0)
|
activemodel (>= 3.0.0)
|
||||||
activesupport (>= 2.3.2)
|
activerecord (>= 3.0.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
cocaine (>= 0.0.2)
|
cocaine (>= 0.0.2)
|
||||||
mime-types
|
mime-types
|
||||||
pg (0.13.2)
|
pg (0.13.2)
|
||||||
|
@ -210,21 +211,21 @@ GEM
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.1)
|
rack-test (0.6.1)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.2)
|
rails (3.2.3)
|
||||||
actionmailer (= 3.2.2)
|
actionmailer (= 3.2.3)
|
||||||
actionpack (= 3.2.2)
|
actionpack (= 3.2.3)
|
||||||
activerecord (= 3.2.2)
|
activerecord (= 3.2.3)
|
||||||
activeresource (= 3.2.2)
|
activeresource (= 3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.2)
|
railties (= 3.2.3)
|
||||||
rails3-generators (0.17.4)
|
rails3-generators (0.17.4)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
rails3-jquery-autocomplete (1.0.6)
|
rails3-jquery-autocomplete (1.0.7)
|
||||||
rails (~> 3.0)
|
rails (~> 3.0)
|
||||||
railties (3.2.2)
|
railties (3.2.3)
|
||||||
actionpack (= 3.2.2)
|
actionpack (= 3.2.3)
|
||||||
activesupport (= 3.2.2)
|
activesupport (= 3.2.3)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
|
@ -241,7 +242,7 @@ GEM
|
||||||
rspec-expectations (~> 2.9.0)
|
rspec-expectations (~> 2.9.0)
|
||||||
rspec-mocks (~> 2.9.0)
|
rspec-mocks (~> 2.9.0)
|
||||||
rspec-core (2.9.0)
|
rspec-core (2.9.0)
|
||||||
rspec-expectations (2.9.0)
|
rspec-expectations (2.9.1)
|
||||||
diff-lcs (~> 1.1.3)
|
diff-lcs (~> 1.1.3)
|
||||||
rspec-mocks (2.9.0)
|
rspec-mocks (2.9.0)
|
||||||
rspec-rails (2.9.0)
|
rspec-rails (2.9.0)
|
||||||
|
@ -277,11 +278,11 @@ GEM
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
sqlite3 (1.3.5)
|
sqlite3 (1.3.6)
|
||||||
state_machine (1.1.2)
|
state_machine (1.1.2)
|
||||||
therubyracer (0.10.0)
|
therubyracer (0.10.1)
|
||||||
libv8 (~> 3.3.10)
|
libv8 (~> 3.3.10)
|
||||||
therubyrhino (1.73.1)
|
therubyrhino (1.73.2)
|
||||||
thin (1.3.1)
|
thin (1.3.1)
|
||||||
daemons (>= 1.0.9)
|
daemons (>= 1.0.9)
|
||||||
eventmachine (>= 0.12.6)
|
eventmachine (>= 0.12.6)
|
||||||
|
@ -294,12 +295,12 @@ GEM
|
||||||
trinidad (1.0.5)
|
trinidad (1.0.5)
|
||||||
jruby-rack (>= 1.0.2)
|
jruby-rack (>= 1.0.2)
|
||||||
trinidad_jars (>= 0.3.0)
|
trinidad_jars (>= 0.3.0)
|
||||||
trinidad_jars (1.0.2)
|
trinidad_jars (1.0.3)
|
||||||
tzinfo (0.3.32)
|
tzinfo (0.3.33)
|
||||||
uglifier (1.2.4)
|
uglifier (1.2.4)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (>= 1.0.2)
|
multi_json (>= 1.0.2)
|
||||||
unicorn (4.2.1)
|
unicorn (4.3.0)
|
||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
rack
|
rack
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
|
@ -308,7 +309,7 @@ GEM
|
||||||
whenever (0.7.3)
|
whenever (0.7.3)
|
||||||
activesupport (>= 2.3.4)
|
activesupport (>= 2.3.4)
|
||||||
chronic (~> 0.6.3)
|
chronic (~> 0.6.3)
|
||||||
wikicloth (0.7.1)
|
wikicloth (0.8.0)
|
||||||
builder
|
builder
|
||||||
expression_parser
|
expression_parser
|
||||||
will_paginate (3.0.3)
|
will_paginate (3.0.3)
|
||||||
|
@ -334,7 +335,7 @@ DEPENDENCIES
|
||||||
delayed_job_active_record (~> 0.3.2)
|
delayed_job_active_record (~> 0.3.2)
|
||||||
devise (~> 2.0.4)
|
devise (~> 2.0.4)
|
||||||
diff-display (~> 0.0.1)
|
diff-display (~> 0.0.1)
|
||||||
factory_girl_rails (~> 3.0.0)
|
factory_girl_rails (~> 3.1.0)
|
||||||
gollum (= 1.3.1)
|
gollum (= 1.3.1)
|
||||||
grack!
|
grack!
|
||||||
grit!
|
grit!
|
||||||
|
@ -342,17 +343,17 @@ DEPENDENCIES
|
||||||
highline (~> 1.6.11)
|
highline (~> 1.6.11)
|
||||||
hirb
|
hirb
|
||||||
jbuilder
|
jbuilder
|
||||||
jquery-rails (~> 2.0.1)
|
jquery-rails (~> 2.0.2)
|
||||||
mailcatcher
|
mailcatcher
|
||||||
meta-tags (~> 1.2.5)
|
meta-tags (~> 1.2.5)
|
||||||
newrelic_rpm (~> 3.3.2)
|
newrelic_rpm (~> 3.3.3)
|
||||||
omniauth (~> 1.0.3)
|
omniauth (~> 1.0.3)
|
||||||
omniauth-openid (~> 1.0.1)
|
omniauth-openid (~> 1.0.1)
|
||||||
paperclip (~> 2.7.0)
|
paperclip (~> 3.0.2)
|
||||||
pg (~> 0.13.2)
|
pg (~> 0.13.2)
|
||||||
rails (= 3.2.2)
|
rails (= 3.2.3)
|
||||||
rails3-generators
|
rails3-generators
|
||||||
rails3-jquery-autocomplete (~> 1.0.6)
|
rails3-jquery-autocomplete (~> 1.0.7)
|
||||||
rdiscount
|
rdiscount
|
||||||
redcarpet (= 1.17.2)
|
redcarpet (= 1.17.2)
|
||||||
redhillonrails_core!
|
redhillonrails_core!
|
||||||
|
@ -362,11 +363,11 @@ DEPENDENCIES
|
||||||
sass-rails (~> 3.2.5)
|
sass-rails (~> 3.2.5)
|
||||||
shotgun
|
shotgun
|
||||||
shoulda
|
shoulda
|
||||||
therubyracer (~> 0.10.0)
|
therubyracer (~> 0.10.1)
|
||||||
therubyrhino (~> 1.73.1)
|
therubyrhino (~> 1.73.1)
|
||||||
trinidad (~> 1.0.2)
|
trinidad (~> 1.0.2)
|
||||||
uglifier (~> 1.2.4)
|
uglifier (~> 1.2.4)
|
||||||
unicorn (~> 4.2.1)
|
unicorn (~> 4.3.0)
|
||||||
whenever (~> 0.7.3)
|
whenever (~> 0.7.3)
|
||||||
wikicloth
|
wikicloth
|
||||||
will_paginate (~> 3.0.3)
|
will_paginate (~> 3.0.3)
|
||||||
|
|
|
@ -6,15 +6,16 @@ class BuildListsController < ApplicationController
|
||||||
before_filter :authenticate_user!, :except => CALLBACK_ACTIONS
|
before_filter :authenticate_user!, :except => CALLBACK_ACTIONS
|
||||||
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
|
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
|
||||||
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
|
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
|
||||||
before_filter :find_project, :only => NESTED_ACTIONS
|
|
||||||
before_filter :find_build_list, :only => [:show, :publish, :cancel, :reject_publish]
|
before_filter :find_build_list, :only => [:show, :publish, :cancel]
|
||||||
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
|
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
|
||||||
before_filter :find_platform, :only => [:create]
|
|
||||||
|
|
||||||
load_and_authorize_resource :project, :only => NESTED_ACTIONS
|
load_and_authorize_resource :project, :only => NESTED_ACTIONS
|
||||||
load_and_authorize_resource :build_list, :through => :project, :only => NESTED_ACTIONS, :shallow => true
|
load_and_authorize_resource :build_list, :through => :project, :only => NESTED_ACTIONS, :shallow => true
|
||||||
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
|
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def search
|
def search
|
||||||
new_params = {:filter => {}}
|
new_params = {:filter => {}}
|
||||||
params[:filter].each do |k,v|
|
params[:filter].each do |k,v|
|
||||||
|
@ -41,6 +42,7 @@ class BuildListsController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
notices, errors = [], []
|
notices, errors = [], []
|
||||||
|
@platform = Platform.find params[:build_list][:pl_id]
|
||||||
params[:build_list].delete(:auto_publish) if @platform.released
|
params[:build_list].delete(:auto_publish) if @platform.released
|
||||||
Arch.where(:id => params[:arches]).each do |arch|
|
Arch.where(:id => params[:arches]).each do |arch|
|
||||||
Platform.main.where(:id => params[:bpls]).each do |bpl|
|
Platform.main.where(:id => params[:bpls]).each do |bpl|
|
||||||
|
@ -159,14 +161,6 @@ class BuildListsController < ApplicationController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def find_project
|
|
||||||
@project = Project.find_by_id params[:project_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_platform
|
|
||||||
@platform = Platform.find params[:build_list][:pl_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_build_list
|
def find_build_list
|
||||||
@build_list = BuildList.find(params[:id])
|
@build_list = BuildList.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class CollaboratorsController < ApplicationController
|
class CollaboratorsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
load_resource :project
|
||||||
|
before_filter :authorize_collaborators
|
||||||
|
|
||||||
before_filter :find_project
|
|
||||||
before_filter :find_users
|
before_filter :find_users
|
||||||
before_filter :find_groups
|
before_filter :find_groups
|
||||||
|
|
||||||
load_resource :project
|
include Modules::Controllers::FindProject
|
||||||
before_filter :authorize_collaborators
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
redirect_to edit_project_collaborators_path(@project)
|
redirect_to edit_project_collaborators_path(@project)
|
||||||
|
@ -125,10 +125,6 @@ class CollaboratorsController < ApplicationController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def find_project
|
|
||||||
@project = Project.find params[:project_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_users
|
def find_users
|
||||||
@users = @project.collaborators.order('uname')#User.all
|
@users = @project.collaborators.order('uname')#User.all
|
||||||
@users = @users.without(@project.owner_id) if @project.owner_type == 'User'
|
@users = @users.without(@project.owner_id) if @project.owner_type == 'User'
|
||||||
|
|
|
@ -7,6 +7,7 @@ class CommentsController < ApplicationController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
include CommentsHelper
|
include CommentsHelper
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if @comment.save
|
if @comment.save
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class CommitSubscribesController < ApplicationController
|
class CommitSubscribesController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
load_and_authorize_resource :project
|
load_and_authorize_resource :project
|
||||||
|
|
||||||
before_filter :find_commit
|
before_filter :find_commit
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if Subscribe.subscribe_to_commit(@options)
|
if Subscribe.subscribe_to_commit(@options)
|
||||||
flash[:notice] = I18n.t("flash.subscribe.commit.saved")
|
flash[:notice] = I18n.t("flash.subscribe.commit.saved")
|
||||||
|
|
|
@ -11,7 +11,10 @@ class Git::BaseController < ApplicationController
|
||||||
before_filter :set_current_tag
|
before_filter :set_current_tag
|
||||||
before_filter :set_current_branch
|
before_filter :set_current_branch
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def find_git_repository
|
def find_git_repository
|
||||||
@git_repository = @project.git_repository
|
@git_repository = @project.git_repository
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,8 @@ class IssuesController < ApplicationController
|
||||||
|
|
||||||
layout 'application'
|
layout 'application'
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def index(status = 200)
|
def index(status = 200)
|
||||||
@is_assigned_to_me = params[:filter] == 'to_me'
|
@is_assigned_to_me = params[:filter] == 'to_me'
|
||||||
@status = params[:status] == 'closed' ? 'closed' : 'open'
|
@status = params[:status] == 'closed' ? 'closed' : 'open'
|
||||||
|
@ -77,12 +79,12 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_label
|
def create_label
|
||||||
status = @project.labels.create(:name => params[:name], :color => params[:color]) ? 200 : 500
|
status = @project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500
|
||||||
index(status)
|
index(status)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_label
|
def update_label
|
||||||
status = @label.update_attributes( :name => params[:name], :color => params[:color]) ? 200 : 500
|
status = @label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500
|
||||||
index(status)
|
index(status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ class ProjectsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@projects = Project.accessible_by(current_ability, :membered)
|
@projects = Project.accessible_by(current_ability, :membered)
|
||||||
# @projects = @projects.search(params[:query]).search_order if params[:query].present?
|
# @projects = @projects.search(params[:query]).search_order if params[:query].present?
|
||||||
|
@ -72,11 +74,11 @@ class ProjectsController < ApplicationController
|
||||||
if request.post?
|
if request.post?
|
||||||
if @project.update_attributes(params[:project])
|
if @project.update_attributes(params[:project])
|
||||||
flash[:notice] = t('flash.project.saved')
|
flash[:notice] = t('flash.project.saved')
|
||||||
|
redirect_to sections_project_path(@project)
|
||||||
else
|
else
|
||||||
@project.save
|
@project.save
|
||||||
flash[:error] = t('flash.project.save_error')
|
flash[:error] = t('flash.project.save_error')
|
||||||
end
|
end
|
||||||
render :action => :sections
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ class SubscribesController < ApplicationController
|
||||||
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id
|
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id
|
||||||
load_and_authorize_resource :subscribe, :through => :issue, :find_by => :user_id
|
load_and_authorize_resource :subscribe, :through => :issue, :find_by => :user_id
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@subscribe = @issue.subscribes.build(:user_id => current_user.id)
|
@subscribe = @issue.subscribes.build(:user_id => current_user.id)
|
||||||
if @subscribe.save
|
if @subscribe.save
|
||||||
|
|
|
@ -13,6 +13,8 @@ class WikiController < ApplicationController
|
||||||
before_filter :authorize_write_actions, :only => [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview]
|
before_filter :authorize_write_actions, :only => [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview]
|
||||||
before_filter :get_wiki
|
before_filter :get_wiki
|
||||||
|
|
||||||
|
include Modules::Controllers::FindProject
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@name = 'Home'
|
@name = 'Home'
|
||||||
@page = @wiki.page(@name)
|
@page = @wiki.page(@name)
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Ability
|
||||||
can(:write, Project) {|project| local_writer? project} # for grack
|
can(:write, Project) {|project| local_writer? project} # for grack
|
||||||
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
|
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
|
||||||
can(:fork, Project) {|project| can? :read, project}
|
can(:fork, Project) {|project| can? :read, project}
|
||||||
can(:fork_to_group, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
|
can(:fork, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
|
||||||
can(:destroy, Project) {|project| owner? project}
|
can(:destroy, Project) {|project| owner? project}
|
||||||
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.objects.exists?(:object_type => 'User', :object_id => user.id, :role => 'admin')}
|
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.objects.exists?(:object_type => 'User', :object_id => user.id, :role => 'admin')}
|
||||||
can :remove_user, Project
|
can :remove_user, Project
|
||||||
|
@ -118,13 +118,10 @@ class Ability
|
||||||
# Shared cannot rights for all users (registered, admin)
|
# Shared cannot rights for all users (registered, admin)
|
||||||
cannot :destroy, Platform, :platform_type => 'personal'
|
cannot :destroy, Platform, :platform_type => 'personal'
|
||||||
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
|
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
|
||||||
cannot :fork, Project, :owner_id => user.id, :owner_type => user.class.to_s
|
|
||||||
cannot :destroy, Issue
|
cannot :destroy, Issue
|
||||||
|
|
||||||
cannot [:members, :add_member, :remove_member, :remove_members], Platform, :platform_type => 'personal'
|
cannot [:members, :add_member, :remove_member, :remove_members], Platform, :platform_type => 'personal'
|
||||||
|
|
||||||
# cannot :read, Product, :platform => {:platform_type => 'personal'}
|
|
||||||
# cannot(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.platform_type == 'personal'}
|
|
||||||
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
|
cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'}
|
||||||
cannot [:clone, :build_all], Platform, :platform_type => 'personal'
|
cannot [:clone, :build_all], Platform, :platform_type => 'personal'
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Group < ActiveRecord::Base
|
||||||
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
|
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
|
||||||
|
|
||||||
validates :owner, :presence => true
|
validates :owner, :presence => true
|
||||||
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ }
|
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
|
||||||
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
|
validate { errors.add(:uname, :taken) if User.where('uname LIKE ?', uname).present? }
|
||||||
|
|
||||||
scope :search_order, order("CHAR_LENGTH(uname) ASC")
|
scope :search_order, order("CHAR_LENGTH(uname) ASC")
|
||||||
|
@ -37,6 +37,8 @@ class Group < ActiveRecord::Base
|
||||||
(by_owner(user) | by_admin(user))
|
(by_owner(user) | by_admin(user))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_param; uname; end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
uname
|
uname
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Issue < ActiveRecord::Base
|
||||||
|
|
||||||
has_many :comments, :as => :commentable, :dependent => :destroy
|
has_many :comments, :as => :commentable, :dependent => :destroy
|
||||||
has_many :subscribes, :as => :subscribeable, :dependent => :destroy
|
has_many :subscribes, :as => :subscribeable, :dependent => :destroy
|
||||||
|
has_many :labelings, :dependent => :destroy
|
||||||
has_many :labels, :through => :labelings, :uniq => true
|
has_many :labels, :through => :labelings, :uniq => true
|
||||||
has_many :labelings
|
|
||||||
|
|
||||||
validates :title, :body, :project_id, :presence => true
|
validates :title, :body, :project_id, :presence => true
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Label < ActiveRecord::Base
|
||||||
has_many :issues, :through => :labelings
|
has_many :issues, :through => :labelings
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
validates :name, :uniqueness => { :scope => :project_id}
|
validates :name, :uniqueness => {:scope => :project_id}
|
||||||
validates :name, :color, :presence => true
|
validates :name, :color, :presence => true
|
||||||
validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')}
|
validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,18 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
include Modules::Models::Owner
|
include Modules::Models::Owner
|
||||||
|
|
||||||
|
def to_param; name; end
|
||||||
|
|
||||||
|
def self.find_by_owner_and_name(owner_name, project_name)
|
||||||
|
owner = User.find_by_uname(owner_name) || Group.find_by_uname(owner_name) and
|
||||||
|
scoped = where(:owner_id => owner.id, :owner_type => owner.class) and
|
||||||
|
scoped.find_by_name(project_name) || scoped.by_name(project_name).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.find_by_owner_and_name!(owner_name, project_name)
|
||||||
|
find_by_owner_and_name(owner_name, project_name) or raise ActiveRecord::RecordNotFound
|
||||||
|
end
|
||||||
|
|
||||||
def build_for(platform, user, arch = 'i586')
|
def build_for(platform, user, arch = 'i586')
|
||||||
# Select main and project platform repository(contrib, non-free and etc)
|
# Select main and project platform repository(contrib, non-free and etc)
|
||||||
# If main does not exist, will connect only project platform repository
|
# If main does not exist, will connect only project platform repository
|
||||||
|
@ -58,7 +70,6 @@ class Project < ActiveRecord::Base
|
||||||
build_reps = [platform.repositories.find_by_name('main')]
|
build_reps = [platform.repositories.find_by_name('main')]
|
||||||
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
|
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
|
||||||
build_ids = build_reps.compact.map(&:id).uniq
|
build_ids = build_reps.compact.map(&:id).uniq
|
||||||
|
|
||||||
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
||||||
build_lists.create do |bl|
|
build_lists.create do |bl|
|
||||||
bl.pl = platform
|
bl.pl = platform
|
||||||
|
|
|
@ -37,7 +37,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
include Modules::Models::PersonalRepository
|
include Modules::Models::PersonalRepository
|
||||||
|
|
||||||
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /^[a-z0-9_]+$/ }
|
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
|
||||||
validate { errors.add(:uname, :taken) if Group.where('uname LIKE ?', uname).present? }
|
validate { errors.add(:uname, :taken) if Group.where('uname LIKE ?', uname).present? }
|
||||||
validates :role, :inclusion => {:in => ROLES}, :allow_blank => true
|
validates :role, :inclusion => {:in => ROLES}, :allow_blank => true
|
||||||
validates :language, :inclusion => {:in => LANGUAGES}, :allow_blank => true
|
validates :language, :inclusion => {:in => LANGUAGES}, :allow_blank => true
|
||||||
|
@ -58,6 +58,8 @@ class User < ActiveRecord::Base
|
||||||
after_create lambda { self.create_notifier }
|
after_create lambda { self.create_notifier }
|
||||||
before_create :ensure_authentication_token
|
before_create :ensure_authentication_token
|
||||||
|
|
||||||
|
def to_param; uname; end
|
||||||
|
|
||||||
def admin?
|
def admin?
|
||||||
role == 'admin'
|
role == 'admin'
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t('notifications.bodies.build_task', :task_num => task_num, :task_link => build_list_path(build_list_id))
|
= raw t('notifications.bodies.build_task', :task_num => task_num, :task_link => build_list_path(build_list_id))
|
||||||
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
- message, error = case status
|
- message, error = case status
|
||||||
- when BuildList::BUILD_PENDING
|
- when BuildList::BUILD_PENDING
|
||||||
- ['pending', nil]
|
- ['pending', nil]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= t('notifications.bodies.delete_branch', :branch_name => branch_name)
|
= t('notifications.bodies.delete_branch', :branch_name => branch_name)
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => defined?(user_name) ? link_to(user_name, user_path(user_id)) : user_email})
|
= raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => defined?(user_name) ? link_to(user_name, user_path(user_id)) : user_email})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
%span.subject
|
%span.subject
|
||||||
- last_commits.each do |commit|
|
- last_commits.each do |commit|
|
||||||
= link_to shortest_hash_id(commit[0]), commit_path(project_id, commit[0])
|
= link_to shortest_hash_id(commit[0]), commit_path(project_owner, project_name, commit[0])
|
||||||
= commit[1]
|
= commit[1]
|
||||||
%br
|
%br
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
.top
|
.top
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id))})
|
= raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id))})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) )
|
= raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) )
|
||||||
= raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id) + "#comment##{comment_id}")})
|
= raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment##{comment_id}")})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))})
|
= raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))})
|
||||||
= raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id) + "#comment##{comment_id}")})
|
= raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment##{comment_id}")})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
|
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_id, issue_serial_id)})
|
= raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
|
= image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar')
|
||||||
.text
|
.text
|
||||||
%span
|
%span
|
||||||
= raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_id))})
|
= raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))})
|
||||||
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) )
|
= raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||||
.both
|
.both
|
||||||
%span.date= activity_feed.created_at
|
%span.date= activity_feed.created_at
|
||||||
.both
|
.both
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : ''
|
- is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : ''
|
||||||
%p.center
|
%p.center
|
||||||
=t 'layout.projects.already_exists'
|
=t 'layout.projects.already_exists'
|
||||||
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner.projects.by_name(@project.name).first.id)
|
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner.projects.by_name(@project.name).first)
|
||||||
- else
|
- else
|
||||||
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
|
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
|
||||||
= hidden_field_tag :group, owner.id if owner.class == Group
|
= hidden_field_tag :group, owner.id if owner.class == Group
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
%span{:style => "display: none;"}=issue.serial_id
|
%span{:style => "display: none;"}=issue.serial_id
|
||||||
%td.td1=issue.serial_id
|
%td.td1=issue.serial_id
|
||||||
%td
|
%td
|
||||||
%a{:href => project_issue_path(@project.id, issue.serial_id)}
|
%a{:href => project_issue_path(@project, issue)}
|
||||||
%div.issue_title=issue.title
|
%div.issue_title=issue.title
|
||||||
.smalltext
|
.smalltext
|
||||||
=issue.created_at.to_s(:long)
|
=issue.created_at.to_s(:long)
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
=image_tag 'zip.png', :alt => 'ZIP'
|
=image_tag 'zip.png', :alt => 'ZIP'
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li=link_to "tar.gz", archive_path(project.id, 'tar', @treeish)
|
%li=link_to "tar.gz", archive_path(project, 'tar', @treeish)
|
||||||
%li=link_to "zip", archive_path(project.id, 'zip', @treeish)
|
%li=link_to "zip", archive_path(project, 'zip', @treeish)
|
||||||
|
|
||||||
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
|
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
|
||||||
.git_help ?
|
.git_help ?
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for f in `ls /srv`
|
# for f in `ls /srv`
|
||||||
do
|
# do
|
||||||
su -l rosa -c "cd /srv/$f/current && APP_NAME=$f bundle exec bluepill --no-privileged load /srv/$f/current/config/production.pill"
|
# su -l rosa -c "cd /srv/$f/current && APP_NAME=$f bundle exec bluepill --no-privileged load /srv/$f/current/config/production.pill"
|
||||||
done
|
# done
|
||||||
|
|
||||||
/srv/rosa_build/current/bin/mount_downloads.sh
|
/srv/rosa_build/current/bin/mount_downloads.sh
|
||||||
|
|
114
config/routes.rb
114
config/routes.rb
|
@ -75,7 +75,39 @@ Rosa::Application.routes.draw do
|
||||||
end
|
end
|
||||||
match '/private/:platform_name/*file_path' => 'privates#show'
|
match '/private/:platform_name/*file_path' => 'privates#show'
|
||||||
|
|
||||||
resources :projects, :except => [:show] do
|
# Core callbacks
|
||||||
|
match 'build_lists/publish_build', :to => "build_lists#publish_build"
|
||||||
|
match 'build_lists/status_build', :to => "build_lists#status_build"
|
||||||
|
match 'build_lists/post_build', :to => "build_lists#post_build"
|
||||||
|
match 'build_lists/pre_build', :to => "build_lists#pre_build"
|
||||||
|
match 'build_lists/circle_build', :to => "build_lists#circle_build"
|
||||||
|
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
|
||||||
|
match 'product_status', :to => 'product_build_lists#status_build'
|
||||||
|
|
||||||
|
resources :build_lists, :only => [:index, :show] do
|
||||||
|
member do
|
||||||
|
put :cancel
|
||||||
|
put :publish
|
||||||
|
put :reject_publish
|
||||||
|
end
|
||||||
|
collection { post :search }
|
||||||
|
end
|
||||||
|
resources :product_build_lists, :only => [:index]
|
||||||
|
|
||||||
|
resources :search, :only => [:index]
|
||||||
|
|
||||||
|
resources :event_logs, :only => :index
|
||||||
|
|
||||||
|
get '/forbidden' => 'pages#forbidden', :as => 'forbidden'
|
||||||
|
get '/terms-of-service' => 'pages#tos', :as => 'tos'
|
||||||
|
|
||||||
|
get '/activity_feeds.:format' => 'activity_feeds#index', :as => 'atom_activity_feeds', :format => /atom/
|
||||||
|
|
||||||
|
resources :projects, :only => [:index, :new, :create]
|
||||||
|
scope ':owner_name' do # Owner
|
||||||
|
# TODO User routes here
|
||||||
|
|
||||||
|
scope ':project_name', :as => 'project' do
|
||||||
resources :wiki do
|
resources :wiki do
|
||||||
collection do
|
collection do
|
||||||
match '_history' => 'wiki#wiki_history', :as => :history, :via => :get
|
match '_history' => 'wiki#wiki_history', :as => :history, :via => :get
|
||||||
|
@ -107,8 +139,8 @@ Rosa::Application.routes.draw do
|
||||||
get :search_collaborators
|
get :search_collaborators
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
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
|
||||||
resources :build_lists, :only => [:index, :new, :create] do
|
resources :build_lists, :only => [:index, :new, :create] do
|
||||||
collection { post :search }
|
collection { post :search }
|
||||||
end
|
end
|
||||||
|
@ -123,66 +155,44 @@ Rosa::Application.routes.draw do
|
||||||
post :update
|
post :update
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
member do
|
|
||||||
post :fork
|
|
||||||
get :sections
|
|
||||||
post :sections
|
|
||||||
delete :remove_user
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
scope ':project_name' do
|
||||||
|
# Resource
|
||||||
|
get '/edit' => 'projects#edit', :as => :edit_project
|
||||||
|
put '/' => 'projects#update'
|
||||||
|
delete '/' => 'projects#destroy'
|
||||||
|
# Member
|
||||||
|
post '/fork' => 'projects#fork', :as => :fork_project
|
||||||
|
get '/sections' => 'projects#sections', :as => :sections_project
|
||||||
|
post '/sections' => 'projects#sections'
|
||||||
|
delete '/remove_user' => 'projects#remove_user', :as => :remove_user_project
|
||||||
# Tree
|
# Tree
|
||||||
get '/projects/:project_id' => "git/trees#show", :as => :project
|
get '/' => "git/trees#show", :as => :project
|
||||||
get '/projects/:project_id/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree
|
get '/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree
|
||||||
# Commits
|
# Commits
|
||||||
get '/projects/:project_id/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false
|
get '/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false
|
||||||
get '/projects/:project_id/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
get '/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
||||||
# Commit comments
|
# Commit comments
|
||||||
post '/projects/:project_id/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
|
post '/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
|
||||||
get '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
|
get '/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
|
||||||
put '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
put '/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
||||||
delete '/projects/:project_id/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
||||||
# Commit subscribes
|
# Commit subscribes
|
||||||
post '/projects/:project_id/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
post '/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
||||||
delete '/projects/:project_id/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
||||||
# Editing files
|
# Editing files
|
||||||
get '/projects/:project_id/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
|
get '/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
|
||||||
put '/projects/:project_id/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
|
put '/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
|
||||||
# Blobs
|
# Blobs
|
||||||
get '/projects/:project_id/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :format => false
|
get '/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :format => false
|
||||||
# Blame
|
# Blame
|
||||||
get '/projects/:project_id/blame/:treeish/*path' => "git/blobs#blame", :defaults => {:treeish => :master}, :as => :blame, :format => false
|
get '/blame/:treeish/*path' => "git/blobs#blame", :defaults => {:treeish => :master}, :as => :blame, :format => false
|
||||||
# Raw
|
# Raw
|
||||||
get '/projects/:project_id/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
|
get '/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
|
||||||
|
# Archive
|
||||||
get '/projects/:project_id/archive/:format/tree/:treeish' => "git/trees#archive", :defaults => {:treeish => :master}, :as => :archive, :format => /zip|tar/
|
get '/archive/:format/tree/:treeish' => "git/trees#archive", :defaults => {:treeish => :master}, :as => :archive, :format => /zip|tar/
|
||||||
|
|
||||||
# Core callbacks
|
|
||||||
match 'build_lists/publish_build', :to => "build_lists#publish_build"
|
|
||||||
match 'build_lists/status_build', :to => "build_lists#status_build"
|
|
||||||
match 'build_lists/post_build', :to => "build_lists#post_build"
|
|
||||||
match 'build_lists/pre_build', :to => "build_lists#pre_build"
|
|
||||||
match 'build_lists/circle_build', :to => "build_lists#circle_build"
|
|
||||||
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
|
|
||||||
match 'product_status', :to => 'product_build_lists#status_build'
|
|
||||||
|
|
||||||
resources :build_lists, :only => [:index, :show] do
|
|
||||||
member do
|
|
||||||
put :cancel
|
|
||||||
put :publish
|
|
||||||
put :reject_publish
|
|
||||||
end
|
end
|
||||||
collection { post :search }
|
|
||||||
end
|
end
|
||||||
resources :product_build_lists, :only => [:index]
|
|
||||||
|
|
||||||
resources :search, :only => [:index]
|
|
||||||
|
|
||||||
resources :event_logs, :only => :index
|
|
||||||
|
|
||||||
get '/forbidden' => 'pages#forbidden', :as => 'forbidden'
|
|
||||||
get '/terms-of-service' => 'pages#tos', :as => 'tos'
|
|
||||||
|
|
||||||
get '/activity_feeds.:format' => 'activity_feeds#index', :as => 'atom_activity_feeds', :format => /atom/
|
|
||||||
|
|
||||||
if APP_CONFIG['anonymous_access']
|
if APP_CONFIG['anonymous_access']
|
||||||
authenticated do
|
authenticated do
|
||||||
|
|
23
db/schema.rb
23
db/schema.rb
|
@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
||||||
t.integer "user_id", :null => false
|
t.integer "user_id", :null => false
|
||||||
t.string "kind"
|
t.string "kind"
|
||||||
t.text "data"
|
t.text "data"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
|
@ -180,7 +180,7 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
||||||
t.string "owner_type"
|
t.string "owner_type"
|
||||||
t.string "visibility", :default => "open", :null => false
|
t.string "visibility", :default => "open", :null => false
|
||||||
t.string "platform_type", :default => "main", :null => false
|
t.string "platform_type", :default => "main", :null => false
|
||||||
t.string "distrib_type"
|
t.string "distrib_type", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||||
|
@ -251,25 +251,27 @@ ActiveRecord::Schema.define(:version => 20120418100619) 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
|
||||||
t.integer "average_build_time", :default => 0, :null => false
|
t.integer "average_build_time", :default => 0, :null => false
|
||||||
t.integer "build_count", :default => 0, :null => false
|
t.integer "build_count", :default => 0, :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||||
|
|
||||||
create_table "register_requests", :force => true do |t|
|
create_table "register_requests", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email"
|
t.string "email"
|
||||||
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", :null => false
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at"
|
||||||
t.string "interest"
|
t.string "interest"
|
||||||
t.text "more"
|
t.text "more"
|
||||||
end
|
end
|
||||||
|
@ -323,7 +325,6 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
||||||
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", :limit => 128, :default => "", :null => false
|
||||||
t.string "password_salt", :default => "", :null => false
|
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
|
@ -331,11 +332,8 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.string "role"
|
t.string "role"
|
||||||
t.string "language", :default => "en"
|
t.string "language", :default => "en"
|
||||||
t.string "confirmation_token"
|
|
||||||
t.datetime "confirmed_at"
|
|
||||||
t.datetime "confirmation_sent_at"
|
|
||||||
t.integer "own_projects_count", :default => 0, :null => false
|
|
||||||
t.datetime "reset_password_sent_at"
|
t.datetime "reset_password_sent_at"
|
||||||
|
t.integer "own_projects_count", :default => 0, :null => false
|
||||||
t.text "professional_experience"
|
t.text "professional_experience"
|
||||||
t.string "site"
|
t.string "site"
|
||||||
t.string "company"
|
t.string "company"
|
||||||
|
@ -347,6 +345,9 @@ ActiveRecord::Schema.define(:version => 20120418100619) do
|
||||||
t.integer "failed_attempts", :default => 0
|
t.integer "failed_attempts", :default => 0
|
||||||
t.string "unlock_token"
|
t.string "unlock_token"
|
||||||
t.datetime "locked_at"
|
t.datetime "locked_at"
|
||||||
|
t.string "confirmation_token"
|
||||||
|
t.datetime "confirmed_at"
|
||||||
|
t.datetime "confirmation_sent_at"
|
||||||
t.string "authentication_token"
|
t.string "authentication_token"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
class ReservedNameValidator < ActiveModel::EachValidator
|
||||||
|
RESERVED_NAMES = %w{
|
||||||
|
about account add admin administrator api
|
||||||
|
app apps archive archives auth
|
||||||
|
blog
|
||||||
|
config connect contact create commit commits
|
||||||
|
dashboard delete direct_messages downloads
|
||||||
|
edit email
|
||||||
|
faq favorites feed feeds follow followers following
|
||||||
|
help home
|
||||||
|
invitations invite
|
||||||
|
jobs
|
||||||
|
login log-in log_in logout log-out log_out logs
|
||||||
|
map maps
|
||||||
|
oauth oauth_clients openid
|
||||||
|
privacy
|
||||||
|
register remove replies rss root
|
||||||
|
save search sessions settings
|
||||||
|
signup sign-up sign_up signin sign-in sign_in signout sign-out sign_out
|
||||||
|
sitemap ssl subscribe
|
||||||
|
teams terms test trends tree
|
||||||
|
unfollow unsubscribe url user
|
||||||
|
widget widgets wiki
|
||||||
|
xfn xmpp
|
||||||
|
} << Rails.application.routes.routes.map{|r| r.path.spec.to_s.match(/^\/([\w-]+)/)[1] rescue nil}.uniq.compact # current routes
|
||||||
|
|
||||||
|
def validate_each(record, attribute, value)
|
||||||
|
if RESERVED_NAMES.include?(value.downcase)
|
||||||
|
record.errors.add(attribute, :exclusion, options.merge!(:value => value))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
module ActionDispatch
|
||||||
|
module Routing
|
||||||
|
module UrlFor
|
||||||
|
def url_for_with_defaults(options = nil)
|
||||||
|
# raise options.inspect
|
||||||
|
if options.kind_of?(Hash)
|
||||||
|
# if options[:controller] == 'projects' and options[:action] == 'show' and post = options[:_positional_args].try(:first) and post.blog
|
||||||
|
if project = options[:_positional_args].try(:first) and project.is_a?(Project)
|
||||||
|
options[:_positional_args].unshift(project.owner)
|
||||||
|
# options[:use_route] = 'blog_post'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
url_for_without_defaults(options)
|
||||||
|
end
|
||||||
|
alias_method_chain :url_for, :defaults
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
module Modules
|
||||||
|
module Controllers
|
||||||
|
module FindProject
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
prepend_before_filter :find_project
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def find_project
|
||||||
|
@project = Project.find_by_owner_and_name!(params[:owner_name], params[:project_name]) if params[:owner_name] && params[:project_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -35,11 +35,8 @@ module Grack
|
||||||
def project
|
def project
|
||||||
@project ||= begin
|
@project ||= begin
|
||||||
uname, name = @env['PATH_INFO'].split('/')[1,2]
|
uname, name = @env['PATH_INFO'].split('/')[1,2]
|
||||||
name.gsub! /\.git$/, ''
|
name.gsub!(/\.git$/, '').gsub!(/\.wiki$/, '')
|
||||||
name.gsub! /\.wiki$/, ''
|
Project.find_by_owner_and_name uname, name
|
||||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
|
||||||
scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class)
|
|
||||||
scoped.find_by_name(name) || scoped.by_name(name).first
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ end
|
||||||
shared_examples_for 'no group user' do
|
shared_examples_for 'no group user' do
|
||||||
it 'should be able to perform create action' do
|
it 'should be able to perform create action' do
|
||||||
post :create, @create_params
|
post :create, @create_params
|
||||||
response.should redirect_to(group_path( Group.last.id ))
|
response.should redirect_to(group_path(Group.last))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should change objects count on create' do
|
it 'should change objects count on create' do
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe ProjectsController do
|
||||||
@project = FactoryGirl.create(:project)
|
@project = FactoryGirl.create(:project)
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
@create_params = {:project => {:name => 'pro'}}
|
@create_params = {:project => {:name => 'pro'}}
|
||||||
@update_params = {:project => {:name => 'pro2'}}
|
@update_params = {:project => {:description => 'pro2'}}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for guest' do
|
context 'for guest' do
|
||||||
|
@ -19,7 +19,7 @@ describe ProjectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not be able to perform update action' do
|
it 'should not be able to perform update action' do
|
||||||
put :update, {:id => @project.id}.merge(@update_params)
|
put :update, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@update_params)
|
||||||
response.should redirect_to(new_user_session_path)
|
response.should redirect_to(new_user_session_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ describe ProjectsController do
|
||||||
|
|
||||||
it 'should be able to perform create action' do
|
it 'should be able to perform create action' do
|
||||||
post :create, @create_params
|
post :create, @create_params
|
||||||
response.should redirect_to(project_path( Project.last.id ))
|
response.should redirect_to(project_path( Project.last ))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should change objects count on create' do
|
it 'should change objects count on create' do
|
||||||
|
@ -55,17 +55,18 @@ describe ProjectsController do
|
||||||
it_should_behave_like 'user with rights to view projects'
|
it_should_behave_like 'user with rights to view projects'
|
||||||
|
|
||||||
it 'should be able to perform destroy action' do
|
it 'should be able to perform destroy action' do
|
||||||
delete :destroy, {:id => @project.id}
|
delete :destroy, {:owner_name => @project.owner.uname, :project_name => @project.name}
|
||||||
response.should redirect_to(@project.owner)
|
response.should redirect_to(@project.owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should change objects count on destroy' do
|
it 'should change objects count on destroy' do
|
||||||
lambda { delete :destroy, :id => @project.id }.should change{ Project.count }.by(-1)
|
lambda { delete :destroy, :owner_name => @project.owner.uname, :project_name => @project.name }.should change{ Project.count }.by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not be able to fork project' do
|
it 'should not be able to fork project' do
|
||||||
post :fork, :id => @project.id
|
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||||
response.should redirect_to(forbidden_path)
|
# @project.errors.count.should == 1
|
||||||
|
response.should redirect_to(@project)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -97,15 +98,15 @@ describe ProjectsController do
|
||||||
|
|
||||||
it 'should not be able to fork project to other group' do
|
it 'should not be able to fork project to other group' do
|
||||||
group = FactoryGirl.create(:group)
|
group = FactoryGirl.create(:group)
|
||||||
post :fork, :id => @project.id, :group => group.id
|
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, :group => group.id
|
||||||
response.should redirect_to(forbidden_path)
|
response.should redirect_to(forbidden_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to fork project to group' do
|
it 'should be able to fork project to group' do
|
||||||
group = FactoryGirl.create(:group)
|
group = FactoryGirl.create(:group)
|
||||||
group.objects.create(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
group.objects.create(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
||||||
post :fork, :id => @project.id, :group => group.id
|
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, :group => group.id
|
||||||
response.should redirect_to(project_path(group.projects.first.id))
|
response.should redirect_to(project_path(group.projects.first))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -128,8 +129,8 @@ describe ProjectsController do
|
||||||
@user = FactoryGirl.create(:user)
|
@user = FactoryGirl.create(:user)
|
||||||
set_session_for(@user)
|
set_session_for(@user)
|
||||||
@project.update_attribute(:visibility, 'hidden')
|
@project.update_attribute(:visibility, 'hidden')
|
||||||
post :fork, :id => @project.id
|
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||||
response.should redirect_to(forbidden_path)
|
response.should redirect_to(@project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,14 +3,14 @@ shared_examples_for 'projects user with reader rights' do
|
||||||
it_should_behave_like 'user with rights to view projects'
|
it_should_behave_like 'user with rights to view projects'
|
||||||
|
|
||||||
it 'should be able to fork project' do
|
it 'should be able to fork project' do
|
||||||
post :fork, :id => @project.id
|
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||||
response.should redirect_to(project_path(Project.last))
|
response.should redirect_to(project_path(Project.last))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples_for 'projects user with admin rights' do
|
shared_examples_for 'projects user with admin rights' do
|
||||||
it 'should be able to perform update action' do
|
it 'should be able to perform update action' do
|
||||||
put :update, {:id => @project.id}.merge(@update_params)
|
put :update, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@update_params)
|
||||||
response.should redirect_to(project_path(@project))
|
response.should redirect_to(project_path(@project))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue