Merge branch 'master' into 90-pull
Conflicts: Gemfile app/assets/stylesheets/design/custom.scss app/models/project.rb db/schema.rb
This commit is contained in:
commit
1ffb1b3940
|
@ -14,3 +14,4 @@ public/downloads/*
|
|||
*.swp
|
||||
*.tmproj
|
||||
.sass-cache/
|
||||
dump.rdb
|
||||
|
|
27
Gemfile
27
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.2.3' #, :git => 'git://github.com/rails/rails.git'
|
||||
gem 'rails', '3.2.6' #, :git => 'git://github.com/rails/rails.git'
|
||||
|
||||
gem 'pg', '~> 0.13.2'
|
||||
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
|
||||
|
@ -12,15 +12,16 @@ gem 'omniauth', '~> 1.0.3'
|
|||
gem 'omniauth-openid', '~> 1.0.1'
|
||||
gem 'cancan', '~> 1.6.7'
|
||||
|
||||
gem 'ancestry', '~> 1.2.5'
|
||||
gem 'paperclip', '~> 3.0.2'
|
||||
gem 'delayed_job_active_record', '~> 0.3.2'
|
||||
gem 'ancestry', '~> 1.3.0'
|
||||
gem 'paperclip', '~> 3.0.4'
|
||||
gem 'resque', '~> 1.20.0'
|
||||
gem 'resque-status', '~> 0.3.3'
|
||||
gem 'resque_mailer', '~> 2.1.0'
|
||||
gem 'perform_later', '~> 1.3.0' # should be after resque_mailer
|
||||
gem 'russian', '~> 0.6.0'
|
||||
gem 'highline', '~> 1.6.11'
|
||||
gem 'state_machine'
|
||||
|
||||
gem 'jbuilder'
|
||||
|
||||
# gem 'rugged', '~> 0.16.0'
|
||||
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
|
||||
gem "grit", :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
|
||||
|
@ -36,11 +37,12 @@ gem 'rdiscount'
|
|||
gem 'RedCloth'
|
||||
gem 'wikicloth'
|
||||
|
||||
gem 'unicorn', '~> 4.2.1', :platforms => [:mri, :rbx]
|
||||
gem 'unicorn', '~> 4.3.1', :platforms => [:mri, :rbx]
|
||||
gem 'trinidad', '~> 1.0.2', :platforms => :jruby
|
||||
gem 'newrelic_rpm', '~> 3.3.3', :platforms => [:mri, :rbx]
|
||||
gem 'newrelic_rpm', '~> 3.3.5', :platforms => [:mri, :rbx]
|
||||
gem 'whenever', '~> 0.7.3', :require => false
|
||||
|
||||
gem 'jbuilder', '~> 0.4.0'
|
||||
gem 'rails3-jquery-autocomplete', '~> 1.0.7'
|
||||
gem 'will_paginate', '~> 3.0.3'
|
||||
gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags'
|
||||
|
@ -52,16 +54,15 @@ gem 'rails-backbone', '~> 0.7.2'
|
|||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.5'
|
||||
gem 'coffee-rails', '~> 3.2.2'
|
||||
gem 'compass-rails', '~> 1.0.1'
|
||||
gem 'compass-rails', '~> 1.0.2'
|
||||
gem 'uglifier', '~> 1.2.4'
|
||||
gem 'therubyracer', '~> 0.10.1', :platforms => [:mri, :rbx]
|
||||
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
|
||||
end
|
||||
|
||||
group :production do
|
||||
gem "airbrake", '~> 3.0.9'
|
||||
gem "airbrake", '~> 3.1.1'
|
||||
gem 'bluepill', '~> 0.0.60', :require => false
|
||||
gem 'daemons', '1.1.6' # Try to upgrade 1.1.8 to avoid tons DJ bugs?
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
@ -77,8 +78,8 @@ group :development do
|
|||
end
|
||||
|
||||
group :test do
|
||||
gem 'rspec-rails', '~> 2.9.0', :group => 'development'
|
||||
gem 'factory_girl_rails', '~> 3.1.0'
|
||||
gem 'rspec-rails', '~> 2.10.1', :group => 'development'
|
||||
gem 'factory_girl_rails', '~> 3.4.0'
|
||||
gem 'rr', '~> 1.0.4'
|
||||
gem 'shoulda'
|
||||
end
|
||||
|
|
177
Gemfile.lock
177
Gemfile.lock
|
@ -25,40 +25,40 @@ GEM
|
|||
remote: http://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
actionmailer (3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
actionmailer (3.2.6)
|
||||
actionpack (= 3.2.6)
|
||||
mail (~> 2.4.4)
|
||||
actionpack (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
actionpack (3.2.6)
|
||||
activemodel (= 3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.1)
|
||||
rack (~> 1.4.0)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.1.2)
|
||||
activemodel (3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
sprockets (~> 2.1.3)
|
||||
activemodel (3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
activerecord (3.2.6)
|
||||
activemodel (= 3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.3)
|
||||
activemodel (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
activesupport (3.2.3)
|
||||
activeresource (3.2.6)
|
||||
activemodel (= 3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
activesupport (3.2.6)
|
||||
i18n (~> 0.6)
|
||||
multi_json (~> 1.0)
|
||||
airbrake (3.0.9)
|
||||
airbrake (3.1.1)
|
||||
activesupport
|
||||
builder
|
||||
albino (1.3.3)
|
||||
posix-spawn (>= 0.3.6)
|
||||
ancestry (1.2.5)
|
||||
activerecord (>= 2.2.2)
|
||||
ancestry (1.3.0)
|
||||
activerecord (>= 2.3.14)
|
||||
arel (3.0.2)
|
||||
bcrypt-ruby (3.0.1)
|
||||
blankslate (2.1.2.4)
|
||||
|
@ -87,20 +87,15 @@ GEM
|
|||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.3.1)
|
||||
coffee-script-source (1.3.3)
|
||||
compass (0.12.1)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (~> 3.1)
|
||||
compass-rails (1.0.1)
|
||||
compass (~> 0.12.0)
|
||||
compass-rails (1.0.2)
|
||||
compass (>= 0.12.0, < 0.14)
|
||||
creole (0.4.2)
|
||||
daemons (1.1.6)
|
||||
delayed_job (3.0.2)
|
||||
activesupport (~> 3.0)
|
||||
delayed_job_active_record (0.3.2)
|
||||
activerecord (> 2.1.0)
|
||||
delayed_job (~> 3.0.0)
|
||||
devise (2.0.4)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.0.3)
|
||||
|
@ -111,13 +106,13 @@ GEM
|
|||
ejs (1.0.0)
|
||||
erubis (2.7.0)
|
||||
eventmachine (0.12.10)
|
||||
execjs (1.3.0)
|
||||
execjs (1.4.0)
|
||||
multi_json (~> 1.0)
|
||||
expression_parser (0.9.0)
|
||||
factory_girl (3.1.1)
|
||||
factory_girl (3.4.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (3.1.0)
|
||||
factory_girl (~> 3.1.0)
|
||||
factory_girl_rails (3.4.0)
|
||||
factory_girl (~> 3.4.0)
|
||||
railties (>= 3.0.0)
|
||||
fssm (0.2.9)
|
||||
github-markup (0.7.2)
|
||||
|
@ -130,14 +125,14 @@ GEM
|
|||
redcarpet
|
||||
sanitize (~> 2.0.0)
|
||||
sinatra (~> 1.0)
|
||||
haml (3.1.4)
|
||||
haml (3.1.6)
|
||||
haml-rails (0.3.4)
|
||||
actionpack (~> 3.0)
|
||||
activesupport (~> 3.0)
|
||||
haml (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
hashie (1.2.0)
|
||||
highline (1.6.11)
|
||||
highline (1.6.12)
|
||||
hike (1.2.1)
|
||||
hirb (0.6.2)
|
||||
i18n (0.6.0)
|
||||
|
@ -148,9 +143,11 @@ GEM
|
|||
jquery-rails (2.0.2)
|
||||
railties (>= 3.2.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.6.6)
|
||||
json (1.7.3)
|
||||
kgio (2.7.4)
|
||||
libv8 (3.3.10.4)
|
||||
macaddr (1.6.1)
|
||||
systemu (~> 2.5.0)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
|
@ -167,17 +164,17 @@ GEM
|
|||
meta-tags (1.2.6)
|
||||
actionpack
|
||||
mime-types (1.18)
|
||||
multi_json (1.3.2)
|
||||
multi_json (1.3.6)
|
||||
mustache (0.99.4)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-sftp (2.0.5)
|
||||
net-ssh (>= 2.0.9)
|
||||
net-ssh (2.3.0)
|
||||
net-ssh (2.5.2)
|
||||
net-ssh-gateway (1.1.0)
|
||||
net-ssh (>= 1.99.1)
|
||||
newrelic_rpm (3.3.4)
|
||||
nokogiri (1.5.2)
|
||||
newrelic_rpm (3.3.5)
|
||||
nokogiri (1.5.4)
|
||||
omniauth (1.0.3)
|
||||
hashie (~> 1.2)
|
||||
rack
|
||||
|
@ -185,12 +182,16 @@ GEM
|
|||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.0.7)
|
||||
paperclip (3.0.2)
|
||||
paperclip (3.0.4)
|
||||
activemodel (>= 3.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (>= 0.0.2)
|
||||
mime-types
|
||||
perform_later (1.3.0)
|
||||
rails (~> 3.0)
|
||||
redis
|
||||
resque
|
||||
pg (0.13.2)
|
||||
polyglot (0.3.3)
|
||||
posix-spawn (0.3.6)
|
||||
|
@ -206,14 +207,14 @@ GEM
|
|||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.3)
|
||||
actionmailer (= 3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
activerecord (= 3.2.3)
|
||||
activeresource (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
rails (3.2.6)
|
||||
actionmailer (= 3.2.6)
|
||||
actionpack (= 3.2.6)
|
||||
activerecord (= 3.2.6)
|
||||
activeresource (= 3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.3)
|
||||
railties (= 3.2.6)
|
||||
rails-backbone (0.7.2)
|
||||
coffee-script (~> 2.2.0)
|
||||
ejs (~> 1.0.0)
|
||||
|
@ -222,44 +223,61 @@ GEM
|
|||
railties (>= 3.0.0)
|
||||
rails3-jquery-autocomplete (1.0.7)
|
||||
rails (~> 3.0)
|
||||
railties (3.2.3)
|
||||
actionpack (= 3.2.3)
|
||||
activesupport (= 3.2.3)
|
||||
railties (3.2.6)
|
||||
actionpack (= 3.2.6)
|
||||
activesupport (= 3.2.6)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
raindrops (0.8.0)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
raindrops (0.9.0)
|
||||
rake (0.9.2.2)
|
||||
rdiscount (1.6.8)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
redcarpet (1.17.2)
|
||||
redis (2.2.2)
|
||||
redis-namespace (1.0.3)
|
||||
redis (< 3.0.0)
|
||||
redisk (0.2.2)
|
||||
redis (>= 0.1.1)
|
||||
redis-namespace (>= 0.1.0)
|
||||
resque (1.20.0)
|
||||
multi_json (~> 1.0)
|
||||
redis-namespace (~> 1.0.2)
|
||||
sinatra (>= 0.9.2)
|
||||
vegas (~> 0.1.2)
|
||||
resque-status (0.3.3)
|
||||
redisk (>= 0.2.1)
|
||||
resque (~> 1.19)
|
||||
uuid (~> 2.3)
|
||||
resque_mailer (2.1.0)
|
||||
actionmailer (~> 3.0)
|
||||
rr (1.0.4)
|
||||
rspec (2.9.0)
|
||||
rspec-core (~> 2.9.0)
|
||||
rspec-expectations (~> 2.9.0)
|
||||
rspec-mocks (~> 2.9.0)
|
||||
rspec-core (2.9.0)
|
||||
rspec-expectations (2.9.1)
|
||||
rspec (2.10.0)
|
||||
rspec-core (~> 2.10.0)
|
||||
rspec-expectations (~> 2.10.0)
|
||||
rspec-mocks (~> 2.10.0)
|
||||
rspec-core (2.10.1)
|
||||
rspec-expectations (2.10.0)
|
||||
diff-lcs (~> 1.1.3)
|
||||
rspec-mocks (2.9.0)
|
||||
rspec-rails (2.9.0)
|
||||
rspec-mocks (2.10.1)
|
||||
rspec-rails (2.10.1)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec (~> 2.9.0)
|
||||
rspec (~> 2.10.0)
|
||||
ruby-haml-js (0.0.3)
|
||||
execjs
|
||||
sprockets (>= 2.0.0)
|
||||
ruby-openid (2.1.8)
|
||||
russian (0.6.0)
|
||||
i18n (>= 0.5.0)
|
||||
rvm-capistrano (1.1.0)
|
||||
rvm-capistrano (1.2.2)
|
||||
capistrano (>= 2.0.0)
|
||||
sanitize (2.0.3)
|
||||
nokogiri (>= 1.4.4, < 1.6)
|
||||
sass (3.1.16)
|
||||
sass (3.1.19)
|
||||
sass-rails (3.2.5)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
|
@ -278,19 +296,20 @@ GEM
|
|||
skinny (0.2.0)
|
||||
eventmachine (~> 0.12)
|
||||
thin (~> 1.2)
|
||||
sprockets (2.1.2)
|
||||
sprockets (2.1.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sqlite3 (1.3.6)
|
||||
state_machine (1.1.2)
|
||||
systemu (2.5.1)
|
||||
therubyracer (0.10.1)
|
||||
libv8 (~> 3.3.10)
|
||||
thin (1.3.1)
|
||||
daemons (>= 1.0.9)
|
||||
eventmachine (>= 0.12.6)
|
||||
rack (>= 1.0.0)
|
||||
thor (0.14.6)
|
||||
thor (0.15.2)
|
||||
tilt (1.3.3)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
|
@ -299,10 +318,14 @@ GEM
|
|||
uglifier (1.2.4)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (>= 1.0.2)
|
||||
unicorn (4.2.1)
|
||||
unicorn (4.3.1)
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
uuid (2.3.5)
|
||||
macaddr (~> 1.0)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
warden (1.1.1)
|
||||
rack (>= 1.0)
|
||||
whenever (0.7.3)
|
||||
|
@ -318,8 +341,8 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
RedCloth
|
||||
airbrake (~> 3.0.9)
|
||||
ancestry (~> 1.2.5)
|
||||
airbrake (~> 3.1.1)
|
||||
ancestry (~> 1.3.0)
|
||||
bluepill (~> 0.0.60)
|
||||
cancan (~> 1.6.7)
|
||||
cape
|
||||
|
@ -327,37 +350,39 @@ DEPENDENCIES
|
|||
capistrano_colors
|
||||
charlock_holmes (~> 0.6.8)
|
||||
coffee-rails (~> 3.2.2)
|
||||
compass-rails (~> 1.0.1)
|
||||
compass-rails (~> 1.0.2)
|
||||
creole
|
||||
daemons (= 1.1.6)
|
||||
delayed_job_active_record (~> 0.3.2)
|
||||
devise (~> 2.0.4)
|
||||
diff-display (~> 0.0.1)
|
||||
factory_girl_rails (~> 3.1.0)
|
||||
factory_girl_rails (~> 3.4.0)
|
||||
gollum (= 1.3.1)
|
||||
grack!
|
||||
grit!
|
||||
haml-rails (~> 0.3.4)
|
||||
highline (~> 1.6.11)
|
||||
hirb
|
||||
jbuilder
|
||||
jbuilder (~> 0.4.0)
|
||||
jquery-rails (~> 2.0.2)
|
||||
mailcatcher
|
||||
meta-tags (~> 1.2.5)
|
||||
newrelic_rpm (~> 3.3.3)
|
||||
newrelic_rpm (~> 3.3.5)
|
||||
omniauth (~> 1.0.3)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
paperclip (~> 3.0.2)
|
||||
paperclip (~> 3.0.4)
|
||||
perform_later (~> 1.3.0)
|
||||
pg (~> 0.13.2)
|
||||
rails (= 3.2.3)
|
||||
rails (= 3.2.6)
|
||||
rails-backbone (~> 0.7.2)
|
||||
rails3-generators
|
||||
rails3-jquery-autocomplete (~> 1.0.7)
|
||||
rdiscount
|
||||
redcarpet (= 1.17.2)
|
||||
redhillonrails_core!
|
||||
resque (~> 1.20.0)
|
||||
resque-status (~> 0.3.3)
|
||||
resque_mailer (~> 2.1.0)
|
||||
rr (~> 1.0.4)
|
||||
rspec-rails (~> 2.9.0)
|
||||
rspec-rails (~> 2.10.1)
|
||||
ruby-haml-js (~> 0.0.3)
|
||||
russian (~> 0.6.0)
|
||||
rvm-capistrano
|
||||
|
@ -369,7 +394,7 @@ DEPENDENCIES
|
|||
therubyrhino (~> 1.73.1)
|
||||
trinidad (~> 1.0.2)
|
||||
uglifier (~> 1.2.4)
|
||||
unicorn (~> 4.2.1)
|
||||
unicorn (~> 4.3.1)
|
||||
whenever (~> 0.7.3)
|
||||
wikicloth
|
||||
will_paginate (~> 3.0.3)
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -3,5 +3,11 @@
|
|||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require 'rake'
|
||||
require 'resque/tasks'
|
||||
|
||||
# This fixes connection fail with Postgres server on new fork:
|
||||
task "resque:setup" => :environment do
|
||||
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
||||
end
|
||||
|
||||
Rosa::Application.load_tasks
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//= require autocomplete-rails
|
||||
//= require vendor
|
||||
//= require jquery.dataTables_ext
|
||||
//= require_tree ./lib
|
||||
//= require lib/lib
|
||||
//= require_tree ./design
|
||||
//= require_tree ./extra
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Rosa.Models.Advisory = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: null,
|
||||
description: null,
|
||||
references: null,
|
||||
update_type: null
|
||||
}
|
||||
});
|
||||
|
||||
Rosa.Collections.AdvisoriesCollection = Backbone.Collection.extend({
|
||||
model: Rosa.Models.Advisory
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
Rosa.Routers.BuildListsAdvisoriesRouter = Backbone.Router.extend({
|
||||
routes: {},
|
||||
|
||||
initialize: function() {
|
||||
this.advisoriesCollection = new Rosa.Collections.AdvisoriesCollection(Rosa.bootstrapedData.advisories);
|
||||
this.advisoriesView = new Rosa.Views.BuildListAdvisoriesView({ collection: this.advisoriesCollection });
|
||||
|
||||
this.advisoriesView.render();
|
||||
}
|
||||
});
|
|
@ -0,0 +1,87 @@
|
|||
Rosa.Views.BuildListAdvisoriesView = Backbone.View.extend({
|
||||
initialize: function() {
|
||||
_.bindAll(this, 'popoverTitle', 'popoverDesc', 'showAdvisory',
|
||||
'changeAdvisoryList', 'showPreview', 'showForm', 'hideAll');
|
||||
this.$el = $('#advisory_block');
|
||||
this._$form = this.$('#new_advisory_form');
|
||||
this._$preview = this.$('#advisory_preview');
|
||||
this._$type_select = $('#build_list_update_type');
|
||||
this._$selector = this.$('#attach_advisory');
|
||||
|
||||
this._$selector.on('change', this.showAdvisory);
|
||||
this._$type_select.on('change', this.changeAdvisoryList);
|
||||
},
|
||||
|
||||
changeAdvisoryList: function() {
|
||||
this._$selector.children('.popoverable').hide();
|
||||
this._$selector.children('.popoverable.' + this._$type_select.val()).show();
|
||||
this._$selector.val('no').trigger('change');
|
||||
},
|
||||
|
||||
popoverTitle: function(el) {
|
||||
return el.val();
|
||||
},
|
||||
|
||||
popoverDesc: function(el) {
|
||||
return this.collection.get(el.val()).get('popover_desc');
|
||||
},
|
||||
|
||||
showAdvisory: function(el) {
|
||||
var adv_id = this._$selector.val();
|
||||
switch (adv_id) {
|
||||
case 'no':
|
||||
this.hideAll();
|
||||
break
|
||||
case 'new':
|
||||
this.showForm();
|
||||
break
|
||||
default:
|
||||
this.showPreview(adv_id);
|
||||
}
|
||||
},
|
||||
|
||||
showPreview: function(id) {
|
||||
if (this._$form.is(':visible')) {
|
||||
this._$form.slideUp();
|
||||
}
|
||||
var adv = this.collection.get(id);
|
||||
var prev = this._$preview;
|
||||
prev.children('h3').html(prev.children('h3').html() + ' ' + adv.get('advisory_id'));
|
||||
prev.children('.descr').html(adv.get('description'));
|
||||
prev.children('.refs').html(adv.get('references'));
|
||||
if (!this._$preview.is(':visible')) {
|
||||
this._$preview.slideDown();
|
||||
}
|
||||
},
|
||||
|
||||
showForm: function() {
|
||||
if (this._$preview.is(':visible')) {
|
||||
this._$preview.slideUp();
|
||||
}
|
||||
if (!this._$form.is(':visible')) {
|
||||
this._$form.slideDown();
|
||||
}
|
||||
},
|
||||
|
||||
hideAll: function() {
|
||||
if (this._$preview.is(':visible')) {
|
||||
this._$preview.slideUp();
|
||||
}
|
||||
if (this._$form.is(':visible')) {
|
||||
this._$form.slideUp();
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var title = this.popoverTitle;
|
||||
var description = this.popoverDesc;
|
||||
this.changeAdvisoryList();
|
||||
this.$('#attach_advisory > .popoverable').popover({
|
||||
title: function() { return title($(this)); },
|
||||
content: function() { return description($(this)); }
|
||||
});
|
||||
this.showAdvisory();
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
|
@ -1,4 +1,5 @@
|
|||
$(document).ready(function() {
|
||||
// TODO: Refactor this handler!! It's too complicated.
|
||||
$('#build_list_save_to_platform_id').change(function() {
|
||||
var platform_id = $(this).val();
|
||||
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
||||
|
@ -8,8 +9,10 @@ $(document).ready(function() {
|
|||
if ($(this).val() == platform_id) {
|
||||
if ($(this).attr('data-released') === '1') {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
disableUpdateTypes();
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
enableUpdateTypes();
|
||||
}
|
||||
|
||||
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
||||
|
@ -31,6 +34,12 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) == -1) {
|
||||
// For personal platforms update types always enebaled:
|
||||
enableUpdateTypes();
|
||||
}
|
||||
|
||||
|
||||
setBranchSelected();
|
||||
});
|
||||
$('#build_list_save_to_platform_id').trigger('change');
|
||||
|
@ -45,6 +54,7 @@ $(document).ready(function() {
|
|||
$('.build_bpl_ids').click(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function setPlChecked(pointer, checked) {
|
||||
|
@ -61,7 +71,7 @@ function setBranchSelected() {
|
|||
var pl_id = $('#build_list_save_to_platform_id').val();
|
||||
// Checks if selected platform is main or not:
|
||||
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
|
||||
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-]+)\/[\w-]+/)[1];
|
||||
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-.]+)\/[\w-.]+/)[1];
|
||||
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
|
||||
// If there is branch we need - set it selected:
|
||||
if ( branch_pl_opt.size() > 0 ) {
|
||||
|
@ -71,15 +81,18 @@ function setBranchSelected() {
|
|||
}
|
||||
}
|
||||
|
||||
function platformChange() {
|
||||
var rel = !!$('input[type="checkbox"].build_bpl_ids').filter(function(index) {
|
||||
var $this = $(this);
|
||||
return !!$this.attr('checked') && ($this.attr('data-released') === '1');
|
||||
}).length;
|
||||
|
||||
if (rel) {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
function disableUpdateTypes() {
|
||||
$("select#build_list_update_type option").each(function(i,el) {
|
||||
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
|
||||
$(el).attr("disabled", "disabled");
|
||||
// If disabled option is selected - select 'bugfix':
|
||||
if ( $(el).attr("selected") ) {
|
||||
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function enableUpdateTypes() {
|
||||
$("select#build_list_update_type option").removeAttr("disabled");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/* =============================================================
|
||||
* bootstrap-collapse.js v2.0.4
|
||||
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ============================================================ */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* COLLAPSE PUBLIC CLASS DEFINITION
|
||||
* ================================ */
|
||||
|
||||
var Collapse = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
||||
|
||||
if (this.options.parent) {
|
||||
this.$parent = $(this.options.parent)
|
||||
}
|
||||
|
||||
this.options.toggle && this.toggle()
|
||||
}
|
||||
|
||||
Collapse.prototype = {
|
||||
|
||||
constructor: Collapse
|
||||
|
||||
, dimension: function () {
|
||||
var hasWidth = this.$element.hasClass('width')
|
||||
return hasWidth ? 'width' : 'height'
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var dimension
|
||||
, scroll
|
||||
, actives
|
||||
, hasData
|
||||
|
||||
if (this.transitioning) return
|
||||
|
||||
dimension = this.dimension()
|
||||
scroll = $.camelCase(['scroll', dimension].join('-'))
|
||||
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
||||
|
||||
if (actives && actives.length) {
|
||||
hasData = actives.data('collapse')
|
||||
if (hasData && hasData.transitioning) return
|
||||
actives.collapse('hide')
|
||||
hasData || actives.data('collapse', null)
|
||||
}
|
||||
|
||||
this.$element[dimension](0)
|
||||
this.transition('addClass', $.Event('show'), 'shown')
|
||||
this.$element[dimension](this.$element[0][scroll])
|
||||
}
|
||||
|
||||
, hide: function () {
|
||||
var dimension
|
||||
if (this.transitioning) return
|
||||
dimension = this.dimension()
|
||||
this.reset(this.$element[dimension]())
|
||||
this.transition('removeClass', $.Event('hide'), 'hidden')
|
||||
this.$element[dimension](0)
|
||||
}
|
||||
|
||||
, reset: function (size) {
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
.removeClass('collapse')
|
||||
[dimension](size || 'auto')
|
||||
[0].offsetWidth
|
||||
|
||||
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
, transition: function (method, startEvent, completeEvent) {
|
||||
var that = this
|
||||
, complete = function () {
|
||||
if (startEvent.type == 'show') that.reset()
|
||||
that.transitioning = 0
|
||||
that.$element.trigger(completeEvent)
|
||||
}
|
||||
|
||||
this.$element.trigger(startEvent)
|
||||
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
this.$element[method]('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('collapse') ?
|
||||
this.$element.one($.support.transition.end, complete) :
|
||||
complete()
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* COLLAPSIBLE PLUGIN DEFINITION
|
||||
* ============================== */
|
||||
|
||||
$.fn.collapse = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('collapse')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.collapse.defaults = {
|
||||
toggle: true
|
||||
}
|
||||
|
||||
$.fn.collapse.Constructor = Collapse
|
||||
|
||||
|
||||
/* COLLAPSIBLE DATA-API
|
||||
* ==================== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
|
||||
var $this = $(this), href
|
||||
, target = $this.attr('data-target')
|
||||
|| e.preventDefault()
|
||||
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
||||
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
||||
$(target).collapse(option)
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -0,0 +1,98 @@
|
|||
/* ===========================================================
|
||||
* bootstrap-popover.js v2.0.4
|
||||
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
||||
* ===========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* =========================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* POPOVER PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
|
||||
var Popover = function ( element, options ) {
|
||||
this.init('popover', element, options)
|
||||
}
|
||||
|
||||
|
||||
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
||||
========================================== */
|
||||
|
||||
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
||||
|
||||
constructor: Popover
|
||||
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
, title = this.getTitle()
|
||||
, content = this.getContent()
|
||||
|
||||
$tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
|
||||
$tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
|
||||
|
||||
$tip.removeClass('fade top bottom left right in')
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle() || this.getContent()
|
||||
}
|
||||
|
||||
, getContent: function () {
|
||||
var content
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
content = $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
, tip: function () {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
/* POPOVER PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
$.fn.popover = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('popover')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.popover.Constructor = Popover
|
||||
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
||||
placement: 'right'
|
||||
, content: ''
|
||||
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -0,0 +1,275 @@
|
|||
/* ===========================================================
|
||||
* bootstrap-tooltip.js v2.0.4
|
||||
* http://twitter.github.com/bootstrap/javascript.html#tooltips
|
||||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||||
* ===========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TOOLTIP PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
|
||||
var Tooltip = function (element, options) {
|
||||
this.init('tooltip', element, options)
|
||||
}
|
||||
|
||||
Tooltip.prototype = {
|
||||
|
||||
constructor: Tooltip
|
||||
|
||||
, init: function (type, element, options) {
|
||||
var eventIn
|
||||
, eventOut
|
||||
|
||||
this.type = type
|
||||
this.$element = $(element)
|
||||
this.options = this.getOptions(options)
|
||||
this.enabled = true
|
||||
|
||||
if (this.options.trigger != 'manual') {
|
||||
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
|
||||
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
|
||||
}
|
||||
|
||||
this.options.selector ?
|
||||
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
, getOptions: function (options) {
|
||||
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
||||
|
||||
if (options.delay && typeof options.delay == 'number') {
|
||||
options.delay = {
|
||||
show: options.delay
|
||||
, hide: options.delay
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
, enter: function (e) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
clearTimeout(this.timeout)
|
||||
self.hoverState = 'in'
|
||||
this.timeout = setTimeout(function() {
|
||||
if (self.hoverState == 'in') self.show()
|
||||
}, self.options.delay.show)
|
||||
}
|
||||
|
||||
, leave: function (e) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (this.timeout) clearTimeout(this.timeout)
|
||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||
|
||||
self.hoverState = 'out'
|
||||
this.timeout = setTimeout(function() {
|
||||
if (self.hoverState == 'out') self.hide()
|
||||
}, self.options.delay.hide)
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var $tip
|
||||
, inside
|
||||
, pos
|
||||
, actualWidth
|
||||
, actualHeight
|
||||
, placement
|
||||
, tp
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
if (this.options.animation) {
|
||||
$tip.addClass('fade')
|
||||
}
|
||||
|
||||
placement = typeof this.options.placement == 'function' ?
|
||||
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
||||
this.options.placement
|
||||
|
||||
inside = /in/.test(placement)
|
||||
|
||||
$tip
|
||||
.remove()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.appendTo(inside ? this.$element : document.body)
|
||||
|
||||
pos = this.getPosition(inside)
|
||||
|
||||
actualWidth = $tip[0].offsetWidth
|
||||
actualHeight = $tip[0].offsetHeight
|
||||
|
||||
switch (inside ? placement.split(' ')[1] : placement) {
|
||||
case 'bottom':
|
||||
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'top':
|
||||
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'left':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
||||
break
|
||||
case 'right':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
||||
break
|
||||
}
|
||||
|
||||
$tip
|
||||
.css(tp)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
}
|
||||
}
|
||||
|
||||
, isHTML: function(text) {
|
||||
// html string detection logic adapted from jQuery
|
||||
return typeof text != 'string'
|
||||
|| ( text.charAt(0) === "<"
|
||||
&& text.charAt( text.length - 1 ) === ">"
|
||||
&& text.length >= 3
|
||||
) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
|
||||
}
|
||||
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
, title = this.getTitle()
|
||||
|
||||
$tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
|
||||
$tip.removeClass('fade in top bottom left right')
|
||||
}
|
||||
|
||||
, hide: function () {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
|
||||
$tip.removeClass('in')
|
||||
|
||||
function removeWithAnimation() {
|
||||
var timeout = setTimeout(function () {
|
||||
$tip.off($.support.transition.end).remove()
|
||||
}, 500)
|
||||
|
||||
$tip.one($.support.transition.end, function () {
|
||||
clearTimeout(timeout)
|
||||
$tip.remove()
|
||||
})
|
||||
}
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
removeWithAnimation() :
|
||||
$tip.remove()
|
||||
}
|
||||
|
||||
, fixTitle: function () {
|
||||
var $e = this.$element
|
||||
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
||||
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
|
||||
}
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle()
|
||||
}
|
||||
|
||||
, getPosition: function (inside) {
|
||||
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
|
||||
width: this.$element[0].offsetWidth
|
||||
, height: this.$element[0].offsetHeight
|
||||
})
|
||||
}
|
||||
|
||||
, getTitle: function () {
|
||||
var title
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
title = $e.attr('data-original-title')
|
||||
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
||||
|
||||
return title
|
||||
}
|
||||
|
||||
, tip: function () {
|
||||
return this.$tip = this.$tip || $(this.options.template)
|
||||
}
|
||||
|
||||
, validate: function () {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide()
|
||||
this.$element = null
|
||||
this.options = null
|
||||
}
|
||||
}
|
||||
|
||||
, enable: function () {
|
||||
this.enabled = true
|
||||
}
|
||||
|
||||
, disable: function () {
|
||||
this.enabled = false
|
||||
}
|
||||
|
||||
, toggleEnabled: function () {
|
||||
this.enabled = !this.enabled
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
this[this.tip().hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* TOOLTIP PLUGIN DEFINITION
|
||||
* ========================= */
|
||||
|
||||
$.fn.tooltip = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('tooltip')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.tooltip.Constructor = Tooltip
|
||||
|
||||
$.fn.tooltip.defaults = {
|
||||
animation: true
|
||||
, placement: 'top'
|
||||
, selector: false
|
||||
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
, trigger: 'hover'
|
||||
, title: ''
|
||||
, delay: 0
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
|
@ -0,0 +1,3 @@
|
|||
//= require ./jquery.placeholder
|
||||
//= require ./bootstrap-tooltip
|
||||
//= require ./bootstrap-popover
|
|
@ -955,3 +955,136 @@ div#git_help_data p {
|
|||
table.diff {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Mass build forms */
|
||||
form.mass_build input[type="checkbox"] {
|
||||
width: 10px;
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
div#new_advisory_form, div#advisory_preview {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*=============== popovers ===============*/
|
||||
|
||||
.popover {
|
||||
display: none;
|
||||
left: 0;
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 1010;
|
||||
}
|
||||
|
||||
.popover.top {
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
.popover.right {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.popover.bottom {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.popover.left {
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.popover.top .arrow {
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
border-top: 5px solid #000000;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.popover.right .arrow {
|
||||
border-bottom: 5px solid transparent;
|
||||
border-right: 5px solid #000000;
|
||||
border-top: 5px solid transparent;
|
||||
left: 0;
|
||||
margin-top: -5px;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.popover.bottom .arrow {
|
||||
border-bottom: 5px solid #000000;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.popover.left .arrow {
|
||||
border-bottom: 5px solid transparent;
|
||||
border-left: 5px solid #000000;
|
||||
border-top: 5px solid transparent;
|
||||
margin-top: -5px;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.popover .arrow {
|
||||
height: 0;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.popover-inner {
|
||||
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.8);
|
||||
border-radius: 6px 6px 6px 6px;
|
||||
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
||||
overflow: hidden;
|
||||
padding: 3px;
|
||||
width: 280px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.popover-title {
|
||||
background-color: #F5F5F5;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
border-radius: 3px 3px 0 0;
|
||||
line-height: 1;
|
||||
padding: 9px 15px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.popover-content {
|
||||
background-clip: padding-box;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 0 0 3px 3px;
|
||||
padding: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.popover-content p, .popover-content ul, .popover-content ol {
|
||||
margin-bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.fade {
|
||||
-moz-transition: opacity 0.15s linear 0s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fade.in {
|
||||
opacity: 1;
|
||||
}
|
||||
/*=============== popovers end ===============*/
|
||||
|
||||
.bottom_20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
form.mass_build section.left {
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
form.mass_build section.right {
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class AdvisoriesController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_advisory, :only => [:show]
|
||||
skip_before_filter :authenticate_user! if APP_CONFIG['anonymous_access']
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
|
|
|
@ -2,14 +2,31 @@
|
|||
class Platforms::PlatformsController < Platforms::BaseController
|
||||
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:advisories] if APP_CONFIG['anonymous_access']
|
||||
load_and_authorize_resource
|
||||
|
||||
autocomplete :user, :uname
|
||||
|
||||
def build_all
|
||||
@platform.delay.build_all(current_user)
|
||||
mass_build = MassBuild.new(
|
||||
:platform => @platform,
|
||||
:user => current_user,
|
||||
:repositories => params[:repositories],
|
||||
:arches => params[:arches],
|
||||
:auto_publish => params[:auto_publish] || false
|
||||
)
|
||||
if mass_build.save
|
||||
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
else
|
||||
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
||||
flash[:warning] = mass_build.errors.full_messages.join('. ')
|
||||
flash[:error] = t("flash.platform.build_all_error")
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to(platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
def mass_builds
|
||||
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
||||
render :action => :build_all
|
||||
end
|
||||
|
||||
def index
|
||||
|
@ -81,8 +98,7 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@platform.delay.destroy if @platform
|
||||
|
||||
@platform.destroy # later with resque
|
||||
flash[:notice] = t("flash.platform.destroyed")
|
||||
redirect_to platforms_path
|
||||
end
|
||||
|
@ -124,4 +140,14 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
redirect_to members_platform_url(@platform)
|
||||
end
|
||||
|
||||
def advisories
|
||||
@advisories = @platform.advisories.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def clear
|
||||
@platform.clear
|
||||
flash[:notice] = t('flash.repository.clear')
|
||||
redirect_to edit_platform_path(@platform)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -70,6 +70,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def show
|
||||
@item_groups = @build_list.items.group_by_level
|
||||
@advisories = @build_list.project.advisories
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -93,13 +94,10 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def publish_build
|
||||
if params[:status].to_i == 0 # ok
|
||||
@build_list.status = BuildList::BUILD_PUBLISHED
|
||||
@build_list.package_version = "#{params[:version]}-#{params[:release]}"
|
||||
system("cd #{@build_list.project.git_repository.path} && git tag #{@build_list.package_version} #{@build_list.commit_hash}") # TODO REDO through grit
|
||||
@build_list.published
|
||||
else
|
||||
@build_list.status = BuildList::FAILED_PUBLISH
|
||||
@build_list.fail_publish
|
||||
end
|
||||
@build_list.save
|
||||
|
||||
render :nothing => true, :status => 200
|
||||
end
|
||||
|
@ -118,20 +116,19 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def pre_build
|
||||
@build_list.status = BuildServer::BUILD_STARTED
|
||||
@build_list.save
|
||||
@build_list.start_build
|
||||
|
||||
render :nothing => true, :status => 200
|
||||
end
|
||||
|
||||
def post_build
|
||||
@build_list.status = params[:status]
|
||||
params[:status].to_i == BuildServer::SUCCESS ? @build_list.build_success : @build_list.build_error
|
||||
@build_list.container_path = params[:container_path]
|
||||
@build_list.save
|
||||
|
||||
render :nothing => true, :status => 200
|
||||
|
||||
@build_list.delay.publish if @build_list.auto_publish # && @build_list.can_publish?
|
||||
@build_list.publish if @build_list.auto_publish # && @build_list.can_publish? # later with resque
|
||||
end
|
||||
|
||||
def circle_build
|
||||
|
@ -172,14 +169,31 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def publish
|
||||
@build_list.update_type = params[:build_list][:update_type] if params[:build_list][:update_type].present?
|
||||
if params[:create_advisory].present? and !@build_list.build_advisory(params[:build_list][:advisory]) do |a|
|
||||
|
||||
if params[:attach_advisory].present? and params[:attach_advisory] != 'no' and !@build_list.advisory
|
||||
if params[:attach_advisory] == 'new'
|
||||
# create new advisory
|
||||
if !@build_list.build_advisory(params[:build_list][:advisory]) do |a|
|
||||
a.update_type = @build_list.update_type
|
||||
a.project = @build_list.project
|
||||
a.platforms << @build_list.save_to_platform unless a.platforms.include? @build_list.save_to_platform
|
||||
end.save
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return
|
||||
end
|
||||
if @build_list.save and @build_list.publish
|
||||
else
|
||||
# attach existing advisory
|
||||
a = Advisory.where(:advisory_id => params[:attach_advisory]).limit(1).first
|
||||
if a.update_type != @build_list.update_type
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return
|
||||
end
|
||||
a.platforms << @build_list.save_to_platform unless a.platforms.include? @build_list.save_to_platform
|
||||
@build_list.advisory = a
|
||||
unless a.save
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return
|
||||
end
|
||||
end
|
||||
end
|
||||
if @build_list.save and @build_list.now_publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail')
|
||||
|
|
|
@ -4,7 +4,7 @@ class Projects::IssuesController < Projects::BaseController
|
|||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
|
||||
load_resource :project
|
||||
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create]
|
||||
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create, :index]
|
||||
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION
|
||||
|
||||
layout 'application'
|
||||
|
|
|
@ -255,10 +255,7 @@ class Projects::WikiController < Projects::BaseController
|
|||
unless @committer
|
||||
p = commit_message.merge({:name => current_user.uname, :email => current_user.email})
|
||||
@committer = Gollum::Committer.new(@wiki, p)
|
||||
# @committer.after_commit do |committer, sha1|
|
||||
# here goes callback for notification
|
||||
# end
|
||||
ActivityFeedObserver.instance.after_create(@committer).delay
|
||||
GitHook.perform_later!(:notification, :process, {:project_id => @project.id, :actor_name => @committer.actor.name, :commit_sha => @committer.commit})
|
||||
end
|
||||
@committer
|
||||
end
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
module AdvisoriesHelper
|
||||
def advisories_select_options(advisories, opts = {:class => 'popoverable'})
|
||||
def_values = [[t("layout.advisories.no_"), 'no'], [t("layout.advisories.new"), 'new']]
|
||||
options_for_select(def_values, def_values.first) +
|
||||
options_for_select(advisories.map { |a| [a.advisory_id, :class => "#{opts[:class]} #{a.update_type}"] })
|
||||
end
|
||||
|
||||
def construct_ref_link(ref)
|
||||
ref = sanitize(ref)
|
||||
url = if ref =~ %r[^http(s?)://*]
|
||||
|
|
|
@ -8,6 +8,8 @@ module ApplicationHelper
|
|||
'right slim'
|
||||
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
|
||||
nil
|
||||
when controller_name == 'platforms' && ['build_all', 'mass_builds'].include?(action_name)
|
||||
'right slim'
|
||||
when controller_name == 'platforms' && action_name == 'show'
|
||||
'right bigpadding'
|
||||
when controller_name == 'platforms' && action_name == 'clone'
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class UserMailer < ActionMailer::Base
|
||||
default :from => APP_CONFIG['do-not-reply-email']
|
||||
|
||||
include Resque::Mailer # send email async
|
||||
|
||||
def new_user_notification(user)
|
||||
@user = user
|
||||
mail(:to => user.email, :subject => I18n.t("notifications.subjects.new_user_notification", :project_name => APP_CONFIG['project_name'])) do |format|
|
||||
|
|
|
@ -20,6 +20,8 @@ class Ability
|
|||
can :search, BuildList
|
||||
can :read, BuildList, :project => {:visibility => 'open'}
|
||||
can :read, ProductBuildList, :product => {:platform => {:visibility => 'open'}}
|
||||
can :read, Advisory
|
||||
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
|
||||
# Core callbacks
|
||||
can [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt], BuildList
|
||||
|
||||
|
@ -84,14 +86,15 @@ class Ability
|
|||
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
||||
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
||||
can([:update, :members], Platform) {|platform| local_admin? platform}
|
||||
can([:destroy, :members, :add_member, :remove_member, :remove_members, :build_all] , Platform) {|platform| owner? platform}
|
||||
can :autocomplete_user_uname, Platform
|
||||
can([:destroy, :members, :add_member, :remove_member, :remove_members, :build_all, :mass_builds] , Platform) {|platform| owner? platform}
|
||||
can [:autocomplete_user_uname, :read_advisories, :advisories], Platform
|
||||
|
||||
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
|
||||
can [:read, :projects_list], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||
can [:read, :projects_list], Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||
can([:read, :projects_list], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
|
||||
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
|
||||
can(:clear, Platform) {|platform| local_admin?(platform) && platform.platform_type == 'personal'}
|
||||
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
|
||||
|
||||
can :read, Product, :platform => {:visibility => 'open'}
|
||||
|
@ -124,12 +127,13 @@ class Ability
|
|||
# Shared cannot rights for all users (registered, admin)
|
||||
cannot :destroy, Platform, :platform_type => 'personal'
|
||||
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
|
||||
cannot :clear, Platform, :platform_type => 'main'
|
||||
cannot :destroy, Issue
|
||||
|
||||
cannot [:members, :add_member, :remove_member, :remove_members], 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, :mass_builds], Platform, :platform_type => 'personal'
|
||||
|
||||
can :create, Subscribe do |subscribe|
|
||||
!subscribe.subscribeable.subscribes.exists?(:user_id => user.id)
|
||||
|
@ -150,21 +154,16 @@ class Ability
|
|||
relations.actor_type = 'Group' AND relations.actor_id IN (?)))", parent.classify, @user, @user.group_ids]
|
||||
end
|
||||
|
||||
def relation_exists_for(target, roles)
|
||||
target.relations.exists?(:actor_id => @user.id, :actor_type => 'User', :role => roles) or
|
||||
target.relations.exists?(:actor_id => @user.group_ids, :actor_type => 'Group', :role => roles)
|
||||
end
|
||||
|
||||
def local_reader?(target)
|
||||
relation_exists_for(target, %w{reader writer admin}) or owner?(target)
|
||||
%w{reader writer admin}.include? @user.best_role(target)
|
||||
end
|
||||
|
||||
def local_writer?(target)
|
||||
relation_exists_for(target, %w{writer admin}) or owner?(target)
|
||||
%w{writer admin}.include? @user.best_role(target)
|
||||
end
|
||||
|
||||
def local_admin?(target)
|
||||
relation_exists_for(target, 'admin') or owner?(target)
|
||||
@user.best_role(target) == 'admin'
|
||||
end
|
||||
|
||||
def owner?(target)
|
||||
|
|
|
@ -15,7 +15,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
recipients = record.collect_recipient_ids
|
||||
recipients.each do |recipient_id|
|
||||
recipient = User.find(recipient_id)
|
||||
UserMailer.delay.new_issue_notification(record, recipient) if User.find(recipient).notifier.can_notify && User.find(recipient).notifier.new_issue
|
||||
UserMailer.new_issue_notification(record, recipient).deliver if User.find(recipient).notifier.can_notify && User.find(recipient).notifier.new_issue
|
||||
ActivityFeed.create(
|
||||
:user => recipient,
|
||||
:kind => 'new_issue_notification',
|
||||
|
@ -25,7 +25,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
end
|
||||
|
||||
if record.assignee_id_changed?
|
||||
UserMailer.delay.issue_assign_notification(record, record.assignee) if record.assignee.notifier.issue_assign && record.assignee.notifier.can_notify
|
||||
UserMailer.new_issue_notification(record, record.assignee).deliver if record.assignee.notifier.issue_assign && record.assignee.notifier.can_notify
|
||||
ActivityFeed.create(
|
||||
:user => record.user,
|
||||
:kind => 'issue_assign_notification',
|
||||
|
@ -39,7 +39,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
subscribes = record.commentable.subscribes
|
||||
subscribes.each do |subscribe|
|
||||
if record.user_id != subscribe.user_id
|
||||
UserMailer.delay.new_comment_notification(record, subscribe.user) if record.can_notify_on_new_comment?(subscribe)
|
||||
UserMailer.new_comment_notification(record, subscribe.user).deliver if record.can_notify_on_new_comment?(subscribe)
|
||||
ActivityFeed.create(
|
||||
:user => subscribe.user,
|
||||
:kind => 'new_comment_notification',
|
||||
|
@ -57,7 +57,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
( (subscribe.project.owner?(subscribe.user) && subscribe.user.notifier.new_comment_commit_repo_owner) or
|
||||
(subscribe.user.commentor?(record.commentable) && subscribe.user.notifier.new_comment_commit_commentor) or
|
||||
(subscribe.user.committer?(record.commentable) && subscribe.user.notifier.new_comment_commit_owner) )
|
||||
UserMailer.delay.new_comment_notification(record, subscribe.user)
|
||||
UserMailer.new_comment_notification(record, subscribe.user).deliver
|
||||
end
|
||||
ActivityFeed.create(
|
||||
:user => subscribe.user,
|
||||
|
@ -94,26 +94,23 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
end
|
||||
|
||||
record.project.owner_and_admin_ids.each do |recipient|
|
||||
ActivityFeed.create(
|
||||
ActivityFeed.create!(
|
||||
:user => User.find(recipient),
|
||||
:kind => kind,
|
||||
:data => options
|
||||
)
|
||||
end
|
||||
|
||||
when 'Gollum::Committer'
|
||||
actor = User.find_by_uname(record.actor.name)
|
||||
project_name = record.wiki.path.match(/\/(\w+)\.wiki\.git$/)[1]
|
||||
project = Project.find_by_name(project_name)
|
||||
commit_sha = record.commit
|
||||
#wiki_name = record.wiki.name
|
||||
when 'Hash' # 'Gollum::Committer'
|
||||
actor = User.find_by_uname! record[:actor_name]
|
||||
project = Project.find record[:project_id]
|
||||
|
||||
project.owner_and_admin_ids.each do |recipient|
|
||||
ActivityFeed.create(
|
||||
ActivityFeed.create!(
|
||||
:user => User.find(recipient),#record.user,
|
||||
:kind => 'wiki_new_commit_notification',
|
||||
:data => {:user_id => actor.id, :user_name => actor.name, :user_email => actor.email, :project_id => project.id,
|
||||
:project_name => project_name, :commit_sha => commit_sha, :project_owner => project.owner.uname}
|
||||
:project_name => project.name, :commit_sha => record[:commit_sha], :project_owner => project.owner.uname}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -123,7 +120,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
|
|||
case record.class.to_s
|
||||
when 'Issue'
|
||||
if record.assignee_id && record.assignee_id_changed?
|
||||
UserMailer.delay.issue_assign_notification(record, record.assignee) if record.assignee.notifier.issue_assign && record.assignee.notifier.can_notify
|
||||
UserMailer.issue_assign_notification(record, record.assignee).deliver if record.assignee.notifier.issue_assign && record.assignee.notifier.can_notify
|
||||
ActivityFeed.create(
|
||||
:user => record.assignee,
|
||||
:kind => 'issue_assign_notification',
|
||||
|
|
|
@ -6,10 +6,13 @@ class Advisory < ActiveRecord::Base
|
|||
validates :description, :update_type, :presence => true
|
||||
|
||||
after_create :generate_advisory_id
|
||||
before_save :normalize_references, :if => :references_changed?
|
||||
|
||||
ID_TEMPLATE = 'ROSA-%<type>s-%<year>d:%<id>04d'
|
||||
TYPES = {'security' => 'SA', 'bugfix' => 'A'}
|
||||
|
||||
scope :by_project, lambda {|p| where('project_id' => p.try(:id) || p)}
|
||||
|
||||
def to_param
|
||||
advisory_id
|
||||
end
|
||||
|
@ -20,4 +23,15 @@ class Advisory < ActiveRecord::Base
|
|||
self.advisory_id = sprintf(ID_TEMPLATE, :type => TYPES[self.update_type], :year => Time.now.utc.year, :id => self.id)
|
||||
self.save
|
||||
end
|
||||
|
||||
def normalize_references
|
||||
self.references.gsub!(/\r| /, '')
|
||||
self.references = self.references.split('\n').map do |ref|
|
||||
ref = CGI::escapeHTML(ref)
|
||||
ref = "http://#{ref}" unless ref =~ %r[^http(s?)://*]
|
||||
ref
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
end
|
||||
Advisory.include_root_in_json = false
|
||||
|
|
|
@ -6,6 +6,7 @@ class BuildList < ActiveRecord::Base
|
|||
belongs_to :build_for_platform, :class_name => 'Platform'
|
||||
belongs_to :user
|
||||
belongs_to :advisory
|
||||
belongs_to :mass_build
|
||||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
|
||||
|
||||
|
@ -16,8 +17,8 @@ class BuildList < ActiveRecord::Base
|
|||
validates_numericality_of :priority, :greater_than_or_equal_to => 0
|
||||
validates :update_type, :inclusion => UPDATE_TYPES,
|
||||
:unless => Proc.new { |b| b.save_to_platform.released }
|
||||
validates :update_type, :inclusion => RELEASE_UPDATE_TYPES,
|
||||
:if => Proc.new { |b| b.save_to_platform.released }
|
||||
validates :update_type, :inclusion => {:in => RELEASE_UPDATE_TYPES, :message => I18n.t('flash.build_list.frozen_platform')},
|
||||
:if => Proc.new { |b| b.save_to_platform.released && b.mass_build_id.nil?}
|
||||
validate lambda {
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
|
||||
}
|
||||
|
@ -72,6 +73,8 @@ class BuildList < ActiveRecord::Base
|
|||
scope :recent, order("#{table_name}.updated_at DESC")
|
||||
scope :for_status, lambda {|status| where(:status => status) }
|
||||
scope :for_user, lambda { |user| where(:user_id => user.id) }
|
||||
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform.id) }
|
||||
scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build) }
|
||||
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
|
||||
scope :scoped_to_project_version, lambda {|project_version| where(:project_version => project_version) }
|
||||
scope :scoped_to_is_circle, lambda {|is_circle| where(:is_circle => is_circle) }
|
||||
|
@ -93,8 +96,105 @@ class BuildList < ActiveRecord::Base
|
|||
serialize :additional_repos
|
||||
serialize :include_repos
|
||||
|
||||
before_create :set_default_status
|
||||
after_create :place_build
|
||||
after_commit :place_build
|
||||
after_destroy :delete_container
|
||||
|
||||
@queue = :clone_and_build
|
||||
|
||||
state_machine :status, :initial => :waiting_for_response do
|
||||
|
||||
after_transition :on => :published, :do => :set_version_and_tag
|
||||
|
||||
event :place_build do
|
||||
transition :waiting_for_response => :build_pending, :if => lambda { |build_list|
|
||||
build_list.add_to_queue == BuildServer::SUCCESS
|
||||
}
|
||||
[
|
||||
'BuildList::BUILD_PENDING',
|
||||
'BuildServer::PLATFORM_PENDING',
|
||||
'BuildServer::PLATFORM_NOT_FOUND',
|
||||
'BuildServer::PROJECT_NOT_FOUND',
|
||||
'BuildServer::PROJECT_VERSION_NOT_FOUND'
|
||||
].each do |code|
|
||||
transition :waiting_for_response => code.demodulize.downcase.to_sym, :if => lambda { |build_list|
|
||||
build_list.add_to_queue == code.constantize
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
event :start_build do
|
||||
transition [ :build_pending,
|
||||
:platform_pending,
|
||||
:platform_not_found,
|
||||
:project_not_found,
|
||||
:project_version_not_found ] => :build_started
|
||||
end
|
||||
|
||||
event :cancel do
|
||||
transition [:build_pending, :platform_pending] => :build_canceled, :if => lambda { |build_list|
|
||||
build_list.can_cancel? && BuildServer.delete_build_list(build_list.bs_id) == BuildServer::SUCCESS
|
||||
}
|
||||
end
|
||||
|
||||
event :published do
|
||||
transition [:build_publish, :rejected_publish] => :build_published
|
||||
end
|
||||
|
||||
event :fail_publish do
|
||||
transition [:build_publish, :rejected_publish] => :failed_publish
|
||||
end
|
||||
|
||||
event :publish do
|
||||
transition [:success, :failed_publish] => :build_publish, :if => lambda { |build_list|
|
||||
BuildServer.publish_container(build_list.bs_id) == BuildServer::SUCCESS
|
||||
}
|
||||
transition [:success, :failed_publish] => :failed_publish
|
||||
end
|
||||
|
||||
event :reject_publish do
|
||||
transition :success => :rejected_publish, :if => :can_reject_publish?
|
||||
end
|
||||
|
||||
event :build_success do
|
||||
transition [:build_started, :build_canceled] => :success
|
||||
end
|
||||
|
||||
event :build_error do
|
||||
transition [:build_started, :build_canceled] => :build_error
|
||||
end
|
||||
|
||||
HUMAN_STATUSES.each do |code,name|
|
||||
state name, :value => code
|
||||
end
|
||||
end
|
||||
|
||||
later :publish, :queue => :clone_build
|
||||
|
||||
def set_version_and_tag
|
||||
pkg = self.packages.where(:package_type => 'source', :project_id => self.project_id).first
|
||||
self.package_version = "#{pkg.platform.name}-#{pkg.version}-#{pkg.release}"
|
||||
system("cd #{self.project.git_repository.path} && git tag #{self.package_version} #{self.commit_hash}") # TODO REDO through grit
|
||||
save
|
||||
end
|
||||
|
||||
#TODO: Share this checking on product owner.
|
||||
def can_cancel?
|
||||
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include? status && bs_id
|
||||
end
|
||||
|
||||
def can_publish?
|
||||
[BuildServer::SUCCESS, FAILED_PUBLISH].include? status
|
||||
end
|
||||
|
||||
def can_reject_publish?
|
||||
can_publish? and save_to_platform.released
|
||||
end
|
||||
|
||||
|
||||
def add_to_queue
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority
|
||||
@status ||= BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority
|
||||
end
|
||||
|
||||
def self.human_status(status)
|
||||
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
|
||||
|
@ -122,38 +222,6 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def publish
|
||||
return false unless can_publish?
|
||||
has_published = BuildServer.publish_container bs_id
|
||||
update_attribute(:status, has_published == 0 ? BUILD_PUBLISH : FAILED_PUBLISH)
|
||||
return has_published == 0
|
||||
end
|
||||
|
||||
def can_publish?
|
||||
status == BuildServer::SUCCESS or status == FAILED_PUBLISH
|
||||
end
|
||||
|
||||
def reject_publish
|
||||
return false unless can_reject_publish?
|
||||
update_attribute(:status, REJECTED_PUBLISH)
|
||||
end
|
||||
|
||||
def can_reject_publish?
|
||||
can_publish? and save_to_platform.released
|
||||
end
|
||||
|
||||
def cancel
|
||||
return false unless can_cancel?
|
||||
has_canceled = BuildServer.delete_build_list bs_id
|
||||
update_attribute(:status, BUILD_CANCELED) if has_canceled == 0
|
||||
return has_canceled == 0
|
||||
end
|
||||
|
||||
#TODO: Share this checking on product owner.
|
||||
def can_cancel?
|
||||
status == BUILD_PENDING && bs_id
|
||||
end
|
||||
|
||||
def event_log_message
|
||||
{:project => project.name, :version => project_version, :arch => arch.name}.inspect
|
||||
end
|
||||
|
@ -177,16 +245,12 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
protected
|
||||
|
||||
def set_default_status
|
||||
self.status = WAITING_FOR_RESPONSE unless self.status.present?
|
||||
return true
|
||||
def delete_container
|
||||
if can_cancel?
|
||||
BuildServer.delete_build_list bs_id
|
||||
else
|
||||
BuildServer.delete_container bs_id if bs_id # prevent error if bs_id does not set
|
||||
end
|
||||
|
||||
def place_build
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority
|
||||
self.status = BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority
|
||||
self.status = BUILD_PENDING if self.status == 0
|
||||
save
|
||||
end
|
||||
|
||||
def build_package(pkg_hash, package_type, prj)
|
||||
|
|
|
@ -18,6 +18,7 @@ class BuildList::Filter
|
|||
build_lists = build_lists.scoped_to_project_version(@options[:project_version]) if @options[:project_version]
|
||||
build_lists = build_lists.scoped_to_is_circle(@options[:is_circle]) if @options[:is_circle].present?
|
||||
build_lists = build_lists.scoped_to_project_name(@options[:project_name]) if @options[:project_name]
|
||||
build_lists = build_lists.by_mass_build(@options[:mass_build_id]) if @options[:mass_build_id]
|
||||
|
||||
if @options[:created_at_start] || @options[:created_at_end]
|
||||
build_lists = build_lists.for_creation_date_period(@options[:created_at_start], @options[:created_at_end])
|
||||
|
@ -53,7 +54,8 @@ class BuildList::Filter
|
|||
:is_circle => nil,
|
||||
:project_version => nil,
|
||||
:bs_id => nil,
|
||||
:project_name => nil
|
||||
:project_name => nil,
|
||||
:mass_build_id => nil
|
||||
}))
|
||||
|
||||
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'index' : 'owned')
|
||||
|
@ -67,6 +69,7 @@ class BuildList::Filter
|
|||
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
|
||||
@options[:bs_id] = @options[:bs_id].presence
|
||||
@options[:project_name] = @options[:project_name].presence
|
||||
@options[:mass_build_id] = @options[:mass_build_id].presence
|
||||
end
|
||||
|
||||
def build_date_from_params(field_name, params)
|
||||
|
|
|
@ -3,10 +3,12 @@ class GitHook
|
|||
attr_reader :repo, :newrev, :oldrev, :newrev_type, :oldrev_type, :refname,
|
||||
:change_type, :rev, :rev_type, :refname_type, :owner, :project
|
||||
|
||||
def initialize(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type)
|
||||
include Resque::Plugins::Status
|
||||
|
||||
def initialize(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type = nil)
|
||||
@repo, @newrev, @oldrev, @refname, @newrev_type, @oldrev_type = repo, newrev, oldrev, ref, newrev_type, oldrev_type
|
||||
if @owner = User.where(:uname => owner_uname).first || Group.where(:uname => owner_uname).first
|
||||
@project = @owner.projects.where(:name => repo).first
|
||||
if @owner = User.where(:uname => owner_uname).first || Group.where(:uname => owner_uname).first!
|
||||
@project = @owner.own_projects.where(:name => repo).first!
|
||||
end
|
||||
@change_type = git_change_type
|
||||
git_revision_types
|
||||
|
@ -55,4 +57,8 @@ class GitHook
|
|||
@refname_type= "*** Unknown type of update to $refname (#{rev_type})"
|
||||
end
|
||||
end
|
||||
|
||||
def self.process(*args)
|
||||
ActivityFeedObserver.instance.after_create(args.size > 1 ? GitHook.new(*args) : args.first)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
class MassBuild < ActiveRecord::Base
|
||||
belongs_to :platform
|
||||
belongs_to :user
|
||||
has_many :build_lists, :dependent => :destroy
|
||||
|
||||
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }
|
||||
|
||||
attr_accessor :repositories, :arches
|
||||
|
||||
validates :platform_id, :arch_names, :name, :user_id, :repositories, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
||||
after_create :build_all
|
||||
|
||||
def initialize(args = nil)
|
||||
super
|
||||
|
||||
if new_record?
|
||||
rep_names = Repository.where(:id => self.repositories).map(&:name).join(", ")
|
||||
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
|
||||
self.arch_names = Arch.where(:id => self.arches).map(&:name).join(", ")
|
||||
end
|
||||
end
|
||||
|
||||
# ATTENTION: repositories and arches must be set before calling this method!
|
||||
def build_all
|
||||
platform.build_all(
|
||||
:mass_build_id => self.id,
|
||||
:user => self.user,
|
||||
:repositories => self.repositories,
|
||||
:arches => self.arches,
|
||||
:auto_publish => self.auto_publish
|
||||
) # later with resque
|
||||
end
|
||||
end
|
|
@ -17,9 +17,11 @@ class Platform < ActiveRecord::Base
|
|||
|
||||
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
|
||||
|
||||
has_many :mass_builds
|
||||
|
||||
validates :description, :presence => true
|
||||
validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES}
|
||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-]+$/ }
|
||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\.]+$/ }
|
||||
validates :distrib_type, :presence => true, :inclusion => {:in => APP_CONFIG['distr_types']}
|
||||
|
||||
before_create :create_directory, :if => lambda {Thread.current[:skip]} # TODO remove this when core will be ready
|
||||
|
@ -46,6 +48,10 @@ class Platform < ActiveRecord::Base
|
|||
|
||||
include Modules::Models::Owner
|
||||
|
||||
def clear
|
||||
system("rm -Rf #{ APP_CONFIG['root_path'] }/platforms/#{ self.name }/repository/*")
|
||||
end
|
||||
|
||||
def urpmi_list(host, pair = nil)
|
||||
blank_pair = {:login => 'login', :pass => 'password'}
|
||||
pair = blank_pair if pair.blank?
|
||||
|
@ -102,11 +108,10 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def base_clone(attrs = {}) # :description, :name, :owner
|
||||
clone.tap do |c|
|
||||
# c.attributes = attrs #
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.parent = self
|
||||
dup.tap do |c|
|
||||
attrs.each {|k,v| c.send("#{k}=", v)} # c.attributes = attrs
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
c.parent = self; c.released = false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -117,7 +122,7 @@ class Platform < ActiveRecord::Base
|
|||
|
||||
def full_clone(attrs = {})
|
||||
base_clone(attrs).tap do |c|
|
||||
with_skip {c.save} and c.clone_relations(self) and c.delay.xml_rpc_clone
|
||||
with_skip {c.save} and c.clone_relations(self) and c.xml_rpc_clone # later with resque
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -155,26 +160,35 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def build_all(user)
|
||||
def build_all(opts={})
|
||||
# Set options to build all need
|
||||
repositories = opts[:repositories] ? self.repositories.where(:id => opts[:repositories]) : self.repositories
|
||||
arches = opts[:arches] ? Arch.where(:id => opts[:arches]) : Arch.all
|
||||
auto_publish = opts[:auto_publish] || false
|
||||
user = opts[:user]
|
||||
mass_build_id = opts[:mass_build_id]
|
||||
|
||||
repositories.each do |rep|
|
||||
rep.projects.find_in_batches(:batch_size => 2) do |group|
|
||||
sleep 1
|
||||
group.each do |p|
|
||||
Arch.all.map(&:name).each do |arch|
|
||||
arches.map(&:name).each do |arch|
|
||||
begin
|
||||
p.build_for(self, user, arch)
|
||||
p.build_for(self, user, arch, auto_publish, mass_build_id)
|
||||
rescue RuntimeError, Exception
|
||||
p.delay.build_for(self, user, arch)
|
||||
# p.async(:build_for, self, user, arch, auto_publish, mass_build_id) # TODO need this?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
later :build_all, :loner => true, :queue => :clone_build
|
||||
|
||||
def destroy
|
||||
with_skip {super} # avoid cascade XML RPC requests
|
||||
end
|
||||
later :destroy, :queue => :clone_build
|
||||
|
||||
protected
|
||||
|
||||
|
@ -208,6 +222,7 @@ class Platform < ActiveRecord::Base
|
|||
raise "Failed to clone platform #{old_name} with code #{result}. Path: #{build_path(old_name)} to platform #{new_name}"
|
||||
end
|
||||
end
|
||||
later :xml_rpc_clone, :loner => true, :queue => :clone_build
|
||||
|
||||
def freeze_platform
|
||||
if released_changed? && released == true
|
||||
|
|
|
@ -54,10 +54,10 @@ class Product < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def full_clone(attrs = {})
|
||||
clone.tap do |c| # dup
|
||||
dup.tap do |c|
|
||||
c.platform_id = nil
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ class Project < ActiveRecord::Base
|
|||
|
||||
after_create :attach_to_personal_repository
|
||||
after_create :create_git_repo
|
||||
after_create {|p| p.delay(:queue => 'fork', :priority => 20).fork_git_repo unless is_root?}
|
||||
after_create {|p| p.fork_git_repo unless p.is_root?}
|
||||
after_save :create_wiki
|
||||
|
||||
after_destroy :destroy_git_repo
|
||||
after_destroy :destroy_wiki
|
||||
after_save {|p| p.delay(:queue => 'import', :priority => 10).import_attached_srpm if p.srpm?} # should be after create_git_repo
|
||||
after_save {|p| p.import_attached_srpm if p.srpm?} # later with resque # should be after create_git_repo
|
||||
# after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||
|
||||
has_ancestry
|
||||
|
@ -71,26 +71,26 @@ class Project < ActiveRecord::Base
|
|||
find_by_owner_and_name(owner_name, project_name) or raise ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
def build_for(platform, user, arch = 'i586', priority = 0)
|
||||
def build_for(platform, user, arch = 'i586', auto_publish = false, mass_build_id = nil, priority = 0)
|
||||
# Select main and project platform repository(contrib, non-free and etc)
|
||||
# If main does not exist, will connect only project platform repository
|
||||
# If project platform repository is main, only main will be connect
|
||||
build_reps = [platform.repositories.find_by_name('main')]
|
||||
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
|
||||
build_ids = build_reps.compact.map(&:id).uniq
|
||||
|
||||
build_reps_ids = build_reps.compact.map(&:id).uniq
|
||||
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
||||
build_lists.create do |bl|
|
||||
bl.save_to_platform = platform
|
||||
bl.build_to_platform = platform
|
||||
bl.build_for_platform = platform
|
||||
bl.update_type = 'newpackage'
|
||||
bl.arch = arch
|
||||
bl.project_version = "latest_#{platform.name}"
|
||||
bl.build_requires = false # already set as db default
|
||||
bl.user = user
|
||||
bl.auto_publish = true # already set as db default
|
||||
bl.include_repos = build_ids
|
||||
bl.auto_publish = auto_publish
|
||||
bl.include_repos = build_reps_ids
|
||||
bl.priority = priority
|
||||
bl.mass_build_id = mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -220,11 +220,6 @@ class Project < ActiveRecord::Base
|
|||
owner == user
|
||||
end
|
||||
|
||||
def self.process_hook(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type)
|
||||
rec = GitHook.new(owner_uname, repo, newrev, oldrev, ref, newrev_type, oldrev_type)
|
||||
ActivityFeedObserver.instance.after_create rec
|
||||
end
|
||||
|
||||
def owner_and_admin_ids
|
||||
recipients = self.relations.by_role('admin').where(:actor_type => 'User').map { |rel| rel.read_attribute(:actor_id) }
|
||||
recipients = recipients | [self.owner_id] if self.owner_type == 'User'
|
||||
|
@ -257,7 +252,7 @@ class Project < ActiveRecord::Base
|
|||
def create_git_repo
|
||||
if is_root?
|
||||
Grit::Repo.init_bare(path)
|
||||
write_hook.delay(:queue => 'fork', :priority => 15)
|
||||
write_hook
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -265,6 +260,7 @@ class Project < ActiveRecord::Base
|
|||
dummy = Grit::Repo.new(path) rescue parent.git_repository.repo.fork_bare(path)
|
||||
write_hook
|
||||
end
|
||||
later :fork_git_repo, :queue => :fork_import
|
||||
|
||||
def destroy_git_repo
|
||||
FileUtils.rm_rf path
|
||||
|
@ -276,7 +272,7 @@ class Project < ActiveRecord::Base
|
|||
self.srpm = nil; save # clear srpm
|
||||
end
|
||||
end
|
||||
|
||||
later :import_attached_srpm, :queue => :fork_import
|
||||
|
||||
def create_wiki
|
||||
if has_wiki && !FileTest.exist?(wiki_path)
|
||||
|
@ -296,7 +292,7 @@ class Project < ActiveRecord::Base
|
|||
hook = File.join(::Rails.root.to_s, 'tmp', "post-receive-hook")
|
||||
FileUtils.cp(File.join(::Rails.root.to_s, 'bin', "post-receive-hook.partial"), hook)
|
||||
File.open(hook, 'a') do |f|
|
||||
s = "\n /bin/bash -l -c \"cd #{is_production ? '/srv/rosa_build/current' : Rails.root.to_s} && #{is_production ? 'RAILS_ENV=production' : ''} bundle exec rails runner 'Project.delay(:queue => \\\"hook\\\").process_hook(\\\"$owner\\\", \\\"$reponame\\\", \\\"$newrev\\\", \\\"$oldrev\\\", \\\"$ref\\\", \\\"$newrev_type\\\", \\\"$oldrev_type\\\")'\""
|
||||
s = "\n /bin/bash -l -c \"cd #{is_production ? '/srv/rosa_build/current' : Rails.root.to_s} && #{is_production ? 'RAILS_ENV=production' : ''} bundle exec rake hook:enqueue[$owner,$reponame,$newrev,$oldrev,$ref,$newrev_type,$oldrev_type]\""
|
||||
s << " > /dev/null 2>&1" if is_production
|
||||
s << "\ndone\n"
|
||||
f.write(s)
|
||||
|
|
|
@ -17,10 +17,10 @@ class Repository < ActiveRecord::Base
|
|||
attr_readonly :name, :platform_id
|
||||
|
||||
def base_clone(attrs = {})
|
||||
clone.tap do |c| # dup
|
||||
dup.tap do |c|
|
||||
c.platform_id = nil
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -29,10 +29,11 @@ class Repository < ActiveRecord::Base
|
|||
from.projects.find_each {|p| self.projects << p}
|
||||
end
|
||||
end
|
||||
later :clone_relations, :loner => true, :queue => :clone_build
|
||||
|
||||
def full_clone(attrs = {})
|
||||
base_clone(attrs).tap do |c|
|
||||
with_skip {c.save} and c.delay.clone_relations(self)
|
||||
with_skip {c.save} and c.clone_relations(self) # later with resque
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -129,4 +129,28 @@ class User < ActiveRecord::Base
|
|||
false
|
||||
end
|
||||
end
|
||||
|
||||
def best_role target
|
||||
roles = target_roles(target)
|
||||
return nil if roles.count == 0
|
||||
%w(admin writer reader).each {|role| return role if roles.include?(role)}
|
||||
raise "unknown user #{self.uname} roles #{roles}"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def target_roles target
|
||||
rel, gr, roles = target.relations, self.groups, []
|
||||
|
||||
if target.owner.class == Group
|
||||
owner_group = self.groups.where(:id => target.owner.id).first
|
||||
roles += owner_group.actors.where(:actor_id => self) if owner_group# user group is owner
|
||||
|
||||
gr = gr.where('groups.id != ?', target.owner.id) # exclude target owner group from users group list
|
||||
end
|
||||
roles += rel.where(:actor_id => self.id, :actor_type => 'User') # user is member
|
||||
roles += rel.where(:actor_id => gr, :actor_type => 'Group') # user group is member
|
||||
roles.map(&:role).uniq
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
json.array!(advisories) do |json, a|
|
||||
json.id a.advisory_id
|
||||
json.advisory_id a.advisory_id
|
||||
json.description simple_format(a.description)
|
||||
json.popover_desc truncate(a.description, :length => 500);
|
||||
json.references a.references.split("\n").map{|ref| construct_ref_link(ref)}.join('<br />')
|
||||
json.update_type a.update_type
|
||||
end
|
|
@ -10,9 +10,15 @@
|
|||
= link_to t("layout.platforms.about"), platform_path(@platform)
|
||||
%li{:class => (contr == :repositories) ? 'active' : ''}
|
||||
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
|
||||
- if can? :mass_builds, @platform
|
||||
%li{:class => (contr == :platforms && [:mass_builds, :build_all].include?(act)) ? 'active' : ''}
|
||||
= link_to t("layout.platforms.mass_build"), mass_builds_platform_path(@platform)
|
||||
- if can? :read, @platform.products.build
|
||||
%li{:class => (contr == :products) ? 'active' : ''}
|
||||
= link_to t("layout.products.list_header"), platform_products_path(@platform)
|
||||
- if can? :read_advisories, @platform
|
||||
%li{:class => (contr == :platforms and act == :advisories) ? 'active' : ''}
|
||||
= link_to t("layout.advisories.list_header"), advisories_platform_path(@platform)
|
||||
- if can? :update, @platform
|
||||
%li{:class => (act == :edit && contr == :platforms) ? 'active' : nil}
|
||||
= link_to t("platform_menu.settings"), edit_platform_path(@platform)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.th1= t("activerecord.attributes.advisory.advisory_id")
|
||||
%th.th2= t("activerecord.attributes.advisory.description")
|
||||
%tbody
|
||||
= render :partial => 'advisory', :collection => @advisories, :as => :advisory
|
|
@ -0,0 +1,3 @@
|
|||
%tr{:class => cycle("odd", "even")}
|
||||
%td= link_to advisory.advisory_id, advisory_path(advisory)
|
||||
%td= truncate(advisory.description, :length => 50)
|
|
@ -0,0 +1,6 @@
|
|||
- set_meta_tags :title => [title_object(@platform), t('layout.advisories.list_header')]
|
||||
= render 'submenu'
|
||||
= render 'sidebar'
|
||||
|
||||
= render :partial => 'advisories', :object => @advisories
|
||||
= will_paginate @advisories
|
|
@ -0,0 +1,45 @@
|
|||
= render 'submenu'
|
||||
= render 'sidebar'
|
||||
|
||||
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
|
||||
%section.left
|
||||
%h3= t("layout.mass_builds.repositories")
|
||||
- @platform.repositories.each do |rep|
|
||||
.both
|
||||
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}"
|
||||
= label_tag "repositories_#{rep.id}", rep.name
|
||||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
%section.right
|
||||
%h3= t("activerecord.attributes.build_list.arch")
|
||||
- Arch.recent.each do |arch|
|
||||
.lefter
|
||||
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
|
||||
= label_tag "arches_#{arch.id}", arch.name
|
||||
.both
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.both.bottom_20
|
||||
= check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : false, :id => 'auto_publish'
|
||||
= label_tag :auto_publish
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
%table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.id')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.name')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.arch_names')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.user')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.auto_publish')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.created_at')
|
||||
- @mass_builds.each do |mass_build|
|
||||
%tr
|
||||
%td= mass_build.id
|
||||
%td= link_to mass_build.name, build_lists_path(:filter => {:mass_build_id => mass_build.id})
|
||||
%td= mass_build.arch_names
|
||||
%td= link_to mass_build.user.fullname, mass_build.user
|
||||
%td= mass_build.auto_publish
|
||||
%td= mass_build.created_at
|
||||
= will_paginate @mass_builds
|
|
@ -9,3 +9,8 @@
|
|||
.hr
|
||||
.leftside= t("layout.platforms.delete_warning")
|
||||
.rightside= link_to t("layout.delete"), platform_path(@platform), :method => :delete, :confirm => t("layout.platforms.confirm_delete"), :class => 'button'
|
||||
- if can? :clear, @platform
|
||||
.hr
|
||||
.leftside= t("layout.repositories.clear_warning")
|
||||
.rightside= link_to t("layout.repositories.clear"), clear_platform_path(@platform), :class => 'button', :confirm => t('layout.repositories.clear_confirm'), :method => :post
|
||||
.both
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
%td
|
||||
.img
|
||||
= image_tag avatar_url(user)
|
||||
.forimg= link_to "#{user.uname} (#{user.name})", user_path(user)
|
||||
.forimg= link_to user.fullname, user_path(user)
|
||||
- if can? :remove_member, @platform
|
||||
%td.buttons
|
||||
= link_to remove_member_platform_path(@platform, :member_id => user.id), :method => :delete, :confirm => t("layout.confirm") do
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
%td= @platform.distrib_type
|
||||
|
||||
.buttons_block
|
||||
- if can? :build_all, @platform
|
||||
= link_to t("layout.platforms.build_all"), build_all_platform_path(@platform), :confirm => I18n.t("layout.confirm"), :method => :post, :class => "button left_floated"
|
||||
= link_to I18n.t("layout.platforms.clone"), clone_platform_path(@platform), :class => "button left_floated" if can? :clone, @platform
|
||||
|
||||
= render 'connection_info' if @platform.platform_type == 'personal' and @platform.visibility == 'open'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
|
||||
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
|
||||
%td= build_list.mass_build_id ? link_to(build_list.mass_build.name, mass_builds_platform_path(build_list.save_to_platform)) : ""
|
||||
%td= build_list.human_status
|
||||
%td= link_to build_list.project.name, build_list.project
|
||||
%td= link_to build_list.project_version, "#"
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
%br
|
||||
= f.submit t("layout.search.header")
|
||||
.block
|
||||
%h3.small= t("activerecord.attributes.build_list.mass_build")
|
||||
.lineForm.aside= f.select :mass_build_id, options_from_collection_for_select( MassBuild.all, :id, :name, @filter.mass_build_id ), {:include_blank => true}
|
||||
%h3.small= t("activerecord.attributes.build_list.status")
|
||||
.lineForm.aside= f.select :status, BuildList::STATUSES.collect{|status| [BuildList.human_status(status), status]}, {:include_blank => true, :selected => @filter.status}, {:class => 'sel80 aside', :id => 'status', :tabindex => 2}
|
||||
%h3.small= t("activerecord.attributes.build_list.is_circle")
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.bs_id")
|
||||
%th.lpadding16= t('activerecord.attributes.build_list.mass_build_id')
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.status")
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.project")
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.project_version")
|
||||
|
|
|
@ -72,12 +72,33 @@
|
|||
.both
|
||||
|
||||
- if @build_list.can_publish? and @build_list.save_to_platform.released and @build_list.advisory.nil?
|
||||
.leftlist= label_tag :create_advisory, t("layout.build_lists.create_advisory")
|
||||
.rightlist= check_box_tag :create_advisory, 1, false
|
||||
#advisory_block
|
||||
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
|
||||
.rightlist= select_tag :attach_advisory, advisories_select_options(@advisories)
|
||||
.both
|
||||
|
||||
#new_advisory_form
|
||||
= f.fields_for @build_list.build_advisory do |f|
|
||||
= render :partial => 'advisories/form', :locals => {:f => f}
|
||||
|
||||
#advisory_preview
|
||||
%h3= t("activerecord.models.advisory") << ' '
|
||||
|
||||
.leftlist= t("activerecord.attributes.advisory.description")
|
||||
.rightlist.descr
|
||||
.both
|
||||
|
||||
.leftlist= t("activerecord.attributes.advisory.references")
|
||||
.rightlist.refs
|
||||
.both
|
||||
|
||||
:javascript
|
||||
$(function() {
|
||||
Rosa.bootstrapedData.advisories = #{ render 'advisories/advisories.json.jbuilder',
|
||||
:advisories => @advisories };
|
||||
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
|
||||
});
|
||||
|
||||
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if @build_list.can_publish? and can?(:publish, @build_list)
|
||||
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish' if @build_list.can_reject_publish? and can?(:reject_publish, @build_list)
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
%td
|
||||
.img
|
||||
= image_tag avatar_url(user)
|
||||
.forimg= link_to "#{user.uname} (#{user.name})", user_path(user)
|
||||
.forimg= link_to user.fullname, user_path(user)
|
||||
- Relation::ROLES.each_with_index do |role, i|
|
||||
%td
|
||||
.radio
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
- if owner.projects.exists? :name => @project.name
|
||||
- if owner.own_projects.exists? :name => @project.name
|
||||
- is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : ''
|
||||
%p.center
|
||||
=t 'layout.projects.already_exists'
|
||||
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner.projects.by_name(@project.name).first)
|
||||
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner, @project.name)
|
||||
- else
|
||||
= 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
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
- if @issue.assignee
|
||||
#user-0.people.nopointer
|
||||
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
|
||||
.name="#{@issue.user.uname} (#{@issue.assignee.name})"
|
||||
.name=@issue.assignee.fullname
|
||||
=hidden_field_tag "user-0", @issue.assignee.id, :name => 'issue[assignee_id]'
|
||||
.both
|
||||
- elsif @issue.assignee
|
||||
.people.nopointer
|
||||
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
|
||||
.name="#{@issue.assignee.uname} (#{@issue.assignee.name})"
|
||||
.name=@issue.assignee.fullname
|
||||
.both
|
||||
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
|
||||
- if can_manage
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- (@users || []).each_with_index do |user, index|
|
||||
.people.selected{:id => "user-#{index}", :class => 'add_assignee'}
|
||||
.avatar= image_tag(avatar_url(user), :alt => 'avatar')
|
||||
.name="#{user.uname} (#{user.name})"
|
||||
.name=user.fullname
|
||||
=hidden_field_tag "user-#{index}", user.id, :name => 'issue[assignee_id]'
|
||||
.both
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
.state=t('layout.issues.status.closed')
|
||||
.text
|
||||
.avatar= image_tag(avatar_url(@issue.closer), :alt => 'avatar')
|
||||
.name="#{@issue.closer.uname} (#{@issue.closer.name}) #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
.name="#{@issue.closer.fullname} #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
.both
|
||||
%br/
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.image
|
||||
=image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user
|
||||
.text
|
||||
%span.name=link_to("#{@issue.user.uname} (#{@issue.user.name})", user_path(@issue.user)) if @issue.user
|
||||
%span.name=link_to(@issue.user.fullname, user_path(@issue.user)) if @issue.user
|
||||
%br/
|
||||
%span.date=@issue.created_at.to_s(:long)
|
||||
%br/
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
%td
|
||||
- c = participant_class(alone_member, project)
|
||||
%span{:class => c, :title => t("layout.relations.#{c}")}
|
||||
= t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}")
|
||||
= t("layout.collaborators.role_names.#{current_user.best_role project}")
|
||||
%td.td5
|
||||
- unless project.owner == current_user or !alone_member
|
||||
= link_to remove_user_project_path(project), :method => :delete, :confirm => t("layout.confirm") do
|
||||
|
|
|
@ -5,7 +5,7 @@ json.project do |proj|
|
|||
proj.description project.description
|
||||
proj.link project_path(project)
|
||||
|
||||
proj.role t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}").force_encoding(Encoding::UTF_8)
|
||||
proj.role t("layout.collaborators.role_names.#{current_user.best_role project}").force_encoding(Encoding::UTF_8)
|
||||
|
||||
proj.leave_link remove_user_project_path(project) unless project.owner == current_user or !alone_member? project
|
||||
proj.rights_class participant_class(alone_member?(project), project)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
= image_tag avatar_url_by_email(v.author.email), :alt => "avatar: #{v.author.name}", :class => 'mini-gravatar'
|
||||
.name
|
||||
= link_to user_path_by_user(user) do
|
||||
%span.username= user.present? ? "#{user.uname} (#{user.name})" : v.author.name
|
||||
%span.username= user.present? ? user.fullname : v.author.name
|
||||
.both
|
||||
%td.td3
|
||||
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
|
||||
|
|
|
@ -35,8 +35,9 @@ set :deploy_via, :remote_cache
|
|||
|
||||
require './lib/recipes/nginx'
|
||||
require './lib/recipes/unicorn'
|
||||
require './lib/recipes/bluepill'
|
||||
require './lib/recipes/delayed_job'
|
||||
#require './lib/recipes/bluepill'
|
||||
set :workers_count, 4
|
||||
require './lib/recipes/resque'
|
||||
|
||||
namespace :deploy do
|
||||
task :stub_xml_rpc do
|
||||
|
@ -82,12 +83,16 @@ end
|
|||
after "deploy:finalize_update", "deploy:symlink_all"
|
||||
after "deploy:update_code", "deploy:migrate"
|
||||
after "deploy:setup", "deploy:symlink_pids"
|
||||
# after "deploy:restart", "bluepill:start" # "bluepill:processes:restart_dj" # "bluepill:restart"
|
||||
|
||||
# DJ
|
||||
after "deploy:stop", "delayed_job:stop"
|
||||
after "deploy:start", "delayed_job:start"
|
||||
after "deploy:restart", "delayed_job:restart"
|
||||
# Bluepill
|
||||
#after "deploy:restart", "bluepill:restart" # "bluepill:processes:restart_dj" # "bluepill:restart"
|
||||
#after "deploy:start", "bluepill:start"
|
||||
#after "deploy:stop", "bluepill:stop"
|
||||
|
||||
# Resque
|
||||
after "deploy:stop", "resque:stop"
|
||||
after "deploy:start", "resque:start"
|
||||
after "deploy:restart", "resque:restart"
|
||||
|
||||
after "deploy:restart", "deploy:cleanup"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ production:
|
|||
action_mailer_host: "abf.rosalinux.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@rosalinux.ru
|
||||
project_name: ABF
|
||||
repo_project_name: ABF
|
||||
build_server_ip: 127.0.0.1
|
||||
|
|
|
@ -12,7 +12,7 @@ production:
|
|||
action_mailer_host: "school.rosalab.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@school.rosalab.ru
|
||||
build_server_ip: 127.0.0.1
|
||||
build_server_port: 12555
|
||||
build_server_path: /xmlrpc
|
||||
|
|
|
@ -2,7 +2,7 @@ production:
|
|||
action_mailer_host: "dev-abf.rosalinux.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@dev-abf.rosalinux.ru
|
||||
project_name: ABF
|
||||
repo_project_name: ABF
|
||||
build_server_ip: 127.0.0.1
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
require 'resque/server'
|
||||
require 'resque/status_server'
|
||||
|
||||
::ResqueServer = ::Resque::Server # need for CanCan
|
||||
|
||||
Resque::Mailer.default_queue_name = :notification
|
||||
Resque::Mailer.excluded_environments = [:test]
|
||||
|
||||
unless Rails.env.test?
|
||||
PerformLater.config.enabled = true # this will default to false if unset
|
||||
end
|
||||
|
||||
Resque::Plugins::Status::Hash.expire_in = (24 * 60 * 60) # 24hrs in seconds
|
|
@ -39,3 +39,4 @@ en:
|
|||
users: Users
|
||||
register_requests: Invites
|
||||
event_logs: Event log
|
||||
resque_server: Resque
|
||||
|
|
|
@ -39,3 +39,4 @@ ru:
|
|||
users: Пользователи
|
||||
register_requests: Инвайты
|
||||
event_logs: Лог событий
|
||||
resque_server: Resque
|
||||
|
|
|
@ -6,6 +6,8 @@ en:
|
|||
project_name: Project
|
||||
affected_versions: Affected versions
|
||||
ref_comment: Add links one by row
|
||||
no_: No
|
||||
new: New
|
||||
|
||||
flash:
|
||||
advisories:
|
||||
|
|
|
@ -6,6 +6,8 @@ ru:
|
|||
project_name: Проект
|
||||
affected_versions: Применен в версиях
|
||||
ref_comment: Вставляйте ссылки по одной на строку
|
||||
no_: Нет
|
||||
new: Новый
|
||||
|
||||
flash:
|
||||
advisories:
|
||||
|
|
|
@ -28,6 +28,7 @@ en:
|
|||
preferences: Preferences
|
||||
started_at: Build started at
|
||||
duration: Build duration in seconds
|
||||
mass_build_id: Mass build
|
||||
|
||||
build_list/item:
|
||||
name: Name
|
||||
|
@ -99,7 +100,7 @@ en:
|
|||
build_error: Build error
|
||||
build_published: Build has been published
|
||||
rejected_publish: Publishing rejected
|
||||
build_publish: Build is being publishing
|
||||
build_publish: Build is being published
|
||||
failed_publish: Publishing error
|
||||
dependencies_fail: Dependences not found
|
||||
waiting_for_response: Waiting for response
|
||||
|
@ -123,3 +124,4 @@ en:
|
|||
no_arch_or_platform_selected: At least one of architecture of platform must selected
|
||||
wrong_platform: Only the primary platform can be selected for the main repository!
|
||||
can_not_published: Build can only be published with status "Build complete"
|
||||
frozen_platform: In case of a repository for package storage with frozen platform allowed only bugfix and security updates
|
||||
|
|
|
@ -27,6 +27,7 @@ ru:
|
|||
user: Пользователь
|
||||
preferences: Настройки
|
||||
duration: Длительность билда в секундах
|
||||
mass_build_id: Массовая сборка
|
||||
|
||||
build_list/item:
|
||||
name: Название
|
||||
|
@ -122,3 +123,4 @@ ru:
|
|||
no_arch_or_platform_selected: Выберите хотя бы одну архитектуру и платформу
|
||||
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
|
||||
can_not_published: Опубликовать сборку можно только со статусом "Собран"
|
||||
frozen_platform: В случае выбора репозитория для сохранения пакетов из замороженнной платформы разрешены только bugfix и security обновления
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
en:
|
||||
layout:
|
||||
mass_builds:
|
||||
repositories: Repositories
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Mass Build
|
||||
attributes:
|
||||
mass_build:
|
||||
id: Id
|
||||
name: Name
|
||||
created_at: Created
|
||||
updated_at: Updated
|
||||
arch_names: Architectures
|
||||
user: User
|
||||
auto_publish: Auto Publish
|
||||
repositories: Repositories
|
|
@ -0,0 +1,17 @@
|
|||
ru:
|
||||
layout:
|
||||
mass_builds:
|
||||
repositories: Репозитории
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Массовая Сборка
|
||||
attributes:
|
||||
mass_build:
|
||||
id: Id
|
||||
name: Название
|
||||
created_at: Создан
|
||||
updated_at: Обновлен
|
||||
arch_names: Архитектуры
|
||||
user: Пользователь
|
||||
auto_publish: Авто Публикация
|
||||
repositories: Репозитории
|
|
@ -40,7 +40,11 @@ en:
|
|||
target_platform: Target platform
|
||||
target_architecture: Target architecture
|
||||
members: Members
|
||||
|
||||
project: Project
|
||||
arch: Architecture
|
||||
mass_build: Mass build
|
||||
build_task: Build Task
|
||||
refresh_button: Refresh
|
||||
|
||||
flash:
|
||||
platform:
|
||||
|
@ -54,6 +58,7 @@ en:
|
|||
unfreeze_error: Platform unfreezing error, try again
|
||||
destroyed: Platform deleted
|
||||
build_all_success: All project build in progress
|
||||
build_all_error: Mass build failed
|
||||
clone_success: Cloned successfully
|
||||
members:
|
||||
already_added: "%{name} is already a member of platform"
|
||||
|
|
|
@ -40,6 +40,11 @@ ru:
|
|||
target_platform: Целевая платформа
|
||||
target_architecture: Целевая архитектура
|
||||
members: Участники
|
||||
arch: Архитектура
|
||||
mass_build: Массовая сборка
|
||||
build_task: Сборочное задание
|
||||
refresh_button: Обновить
|
||||
project: Проект
|
||||
|
||||
flash:
|
||||
platform:
|
||||
|
@ -53,6 +58,7 @@ ru:
|
|||
unfreeze_error: Не удалось разморозить платформу, попробуйте еще раз
|
||||
destroyed: Платформа успешно удалена
|
||||
build_all_success: Все проекты успешно отправлены на сборку
|
||||
build_all_error: Сборка не удалась!
|
||||
clone_success: Клонирование успешно
|
||||
members:
|
||||
already_added: "%{name} уже является участником платформы"
|
||||
|
|
|
@ -3,5 +3,5 @@ ru:
|
|||
relations:
|
||||
user_owner: Я - владелец
|
||||
group_owner: Я состою в группе-владельце
|
||||
user: Я участник
|
||||
user: Я - участник
|
||||
group: Я состою в группе-участнике
|
||||
|
|
|
@ -14,6 +14,9 @@ en:
|
|||
back_to_the_list: ⇐ List of repositories
|
||||
confirm_delete: Are you sure you want to delete this repository?
|
||||
current_repository_header: Current repository
|
||||
clear: Clear
|
||||
clear_confirm: Are you sure you want to clear this platform?
|
||||
clear_warning: Attention! Cleared packages cannot be restored!
|
||||
|
||||
personal_repositories:
|
||||
settings_header: Settings
|
||||
|
@ -32,6 +35,7 @@ en:
|
|||
project_not_added: Project adding error. A project with such name already exists in this repository. Remove the old project first
|
||||
project_removed: Project deleted
|
||||
project_not_removed: Unable to delete project from repository
|
||||
clear: Platform successfully cleared!
|
||||
|
||||
activerecord:
|
||||
models:
|
||||
|
|
|
@ -14,6 +14,9 @@ ru:
|
|||
back_to_the_list: ⇐ К списку репозиториев
|
||||
confirm_delete: Вы уверены, что хотите удалить этот репозиторий?
|
||||
current_repository_header: Текущий репозиторий
|
||||
clear: Очистить
|
||||
clear_confirm: Уверены, что хотите очистить платформу?
|
||||
clear_warning: Внимание! Очищенные пакеты не могут быть восстановлены!
|
||||
|
||||
personal_repositories:
|
||||
settings_header: Настройки
|
||||
|
@ -32,6 +35,7 @@ ru:
|
|||
project_not_added: Не удалось добавить проект. В этом репозитории уже есть проект с таким именем. Сначала нужно удалить старый проект
|
||||
project_removed: Проект удален из репозитория
|
||||
project_not_removed: Не удалось удалить проект из репозитория
|
||||
clear: Платформа успешно очищена!
|
||||
|
||||
activerecord:
|
||||
models:
|
||||
|
|
|
@ -1,46 +1,53 @@
|
|||
#! /usr/bin/env ruby
|
||||
|
||||
app_name = ENV['APP_NAME'] || 'rosa_build'
|
||||
Bluepill.application(app_name) do |app|
|
||||
Bluepill.application(app_name, :log_file => "/srv/rosa_build/shared/log/bluepill.log") do |app|
|
||||
app.uid = app.gid = 'rosa'
|
||||
app.working_dir = "/srv/#{app_name}/current"
|
||||
%w(fork import hook default).each do |queue|
|
||||
app.process("delayed_job_#{queue}_queue") do |process|
|
||||
process.start_grace_time = 10.seconds
|
||||
process.stop_grace_time = 10.seconds
|
||||
process.restart_grace_time = 10.seconds
|
||||
|
||||
process.start_command = "/usr/bin/env ruby script/delayed_job --queue=#{queue} -p #{queue} --pid-dir=/srv/#{app_name}/current/tmp/#{queue}_pids start"
|
||||
process.stop_command = "/usr/bin/env ruby script/delayed_job --pid-dir=/srv/#{app_name}/current/tmp/#{queue}_pids stop"
|
||||
process.pid_file = File.join(app.working_dir, 'tmp', "#{queue}_pids", 'delayed_job.pid')
|
||||
end
|
||||
end
|
||||
|
||||
app.process("newrelic") do |process|
|
||||
process.start_grace_time = 10.seconds
|
||||
process.stop_grace_time = 10.seconds
|
||||
process.restart_grace_time = 10.seconds
|
||||
|
||||
path = File.join(app.working_dir, 'tmp', 'pids', 'newrelic.pid')
|
||||
process.start_command = "/usr/bin/env /usr/local/bin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p #{path}"
|
||||
process.pid_file = path
|
||||
end
|
||||
|
||||
app.process("unicorn") do |process|
|
||||
process.start_grace_time = 8.seconds
|
||||
process.stop_grace_time = 5.seconds
|
||||
process.restart_grace_time = 13.seconds
|
||||
|
||||
process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -E production -c config/unicorn.rb -D"
|
||||
app.process("resque") do |process|
|
||||
process.group = "resque"
|
||||
pid_path = File.join(app.working_dir, 'tmp', 'pids', 'resque.pid')
|
||||
process.start_command = "bundle exec rake resque:work QUEUE=fork_import,hook,clone_build,notification PIDFILE=#{ pid_path } BACKGROUND=yes"
|
||||
process.pid_file = pid_path
|
||||
process.stop_command = "kill -QUIT {{PID}}"
|
||||
process.restart_command = "kill -USR2 {{PID}}"
|
||||
process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'unicorn.pid')
|
||||
process.daemonize = true
|
||||
process.start_grace_time = 5.seconds
|
||||
process.stop_grace_time = 5.seconds
|
||||
process.restart_grace_time = 5.seconds
|
||||
|
||||
process.monitor_children do |child_process|
|
||||
child_process.stop_command = "kill -QUIT {{PID}}"
|
||||
#process.monitor_children do |c|
|
||||
# c.stop_command = "kill -USR1 {{PID}}" # TODO: Are we really need this?
|
||||
# c.checks :mem_usage, :every => 30.seconds, :below => 80.megabytes, :fires => :stop
|
||||
# c.checks :running_time, :every => 30.seconds, :below => 10.minutes, :fires => :stop
|
||||
#end
|
||||
end
|
||||
|
||||
child_process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [3,4], :fires => :stop
|
||||
child_process.checks :cpu_usage, :every => 10.seconds, :below => 20, :times => [3,4], :fires => :stop
|
||||
end
|
||||
end
|
||||
#app.process("newrelic") do |process|
|
||||
# process.start_grace_time = 10.seconds
|
||||
# process.stop_grace_time = 10.seconds
|
||||
# process.restart_grace_time = 10.seconds
|
||||
|
||||
# path = File.join(app.working_dir, 'tmp', 'pids', 'newrelic.pid')
|
||||
# process.start_command = "/usr/bin/env /usr/local/bin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p #{path}"
|
||||
# process.pid_file = path
|
||||
#end
|
||||
|
||||
#app.process("unicorn") do |process|
|
||||
# process.start_grace_time = 8.seconds
|
||||
# process.stop_grace_time = 5.seconds
|
||||
# process.restart_grace_time = 13.seconds
|
||||
|
||||
# process.start_command = "bundle exec unicorn -l /tmp/#{app_name}_unicorn.sock -E production -c config/unicorn.rb -D"
|
||||
# process.stop_command = "kill -QUIT {{PID}}"
|
||||
# process.restart_command = "kill -USR2 {{PID}}"
|
||||
# process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'unicorn.pid')
|
||||
|
||||
# process.monitor_children do |child_process|
|
||||
# child_process.stop_command = "kill -QUIT {{PID}}"
|
||||
|
||||
# child_process.checks :mem_usage, :every => 10.seconds, :below => 150.megabytes, :times => [3,4], :fires => :stop
|
||||
# child_process.checks :cpu_usage, :every => 10.seconds, :below => 20, :times => [3,4], :fires => :stop
|
||||
# end
|
||||
#end
|
||||
end
|
||||
|
|
|
@ -33,6 +33,9 @@ Rosa::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
resources :event_logs, :only => :index
|
||||
constraints AdminAccess do
|
||||
mount Resque::Server => 'resque'
|
||||
end
|
||||
end
|
||||
|
||||
resources :advisories, :only => [:index, :show]
|
||||
|
@ -41,6 +44,7 @@ Rosa::Application.routes.draw do
|
|||
resources :platforms do
|
||||
resources :private_users, :except => [:show, :destroy, :update]
|
||||
member do
|
||||
post :clear
|
||||
get :clone
|
||||
get :members
|
||||
post :remove_members
|
||||
|
@ -48,6 +52,8 @@ Rosa::Application.routes.draw do
|
|||
post :add_member
|
||||
post :make_clone
|
||||
post :build_all
|
||||
get :mass_builds
|
||||
get :advisories
|
||||
end
|
||||
get :autocomplete_user_uname, :on => :collection
|
||||
resources :repositories do
|
||||
|
@ -60,6 +66,7 @@ Rosa::Application.routes.draw do
|
|||
resources :products do
|
||||
resources :product_build_lists, :only => [:create, :destroy]
|
||||
end
|
||||
|
||||
end
|
||||
match '/private/:platform_name/*file_path' => 'privates#show'
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class CreateMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :mass_builds do |t|
|
||||
t.integer :platform_id
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddMassBuildIdToBuildLists < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :mass_build_id, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class AddArchNamesToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :arch_names, :string
|
||||
add_column :mass_builds, :user_id, :integer
|
||||
add_column :mass_builds, :auto_publish, :boolean
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class SetMassBuildUserIdToFirstIfNil < ActiveRecord::Migration
|
||||
def up
|
||||
MassBuild.update_all(:user_id => nil, :user_id => 1)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
class DropDelayedJobs < ActiveRecord::Migration
|
||||
def up
|
||||
drop_table :delayed_jobs
|
||||
end
|
||||
|
||||
def down
|
||||
create_table :delayed_jobs do |t|
|
||||
t.integer "priority", :default => 0
|
||||
t.integer "attempts", :default => 0
|
||||
t.text "handler"
|
||||
t.text "last_error"
|
||||
t.datetime "run_at"
|
||||
t.datetime "locked_at"
|
||||
t.datetime "failed_at"
|
||||
t.string "locked_by"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "queue", :default => "default"
|
||||
end
|
||||
add_index :delayed_jobs, ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class AddIndexToPullRequest < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :pull_requests, :base_project_id
|
||||
add_index :pull_requests, :head_project_id
|
||||
add_index :pull_requests, :issue_id
|
||||
end
|
||||
end
|
33
db/schema.rb
33
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120515095324) do
|
||||
ActiveRecord::Schema.define(:version => 20120627101821) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -118,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.datetime "started_at"
|
||||
t.integer "duration"
|
||||
t.integer "advisory_id"
|
||||
t.integer "mass_build_id"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
|
@ -135,22 +136,6 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "delayed_jobs", :force => true do |t|
|
||||
t.integer "priority", :default => 0
|
||||
t.integer "attempts", :default => 0
|
||||
t.text "handler"
|
||||
t.text "last_error"
|
||||
t.datetime "run_at"
|
||||
t.datetime "locked_at"
|
||||
t.datetime "failed_at"
|
||||
t.string "locked_by"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "queue", :default => "default"
|
||||
end
|
||||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
|
||||
create_table "event_logs", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "user_name"
|
||||
|
@ -211,6 +196,16 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
|
||||
add_index "labels", ["project_id"], :name => "index_labels_on_project_id"
|
||||
|
||||
create_table "mass_builds", :force => true do |t|
|
||||
t.integer "platform_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "arch_names"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", :default => false, :null => false
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
t.string "description"
|
||||
t.string "name", :null => false
|
||||
|
@ -314,6 +309,10 @@ ActiveRecord::Schema.define(:version => 20120515095324) do
|
|||
t.string "head_ref", :null => false
|
||||
end
|
||||
|
||||
add_index "pull_requests", ["base_project_id"], :name => "index_pull_requests_on_base_project_id"
|
||||
add_index "pull_requests", ["head_project_id"], :name => "index_pull_requests_on_head_project_id"
|
||||
add_index "pull_requests", ["issue_id"], :name => "index_pull_requests_on_issue_id"
|
||||
|
||||
create_table "register_requests", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email"
|
||||
|
|
|
@ -10,3 +10,9 @@ class OwnerConstraint
|
|||
@class_name.send(@finder, request.params[:uname]).present?
|
||||
end
|
||||
end
|
||||
|
||||
class AdminAccess
|
||||
def self.matches?(request)
|
||||
!!request.env['warden'].user.try(:admin?)
|
||||
end
|
||||
end
|
|
@ -23,13 +23,6 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|||
task :status, :roles => [:app] do
|
||||
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} status"
|
||||
end
|
||||
|
||||
desc "Restart DJ processes"
|
||||
task :restart_dj, :roles => [:app] do
|
||||
%w(fork import hook default).each do |queue|
|
||||
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} #{fetch :application} restart delayed_job_#{queue}_queue"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Start a bluepill process and load a config"
|
||||
|
@ -47,5 +40,10 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|||
task :restart, :roles => [:app] do
|
||||
processes.stop; stop; start
|
||||
end
|
||||
|
||||
desc "Stop bluepill and monitored services"
|
||||
task :stop, :roles => [:app] do
|
||||
processes.stop
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
Capistrano::Configuration.instance(:must_exist).load do
|
||||
namespace :delayed_job do
|
||||
def dj_queues
|
||||
%w(fork import hook default)
|
||||
end
|
||||
|
||||
def rails_env
|
||||
fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
|
||||
end
|
||||
|
||||
def roles
|
||||
fetch(:delayed_job_server_role, :app)
|
||||
end
|
||||
|
||||
desc "Stop the delayed_job process"
|
||||
task :stop, :roles => lambda { roles } do
|
||||
dj_queues.each do |queue|
|
||||
run "cd #{current_path};#{rails_env} script/delayed_job --pid-dir=#{shared_path}/pids/#{queue} stop"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Start the delayed_job process"
|
||||
task :start, :roles => lambda { roles } do
|
||||
dj_queues.each do |queue|
|
||||
run "cd #{current_path};#{rails_env} script/delayed_job --queue=#{queue} -p #{queue} --pid-dir=#{shared_path}/pids/#{queue} start"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Restart the delayed_job process"
|
||||
task :restart, :roles => lambda { roles } do
|
||||
dj_queues.each do |queue|
|
||||
run "cd #{current_path};#{rails_env} script/delayed_job --queue=#{queue} -p #{queue} --pid-dir=#{shared_path}/pids/#{queue} restart"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
Capistrano::Configuration.instance(:must_exist).load do
|
||||
|
||||
namespace :resque do
|
||||
task :start do
|
||||
start_workers
|
||||
end
|
||||
|
||||
task :stop do
|
||||
stop_workers
|
||||
end
|
||||
|
||||
task :restart do
|
||||
stop_workers
|
||||
start_workers
|
||||
end
|
||||
|
||||
def rails_env
|
||||
fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
|
||||
end
|
||||
|
||||
def stop_workers
|
||||
ps = 'ps aux | grep resque | grep -v grep'
|
||||
run "#{ps} && kill -QUIT `#{ps} | awk '{ print $2 }'` || echo 'Workers already stopped!'"
|
||||
end
|
||||
|
||||
def start_workers
|
||||
run "cd #{fetch :current_path} && COUNT=#{ workers_count } QUEUE=fork_import,hook,clone_build,notification #{ rails_env } BACKGROUND=yes bundle exec rake resque:workers"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -6,7 +6,7 @@ namespace :hook do
|
|||
hook = File.join(::Rails.root.to_s, 'tmp', "post-receive-hook")
|
||||
FileUtils.cp(File.join(::Rails.root.to_s, 'bin', "post-receive-hook.partial"), hook)
|
||||
File.open(hook, 'a') do |f|
|
||||
s = "\n /bin/bash -l -c \"cd #{is_production ? '/srv/rosa_build/current' : Rails.root.to_s} && #{is_production ? 'RAILS_ENV=production' : ''} bundle exec rails runner 'Project.delay(:queue => \\\"hook\\\").process_hook(\\\"$owner\\\", \\\"$reponame\\\", \\\"$newrev\\\", \\\"$oldrev\\\", \\\"$ref\\\", \\\"$newrev_type\\\", \\\"$oldrev_type\\\")'\""
|
||||
s = "\n /bin/bash -l -c \"cd #{is_production ? '/srv/rosa_build/current' : Rails.root.to_s} && #{is_production ? 'RAILS_ENV=production' : ''} bundle exec rake hook:enqueue[$owner,$reponame,$newrev,$oldrev,$ref,$newrev_type,$oldrev_type]\""
|
||||
s << " > /dev/null 2>&1" if is_production
|
||||
s << "\ndone\n"
|
||||
f.write(s)
|
||||
|
@ -32,6 +32,14 @@ namespace :hook do
|
|||
FileUtils.rm_rf(hook)
|
||||
end
|
||||
|
||||
desc 'Enqueue hook process'
|
||||
task :enqueue, :owner, :reponame, :newrev, :oldrev, :ref, :newrev_type, :oldrev_type do |t, args|
|
||||
# require 'resque'
|
||||
require './app/models/git_hook'
|
||||
PerformLater.config.enabled = true unless Rails.env.test?
|
||||
GitHook.perform_later!(:hook, :process, *args.to_hash.values)
|
||||
end
|
||||
|
||||
desc "remove git hook from all repos"
|
||||
task :remove => :environment do
|
||||
say "process.."
|
||||
|
|
|
@ -27,6 +27,32 @@ namespace :import do
|
|||
say 'DONE'
|
||||
end
|
||||
|
||||
# bundle exec rake import:srpm RAILS_ENV=production BASE=/share/platforms/naulinux5x_personal/tmp/SRPMS LIST=https://dl.dropbox.com/u/984976/nauschool5x.srpms.txt OWNER=naulinux PLATFORM=naulinux REPO=main > log/srpm_naulinux.log
|
||||
desc 'Import SRPMs as projects'
|
||||
task :srpm => :environment do
|
||||
base = ENV['BASE'] || '/share/alt_repos/rsync'
|
||||
list = ENV['LIST'] #|| 'https://dl.dropbox.com/u/984976/alt_import.txt'
|
||||
mask = ENV['MASK'] || '*.src.rpm'
|
||||
owner = User.find_by_uname(ENV['OWNER']) || Group.find_by_uname!(ENV['OWNER'] || 'altlinux')
|
||||
platform = Platform.find_by_name!(ENV['PLATFORM'] || 'altlinux5')
|
||||
repo = platform.repositories.find_by_name!(ENV['REPO'] || 'main')
|
||||
say "START import projects from '#{base}' using '#{list || mask}' for '#{owner.uname}' to repo '#{platform.name}/#{repo.name}'."
|
||||
repo.project_to_repositories.clear if agree "Clear destination repo #{platform.name}/#{repo.name}?"
|
||||
(list ? open(list).readlines.map{|n| File.join base, n.chomp.strip} : Dir[File.join base, mask]).each do |path|
|
||||
print "Processing '#{path}'..."
|
||||
if name = `rpm -q --qf '[%{Name}]' -p #{path}` and $?.success? and name.present?
|
||||
p = Project.find_or_create_by_name_and_owner_type_and_owner_id(name, owner.class.to_s, owner.id)
|
||||
p.import_srpm(path, platform.name)
|
||||
repo.projects << p
|
||||
print "Ok! - #{p.name}"
|
||||
else
|
||||
print 'Fail!'
|
||||
end
|
||||
puts
|
||||
end
|
||||
say 'DONE'
|
||||
end
|
||||
|
||||
namespace :sync do
|
||||
desc "Sync all repos"
|
||||
task :all do
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
ENV['RAILS_ENV'] ||= "production"
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
|
||||
require 'delayed/command'
|
||||
Delayed::Command.new(ARGV).daemonize
|
|
@ -177,7 +177,7 @@ describe Projects::BuildListsController do
|
|||
before(:each) do
|
||||
@owner_group = FactoryGirl.create(:group)
|
||||
@owner_user = FactoryGirl.create(:user)
|
||||
@owner_group.actors.create :role => 'reader', :actor_id => @owner_user.id, :actor_type => 'User'
|
||||
@owner_group.actors.create :role => 'admin', :actor_id => @owner_user.id, :actor_type => 'User'
|
||||
@member_group = FactoryGirl.create(:group)
|
||||
@member_user = FactoryGirl.create(:user)
|
||||
@member_group.actors.create :role => 'reader', :actor_id => @member_user.id, :actor_type => 'User'
|
||||
|
@ -317,27 +317,37 @@ describe Projects::BuildListsController do
|
|||
|
||||
context 'callbacks' do
|
||||
let(:build_list) { FactoryGirl.create(:build_list_core) }
|
||||
let(:build_list_package) { FactoryGirl.create(:build_list_package, :build_list_id => build_list.id, :platform_id => build_list.project.repositories.first.platform_id, :project_id => build_list.project_id, :version => "4.7.5.3", :release => 1) }
|
||||
|
||||
before(:each) do
|
||||
mock(controller).authenticate_build_service! {true}
|
||||
end
|
||||
|
||||
describe 'publish_build' do
|
||||
before { test_git_commit(build_list.project); build_list.update_attribute :commit_hash, build_list.project.git_repository.commits('master').last.id }
|
||||
before {
|
||||
test_git_commit(build_list.project)
|
||||
build_list.update_attribute :commit_hash, build_list.project.git_repository.commits('master').last.id
|
||||
build_list.update_attribute(:status, BuildList::BUILD_PUBLISH)
|
||||
build_list_package
|
||||
}
|
||||
|
||||
def do_get(status)
|
||||
get :publish_build, :id => build_list.bs_id, :status => status, :version => '4.7.5.3', :release => '1'
|
||||
build_list.reload
|
||||
end
|
||||
|
||||
it { do_get(BuildServer::SUCCESS); response.should be_ok }
|
||||
it(:passes) {
|
||||
build_list.update_attribute(:status, BuildServer::BUILD_STARTED)
|
||||
do_get(BuildServer::SUCCESS)
|
||||
response.should be_ok
|
||||
}
|
||||
it 'should create correct git tag for correct commit' do
|
||||
do_get(BuildServer::SUCCESS)
|
||||
build_list.project.git_repository.tags.last.name.should == build_list.package_version
|
||||
build_list.project.git_repository.commits(build_list.package_version).last.id.should == build_list.commit_hash
|
||||
end
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to('4.7.5.3-1') }
|
||||
it(:passes) { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
|
||||
it(:passes) { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to("#{ build_list_package.platform.name }-4.7.5.3-1") }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildList::FAILED_PUBLISH) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should_not change(build_list, :package_version) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :updated_at) }
|
||||
|
@ -390,6 +400,10 @@ describe Projects::BuildListsController do
|
|||
end
|
||||
|
||||
describe 'pre_build' do
|
||||
before do
|
||||
build_list.update_attribute :status, BuildList::BUILD_PENDING
|
||||
end
|
||||
|
||||
def do_get
|
||||
get :pre_build, :id => build_list.bs_id
|
||||
build_list.reload
|
||||
|
@ -413,15 +427,32 @@ describe Projects::BuildListsController do
|
|||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :updated_at) }
|
||||
|
||||
context 'with auto_publish' do
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISH) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildServer::ERROR) }
|
||||
it(:passes) {
|
||||
build_list.update_attribute(:started_at, (Time.now - 1.day))
|
||||
build_list.update_attribute(:status, BuildServer::BUILD_STARTED)
|
||||
build_list.reload
|
||||
lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISH)
|
||||
}
|
||||
it(:passes) {
|
||||
build_list.update_attribute(:started_at, (Time.now - 1.day))
|
||||
build_list.update_attribute(:status, BuildServer::BUILD_STARTED)
|
||||
lambda{ do_get(BuildServer::BUILD_ERROR) }.should change(build_list, :status).to(BuildServer::BUILD_ERROR)
|
||||
}
|
||||
end
|
||||
|
||||
context 'without auto_publish' do
|
||||
before { build_list.update_attribute(:auto_publish, false) }
|
||||
|
||||
it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildServer::SUCCESS) }
|
||||
it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildServer::ERROR) }
|
||||
it(:passes) {
|
||||
build_list.update_attribute(:started_at, (Time.now - 1.day))
|
||||
build_list.update_attribute(:status, BuildServer::BUILD_STARTED)
|
||||
lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildServer::SUCCESS)
|
||||
}
|
||||
it(:passes) {
|
||||
build_list.update_attribute(:started_at, (Time.now - 1.day))
|
||||
build_list.update_attribute(:status, BuildServer::BUILD_STARTED)
|
||||
lambda{ do_get(BuildServer::BUILD_ERROR) }.should change(build_list, :status).to(BuildServer::BUILD_ERROR)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -102,6 +102,8 @@ describe Projects::CommentsController do
|
|||
context 'for project owner user' do
|
||||
before(:each) do
|
||||
@project.update_attribute(:owner, @user)
|
||||
@project.relations.destroy_all
|
||||
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
|
||||
@create_params[:owner_name] = @user.uname; @update_params[:owner_name] = @user.uname
|
||||
end
|
||||
|
||||
|
|
|
@ -11,6 +11,12 @@ shared_examples_for 'issue user with project reader rights' do
|
|||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
|
||||
it 'should be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'issue user with project writer rights' do
|
||||
|
@ -187,7 +193,22 @@ describe Projects::IssuesController do
|
|||
|
||||
context 'for guest' do
|
||||
if APP_CONFIG['anonymous_access']
|
||||
it_should_behave_like 'issue user with project reader rights'
|
||||
# it_should_behave_like 'issue user with project reader rights'
|
||||
it 'should be able to perform index action' do
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should render_template(:index)
|
||||
end
|
||||
|
||||
it 'should be able to perform show action' do
|
||||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
|
||||
it 'should not be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
else
|
||||
it 'should not be able to perform index action' do
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
|
@ -198,6 +219,12 @@ describe Projects::IssuesController do
|
|||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not be able to perform create action' do
|
||||
|
|
|
@ -79,6 +79,7 @@ describe Projects::ProjectsController do
|
|||
end
|
||||
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
it_should_behave_like 'user without update rights'
|
||||
end
|
||||
|
||||
context 'for writer user' do
|
||||
|
@ -136,20 +137,115 @@ describe Projects::ProjectsController do
|
|||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
it 'should not be able to edit project' do
|
||||
description = @project.description
|
||||
put :update, :project=>{:description =>"hack"}, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(forbidden_path)
|
||||
Project.find(@project.id).description.should == description
|
||||
it_should_behave_like 'user without update rights'
|
||||
end
|
||||
|
||||
it 'should not be able to edit project sections' do
|
||||
has_wiki, has_issues = @project.has_wiki, @project.has_issues
|
||||
post :sections, :project =>{:has_wiki => !has_wiki, :has_issues => !has_issues}, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(forbidden_path)
|
||||
project = Project.find(@project.id)
|
||||
project.has_wiki.should == has_wiki
|
||||
project.has_issues.should == has_issues
|
||||
context 'for group' do
|
||||
before(:each) do
|
||||
@group = FactoryGirl.create(:group)
|
||||
@group_user = FactoryGirl.create(:user)
|
||||
@project.relations.destroy_all
|
||||
set_session_for(@group_user)
|
||||
end
|
||||
|
||||
context 'owner of the project' do
|
||||
before(:each) do
|
||||
@project.update_attribute :owner, @group
|
||||
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
|
||||
end
|
||||
|
||||
context 'reader user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
it_should_behave_like 'user without update rights'
|
||||
|
||||
it 'should has reader role to group project' do
|
||||
@group_user.best_role(@project).should eql('reader') # Need this?
|
||||
end
|
||||
|
||||
context 'user should has best role' do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'admin'
|
||||
end
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
end
|
||||
end
|
||||
|
||||
context 'admin user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
end
|
||||
end
|
||||
|
||||
context 'member of the project' do
|
||||
context 'with admin rights' do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'admin'
|
||||
end
|
||||
|
||||
context 'reader user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
|
||||
context 'user should has best role' do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'reader'
|
||||
end
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
end
|
||||
end
|
||||
|
||||
context 'admin user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with reader rights' do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'reader'
|
||||
end
|
||||
|
||||
context 'reader user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
it_should_behave_like 'user without update rights'
|
||||
|
||||
context 'user should has best role' do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'admin'
|
||||
end
|
||||
it_should_behave_like 'projects user with admin rights'
|
||||
end
|
||||
end
|
||||
|
||||
context 'admin user' do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
|
||||
end
|
||||
|
||||
it_should_behave_like 'projects user with reader rights'
|
||||
it_should_behave_like 'user without update rights'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,4 +16,15 @@ FactoryGirl.define do
|
|||
factory :build_list_core, :parent => :build_list do
|
||||
bs_id { FactoryGirl.generate(:integer) }
|
||||
end
|
||||
|
||||
factory :build_list_package, :class => BuildList::Package do
|
||||
association :build_list
|
||||
association :project
|
||||
association :platform
|
||||
fullname "test_package"
|
||||
name "test_package"
|
||||
version "3.1.12"
|
||||
release 6
|
||||
package_type "source"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -208,6 +208,7 @@ describe CanCan do
|
|||
context 'with owner rights' do
|
||||
before(:each) do
|
||||
@project.update_attribute(:owner, @user)
|
||||
@project.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'admin')
|
||||
@issue.project.reload
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe MassBuild do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -1,6 +1,93 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require 'spec_helper'
|
||||
|
||||
#describe User do
|
||||
# pending "add some examples to (or delete) #{__FILE__}"
|
||||
#end
|
||||
describe User do
|
||||
before { stub_symlink_methods }
|
||||
before(:each) do
|
||||
@project = FactoryGirl.create(:project)
|
||||
@group = FactoryGirl.create(:group)
|
||||
@user = FactoryGirl.create(:user)
|
||||
end
|
||||
|
||||
context 'for own project' do
|
||||
it 'should have admin role' do
|
||||
@project.owner.best_role(@project).should == 'admin'
|
||||
end
|
||||
end
|
||||
|
||||
context 'other user' do
|
||||
it 'should have not right to project' do
|
||||
other_user = FactoryGirl.create(:user)
|
||||
other_user.best_role(@project).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
%w(reader writer admin).each do |group_role|
|
||||
context "for group with #{group_role} role in project" do
|
||||
before(:each) do
|
||||
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => group_role
|
||||
end
|
||||
|
||||
%w(reader writer admin).each do |role|
|
||||
context "for user with #{role} role in group" do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
|
||||
end
|
||||
|
||||
it "should have #{group_role} role to project" do
|
||||
@user.best_role(@project).should == group_role
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'for group project' do
|
||||
before(:each) do
|
||||
@project.relations.destroy_all
|
||||
@project.update_attribute :owner, @group
|
||||
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
|
||||
end
|
||||
|
||||
%w(reader writer admin).each do |role|
|
||||
context "for user with #{role} role in group" do
|
||||
before(:each) do
|
||||
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
|
||||
end
|
||||
|
||||
it "should have #{role} role to project" do
|
||||
@user.best_role(@project).should == role
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%w(reader writer admin).each do |role|
|
||||
context "for user with #{role} role in project" do
|
||||
before(:each) do
|
||||
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
|
||||
end
|
||||
|
||||
it "should have #{role} role to project" do
|
||||
@user.best_role(@project).should == role
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "for user with reader role in group and writer role in project" do
|
||||
it "should have writer best role to project" do
|
||||
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader')
|
||||
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => 'writer')
|
||||
@user.best_role(@project).should == 'writer'
|
||||
end
|
||||
end
|
||||
|
||||
context "for user with admin role in group and reader role in project" do
|
||||
it "should have admin best role to project" do
|
||||
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin')
|
||||
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader')
|
||||
@user.best_role(@project).should == 'admin'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ def test_git_commit(project)
|
|||
project.git_repository.repo.index.commit('Test commit')
|
||||
end
|
||||
|
||||
Delayed::Worker.delay_jobs = false # Execute all jobs realtime
|
||||
Resque.inline = true
|
||||
|
||||
# Add testing root_path
|
||||
%x(rm -Rf #{Rails.root}/tmp/test_root)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue