Merge branch '369-remove_codemirror' into 369-bootstrap
Conflicts: Gemfile Gemfile.lock vendor/assets/javascripts/old-codemirror.js vendor/assets/javascripts/old-codemirror/keymaps/emacs.js vendor/assets/javascripts/old-codemirror/keymaps/vim.js vendor/assets/javascripts/old-codemirror/modes/clike.js vendor/assets/javascripts/old-codemirror/modes/clojure.js vendor/assets/javascripts/old-codemirror/modes/coffeescript.js vendor/assets/javascripts/old-codemirror/modes/css.js vendor/assets/javascripts/old-codemirror/modes/diff.js vendor/assets/javascripts/old-codemirror/modes/gfm.js vendor/assets/javascripts/old-codemirror/modes/go.js vendor/assets/javascripts/old-codemirror/modes/groovy.js vendor/assets/javascripts/old-codemirror/modes/haskell.js vendor/assets/javascripts/old-codemirror/modes/htmlembedded.js vendor/assets/javascripts/old-codemirror/modes/htmlmixed.js vendor/assets/javascripts/old-codemirror/modes/javascript.js vendor/assets/javascripts/old-codemirror/modes/jinja2.js vendor/assets/javascripts/old-codemirror/modes/less.js vendor/assets/javascripts/old-codemirror/modes/lua.js vendor/assets/javascripts/old-codemirror/modes/markdown.js vendor/assets/javascripts/old-codemirror/modes/mysql.js vendor/assets/javascripts/old-codemirror/modes/ntriples.js vendor/assets/javascripts/old-codemirror/modes/pascal.js vendor/assets/javascripts/old-codemirror/modes/perl.js vendor/assets/javascripts/old-codemirror/modes/php.js vendor/assets/javascripts/old-codemirror/modes/plsql.js vendor/assets/javascripts/old-codemirror/modes/python.js vendor/assets/javascripts/old-codemirror/modes/r.js vendor/assets/javascripts/old-codemirror/modes/rpm-changes.js vendor/assets/javascripts/old-codemirror/modes/rpm-spec.js vendor/assets/javascripts/old-codemirror/modes/rst.js vendor/assets/javascripts/old-codemirror/modes/ruby.js vendor/assets/javascripts/old-codemirror/modes/rust.js vendor/assets/javascripts/old-codemirror/modes/scheme.js vendor/assets/javascripts/old-codemirror/modes/shell.js vendor/assets/javascripts/old-codemirror/modes/smalltalk.js vendor/assets/javascripts/old-codemirror/modes/sparql.js vendor/assets/javascripts/old-codemirror/modes/stex.js vendor/assets/javascripts/old-codemirror/modes/tiddlywiki.js vendor/assets/javascripts/old-codemirror/modes/velocity.js vendor/assets/javascripts/old-codemirror/modes/verilog.js vendor/assets/javascripts/old-codemirror/modes/xml.js vendor/assets/javascripts/old-codemirror/modes/xmlpure.js vendor/assets/javascripts/old-codemirror/modes/yaml.js vendor/assets/javascripts/old-codemirror/overlay.js vendor/assets/javascripts/old-codemirror/runmode.js vendor/assets/javascripts/vendor.js vendor/assets/stylesheets/old-codemirror.scss vendor/assets/stylesheets/old-codemirror/modes/diff.scss vendor/assets/stylesheets/old-codemirror/modes/rpm-spec.scss vendor/assets/stylesheets/old-codemirror/modes/tiddlywiki.scss vendor/assets/stylesheets/old-codemirror/themes/cobalt.scss vendor/assets/stylesheets/old-codemirror/themes/eclipse.scss vendor/assets/stylesheets/old-codemirror/themes/elegant.scss vendor/assets/stylesheets/old-codemirror/themes/monokai.scss vendor/assets/stylesheets/old-codemirror/themes/neat.scss vendor/assets/stylesheets/old-codemirror/themes/night.scss vendor/assets/stylesheets/old-codemirror/themes/rubyblue.scss vendor/assets/stylesheets/vendor.scss
This commit is contained in:
commit
d66d9accaf
4
Gemfile
4
Gemfile
|
@ -2,6 +2,7 @@ source 'https://rubygems.org'
|
|||
|
||||
gem 'rails', '4.0.4'
|
||||
|
||||
gem 'activeadmin', github: 'gregbell/active_admin'
|
||||
gem 'pg', '~> 0.17.1'
|
||||
gem 'schema_plus', '~> 1.4.0'
|
||||
########
|
||||
|
@ -89,7 +90,7 @@ gem 'therubyrhino', '~> 1.73.1', platforms: :jruby
|
|||
gem 'bootstrap-sass', '~> 3.1.1'
|
||||
gem 'font-awesome-rails'
|
||||
|
||||
gem 'codemirror-rails'
|
||||
gem 'sitemap_generator'
|
||||
|
||||
group :production do
|
||||
gem "airbrake", '~> 3.1.2'
|
||||
|
@ -130,4 +131,5 @@ group :test do
|
|||
gem 'mock_redis', '~> 0.11'
|
||||
gem 'rake'
|
||||
gem 'test_after_commit'
|
||||
gem 'timecop'
|
||||
end
|
||||
|
|
66
Gemfile.lock
66
Gemfile.lock
|
@ -8,6 +8,24 @@ GIT
|
|||
resque (> 1.25)
|
||||
resque-scheduler
|
||||
|
||||
GIT
|
||||
remote: git://github.com/gregbell/active_admin.git
|
||||
revision: 5ac883c59978799829a8c085fab47f858574c42f
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0)
|
||||
bourbon
|
||||
coffee-rails
|
||||
devise (~> 3.2)
|
||||
formtastic (~> 2.3.0.rc2)
|
||||
inherited_resources (~> 1.3)
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
kaminari (~> 0.15)
|
||||
rails (>= 3.2, <= 4.1)
|
||||
ransack (~> 1.0)
|
||||
sass-rails
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rosa-abf/cancan.git
|
||||
revision: fe1089b70c08d3ed11bac4f8e69ecb3d1d9adc29
|
||||
|
@ -64,11 +82,17 @@ GEM
|
|||
ancestry (2.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
angular-i18n (0.1.2)
|
||||
<<<<<<< HEAD
|
||||
angular-rails-templates (0.0.7)
|
||||
railties (>= 3.1)
|
||||
sprockets
|
||||
angular-ui-bootstrap-rails (0.10.0)
|
||||
angularjs-rails (1.2.15)
|
||||
=======
|
||||
angularjs-rails (1.2.14)
|
||||
arbre (1.0.1)
|
||||
activesupport (>= 3.0.0)
|
||||
>>>>>>> 369-remove_codemirror
|
||||
arel (4.0.2)
|
||||
atomic (1.1.16)
|
||||
attr_encrypted (1.3.2)
|
||||
|
@ -86,8 +110,14 @@ GEM
|
|||
daemons (~> 1.1.4)
|
||||
i18n (>= 0.5.0)
|
||||
state_machine (~> 1.1)
|
||||
<<<<<<< HEAD
|
||||
bootstrap-sass (3.1.1.0)
|
||||
sass (~> 3.2)
|
||||
=======
|
||||
bourbon (3.1.8)
|
||||
sass (>= 3.2.0)
|
||||
thor
|
||||
>>>>>>> 369-remove_codemirror
|
||||
builder (3.1.4)
|
||||
callsite (0.0.11)
|
||||
cape (1.8.0)
|
||||
|
@ -146,13 +176,18 @@ GEM
|
|||
faraday (0.9.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.3)
|
||||
<<<<<<< HEAD
|
||||
font-awesome-rails (4.0.3.1)
|
||||
railties (>= 3.2, < 5.0)
|
||||
=======
|
||||
formtastic (2.3.0.rc2)
|
||||
actionpack (>= 3.0)
|
||||
>>>>>>> 369-remove_codemirror
|
||||
friendly_id (5.0.3)
|
||||
activerecord (>= 4.0.0)
|
||||
fssm (0.2.10)
|
||||
gemoji (1.2.1)
|
||||
github-linguist (2.10.9)
|
||||
github-linguist (2.10.11)
|
||||
charlock_holmes (~> 0.6.6)
|
||||
escape_utils (>= 0.3.1)
|
||||
mime-types (~> 1.19)
|
||||
|
@ -178,11 +213,17 @@ GEM
|
|||
activesupport (>= 4.0.1)
|
||||
haml (>= 3.1, < 5.0)
|
||||
railties (>= 4.0.1)
|
||||
has_scope (0.6.0.rc)
|
||||
actionpack (>= 3.2, < 5)
|
||||
activesupport (>= 3.2, < 5)
|
||||
hashie (2.0.5)
|
||||
highline (1.6.21)
|
||||
hike (1.2.3)
|
||||
hirb (0.7.1)
|
||||
i18n (0.6.9)
|
||||
inherited_resources (1.4.1)
|
||||
has_scope (~> 0.6.0.rc)
|
||||
responders (~> 1.0.0.rc)
|
||||
jbuilder (2.0.4)
|
||||
activesupport (>= 3.0.0)
|
||||
multi_json (>= 1.2.0)
|
||||
|
@ -190,12 +231,17 @@ GEM
|
|||
jquery-rails (2.3.0)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (4.2.0)
|
||||
railties (>= 3.2.16)
|
||||
js-routes (0.9.7)
|
||||
railties (>= 3.2)
|
||||
sprockets-rails
|
||||
json (1.8.1)
|
||||
jwt (0.1.11)
|
||||
multi_json (>= 1.5)
|
||||
kaminari (0.15.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
libv8 (3.16.14.3)
|
||||
localeapp (0.7.1)
|
||||
gli
|
||||
|
@ -282,11 +328,13 @@ GEM
|
|||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
pg (0.17.1)
|
||||
polyamorous (0.6.4)
|
||||
activerecord (>= 3.0)
|
||||
polyglot (0.3.4)
|
||||
posix-spawn (0.3.8)
|
||||
protected_attributes (1.0.7)
|
||||
activemodel (>= 4.0.1, < 5.0)
|
||||
puma (2.8.1)
|
||||
puma (2.8.2)
|
||||
rack (>= 1.1, < 2.0)
|
||||
pygments.rb (0.5.4)
|
||||
posix-spawn (~> 0.3.6)
|
||||
|
@ -318,6 +366,12 @@ GEM
|
|||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.1.1)
|
||||
ransack (1.2.1)
|
||||
actionpack (>= 3.0)
|
||||
activerecord (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
i18n
|
||||
polyamorous (~> 0.6.0)
|
||||
rdiscount (2.1.7)
|
||||
redcarpet (3.1.1)
|
||||
redis (3.0.7)
|
||||
|
@ -340,6 +394,8 @@ GEM
|
|||
redis-store (1.1.4)
|
||||
redis (>= 2.2)
|
||||
ref (1.0.5)
|
||||
responders (1.0.0)
|
||||
railties (>= 3.2, < 5)
|
||||
resque (1.25.2)
|
||||
mono_logger (~> 1.0)
|
||||
multi_json (~> 1.0)
|
||||
|
@ -405,6 +461,8 @@ GEM
|
|||
rack (~> 1.4)
|
||||
rack-protection (~> 1.4)
|
||||
tilt (~> 1.3, >= 1.3.4)
|
||||
sitemap_generator (5.0.1)
|
||||
builder
|
||||
skinny (0.2.3)
|
||||
eventmachine (~> 1.0.0)
|
||||
thin (~> 1.5.0)
|
||||
|
@ -440,6 +498,7 @@ GEM
|
|||
time_diff (0.3.0)
|
||||
activesupport
|
||||
i18n
|
||||
timecop (0.7.1)
|
||||
tmp_cache (0.1.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
|
@ -470,6 +529,7 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
RedCloth
|
||||
activeadmin!
|
||||
airbrake (~> 3.1.2)
|
||||
ancestry (~> 2.0.0)
|
||||
angular-i18n (= 0.1.2)
|
||||
|
@ -551,6 +611,7 @@ DEPENDENCIES
|
|||
shotgun
|
||||
shoulda
|
||||
shoulda-matchers
|
||||
sitemap_generator
|
||||
skype
|
||||
soundmanager-rails
|
||||
state_machine (~> 1.2)
|
||||
|
@ -558,6 +619,7 @@ DEPENDENCIES
|
|||
therubyracer (~> 0.12.1)
|
||||
therubyrhino (~> 1.73.1)
|
||||
time_diff
|
||||
timecop
|
||||
uglifier (~> 2.4)
|
||||
underscore-rails
|
||||
whenever (~> 0.9.0)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
ActiveAdmin.register_page 'Dashboard' do
|
||||
|
||||
menu priority: 1
|
||||
|
||||
content do
|
||||
|
||||
columns do
|
||||
column do
|
||||
panel "Deploy Information" do
|
||||
require 'deploy_info'
|
||||
|
||||
abf = "https://abf.io/abf/rosa-build/"
|
||||
#jenkins = "https://ci.shuttlerock.com/"
|
||||
|
||||
attributes_table_for DeployInfo do
|
||||
row('Branch') { link_to DeployInfo::BRANCH, "#{abf}tree/#{DeployInfo::BRANCH}" }
|
||||
row('Commit') { link_to DeployInfo::GIT_COMMIT, "#{abf}commit/#{DeployInfo::GIT_COMMIT}" }
|
||||
row('Build Number') { DeployInfo::BUILD_NUMBER }
|
||||
row('Build ID') { DeployInfo::BUILD_ID }
|
||||
row('Deployer') { DeployInfo::DEPLOYER }
|
||||
row(:message) { pre DeployInfo.message }
|
||||
end
|
||||
end # panel
|
||||
end # column
|
||||
end # columns
|
||||
|
||||
|
||||
end # content
|
||||
|
||||
end
|
|
@ -0,0 +1,37 @@
|
|||
ActiveAdmin.register EventLog do
|
||||
|
||||
menu parent: 'Misc'
|
||||
|
||||
actions :all, except: %i(create update new edit destroy)
|
||||
|
||||
controller do
|
||||
def scoped_collection
|
||||
EventLog.includes(:user)
|
||||
end
|
||||
end
|
||||
|
||||
index do
|
||||
column :id
|
||||
column :kind
|
||||
column :created_at
|
||||
column :user
|
||||
column :ip
|
||||
column :protocol
|
||||
column('Description') do |el|
|
||||
msg = %w([)
|
||||
msg << I18n.t("event_log.controllers.#{el.controller.underscore}", default: el.controller) << "]"
|
||||
msg << I18n.t("event_log.actions.#{el.controller.underscore}.#{el.action}", default: :"event_log.actions.#{el.action}")
|
||||
if el.eventable_id.present? and el.eventable_type.present?
|
||||
msg << '' << I18n.t("activerecord.models.#{el.eventable_type.underscore}")
|
||||
msg << el.eventable_name
|
||||
msg << "(id##{el.eventable_id})" # link_to "id##{el.eventable_id}", el.eventable
|
||||
end
|
||||
msg << el.message.to_s
|
||||
msg.join(' ')
|
||||
end
|
||||
|
||||
|
||||
default_actions
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
ActiveAdmin.register FlashNotify do
|
||||
|
||||
menu parent: 'Misc'
|
||||
|
||||
index do
|
||||
column :id
|
||||
column(:body_en) do |fn|
|
||||
fn.body_en.truncate(18)
|
||||
end
|
||||
column(:body_ru) do |fn|
|
||||
fn.body_ru.truncate(18)
|
||||
end
|
||||
column :published
|
||||
|
||||
default_actions
|
||||
end
|
||||
|
||||
form do |f|
|
||||
f.inputs do
|
||||
f.input :body_en
|
||||
f.input :body_ru
|
||||
f.input :status, as: :select, collection: FlashNotify::STATUSES, include_blank: false
|
||||
f.input :published
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
ActiveAdmin.register RegisterRequest do
|
||||
|
||||
menu parent: 'Misc'
|
||||
|
||||
index do
|
||||
column :id
|
||||
column :name
|
||||
|
||||
column('User') do |request|
|
||||
user = User.find_by(email: request.email) if request.approved
|
||||
link_to(user.uname, admin_user_path(user)) if user
|
||||
end
|
||||
column :interest
|
||||
column :more
|
||||
column :created_at
|
||||
|
||||
default_actions
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
ActiveAdmin.register_page 'Resque' do
|
||||
menu priority: 100, label: 'Resque', url: '/admin/resque/overview'
|
||||
end
|
|
@ -0,0 +1,56 @@
|
|||
ActiveAdmin.register User do
|
||||
|
||||
menu priority: 2
|
||||
|
||||
filter :uname
|
||||
filter :email
|
||||
filter :role, as: :select, collection: User::EXTENDED_ROLES
|
||||
filter :created_at
|
||||
|
||||
controller do
|
||||
def update(options={}, &block)
|
||||
user_params = params[:user]
|
||||
resource.role = user_params.delete(:role)
|
||||
user_params.delete(:password) if user_params[:password].blank?
|
||||
user_params.delete(:password_confirmation) if user_params[:password_confirmation].blank?
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
index do
|
||||
column :id
|
||||
column(:uname) do |user|
|
||||
link_to(user.uname, user_path(user))
|
||||
end
|
||||
column :email
|
||||
column :created_at
|
||||
column :role
|
||||
|
||||
default_actions
|
||||
end
|
||||
|
||||
form do |f|
|
||||
f.inputs do
|
||||
f.input :name
|
||||
f.input :email
|
||||
f.input :uname
|
||||
f.input :role, as: :select, collection: User::EXTENDED_ROLES, include_blank: false
|
||||
f.input :password
|
||||
f.input :password_confirmation
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
action_item only: %i(show edit) do
|
||||
link_to 'Reset token', reset_token_admin_user_path(resource),
|
||||
'data-method' => :put,
|
||||
data: { confirm: 'Are you sure you want to reset token?' }
|
||||
end
|
||||
|
||||
member_action :reset_token, :method => :put do
|
||||
resource.reset_authentication_token!
|
||||
flash[:info] = 'User token reseted successfully'
|
||||
redirect_to admin_user_path(resource)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
#= require active_admin/base
|
|
@ -28,4 +28,13 @@ RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout',
|
|||
}
|
||||
$scope.refresh();
|
||||
|
||||
$scope.updateStatus = function() {
|
||||
$http.put(
|
||||
Routes.product_build_list_path($scope.id),
|
||||
{product_build_list: {not_delete: $scope.pbl.not_delete}, format: 'json'}
|
||||
).success(function(results) {
|
||||
$scope.pbl = $scope.subject = results.product_build_list;
|
||||
});
|
||||
}
|
||||
|
||||
}]);
|
|
@ -87,12 +87,6 @@ $(document).ready(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
window.CodeMirrorRun = function(code) {
|
||||
CodeMirror.runMode(code.innerHTML.replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>'), code.className, code);
|
||||
}
|
||||
|
||||
$('.md_and_cm code').each(function (code) { CodeMirrorRun(this); });
|
||||
|
||||
window.updateTime = function () {
|
||||
$('.datetime_moment').each(function() {
|
||||
$(this).html(moment($(this).attr('origin_datetime'), 'X').fromNow());
|
||||
|
|
|
@ -24,7 +24,7 @@ $(document).ready(function() {
|
|||
var cancel_button = form.find('.cancel_edit_comment.button');
|
||||
var id = cancel_button.attr('id').match(/\d+$/)[0];
|
||||
cancel_button.click();
|
||||
$('#comment'+id+', #diff-comment'+id).find('.cm-s-default.md_and_cm').html(data).find('code').each(function (code) { CodeMirrorRun(this); })
|
||||
$('#comment'+id+', #diff-comment'+id).find('.cm-s-default.md_and_cm').html(data);
|
||||
},
|
||||
error: function(data){
|
||||
form.before(data.responseText);
|
||||
|
|
|
@ -50,7 +50,7 @@ function initLogWrapper() {
|
|||
var hScroll = l.scrollLeft;
|
||||
var onBottom = Math.abs((l.clientHeight + vScroll - l.scrollHeight)) < getLineHeight(l);
|
||||
|
||||
CodeMirror.runMode(data.log.replace(/&/gi, '&'), "text/x-sh", document.getElementById("output"));
|
||||
$("#output").html(data.log);
|
||||
|
||||
$logCont.scrollLeft(hScroll);
|
||||
$logCont.scrollTop((onBottom || first_open) ? l.scrollHeight - l.clientHeight : vScroll);
|
||||
|
|
|
@ -15,7 +15,7 @@ $(document).ready(function() {
|
|||
url: preview_url,
|
||||
data: el_dup.serialize(),
|
||||
success: function(data){
|
||||
preview.html(data).find('code').each(function (code) { CodeMirrorRun(this); })
|
||||
preview.html(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -108,7 +108,8 @@ $(document).ready(function() {
|
|||
$('#search_user').on('keyup', function() {
|
||||
path = $('#search_user_path').attr('path');
|
||||
data = $(this).serialize();
|
||||
dom = $('#manage_issue_users_list');
|
||||
// dom = $('#manage_issue_users_list');
|
||||
dom = $('#assigned-popup .list');
|
||||
return search_items(path, data, dom);
|
||||
});
|
||||
|
||||
|
@ -116,11 +117,11 @@ $(document).ready(function() {
|
|||
$('.users-search-popup').hide();
|
||||
});
|
||||
|
||||
$('#assigned-container .icon-share').on('click', function() {
|
||||
$(document).on('click', '#assigned-container .icon-share', function() {
|
||||
$('#assigned-popup').show();
|
||||
});
|
||||
|
||||
$('#assigned-popup .people.selected').on('click', function() {
|
||||
$(document).on('click', '#assigned-popup .people.selected', function() {
|
||||
var form = $('#assigned-popup .edit_assignee');
|
||||
var item = $(this);
|
||||
if (form.length == 0) {
|
||||
|
@ -213,7 +214,7 @@ $(document).ready(function() {
|
|||
form.fadeOut('slow');
|
||||
$('#edit_issue_content').fadeIn('slow');
|
||||
$('h3.issue_title').html(form.find('#issue_title').attr('value'));
|
||||
$('.fulltext.view.issue_body').html(data).find('code').each(function (code) { CodeMirrorRun(this); })
|
||||
$('.fulltext.view.issue_body').html(data);
|
||||
},
|
||||
error: function(data){
|
||||
form.before(data.responseText);
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// SASS variable overrides must be declared before loading up Active Admin's styles.
|
||||
//
|
||||
// To view the variables that Active Admin provides, take a look at
|
||||
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
|
||||
// Active Admin source.
|
||||
//
|
||||
// For example, to change the sidebar width:
|
||||
// $sidebar-width: 242px;
|
||||
|
||||
// Active Admin's got SASS!
|
||||
@import "active_admin/mixins";
|
||||
@import "active_admin/base";
|
||||
|
||||
// Overriding any non-variable SASS must be done after the fact.
|
||||
// For example, to change the default status-tag color:
|
||||
//
|
||||
// .status_tag { background: #6090DB; }
|
|
@ -393,7 +393,6 @@ div.comment textarea { resize: none }
|
|||
#repo-wrapper div.file div.data .formatted {
|
||||
overflow-x: auto;
|
||||
overflow-y: none;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
table.tablesorter tbody td a .issue_title {
|
||||
|
@ -474,6 +473,11 @@ div.blame_data tr td.lines {
|
|||
div.blame_data tr td.code {
|
||||
padding: 0 10px !important;
|
||||
font-size: 12px;
|
||||
width: auto;
|
||||
font-family: "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace;
|
||||
color: #000000;
|
||||
padding: 10px 5px 0px;
|
||||
margin-left: 45px;
|
||||
}
|
||||
|
||||
div.blame_data tr td.code pre {
|
||||
|
@ -1588,6 +1592,8 @@ table.tablesorter.platform-maintainers.static-search thead tr.search th input[ty
|
|||
code {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1790,10 +1796,6 @@ table#myTable thead tr.search th form.button_to div input {
|
|||
max-width: 860px;
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
border: 1px solid #DDDDDD;
|
||||
}
|
||||
|
||||
.semi {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
class Admin::BaseController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
load_and_authorize_resource
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
class Admin::EventLogsController < Admin::BaseController
|
||||
def index
|
||||
@event_logs = EventLog.default_order.eager_loading.paginate page: params[:page]
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
class Admin::FlashNotifiesController < Admin::BaseController
|
||||
def index
|
||||
@flash_notifies = FlashNotify.paginate(page: params[:page], per_page: 20)
|
||||
end
|
||||
|
||||
def new
|
||||
@flash_notify = FlashNotify.new(published: true)
|
||||
end
|
||||
|
||||
def create
|
||||
@flash_notify = FlashNotify.new(params[:flash_notify])
|
||||
if @flash_notify.save
|
||||
flash[:notice] = t("flash.flash_notify.saved")
|
||||
redirect_to admin_flash_notifies_path
|
||||
else
|
||||
flash[:error] = t("flash.flash_notify.save_error")
|
||||
flash[:warning] = @flash_notify.errors.full_messages.join('. ')
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @flash_notify.update_attributes(params[:flash_notify])
|
||||
flash[:notice] = t("flash.flash_notify.saved")
|
||||
redirect_to admin_flash_notifies_path
|
||||
else
|
||||
flash[:error] = t("flash.flash_notify.save_error")
|
||||
flash[:warning] = @flash_notify.errors.full_messages.join('. ')
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @flash_notify.destroy
|
||||
flash[:notice] = t("flash.flash_notify.destroyed")
|
||||
else
|
||||
flash[:error] = t("flash.flash_notify.destroy_error")
|
||||
end
|
||||
redirect_to admin_flash_notifies_path
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
class Admin::RegisterRequestsController < Admin::BaseController
|
||||
def index
|
||||
@register_requests = @register_requests.send((params[:scope] || 'unprocessed').to_sym).paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def update
|
||||
RegisterRequest.where(id: params[:request_ids]).each(¶ms[:update_type].to_sym) if params[:update_type].present? && params[:request_ids].present?
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
def approve
|
||||
@register_request.approve
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
def reject
|
||||
@register_request.reject
|
||||
redirect_to action: :index
|
||||
end
|
||||
end
|
|
@ -1,92 +0,0 @@
|
|||
class Admin::UsersController < Admin::BaseController
|
||||
include AvatarHelper
|
||||
prepend_before_filter :find_user
|
||||
load_and_authorize_resource collection: [:system, :list]
|
||||
|
||||
def index
|
||||
@filter = params[:filter] || 'all'
|
||||
end
|
||||
|
||||
def system
|
||||
@users, @filter = @users.system, 'system'
|
||||
render :index
|
||||
end
|
||||
|
||||
def new
|
||||
@user.role = 'system' if params[:system] == 'true'
|
||||
end
|
||||
|
||||
def create
|
||||
@user.role = params[:role]
|
||||
@user.email, @user.password = "#{@user.uname}@rosalinux.ru", SecureRandom.base64 if @user.system?
|
||||
@user.confirmed_at = Time.now.utc
|
||||
if (@user.save rescue false)
|
||||
flash[:notice] = t('flash.user.saved')
|
||||
flash[:warning] = @user.authentication_token
|
||||
redirect_to(@user.system? ? system_admin_users_path : admin_users_path)
|
||||
else
|
||||
flash[:error] = t('flash.user.save_error')
|
||||
flash[:warning] = @user.errors.full_messages.join('. ')
|
||||
@system = @user.system?
|
||||
|
||||
render action: :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
@user.role = params[:role]
|
||||
if @user.update_without_password(params[:user])
|
||||
update_avatar(@user, params)
|
||||
flash[:notice] = t('flash.user.saved')
|
||||
redirect_to admin_users_path
|
||||
else
|
||||
flash[:error] = t('flash.user.save_error')
|
||||
flash[:warning] = @user.errors.full_messages.join('. ')
|
||||
render action: :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user.destroy
|
||||
flash[:notice] = t("flash.user.destroyed")
|
||||
redirect_to(@user.system? ? system_admin_users_path : admin_users_path)
|
||||
end
|
||||
|
||||
def list
|
||||
if params[:system] != 'true'
|
||||
colName, @users = %w(name uname email created_at), @users.opened
|
||||
else
|
||||
colName, @users, @system_list = ['uname'], @users.system, true
|
||||
end
|
||||
sort_col = params[:iSortCol_0] || 0
|
||||
sort_dir = params[:sSortDir_0]=="asc" ? 'asc' : 'desc'
|
||||
order = "users.#{colName[sort_col.to_i]} #{sort_dir}"
|
||||
|
||||
@users = @users.paginate(page: (params[:iDisplayStart].to_i/params[:iDisplayLength].to_i).to_i + 1, per_page: params[:iDisplayLength])
|
||||
@total_users = @users.count
|
||||
if !params[:sSearch].blank? && search = "%#{params[:sSearch]}%"
|
||||
@users = @users.where('users.name ILIKE ? or users.uname ILIKE ? or users.email ILIKE ?', search, search, search)
|
||||
end
|
||||
@filter = params[:filter] || 'all'
|
||||
@users = @users.send(@filter) if ['real', 'admin', 'banned', 'tester'].include? @filter
|
||||
@users = @users.order(order)
|
||||
|
||||
render partial: 'users_ajax', layout: false
|
||||
end
|
||||
|
||||
def reset_auth_token
|
||||
@user.reset_authentication_token!
|
||||
flash[:notice] = t("flash.user.reset_auth_token")
|
||||
flash[:warning] = @user.authentication_token
|
||||
redirect_to system_admin_users_path
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_user
|
||||
@user = User.find_by!(uname: params[:id]) if params[:id].present?
|
||||
end
|
||||
end
|
|
@ -13,34 +13,6 @@ class Api::V1::BaseController < ApplicationController
|
|||
|
||||
protected
|
||||
|
||||
# For this example, we are simply using token authentication
|
||||
# via parameters. However, anyone could use Rails's token
|
||||
# authentication features to get the token from a header.
|
||||
def authenticate_user!
|
||||
user_token = params[:authentication_token].presence
|
||||
unless user_token
|
||||
credentials = decode_credentials.select(&:present?)
|
||||
user_token = credentials.first if credentials.size == 1
|
||||
end
|
||||
user = user_token && User.find_by_authentication_token(user_token.to_s)
|
||||
|
||||
if user
|
||||
# Notice we are passing store false, so the user is not
|
||||
# actually stored in the session and a token is needed
|
||||
# for every request. If you want the token to work as a
|
||||
# sign in token, you can simply remove store: false.
|
||||
sign_in user, store: false
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
# Helper to decode credentials from HTTP.
|
||||
def decode_credentials
|
||||
return [] unless request.authorization && request.authorization =~ /^Basic (.*)/m
|
||||
Base64.decode64($1).split(/:/, 2)
|
||||
end
|
||||
|
||||
def set_csv_file_headers(file_name)
|
||||
headers['Content-Type'] = 'text/csv'
|
||||
headers['Content-disposition'] = "attachment; filename=\"#{file_name}.csv\""
|
||||
|
|
|
@ -2,11 +2,13 @@ class Api::V1::PlatformsController < Api::V1::BaseController
|
|||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, only: :allowed
|
||||
skip_before_filter :authenticate_user!, only: [:show, :platforms_for_build, :members] if APP_CONFIG['anonymous_access']
|
||||
|
||||
load_and_authorize_resource except: :allowed
|
||||
|
||||
def allowed
|
||||
if Platform.allowed?(params[:path] || '', request)
|
||||
if request.authorization.present?
|
||||
token, pass = *ActionController::HttpAuthentication::Basic::user_name_and_password(request)
|
||||
end
|
||||
if Platform.allowed?(params[:path] || '', token)
|
||||
render nothing: true
|
||||
else
|
||||
render nothing: true, status: 403
|
||||
|
|
|
@ -37,6 +37,36 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
protected
|
||||
|
||||
# For this example, we are simply using token authentication
|
||||
# via parameters. However, anyone could use Rails's token
|
||||
# authentication features to get the token from a header.
|
||||
def authenticate_user!
|
||||
if user = find_user_by_token
|
||||
# Notice we are passing store false, so the user is not
|
||||
# actually stored in the session and a token is needed
|
||||
# for every request. If you want the token to work as a
|
||||
# sign in token, you can simply remove store: false.
|
||||
sign_in user, store: false
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def authenticate_user
|
||||
if user = find_user_by_token
|
||||
sign_in user, store: false
|
||||
end
|
||||
end
|
||||
|
||||
def find_user_by_token
|
||||
user_token = params[:authentication_token].presence
|
||||
if user_token.blank? && request.authorization.present?
|
||||
token, pass = *ActionController::HttpAuthentication::Basic::user_name_and_password(request)
|
||||
user_token = token if pass.blank?
|
||||
end
|
||||
user = user_token && User.find_by_authentication_token(user_token.to_s)
|
||||
end
|
||||
|
||||
def render_500(e)
|
||||
#check for exceptions Airbrake ignores by default and exclude them from manual Airbrake notification
|
||||
if Rails.env.production? && !AIRBRAKE_IGNORE.include?(e.class)
|
||||
|
|
|
@ -3,7 +3,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, only: [:index, :show, :log] if APP_CONFIG['anonymous_access']
|
||||
before_filter :redirect_to_full_path_if_short_url, only: :show
|
||||
before_filter :redirect_to_full_path_if_short_url, only: [:show, :update]
|
||||
load_and_authorize_resource :platform, except: :index
|
||||
load_and_authorize_resource :product, through: :platform, except: :index
|
||||
load_and_authorize_resource :product_build_list, through: :product, except: :index
|
||||
|
@ -25,13 +25,8 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def update
|
||||
if @product_build_list.update_attributes(not_delete: (params[:product_build_list] || {})[:not_delete])
|
||||
flash[:notice] = t('flash.product_build_list.updated')
|
||||
else
|
||||
flash[:error] = t('flash.product_build_list.update_error')
|
||||
flash[:warning] = @product_build_list.errors.full_messages.join('. ')
|
||||
end
|
||||
redirect_to platform_product_product_build_list_path(@platform, @product, @product_build_list)
|
||||
@product_build_list.update_attributes(not_delete: (params[:product_build_list] || {})[:not_delete])
|
||||
render :show
|
||||
end
|
||||
|
||||
def cancel
|
||||
|
@ -45,7 +40,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
|
||||
def log
|
||||
render json: {
|
||||
log: @product_build_list.abf_worker_log,
|
||||
log: Pygments.highlight(@product_build_list.abf_worker_log, lexer: 'sh'),
|
||||
building: @product_build_list.build_started?
|
||||
}
|
||||
end
|
||||
|
|
|
@ -6,9 +6,9 @@ class Projects::BaseController < ApplicationController
|
|||
|
||||
def find_collaborators
|
||||
search = "%#{params[:search_user]}%"
|
||||
users = User.joins(groups: :projects).where(projects: {id: @project.id}).where("users.uname ILIKE ?", search)
|
||||
users2 = @project.collaborators.where("users.uname ILIKE ?", search)
|
||||
@users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10)
|
||||
@users = @project.collaborators.where("users.uname ILIKE ?", search)
|
||||
@users |= @project.owner.members.where("users.uname ILIKE ?", search) if @project.owner.is_a?(Group)
|
||||
@users = @users.sort_by(&:uname).first(10)
|
||||
end
|
||||
|
||||
def find_project
|
||||
|
|
|
@ -190,12 +190,12 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def create_from_build_list
|
||||
return if params[:build_list_id].blank?
|
||||
build_list = BuildList.find(params[:build_list_id])
|
||||
build_list = @project.build_lists.find(params[:build_list_id])
|
||||
|
||||
params[:build_list] ||= {}
|
||||
keys = [:save_to_repository_id, :auto_publish_status, :include_repos, :extra_params,
|
||||
:project_version, :update_type, :auto_create_container,
|
||||
:extra_repositories, :extra_build_lists, :build_for_platform_id]
|
||||
:extra_repositories, :extra_build_lists, :build_for_platform_id, :use_cached_chroot]
|
||||
keys.each { |key| params[:build_list][key] = build_list.send(key) }
|
||||
params[:arches] = [build_list.arch_id.to_s]
|
||||
[:owner_filter, :status_filter].each { |t| params[t] = 'true' if %w(true undefined).exclude? params[t] }
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
class Projects::Git::BaseController < Projects::BaseController
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, only: [:show, :index, :blame, :raw, :archive, :diff, :tags, :branches] if APP_CONFIG['anonymous_access']
|
||||
if APP_CONFIG['anonymous_access']
|
||||
skip_before_filter :authenticate_user!, only: %i(show index blame raw archive diff tags branches)
|
||||
before_filter :authenticate_user, only: %i(show index blame raw archive diff tags branches)
|
||||
end
|
||||
|
||||
load_and_authorize_resource :project
|
||||
before_filter :set_treeish_and_path
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class SitemapController < ApplicationController
|
||||
|
||||
def show
|
||||
redirect_to "/sitemaps/#{request.host_with_port.gsub(/www./, '')}/sitemap.xml.gz"
|
||||
end
|
||||
|
||||
def robots
|
||||
render file: 'sitemap/robots', layout: false, content_type: Mime::TEXT
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
layout 'application'
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
module ActiveAdmin::AdminHelper
|
||||
|
||||
include ActiveAdmin::Views
|
||||
|
||||
def admin_polymorphic_path(resource)
|
||||
self.send("admin_#{resource.class.to_s.underscore}_path", resource)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -102,4 +102,20 @@ module GitHelper
|
|||
h
|
||||
end
|
||||
end
|
||||
|
||||
def blob_highlight(blob)
|
||||
if blob.mime_type == 'text/rpm-spec'
|
||||
Pygments.highlight blob.data, lexer: 'spec'
|
||||
else
|
||||
blob.colorize
|
||||
end.html_safe
|
||||
end
|
||||
|
||||
def blame_highlight(blob, text)
|
||||
if blob.mime_type == 'text/rpm-spec'
|
||||
Pygments.highlight(text, lexer: 'spec')
|
||||
else
|
||||
blob.lexer.highlight text
|
||||
end.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class CleanApiDefenderStatisticsJob
|
||||
@queue = :clone_build
|
||||
|
||||
def self.perform
|
||||
deadline = Date.today - 1.month
|
||||
Redis.current.keys.select do |key|
|
||||
next if key !~ /^throttle:/
|
||||
# See: https://github.com/datagraph/rack-throttle/blob/master/lib/rack/throttle/daily.rb#L41
|
||||
# Formats:
|
||||
# 'throttle:uname:%Y-%m-%dT%H', 'throttle:uname:%Y-%m-%d'
|
||||
# example: "throttle:uname1:2014-01-25T20", "throttle:uname1:2014-01-25"
|
||||
date = key.gsub(/.*:/, '').gsub(/T.*/, '')
|
||||
Redis.current.del(key) if Date.parse(date) < deadline
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -64,7 +64,8 @@ class Ability
|
|||
can :read, Project, visibility: 'open'
|
||||
can [:read, :archive, :membered, :get_id], Project, owner_type: 'User', owner_id: user.id
|
||||
can [:read, :archive, :membered, :get_id], Project, owner_type: 'Group', owner_id: user_group_ids
|
||||
can([:read, :archive, :membered, :get_id], Project, read_relations_for('projects')) {|project| local_reader? project}
|
||||
# can([:read, :archive, :membered, :get_id], Project, read_relations_for('projects')) {|project| local_reader? project}
|
||||
can([:read, :archive, :membered, :get_id], Project, read_relations_with_projects) {|project| local_reader? project}
|
||||
can(:write, Project) {|project| local_writer? project} # for grack
|
||||
can [:update, :sections, :manage_collaborators, :autocomplete_maintainers, :add_member, :remove_member, :update_member, :members, :schedule], Project do |project|
|
||||
local_admin? project
|
||||
|
@ -81,7 +82,9 @@ class Ability
|
|||
can [:read, :log, :owned, :everything], BuildList, user_id: user.id
|
||||
can [:read, :log, :related, :everything], BuildList, project: {owner_type: 'User', owner_id: user.id}
|
||||
can [:read, :log, :related, :everything], BuildList, project: {owner_type: 'Group', owner_id: user_group_ids}
|
||||
can([:read, :log, :everything, :list], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||
# can([:read, :log, :everything, :list], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||
# can([:read, :log, :everything, :list], BuildList, read_relations_for_build_lists_and_projects) {|build_list| can? :read, build_list.project}
|
||||
can([:read, :log, :everything, :list], BuildList, read_relations_with_projects('build_lists')) {|build_list| can? :read, build_list.project}
|
||||
|
||||
can(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) && build_list.save_to_platform.main? }
|
||||
can(:create, BuildList) {|build_list|
|
||||
|
@ -202,10 +205,36 @@ class Ability
|
|||
key = parent ? "#{parent.singularize}_id" : 'id'
|
||||
parent ||= table
|
||||
|
||||
["#{table}.#{key} IN (
|
||||
SELECT target_id FROM relations WHERE relations.target_type = ? AND
|
||||
["#{table}.#{key} = ANY (
|
||||
ARRAY (
|
||||
SELECT target_id
|
||||
FROM relations
|
||||
WHERE relations.target_type = ? AND
|
||||
(relations.actor_type = 'User' AND relations.actor_id = ? OR
|
||||
relations.actor_type = 'Group' AND relations.actor_id IN (?)))", parent.classify, @user, user_group_ids]
|
||||
relations.actor_type = 'Group' AND relations.actor_id IN (?))
|
||||
)
|
||||
)", parent.classify, @user, user_group_ids
|
||||
]
|
||||
end
|
||||
|
||||
def read_relations_with_projects(table = 'projects')
|
||||
key = table == 'projects' ? 'id' : 'project_id'
|
||||
["#{table}.#{key} = ANY (
|
||||
ARRAY (
|
||||
SELECT target_id
|
||||
FROM relations
|
||||
INNER JOIN projects ON projects.id = relations.target_id
|
||||
WHERE relations.target_type = 'Project' AND
|
||||
(
|
||||
projects.owner_type = 'User' AND projects.owner_id != :user OR
|
||||
projects.owner_type = 'Group' AND projects.owner_id NOT IN (:groups)
|
||||
) AND (
|
||||
relations.actor_type = 'User' AND relations.actor_id = :user OR
|
||||
relations.actor_type = 'Group' AND relations.actor_id IN (:groups)
|
||||
)
|
||||
)
|
||||
)", { user: @user, groups: user_group_ids }
|
||||
]
|
||||
end
|
||||
|
||||
def local_reader?(target)
|
||||
|
|
|
@ -30,8 +30,14 @@ class BuildList < ActiveRecord::Base
|
|||
AUTO_PUBLISH_STATUS_TESTING = 'testing'
|
||||
AUTO_PUBLISH_STATUSES = [AUTO_PUBLISH_STATUS_NONE, AUTO_PUBLISH_STATUS_DEFAULT, AUTO_PUBLISH_STATUS_TESTING]
|
||||
|
||||
validates :project_id, :project_version, :arch, :include_repos,
|
||||
:build_for_platform_id, :save_to_platform_id, :save_to_repository_id, presence: true
|
||||
validates :project_id,
|
||||
:project_version,
|
||||
:arch,
|
||||
:include_repos,
|
||||
:build_for_platform_id,
|
||||
:save_to_platform_id,
|
||||
:save_to_repository_id,
|
||||
presence: true
|
||||
validates_numericality_of :priority, greater_than_or_equal_to: 0
|
||||
validates :external_nodes, inclusion: { in: EXTERNAL_NODES }, allow_blank: true
|
||||
validates :auto_publish_status, inclusion: { in: AUTO_PUBLISH_STATUSES }
|
||||
|
@ -64,7 +70,8 @@ class BuildList < ActiveRecord::Base
|
|||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||
:save_to_platform_id, :project_version, :auto_create_container,
|
||||
:extra_repositories, :extra_build_lists, :extra_params, :external_nodes,
|
||||
:include_testing_subrepository, :auto_publish_status
|
||||
:include_testing_subrepository, :auto_publish_status,
|
||||
:use_cached_chroot
|
||||
|
||||
LIVE_TIME = 4.week # for unpublished
|
||||
MAX_LIVE_TIME = 3.month # for published
|
||||
|
@ -465,7 +472,11 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def log(load_lines)
|
||||
new_core? ? abf_worker_log : I18n.t('layout.build_lists.log.not_available')
|
||||
if new_core?
|
||||
Pygments.highlight abf_worker_log, lexer: 'sh'
|
||||
else
|
||||
I18n.t('layout.build_lists.log.not_available')
|
||||
end
|
||||
end
|
||||
|
||||
def last_published(testing = false)
|
||||
|
@ -505,6 +516,7 @@ class BuildList < ActiveRecord::Base
|
|||
git_project_address = project.git_project_address user
|
||||
# git_project_address.gsub!(/^http:\/\/(0\.0\.0\.0|localhost)\:[\d]+/, 'https://abf.rosalinux.ru') unless Rails.env.production?
|
||||
|
||||
|
||||
cmd_params = {
|
||||
'GIT_PROJECT_ADDRESS' => git_project_address,
|
||||
'COMMIT_HASH' => commit_hash,
|
||||
|
@ -512,7 +524,12 @@ class BuildList < ActiveRecord::Base
|
|||
'EXTRA_CFG_URPM_OPTIONS' => extra_params['cfg_urpm_options'],
|
||||
'EXTRA_BUILD_SRC_RPM_OPTIONS' => extra_params['build_src_rpm'],
|
||||
'EXTRA_BUILD_RPM_OPTIONS' => extra_params['build_rpm']
|
||||
}.map{ |k, v| "#{k}='#{v}'" }.join(' ')
|
||||
}
|
||||
if use_cached_chroot?
|
||||
sha1 = build_for_platform.cached_chroot(arch.name)
|
||||
cmd_params.merge!('CACHED_CHROOT_SHA1' => sha1) if sha1.present?
|
||||
end
|
||||
cmd_params = cmd_params.map{ |k, v| "#{k}='#{v}'" }.join(' ')
|
||||
|
||||
{
|
||||
id: id,
|
||||
|
|
|
@ -97,7 +97,7 @@ class Issue < ActiveRecord::Base
|
|||
|
||||
def subscribe_issue_assigned_user
|
||||
if self.assignee_id && self.assignee_id_changed?
|
||||
self.subscribes.where(user_id: self.assignee_id_was).first.destroy unless self.assignee_id_was.blank?
|
||||
self.subscribes.where(user_id: self.assignee_id_was).first.try(:destroy) unless self.assignee_id_was.blank?
|
||||
if self.assignee.notifier.issue_assign && !self.subscribes.exists?(user_id: self.assignee_id)
|
||||
self.subscribes.create(user_id: self.assignee_id)
|
||||
end
|
||||
|
|
|
@ -104,12 +104,10 @@ class MassBuild < ActiveRecord::Base
|
|||
where(
|
||||
status: status,
|
||||
mass_build_id: self.id
|
||||
).joins(:project, :arch).find_in_batches(batch_size: 100) do |build_lists|
|
||||
build_lists.each do |build_list|
|
||||
report << "ID: #{build_list.id}; "
|
||||
report << "PROJECT_NAME: #{build_list.project_name}; "
|
||||
report << "ARCH: #{build_list.arch_name}\n"
|
||||
end
|
||||
).joins(:project, :arch).find_each(batch_size: 100) do |build_list|
|
||||
report << "ID: #{build_list.id}; "
|
||||
report << "PROJECT_NAME: #{build_list.project_name}; "
|
||||
report << "ARCH: #{build_list.arch_name}\n"
|
||||
end
|
||||
report
|
||||
end
|
||||
|
@ -117,8 +115,8 @@ class MassBuild < ActiveRecord::Base
|
|||
def publish(user, *statuses)
|
||||
builds = build_lists.where(status: statuses)
|
||||
builds.update_all(publisher_id: user.id)
|
||||
builds.order(:id).find_in_batches(batch_size: 50) do |bls|
|
||||
bls.each{ |bl| bl.can_publish? && bl.has_new_packages? && bl.now_publish }
|
||||
builds.find_each(batch_size: 50) do |bl|
|
||||
bl.now_publish if bl.can_publish? && bl.has_new_packages?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ class Platform < ActiveRecord::Base
|
|||
include Owner
|
||||
include EventLoggable
|
||||
|
||||
CACHED_CHROOT_PRODUCT_NAME = 'cached-chroot'
|
||||
AUTOMATIC_METADATA_REGENERATIONS = %w(day week)
|
||||
VISIBILITIES = %w(open hidden)
|
||||
NAME_PATTERN = /[\w\-\.]+/
|
||||
|
@ -211,31 +212,34 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
# Checks access rights to platform and caching for 1 day.
|
||||
def self.allowed?(path, request)
|
||||
def self.allowed?(path, token)
|
||||
platform_name = path.gsub(/^[\/]+/, '')
|
||||
.match(/^(#{NAME_PATTERN}\/|#{NAME_PATTERN}$)/)
|
||||
|
||||
return true unless platform_name
|
||||
platform_name = platform_name[0].gsub(/\//, '')
|
||||
|
||||
if request.authorization.present?
|
||||
token, pass = *ActionController::HttpAuthentication::Basic::user_name_and_password(request)
|
||||
end
|
||||
|
||||
Rails.cache.fetch([platform_name, token, :platform_allowed], expires_in: 2.minutes) do
|
||||
platform = Platform.find_by name: platform_name
|
||||
next false unless platform
|
||||
next true unless platform.hidden?
|
||||
next false unless token
|
||||
next true if platform.tokens.by_active.where(authentication_token: token).exists?
|
||||
|
||||
user = User.find_by authentication_token: token
|
||||
return false if token.blank?
|
||||
return true if platform.tokens.by_active.where(authentication_token: token).exists?
|
||||
user = User.find_by(authentication_token: token)
|
||||
current_ability = Ability.new(user)
|
||||
if user && current_ability.can?(:show, platform)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
user && current_ability.can?(:show, platform) ? true : false
|
||||
end
|
||||
end
|
||||
|
||||
def cached_chroot(arch)
|
||||
return false if personal?
|
||||
Rails.cache.fetch([:cached_chroot, name, arch], expires_in: 10.minutes) do
|
||||
product = products.where(name: CACHED_CHROOT_PRODUCT_NAME).first
|
||||
next false unless product
|
||||
pbl = product.product_build_lists.for_status(ProductBuildList::BUILD_COMPLETED).recent.first
|
||||
next false unless pbl
|
||||
result = pbl.results.find{ |r| r['file_name'] =~ /-#{arch}.tar.gz$/ }
|
||||
result.present? ? result['sha1'] : false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ class ProductBuildList < ActiveRecord::Base
|
|||
BUILD_CANCELING => :build_canceling
|
||||
}.freeze
|
||||
|
||||
CACHED_CHROOT_TOKEN_DESCRIPTION = 'cached-chroot'
|
||||
|
||||
belongs_to :product
|
||||
belongs_to :project
|
||||
belongs_to :arch
|
||||
|
@ -120,8 +122,12 @@ class ProductBuildList < ActiveRecord::Base
|
|||
status == BUILD_CANCELING
|
||||
end
|
||||
|
||||
def can_destroy?
|
||||
![BUILD_STARTED, BUILD_PENDING, BUILD_CANCELING].include?(status)
|
||||
end
|
||||
|
||||
def can_cancel?
|
||||
[BUILD_STARTED, BUILD_PENDING].include? status
|
||||
[BUILD_STARTED, BUILD_PENDING].include?(status)
|
||||
end
|
||||
|
||||
def event_log_message
|
||||
|
@ -164,14 +170,22 @@ class ProductBuildList < ActiveRecord::Base
|
|||
'tar.gz',
|
||||
opts
|
||||
)
|
||||
|
||||
cmd_params = "BUILD_ID=#{id} "
|
||||
if product.platform.hidden?
|
||||
token = product.platform.tokens.by_active.where(description: CACHED_CHROOT_TOKEN_DESCRIPTION).first
|
||||
cmd_params << "TOKEN=#{token.authentication_token} " if token
|
||||
end
|
||||
cmd_params << params.to_s
|
||||
|
||||
{
|
||||
id: id,
|
||||
# TODO: remove comment
|
||||
# srcpath: 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz',
|
||||
srcpath: srcpath,
|
||||
params: ("BUILD_ID=#{id} " << params.to_s),
|
||||
time_living: time_living,
|
||||
main_script: main_script,
|
||||
srcpath: srcpath,
|
||||
params: cmd_params,
|
||||
time_living: time_living,
|
||||
main_script: main_script,
|
||||
platform: {
|
||||
type: product.platform.distrib_type,
|
||||
name: product.platform.name,
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class User < Avatar
|
||||
extend FriendlyId
|
||||
friendly_id :uname, use: [:finders]
|
||||
|
||||
include PersonalRepository
|
||||
include ActsLikeMember
|
||||
include Feed::User
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
= surround '[', ']' do
|
||||
= I18n.t "event_log.controllers.#{el.controller.underscore}", default: el.controller
|
||||
= I18n.t "event_log.actions.#{el.controller.underscore}.#{el.action}", default: :"event_log.actions.#{el.action}"
|
||||
- if el.eventable_id.present? and el.eventable_type.present?
|
||||
= I18n.t "activerecord.models.#{el.eventable_type.underscore}"
|
||||
= el.eventable_name
|
||||
= "(id##{el.eventable_id})" # link_to "id##{el.eventable_id}", el.eventable
|
||||
= el.message
|
|
@ -1,7 +0,0 @@
|
|||
%tr{class: cycle("odd", "even")}
|
||||
%td= event_log.kind
|
||||
%td= event_log.created_at
|
||||
%td= link_to_if event_log.user_id, event_log.user_name, event_log.user #{controller: "users", action: "show", id: event_log.user_id}
|
||||
%td= event_log.ip
|
||||
%td= event_log.protocol
|
||||
%td= render 'description', el: event_log
|
|
@ -1,14 +0,0 @@
|
|||
%h3.fix= title t("layout.event_logs.list_header")
|
||||
|
||||
%table#datatable.tablesorter.list-users
|
||||
%tr
|
||||
%th.first= t("activerecord.attributes.event_log.kind")
|
||||
%th= t("activerecord.attributes.event_log.created_at")
|
||||
%th= t("activerecord.attributes.event_log.user")
|
||||
%th= t("activerecord.attributes.event_log.ip")
|
||||
%th= t("activerecord.attributes.event_log.protocol")
|
||||
%th.last= t("activerecord.attributes.event_log.description")
|
||||
= render @event_logs
|
||||
= will_paginate
|
||||
|
||||
= render 'submenu'
|
|
@ -1,21 +0,0 @@
|
|||
.leftlist= f.label :body_ru, t("activerecord.attributes.flash_notify.body_ru"), class: :label
|
||||
.rightlist= f.text_area :body_ru, class: 'text_field'
|
||||
.both
|
||||
|
||||
.leftlist= f.label :body_en, t("activerecord.attributes.flash_notify.body_en"), class: :label
|
||||
.rightlist= f.text_area :body_en, class: 'text_field'
|
||||
.both
|
||||
|
||||
.leftlist= f.label :status, t("activerecord.attributes.flash_notify.status"), class: :label
|
||||
.rightlist= f.select :status, FlashNotify::STATUSES
|
||||
.both
|
||||
|
||||
.leftlist= f.label :published, t("activerecord.attributes.flash_notify.published"), class: :label
|
||||
.rightlist= f.check_box :published
|
||||
.both
|
||||
|
||||
.button_block
|
||||
= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')}
|
||||
%span.text_button_padding= t("layout.or")
|
||||
= link_to t("layout.cancel"), admin_flash_notifies_path, class: "button"
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
%h3= t("layout.flash_notifies.edit_header")
|
||||
|
||||
= form_for @flash_notify, url: admin_flash_notify_path(@flash_notify), html: { class: :form } do |f|
|
||||
= render "form", f: f
|
||||
|
||||
= render 'submenu'
|
|
@ -1,22 +0,0 @@
|
|||
= link_to t("layout.flash_notifies.new"), new_admin_flash_notify_path, class: 'button' if can? :create, FlashNotify
|
||||
|
||||
%table#myTable.tablesorter.flash_notifys{cellspacing: "0", cellpadding: "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.th1= t("activerecord.attributes.flash_notify.body_en")
|
||||
%th.th2= t("activerecord.attributes.flash_notify.body_ru")
|
||||
%th.th3= t("activerecord.attributes.flash_notify.published")
|
||||
%th.th3= t("layout.flash_notifies.actions")
|
||||
%tbody
|
||||
- @flash_notifies.each do |flash_notify|
|
||||
%tr{class: cycle("odd", "even")}
|
||||
%td= flash_notify.body_en.truncate 18
|
||||
%td= flash_notify.body_ru.truncate 18
|
||||
%td= flash_notify.published
|
||||
%td
|
||||
= link_to t("layout.flash_notifies.edit"), edit_admin_flash_notify_path(flash_notify)
|
||||
= link_to t("layout.flash_notifies.delete"), admin_flash_notify_path(flash_notify), method: :delete, data: { confirm: t("layout.mass_builds.cancel_confirm") } if can?(:delete, flash_notify)
|
||||
|
||||
= will_paginate @flash_notifies
|
||||
|
||||
= render 'submenu'
|
|
@ -1,6 +0,0 @@
|
|||
%h3= t("layout.flash_notifies.new_header")
|
||||
|
||||
= form_for @flash_notify, url: admin_flash_notifies_path, html: { class: :form } do |f|
|
||||
= render "form", f: f
|
||||
|
||||
= render 'submenu'
|
|
@ -2,7 +2,7 @@ json.build_list do
|
|||
json.(@build_list, :id, :container_status, :status, :duration)
|
||||
json.(@build_list, :update_type, :priority, :new_core)
|
||||
json.(@build_list, :advisory, :mass_build)
|
||||
json.(@build_list, :auto_publish_status, :package_version, :commit_hash, :last_published_commit_hash, :auto_create_container)
|
||||
json.(@build_list, :auto_publish_status, :package_version, :commit_hash, :last_published_commit_hash, :auto_create_container, :use_cached_chroot)
|
||||
json.build_log_url log_build_list_path(@build_list)
|
||||
|
||||
if @build_list.container_published?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.block
|
||||
%h2= title t("devise.confirmations.resend_header")
|
||||
%h2= title t("devise.confirmations.new.title")
|
||||
.content
|
||||
- if resource.errors.present?
|
||||
.flash
|
||||
|
@ -10,14 +10,12 @@
|
|||
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: "form" }) do |f|
|
||||
= f.hidden_field :reset_password_token
|
||||
.group.wat-cf
|
||||
.left
|
||||
= f.label :email, class: "label"
|
||||
.right
|
||||
= f.text_field :email, class: "text_field"
|
||||
= f.label :email, class: "label"
|
||||
= f.text_field :email, class: "text_field"
|
||||
|
||||
.group.navform.wat-cf
|
||||
%button.button{tyle: "submit"}
|
||||
= image_tag("choose.png", alt: t("devise.confirmations.send"))
|
||||
= t("devise.confirmations.send")
|
||||
= image_tag("choose.png", alt: t("devise.confirmations.new.submit_html"))
|
||||
= t("devise.confirmations.new.submit_html")
|
||||
%span.text_button_padding
|
||||
= render "devise/shared/links"
|
|
@ -1,6 +1,6 @@
|
|||
%p
|
||||
Welcome #{@resource.email}!
|
||||
%p You can confirm your account through the link below:
|
||||
%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @resource.confirmation_token)
|
||||
%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token)
|
||||
%br
|
||||
%p== Support team «ROSA ABF»
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%p
|
||||
Здравствуйте, #{@resource.email}!
|
||||
%p Вы можете подтвердить свой аккаунт, перейдя по ссылке снизу:
|
||||
%p= link_to 'Подтвердить мой аккаунт', confirmation_url(@resource, confirmation_token: @resource.confirmation_token)
|
||||
%p= link_to 'Подтвердить мой аккаунт', confirmation_url(@resource, confirmation_token: @token)
|
||||
%br
|
||||
%p== Команда поддержки «ROSA ABF»
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%p
|
||||
Hello #{@resource.email}!
|
||||
%p Someone has requested a link to change your password, and you can do this through the link below.
|
||||
%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token)
|
||||
%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token)
|
||||
%p If you didn't request this, please ignore this email.
|
||||
%p Your password won't change until you access the link above and create a new one.
|
||||
%br
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%p
|
||||
Здравствуйте, #{@resource.email}!
|
||||
%p Кто-то запросил смену Вашего пароля. Чтобы сменить пароль, перейдите по ссылке снизу.
|
||||
%p= link_to 'Сменить пароль', edit_password_url(@resource, reset_password_token: @resource.reset_password_token)
|
||||
%p= link_to 'Сменить пароль', edit_password_url(@resource, reset_password_token: @token)
|
||||
%p Пожалуйста, проигнорируйте это письмо, если оно попало к Вам по ошибке.
|
||||
%p Ваш пароль не поменяется, пока вы не перейдете по ссылке и не создадите новый.
|
||||
%br
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
- if can? :index, base.to_s.classify.constantize
|
||||
%li= link_to title, send(:"#{namespace}#{base}_path"), class: top_menu_class(base)
|
||||
- if current_user.try(:admin?) and which_menu == 'top_menu'
|
||||
%li= link_to t('admins_menu_header'), admin_users_path, class: top_menu_class('admin')
|
||||
%li= link_to t('admins_menu_header'), admin_root_path, class: top_menu_class('admin')
|
|
@ -38,17 +38,18 @@
|
|||
%br
|
||||
|
||||
- if can?(:update, pbl)
|
||||
= form_for pbl,
|
||||
url: platform_product_product_build_list_path(pbl.product.platform,pbl.product, pbl),
|
||||
html: {'ng-show' => "pbl.status == #{ProductBuildList::BUILD_COMPLETED}"} do |f|
|
||||
|
||||
.leftlist= f.label :not_delete
|
||||
%div{'ng-show' => "pbl.status == #{ProductBuildList::BUILD_COMPLETED}"}
|
||||
.leftlist= t('activerecord.attributes.product_build_list.not_delete')
|
||||
.rightlist
|
||||
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {selected: pbl.not_delete}
|
||||
.both
|
||||
%br
|
||||
= submit_tag t('layout.update'), data: {'disable-with' => t('layout.processing')}
|
||||
= select_tag 'not_delete', options_for_select([false, true].map{|status| [t("layout.#{status}_"), status]}), {'ng-model' => "pbl.not_delete", 'ng-change' => 'updateStatus()'}
|
||||
.both
|
||||
- if can?(:destroy, pbl)
|
||||
= link_to t('layout.product_build_lists.delete'),
|
||||
platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl),
|
||||
method: :delete, data: { confirm: t("layout.confirm") }, class: 'button',
|
||||
'ng-show' => 'pbl.can_destroy'
|
||||
.both
|
||||
%br
|
||||
.flash_notify{'ng-hide' => 'pbl.not_delete'}
|
||||
.alert.alert-error
|
||||
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
json.product_build_list do
|
||||
json.(@product_build_list, :id, :status, :human_status, :not_delete)
|
||||
json.(@product_build_list, :id, :status, :human_status)
|
||||
json.notified_at l(@product_build_list.updated_at, format: :long)
|
||||
|
||||
json.can_cancel @product_build_list.can_cancel?
|
||||
json.not_delete @product_build_list.not_delete?.to_s
|
||||
json.can_cancel @product_build_list.can_cancel?
|
||||
json.can_destroy @product_build_list.can_destroy?
|
||||
|
||||
json.results @product_build_list.results do |result|
|
||||
json.file_name result['file_name']
|
||||
|
|
|
@ -46,12 +46,11 @@
|
|||
- selected = params[:build_list].try(:[], :auto_publish_status) ? {selected: params[:build_list][:auto_publish_status]} : {}
|
||||
= f.select :auto_publish_status, auto_publish_statuses, selected
|
||||
= f.label :auto_publish_status
|
||||
.both
|
||||
- %i(auto_create_container include_testing_subrepository).each do |kind|
|
||||
- %i(auto_create_container include_testing_subrepository use_cached_chroot).each do |kind|
|
||||
.both
|
||||
- checked, field = params[:build_list].try(:[], kind), "build_list[#{kind}]"
|
||||
= hidden_field_tag field, false, id: nil
|
||||
= check_box_tag field, true, checked
|
||||
- checked = params[:build_list].try(:[], kind)
|
||||
- checked = @build_list.send(kind) if checked.nil?
|
||||
= f.check_box kind, checked: checked
|
||||
= f.label kind
|
||||
.both
|
||||
- selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {}
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
.leftlist= t("activerecord.attributes.build_list.auto_create_container")
|
||||
.rightlist= t("layout.#{@build_list.auto_create_container?}_")
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.use_cached_chroot")
|
||||
.rightlist= t("layout.#{@build_list.use_cached_chroot?}_")
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.project_version")
|
||||
.rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version)
|
||||
.both
|
||||
|
|
|
@ -18,24 +18,15 @@
|
|||
= index
|
||||
- index += 1
|
||||
|
||||
%td.code.cm-s-default
|
||||
%pre
|
||||
%div= elem[1].first
|
||||
%td.code.formatted
|
||||
= preserve do
|
||||
= blame_highlight @blob, elem[1].first
|
||||
|
||||
- elem[1][1..-1].each do |line|
|
||||
%tr
|
||||
%td.lines
|
||||
= index
|
||||
- index += 1
|
||||
%td.code.cm-s-default
|
||||
%pre
|
||||
%div= line
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
var $code_rows = $('.code.cm-s-default pre div');
|
||||
var mode = "#{File.extname(@blob.name) == '.spec' ? 'text/x-rpm-spec' : @blob.mime_type}"
|
||||
$code_rows.each(function() {
|
||||
CodeMirror.runMode($(this).text().replace(/&/gi, '&'), mode, this.parentElement.parentElement);
|
||||
});
|
||||
});
|
||||
%td.code.formatted
|
||||
= preserve do
|
||||
= blame_highlight @blob, line
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
.gutter= render_line_numbers(@blob.loc)
|
||||
#output.formatted.cm-s-default
|
||||
%pre#code
|
||||
:preserve
|
||||
#{h(@blob.data).html_safe}
|
||||
#output.formatted
|
||||
= preserve do
|
||||
= blob_highlight(@blob)
|
||||
.both
|
||||
|
|
|
@ -8,7 +8,3 @@
|
|||
.top= render 'top'
|
||||
.data= render "render_as_#{@blob.render_as}"
|
||||
|
||||
:javascript
|
||||
$(document).ready(function() {
|
||||
CodeMirror.runMode($('#code').text().replace(/&/gi, '&'), "#{@blob.raw_mime_type.content_type}", document.getElementById("output"));
|
||||
});
|
|
@ -23,6 +23,6 @@
|
|||
.fulltext{class: "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}",
|
||||
id: presenter.expandable? ? "content-expand#{item_no}" : ''}
|
||||
.md_and_cm{class: presenter.is_reference_to_issue ? '' : 'cm-s-default'}
|
||||
=presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content)
|
||||
= preserve do
|
||||
= presenter.is_reference_to_issue ? presenter.content : markdown(presenter.content)
|
||||
.both
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# robots.txt for <%= root_url %>
|
||||
|
||||
User-agent: *
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
Allow: /
|
||||
Host: <%= root_url.gsub(/\/$/, '') %>
|
||||
Sitemap: <%= sitemap_url %>
|
|
@ -50,7 +50,9 @@ module Rosa
|
|||
config.encoding = "utf-8"
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
config.assets.enabled = true
|
||||
config.assets.initialize_on_precompile = false # http://bit.ly/u7pQKz
|
||||
config.assets.precompile += %w(active_admin.js active_admin.css)
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace :deploy do
|
|||
# It will survive downloads folder between deployments
|
||||
run "mkdir -p #{fetch :shared_path}/downloads"
|
||||
run "ln -nfs #{fetch :shared_path}/downloads/ #{fetch :release_path}/public/downloads"
|
||||
|
||||
# It will survive sitemaps folder between deployments
|
||||
run "mkdir -p #{fetch :shared_path}/sitemaps"
|
||||
run "ln -nfs #{fetch :shared_path}/sitemaps #{fetch :release_path}/public/sitemaps"
|
||||
end
|
||||
|
||||
task :symlink_pids, :roles => :app do
|
||||
|
|
|
@ -65,5 +65,9 @@ Rosa::Application.configure do
|
|||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js moment/ru.js new_application.css new_application.js)
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
config.assets.css_compressor = :sass
|
||||
|
||||
config.eager_load = true
|
||||
end
|
||||
|
|
|
@ -64,6 +64,10 @@ Rosa::Application.configure do
|
|||
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
||||
config.assets.precompile += %w(login.css login.js reg_session.css tour.css tour.js gollum/editor/langs/*.js moment/ru.js)
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
config.assets.css_compressor = :sass
|
||||
|
||||
config.eager_load = true
|
||||
config.log_redis = true
|
||||
end
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
ActiveAdmin.setup do |config|
|
||||
|
||||
# == Site Title
|
||||
#
|
||||
# Set the title that is displayed on the main layout
|
||||
# for each of the active admin pages.
|
||||
#
|
||||
config.site_title = "ABF"
|
||||
config.site_title_link = "/"
|
||||
|
||||
# == Default Namespace
|
||||
#
|
||||
# Set the default namespace each administration resource
|
||||
# will be added to.
|
||||
#
|
||||
# eg:
|
||||
# config.default_namespace = :hello_world
|
||||
#
|
||||
# This will create resources in the HelloWorld module and
|
||||
# will namespace routes to /hello_world/*
|
||||
#
|
||||
# To set no namespace by default, use:
|
||||
# config.default_namespace = false
|
||||
config.default_namespace = :admin
|
||||
|
||||
|
||||
# == User Authentication
|
||||
#
|
||||
# Active Admin will automatically call an authentication
|
||||
# method in a before filter of all controller actions to
|
||||
# ensure that there is a currently logged in admin user.
|
||||
#
|
||||
# This setting changes the method which Active Admin calls
|
||||
# within the controller.
|
||||
config.authentication_method = :authenticate_user!
|
||||
|
||||
|
||||
# == Current User
|
||||
#
|
||||
# Active Admin will associate actions with the current
|
||||
# user performing them.
|
||||
#
|
||||
# This setting changes the method which Active Admin calls
|
||||
# to return the currently logged in user.
|
||||
config.current_user_method = :current_user
|
||||
|
||||
|
||||
# == Admin Comments
|
||||
#
|
||||
# Admin comments allow you to add comments to any model for admin use
|
||||
#
|
||||
# Admin comments are enabled by default in the default
|
||||
# namespace only. You can turn them on in a namesapce
|
||||
# by adding them to the comments array.
|
||||
#
|
||||
# config.allow_comments_in = [:admin]
|
||||
config.allow_comments = false
|
||||
|
||||
|
||||
# == Controller Filters
|
||||
#
|
||||
# You can add before, after and around filters to all of your
|
||||
# Active Admin resources from here.
|
||||
#
|
||||
# config.before_filter :do_something_awesome
|
||||
config.before_filter :check_admin_role
|
||||
|
||||
|
||||
# == Register Stylesheets & Javascripts
|
||||
#
|
||||
# We recommend using the built in Active Admin layout and loading
|
||||
# up your own stylesheets / javascripts to customize the look
|
||||
# and feel.
|
||||
#
|
||||
# To load a stylesheet:
|
||||
# config.register_stylesheet 'my_stylesheet.css'
|
||||
#
|
||||
# To load a javascript file:
|
||||
# config.register_javascript 'my_javascript.js'
|
||||
|
||||
config.logout_link_path = :destroy_user_session_path
|
||||
config.logout_link_method = :delete
|
||||
end
|
||||
|
||||
# Block admin access to non-admin-users.
|
||||
ActiveAdmin::BaseController.class_eval do
|
||||
# include ActionController::Caching::Sweeping
|
||||
protected
|
||||
def check_admin_role
|
||||
raise ActiveRecord::RecordNotFound unless current_user.admin?
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
Kaminari.configure do |config|
|
||||
config.page_method_name = :per_page_kaminari
|
||||
end
|
|
@ -38,6 +38,9 @@ en:
|
|||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
||||
new:
|
||||
title: "Resend confirmation instructions"
|
||||
submit_html: "Resend the instructions »"
|
||||
registrations:
|
||||
signed_up: 'Welcome! You have signed up successfully.'
|
||||
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
|
||||
|
|
|
@ -41,6 +41,9 @@ ru:
|
|||
send_paranoid_instructions: 'Если Ваш e-mail существует, то в течение нескольких минут вы получите e-mail с инструкциями по подтверждению вашей учётной записи.'
|
||||
confirmed: "Ваша учётная запись подтверждена. Теперь вы вошли в систему."
|
||||
error: "Неверный код подтверждения."
|
||||
new:
|
||||
title: "Отправить инструкцию по подтверждению учётной записи"
|
||||
submit_html: "Отправить инструкцию »"
|
||||
registrations:
|
||||
signed_up: "Добро пожаловать! Вы успешно зарегистрировались."
|
||||
signed_up_but_unconfirmed: 'Сообщение для подтверждения учетной записи было отправлено на Ваш email. Пожалуйста откройте ссылку из письма для активации.'
|
||||
|
|
|
@ -10,6 +10,7 @@ en:
|
|||
extra_repositories: Extra repositories
|
||||
extra_build_lists: Extra build lists
|
||||
auto_create_container: Create container automatically
|
||||
use_cached_chroot: Use cached chroot
|
||||
container_path: Container path
|
||||
status: Status
|
||||
project_id: Project
|
||||
|
|
|
@ -10,6 +10,7 @@ ru:
|
|||
extra_repositories: Дополнительные репозитории
|
||||
extra_build_lists: Дополнительные сборки
|
||||
auto_create_container: Создать контейнер автоматически
|
||||
use_cached_chroot: Использовать кэшированный chroot
|
||||
container_path: Путь до контейнера
|
||||
status: Статус
|
||||
project_id: Проект
|
||||
|
|
|
@ -18,3 +18,10 @@ build_lists_queues_monitoring:
|
|||
class: 'BuildListsQueuesMonitoringJob'
|
||||
queue: hook
|
||||
description: 'Monitoring for "user/mass-build" queues'
|
||||
|
||||
clean_api_defender_statistics:
|
||||
every:
|
||||
- '1d'
|
||||
class: 'CleanApiDefenderStatisticsJob'
|
||||
queue: clone_build
|
||||
description: 'Cleans ApiDefender statistics'
|
|
@ -1,4 +1,18 @@
|
|||
Rosa::Application.routes.draw do
|
||||
|
||||
# ActiveAdmin routes.
|
||||
ActiveAdmin.routes(self)
|
||||
|
||||
namespace :admin do
|
||||
constraints Rosa::Constraints::AdminAccess do
|
||||
mount Resque::Server => 'resque'
|
||||
end
|
||||
end
|
||||
|
||||
# Redirect sitemap1.xml.gz file on AWS S3
|
||||
match '/sitemap.xml.gz' => 'sitemap#show', via: [:get, :post, :head], as: :sitemap
|
||||
match '/robots.txt' => 'sitemap#robots', via: [:get, :post, :head], as: :robots
|
||||
|
||||
resource :contact, only: [:new, :create, :sended] do
|
||||
get '/' => 'contacts#new'
|
||||
get :sended
|
||||
|
@ -10,7 +24,10 @@ Rosa::Application.routes.draw do
|
|||
post 'users' => 'users/registrations#create', as: :user_registration
|
||||
end
|
||||
|
||||
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }, skip: [:registrations]
|
||||
devise_for :users, controllers: {
|
||||
omniauth_callbacks: 'users/omniauth_callbacks',
|
||||
confirmations: 'users/confirmations'
|
||||
}, skip: [:registrations]
|
||||
|
||||
namespace :api do
|
||||
namespace :v1 do
|
||||
|
@ -25,8 +42,8 @@ Rosa::Application.routes.draw do
|
|||
put :publish_into_testing
|
||||
}
|
||||
end
|
||||
resources :arches, only: [:index]
|
||||
resources :platforms, only: [:index, :show, :update, :destroy, :create] do
|
||||
resources :arches, only: :index
|
||||
resources :platforms, only: %i(index show update destroy create) do
|
||||
collection {
|
||||
get :platforms_for_build
|
||||
get :allowed
|
||||
|
@ -139,28 +156,6 @@ Rosa::Application.routes.draw do
|
|||
root to: 'home#activity'
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
resources :users do
|
||||
collection do
|
||||
get :list
|
||||
get :system
|
||||
end
|
||||
put :reset_auth_token, on: :member
|
||||
end
|
||||
resources :register_requests, only: [:index] do
|
||||
put :update, on: :collection
|
||||
member do
|
||||
get :approve
|
||||
get :reject
|
||||
end
|
||||
end
|
||||
resources :flash_notifies
|
||||
resources :event_logs, only: :index
|
||||
constraints Rosa::Constraints::AdminAccess do
|
||||
mount Resque::Server => 'resque'
|
||||
end
|
||||
end
|
||||
|
||||
resources :advisories, only: [:index, :show, :search] do
|
||||
get :search, on: :collection
|
||||
end
|
||||
|
@ -223,7 +218,7 @@ Rosa::Application.routes.draw do
|
|||
resources :maintainers, only: [:index]
|
||||
end
|
||||
|
||||
resources :product_build_lists, only: [:index, :show]
|
||||
resources :product_build_lists, only: [:index, :show, :update]
|
||||
end
|
||||
|
||||
resources :autocompletes, only: [] do
|
||||
|
@ -376,7 +371,7 @@ Rosa::Application.routes.draw do
|
|||
# Commit comments
|
||||
post '/commit/:commit_id/comments(.:format)' => "comments#create", as: :project_commit_comments
|
||||
get '/commit/:commit_id/comments/:id(.:format)' => "comments#edit", as: :edit_project_commit_comment
|
||||
put '/commit/:commit_id/comments/:id(.:format)' => "comments#update", as: :project_commit_comment
|
||||
patch '/commit/:commit_id/comments/:id(.:format)' => "comments#update", as: :project_commit_comment
|
||||
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
||||
get '/commit/:commit_id/add_line_comments(.:format)' => "comments#new_line", as: :new_line_commit_comment
|
||||
# Commit subscribes
|
||||
|
|
|
@ -26,6 +26,10 @@ every :day, at: '3:00 am' do
|
|||
rake 'activity_feeds:clear', output: 'log/activity_feeds.log'
|
||||
end
|
||||
|
||||
every :day, at: '2:30 am' do
|
||||
rake 'sitemap:refresh', output: 'log/sitemap.log'
|
||||
end
|
||||
|
||||
every 1.hour do
|
||||
rake 'buildlist:clear:outdated_canceling', output: 'log/canceling_build_list_clear.log'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
%w(abf.rosalinux.ru abf.io).each do |domain|
|
||||
|
||||
SitemapGenerator::Sitemap.create(
|
||||
default_host: "https://#{domain}",
|
||||
sitemaps_path: "sitemaps/#{domain}"
|
||||
) do
|
||||
|
||||
# root
|
||||
add(root_path)
|
||||
|
||||
# Projects
|
||||
Project.opened.find_each do |project|
|
||||
add(project_path(project), lastmod: project.updated_at)
|
||||
end
|
||||
|
||||
# BuildLists
|
||||
BuildList.for_status(BuildList::BUILD_PUBLISHED).
|
||||
where(platforms: { visibility: 'open' }, projects: { visibility: 'open' }).
|
||||
joins(:save_to_platform, :project).
|
||||
find_each do |bl|
|
||||
add(build_list_path(bl), lastmod: bl.updated_at)
|
||||
end
|
||||
|
||||
# Platforms
|
||||
Platform.opened.find_each do |platform|
|
||||
add(platform_path(platform), lastmod: platform.updated_at)
|
||||
|
||||
# Repositories
|
||||
add(platform_repositories_path(platform), lastmod: platform.updated_at)
|
||||
platform.repositories.find_each do |repository|
|
||||
add(platform_repository_path(platform, repository), lastmod: repository.updated_at)
|
||||
end
|
||||
|
||||
|
||||
# Products
|
||||
add(platform_products_path(platform), lastmod: platform.updated_at)
|
||||
platform.products.find_each do |product|
|
||||
add(platform_product_path(platform, product), lastmod: product.updated_at)
|
||||
|
||||
# ProductBuildList (ISO)
|
||||
product.product_build_lists.for_status(ProductBuildList::BUILD_COMPLETED).find_each do |pbl|
|
||||
add(platform_product_product_build_list_path(platform, product, pbl), lastmod: pbl.updated_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Users
|
||||
User.find_each do |user|
|
||||
add(user_path(user), lastmod: user.updated_at)
|
||||
end
|
||||
|
||||
# Groups
|
||||
Group.find_each do |group|
|
||||
add(group_path(group), lastmod: group.updated_at)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddUseCachedChrootToBuildList < ActiveRecord::Migration
|
||||
def change
|
||||
# Make existing build_lists 'false', but default to 'true' in the future.
|
||||
add_column :build_lists, :use_cached_chroot, :boolean, null: false, default: false
|
||||
change_column :build_lists, :use_cached_chroot, :boolean, null: false, default: true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :build_lists, :use_cached_chroot
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140306102620) do
|
||||
ActiveRecord::Schema.define(version: 20140407181059) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -140,6 +140,7 @@ ActiveRecord::Schema.define(version: 20140306102620) do
|
|||
t.integer "builder_id"
|
||||
t.boolean "include_testing_subrepository"
|
||||
t.string "auto_publish_status", default: "default", null: false
|
||||
t.boolean "use_cached_chroot", default: true, null: false
|
||||
t.index ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
t.index ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# This file gets overwritten during deploy process
|
||||
module DeployInfo
|
||||
BRANCH=`git rev-parse --abbrev-ref HEAD`.strip
|
||||
GIT_COMMIT=`git rev-parse HEAD`.strip
|
||||
BUILD_NUMBER='dev'
|
||||
BUILD_ID='dev'
|
||||
DEPLOYER=`git config user.name`.strip
|
||||
|
||||
def message
|
||||
`git log -1 --pretty=medium`.strip
|
||||
end
|
||||
|
||||
module_function :message
|
||||
end
|
|
@ -1,202 +0,0 @@
|
|||
User-agent: Googlebot
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: baiduspider
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: msnbot
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: naverbot
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: seznambot
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: Slurp
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: teoma
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: Yandex
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: CCBot
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: Telefonica
|
||||
Allow: /*/*/tree/master
|
||||
Allow: /*/*/blob/master
|
||||
Disallow: /*/*/tree/*
|
||||
Disallow: /*/*/blob/*
|
||||
Disallow: /*/*/wiki/*/*
|
||||
Disallow: /*/*/issues?*
|
||||
Disallow: /*/*/commits/*
|
||||
Disallow: /*/blame/
|
||||
Disallow: /*/raw/
|
||||
Disallow: /*.git
|
||||
Disallow: /*.git/
|
||||
Disallow: /search
|
||||
Disallow: /users/sign_up
|
||||
Disallow: /users/sign_in
|
||||
Disallow: /users/password/new
|
||||
Disallow: /users/register_requests/new
|
||||
Disallow: /invite.html
|
||||
Disallow: /thanks.html
|
||||
|
||||
User-agent: *
|
||||
Disallow: /
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::DashboardController do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::EventLogsController do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
|
@ -1,124 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::FlashNotifiesController do
|
||||
before(:each) do
|
||||
stub_symlink_methods
|
||||
|
||||
@user = FactoryGirl.create(:user)
|
||||
@create_params = {
|
||||
flash_notify: {
|
||||
body_ru: "Hello! I`m ru body",
|
||||
body_en: "Hello! I`m en body",
|
||||
status: "error",
|
||||
published: true
|
||||
}
|
||||
}
|
||||
|
||||
@flash_notify = FactoryGirl.create(:flash_notify)
|
||||
@flash_notify2 = FactoryGirl.create(:flash_notify)
|
||||
|
||||
@update_params = {
|
||||
id: @flash_notify,
|
||||
flash_notify: {
|
||||
body_ru: "updated!"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
context 'for guest' do
|
||||
[:index, :create, :update, :edit, :new, :destroy].each do |action|
|
||||
it "should not be able to perform #{ action } action" do
|
||||
get action, id: @flash_notify
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not change objects count on create' do
|
||||
lambda { post :create, @create_params }.should change{ FlashNotify.count }.by(0)
|
||||
end
|
||||
|
||||
it 'should not change objects count on destroy' do
|
||||
lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(0)
|
||||
end
|
||||
|
||||
it 'should not change flash notify body on update' do
|
||||
put :update, @update_params
|
||||
@flash_notify.reload.body_ru.should_not == "updated!"
|
||||
end
|
||||
end
|
||||
|
||||
context 'for global admin' do
|
||||
before(:each) do
|
||||
@admin = FactoryGirl.create(:admin)
|
||||
@user = FactoryGirl.create(:user)
|
||||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it 'should load 2 flash notifies objects on index' do
|
||||
get :index
|
||||
assigns[:flash_notifies].count.should == 2
|
||||
end
|
||||
|
||||
[:index, :new, :edit].each do |action|
|
||||
it "should be able to perform #{action} action" do
|
||||
get action, id: @flash_notify
|
||||
response.should render_template(action)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should be able to perform create action' do
|
||||
post :create, @create_params
|
||||
response.should redirect_to(admin_flash_notifies_path)
|
||||
end
|
||||
|
||||
it 'should change objects count on create' do
|
||||
lambda { post :create, @create_params }.should change{ FlashNotify.count }.by(1)
|
||||
end
|
||||
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, id: @flash_notify
|
||||
response.should redirect_to(admin_flash_notifies_path)
|
||||
end
|
||||
|
||||
it 'should change objects count on destroy' do
|
||||
lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(-1)
|
||||
end
|
||||
|
||||
it 'should be able to perform update action' do
|
||||
put :update, @update_params
|
||||
response.should redirect_to(admin_flash_notifies_path)
|
||||
end
|
||||
|
||||
it 'should change flash notify body on update' do
|
||||
put :update, @update_params
|
||||
@flash_notify.reload.body_ru.should == "updated!"
|
||||
end
|
||||
end
|
||||
|
||||
context 'for simple user' do
|
||||
before(:each) do
|
||||
@user = FactoryGirl.create(:user)
|
||||
set_session_for(@user)
|
||||
end
|
||||
|
||||
[:index, :create, :update, :edit, :new, :destroy].each do |action|
|
||||
it "should not be able to perform #{ action } action" do
|
||||
get action, id: @flash_notify
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not change objects count on create' do
|
||||
lambda { post :create, @create_params }.should change{ FlashNotify.count }.by(0)
|
||||
end
|
||||
|
||||
it 'should not change objects count on destroy' do
|
||||
lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(0)
|
||||
end
|
||||
|
||||
it 'should not change flash notify body on update' do
|
||||
put :update, @update_params
|
||||
@flash_notify.reload.body_ru.should_not == "updated!"
|
||||
end
|
||||
end
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::RegisterRequestsController do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::ResqueController do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::UsersController do
|
||||
it_should_behave_like 'an admin controller'
|
||||
end
|
|
@ -12,6 +12,7 @@ shared_examples_for 'api platform user with reader rights' do
|
|||
get :members, id: @platform.id, format: :json
|
||||
response.should render_template(:members)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples_for 'api platform user with owner rights' do
|
||||
|
|
|
@ -36,7 +36,7 @@ shared_examples_for 'product build list admin' do
|
|||
|
||||
it 'should be able to perform update action' do
|
||||
put :update, valid_attributes_for_show.merge(product_build_list: {time_living: 100,not_delete: true})
|
||||
response.should redirect_to(platform_product_product_build_list_path(@product.platform, @product, @pbl))
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "ensures that only not_delete field of product build list has been updated" do
|
||||
|
@ -73,6 +73,12 @@ shared_examples_for 'product build list user without admin rights' do
|
|||
put :cancel, valid_attributes_for_show
|
||||
response.should_not redirect_to(platform_product_product_build_list_path(@product.platform, @product, @pbl))
|
||||
end
|
||||
|
||||
it 'should not be able to perform update action' do
|
||||
put :update, valid_attributes_for_show
|
||||
response.should_not be_success
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
shared_examples_for 'product build list user' do
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe SitemapController do
|
||||
describe 'robots' do
|
||||
|
||||
it 'is successful' do
|
||||
get :robots
|
||||
response.should be_success
|
||||
response.should render_template('sitemap/robots')
|
||||
end
|
||||
|
||||
context 'validate robots.txt' do
|
||||
render_views
|
||||
|
||||
it 'ensures that Host is correct' do
|
||||
get :robots
|
||||
response.body.should match(/^Host: http:\/\/test.host$/)
|
||||
end
|
||||
|
||||
it 'ensures that Sitemap is correct' do
|
||||
get :robots
|
||||
response.body.should match(/^Sitemap: http:\/\/test.host\/sitemap.xml.gz$/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'show' do
|
||||
|
||||
it 'is successful' do
|
||||
get :show
|
||||
response.should redirect_to("/sitemaps/test.host/sitemap.xml.gz")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue