diff --git a/Gemfile b/Gemfile index 7caa01300..f4848b1d3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' -gem 'rails', '3.2.16' #, :git => 'git://github.com/rails/rails.git' -gem 'redhillonrails_core', :git => 'git://github.com/rosa-abf/redhillonrails_core.git', :branch => 'rails31' # '~> 2.0.0.pre' # deprecated +gem 'rails', '3.2.16' #, git: 'git://github.com/rails/rails.git' +gem 'redhillonrails_core', git: 'git://github.com/rosa-abf/redhillonrails_core.git', branch: 'rails31' # '~> 2.0.0.pre' # deprecated gem 'pg', '~> 0.14.0' @@ -24,10 +24,10 @@ gem 'highline', '~> 1.6.11' gem 'state_machine' gem 'redis-rails' -gem 'grack', :git => 'git://github.com/rosa-abf/grack.git', :require => 'git_http' -gem 'grit', :git => 'git://github.com/rosa-abf/grit.git' +gem 'grack', git: 'git://github.com/rosa-abf/grack.git', require: 'git_http' +gem 'grit', git: 'git://github.com/rosa-abf/grit.git' gem 'charlock_holmes', '~> 0.6.9' -gem 'github-linguist', '~> 2.3.4', :require => 'linguist' +gem 'github-linguist', '~> 2.3.4', require: 'linguist' gem 'diff-display', '~> 0.0.1' # Wiki @@ -39,17 +39,17 @@ gem 'rdiscount' gem 'RedCloth' gem 'wikicloth' -# gem 'unicorn', '~> 4.3.1', :platforms => [:mri, :rbx] -gem 'trinidad', '~> 1.0.2', :platforms => :jruby +# gem 'unicorn', '~> 4.3.1', platforms: [:mri, :rbx] +gem 'trinidad', '~> 1.0.2', platforms: :jruby gem 'newrelic_rpm' -# gem 'whenever', '~> 0.7.3', :require => false -gem 'whenever', '~> 0.9.0', :require => false +# gem 'whenever', '~> 0.7.3', require: false +gem 'whenever', '~> 0.9.0', require: false gem 'jbuilder', '~> 1.4.2' gem 'rails3-jquery-autocomplete', '~> 1.0.7' gem 'will_paginate', '~> 3.0.3' -gem 'meta-tags', '~> 1.2.5', :require => 'meta_tags' +gem 'meta-tags', '~> 1.2.5', require: 'meta_tags' gem "haml-rails", '~> 0.3.4' gem 'jquery-rails', '~> 2.0.2' gem 'ruby-haml-js', '~> 0.0.3' @@ -81,14 +81,14 @@ group :assets do gem 'coffee-rails', '~> 3.2.2' gem 'compass-rails', '~> 1.0.3' gem 'uglifier', '~> 1.2.4' - gem 'therubyracer', '~> 0.10.2', :platforms => [:mri, :rbx] - gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby + gem 'therubyracer', '~> 0.10.2', platforms: [:mri, :rbx] + gem 'therubyrhino', '~> 1.73.1', platforms: :jruby gem 'turbo-sprockets-rails3' end group :production do gem "airbrake", '~> 3.1.2' - gem 'bluepill', '~> 0.0.60', :require => false + gem 'bluepill', '~> 0.0.60', require: false # gem 'le' gem 'logglier' gem 'puma' @@ -100,10 +100,10 @@ group :development do gem 'hirb' gem 'shotgun' # deploy - gem 'capistrano', :require => false - gem 'rvm-capistrano', :require => false - gem 'cape', :require => false - gem 'capistrano_colors', :require => false + gem 'capistrano', require: false + gem 'rvm-capistrano', require: false + gem 'cape', require: false + gem 'capistrano_colors', require: false # Better Errors & RailsPanel gem 'better_errors' gem 'binding_of_caller' @@ -112,7 +112,7 @@ group :development do end group :test do - gem 'rspec-rails', '~> 2.11.0', :group => 'development' + gem 'rspec-rails', '~> 2.11.0', group: 'development' gem 'factory_girl_rails', '~> 4.0.0' gem 'rr', '~> 1.0.4' gem 'shoulda' diff --git a/app/controllers/admin/event_logs_controller.rb b/app/controllers/admin/event_logs_controller.rb index a683628dd..e099acbb2 100644 --- a/app/controllers/admin/event_logs_controller.rb +++ b/app/controllers/admin/event_logs_controller.rb @@ -1,5 +1,5 @@ class Admin::EventLogsController < Admin::BaseController def index - @event_logs = EventLog.default_order.eager_loading.paginate :page => params[:page] + @event_logs = EventLog.default_order.eager_loading.paginate page: params[:page] end end diff --git a/app/controllers/admin/flash_notifies_controller.rb b/app/controllers/admin/flash_notifies_controller.rb index 5946427bf..97f2ca7e9 100644 --- a/app/controllers/admin/flash_notifies_controller.rb +++ b/app/controllers/admin/flash_notifies_controller.rb @@ -1,10 +1,10 @@ class Admin::FlashNotifiesController < Admin::BaseController def index - @flash_notifies = FlashNotify.paginate(:page => params[:page], :per_page => 20) + @flash_notifies = FlashNotify.paginate(page: params[:page], per_page: 20) end def new - @flash_notify = FlashNotify.new(:published => true) + @flash_notify = FlashNotify.new(published: true) end def create diff --git a/app/controllers/admin/register_requests_controller.rb b/app/controllers/admin/register_requests_controller.rb index 5939746fa..0dda01db0 100644 --- a/app/controllers/admin/register_requests_controller.rb +++ b/app/controllers/admin/register_requests_controller.rb @@ -1,20 +1,20 @@ class Admin::RegisterRequestsController < Admin::BaseController def index - @register_requests = @register_requests.send((params[:scope] || 'unprocessed').to_sym).paginate(:page => params[:page]) + @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 + 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 + redirect_to action: :index end def reject @register_request.reject - redirect_to :action => :index + redirect_to action: :index end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 3d42bfddc..91d66d3e6 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,7 +1,7 @@ class Admin::UsersController < Admin::BaseController include AvatarHelper prepend_before_filter :find_user - load_and_authorize_resource :collection => [:system, :list] + load_and_authorize_resource collection: [:system, :list] def index @filter = params[:filter] || 'all' @@ -29,7 +29,7 @@ class Admin::UsersController < Admin::BaseController flash[:warning] = @user.errors.full_messages.join('. ') @system = @user.system? - render :action => :new + render action: :new end end @@ -45,7 +45,7 @@ class Admin::UsersController < Admin::BaseController else flash[:error] = t('flash.user.save_error') flash[:warning] = @user.errors.full_messages.join('. ') - render :action => :edit + render action: :edit end end @@ -65,7 +65,7 @@ class Admin::UsersController < Admin::BaseController 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]) + @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) @@ -74,7 +74,7 @@ class Admin::UsersController < Admin::BaseController @users = @users.send(@filter) if ['real', 'admin', 'banned', 'tester'].include? @filter @users = @users.order(order) - render :partial => 'users_ajax', :layout => false + render partial: 'users_ajax', layout: false end def reset_auth_token diff --git a/app/controllers/advisories_controller.rb b/app/controllers/advisories_controller.rb index 0181c57ea..d848a8549 100644 --- a/app/controllers/advisories_controller.rb +++ b/app/controllers/advisories_controller.rb @@ -1,13 +1,13 @@ class AdvisoriesController < ApplicationController before_filter :authenticate_user! skip_before_filter :authenticate_user! if APP_CONFIG['anonymous_access'] - load_resource :find_by => :advisory_id + load_resource find_by: :advisory_id authorize_resource def index - @advisories = @advisories.scoped(:include => :platforms) + @advisories = @advisories.scoped(include: :platforms) @advisories = @advisories.search_by_id(params[:q]) if params[:q] - @advisories = @advisories.paginate(:page => params[:page]) + @advisories = @advisories.paginate(page: params[:page]) respond_to do |format| format.html format.atom @@ -21,7 +21,7 @@ class AdvisoriesController < ApplicationController def search @advisory = Advisory.by_update_type(params[:bl_type]).search_by_id(params[:query]).first if @advisory.nil? - render :nothing => true, :status => 404 + render nothing: true, status: 404 else # respond_to do |format| # format.json { render @advisory } diff --git a/app/controllers/api/v1/advisories_controller.rb b/app/controllers/api/v1/advisories_controller.rb index 39c59bb41..23c722ccc 100644 --- a/app/controllers/api/v1/advisories_controller.rb +++ b/app/controllers/api/v1/advisories_controller.rb @@ -1,12 +1,12 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] - load_resource :advisory, :find_by => :advisory_id - before_filter :find_and_authorize_build_list, :only => [:create, :update] - authorize_resource :build_list, :only => [:create, :update] + skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + load_resource :advisory, find_by: :advisory_id + before_filter :find_and_authorize_build_list, only: [:create, :update] + authorize_resource :build_list, only: [:create, :update] def index - @advisories = @advisories.scoped(:include => [:platforms, :projects]). + @advisories = @advisories.scoped(include: [:platforms, :projects]). paginate(paginate_params) end diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index 38d0efc95..f06fb29ee 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -47,7 +47,7 @@ class Api::V1::BaseController < ApplicationController role = params[:role] class_name = subject.class.name.downcase if member.present? && role.present? && subject.respond_to?(:owner) && subject.owner != member && - subject.send(relation).by_actor(member).update_all(:role => role) + subject.send(relation).by_actor(member).update_all(role: role) render_json_response subject, "Role for #{member.class.name.downcase} '#{member.id} has been updated in #{class_name} successfully" else render_validation_error subject, "Role for member has not been updated in #{class_name}" @@ -89,12 +89,12 @@ class Api::V1::BaseController < ApplicationController def render_json_response(subject, message, status = 200) id = status != 200 ? nil : subject.id - render :json => { + render json: { subject.class.name.underscore.to_sym => { - :id => id, - :message => message + id: id, + message: message } - }.to_json, :status => status + }.to_json, status: status end def render_validation_error(subject, message) @@ -103,9 +103,9 @@ class Api::V1::BaseController < ApplicationController def member_path(subject) if subject.is_a?(User) - api_v1_user_path(subject.id, :format => :json) + api_v1_user_path(subject.id, format: :json) else - api_v1_group_path(subject.id, :format => :json) + api_v1_group_path(subject.id, format: :json) end end @@ -113,7 +113,7 @@ class Api::V1::BaseController < ApplicationController def member if @member.blank? && %w(User Group).include?(params[:type]) - @member = params[:type].constantize.where(:id => params[:member_id]).first + @member = params[:type].constantize.where(id: params[:member_id]).first end @member end diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index 3b41ae812..dc6fce832 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -1,20 +1,20 @@ class Api::V1::BuildListsController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show, :index] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:show, :index] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :project, :only => :index - load_and_authorize_resource :build_list, :only => [:show, :create, :cancel, :publish, :reject_publish, :create_container, :publish_into_testing] + load_and_authorize_resource :project, only: :index + load_and_authorize_resource :build_list, only: [:show, :create, :cancel, :publish, :reject_publish, :create_container, :publish_into_testing] def index filter = BuildList::Filter.new(@project, current_user, current_ability, params[:filter] || {}) - @build_lists = filter.find.scoped(:include => [:save_to_platform, :project, :user, :arch]) + @build_lists = filter.find.scoped(include: [:save_to_platform, :project, :user, :arch]) @build_lists = @build_lists.recent.paginate(paginate_params) end def create bl_params = params[:build_list] || {} - save_to_repository = Repository.where(:id => bl_params[:save_to_repository_id]).first + save_to_repository = Repository.where(id: bl_params[:save_to_repository_id]).first if save_to_repository bl_params[:save_to_platform_id] = save_to_repository.platform_id diff --git a/app/controllers/api/v1/groups_controller.rb b/app/controllers/api/v1/groups_controller.rb index 5e021e684..f5c19ef0d 100644 --- a/app/controllers/api/v1/groups_controller.rb +++ b/app/controllers/api/v1/groups_controller.rb @@ -1,7 +1,7 @@ class Api::V1::GroupsController < Api::V1::BaseController - + before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource def index diff --git a/app/controllers/api/v1/issues_controller.rb b/app/controllers/api/v1/issues_controller.rb index fc38f49a3..fe6a767f9 100644 --- a/app/controllers/api/v1/issues_controller.rb +++ b/app/controllers/api/v1/issues_controller.rb @@ -2,11 +2,11 @@ class Api::V1::IssuesController < Api::V1::BaseController respond_to :json before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :group_index, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :group_index, :show] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :group, :only => :group_index, :find_by => :id, :parent => false + load_and_authorize_resource :group, only: :group_index, find_by: :id, parent: false load_and_authorize_resource :project - load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :update, :create, :index] + load_and_authorize_resource :issue, through: :project, find_by: :serial_id, only: [:show, :update, :create, :index] def index @issues = @project.issues @@ -15,20 +15,20 @@ class Api::V1::IssuesController < Api::V1::BaseController def all_index project_ids = get_all_project_ids Project.accessible_by(current_ability, :membered).pluck(:id) - @issues = Issue.where(:project_id => project_ids) + @issues = Issue.where(project_id: project_ids) render_issues_list end def user_index project_ids = get_all_project_ids current_user.projects.pluck(:id) - @issues = Issue.where(:project_id => project_ids) + @issues = Issue.where(project_id: project_ids) render_issues_list end def group_index project_ids = @group.projects.pluck(:id) - project_ids = Project.accessible_by(current_ability, :membered).where(:id => project_ids).pluck(:id) - @issues = Issue.where(:project_id => project_ids) + project_ids = Project.accessible_by(current_ability, :membered).where(id: project_ids).pluck(:id) + @issues = Issue.where(project_id: project_ids) render_issues_list end @@ -70,7 +70,7 @@ class Api::V1::IssuesController < Api::V1::BaseController if action_name == 'index' && params[:assignee].present? case params[:assignee] when 'none' - @issues = @issues.where(:assigned_id => nil) + @issues = @issues.where(assigned_id: nil) when '*' @issues = @issues.where('issues.assigned_id IS NOT NULL') else @@ -81,10 +81,10 @@ class Api::V1::IssuesController < Api::V1::BaseController if %w[all_index user_index group_index].include?(action_name) case params[:filter] when 'created' - @issues = @issues.where(:user_id => current_user) + @issues = @issues.where(user_id: current_user) when 'all' else - @issues = @issues.where(:assignee_id => current_user) + @issues = @issues.where(assignee_id: current_user) end else @issues.where('users.uname = ?', params[:creator]) if params[:creator].present? @@ -109,7 +109,7 @@ class Api::V1::IssuesController < Api::V1::BaseController if ['created', 'all'].include? params[:filter] # add own issues project_ids = Project.accessible_by(current_ability, :show).joins(:issues). - where(:issues => {:user_id => current_user.id}).pluck('projects.id') + where(issues: {user_id: current_user.id}).pluck('projects.id') end project_ids |= default_project_ids end diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index 0b10f801d..f3a9ef152 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -15,7 +15,7 @@ class Api::V1::JobsController < Api::V1::BaseController if current_user.system? if task = (Resque.pop('rpm_worker_default') || Resque.pop('rpm_worker')) - @build_list = BuildList.where(:id => task['args'][0]['id']).first + @build_list = BuildList.where(id: task['args'][0]['id']).first end end @@ -37,12 +37,12 @@ class Api::V1::JobsController < Api::V1::BaseController if @build_list job = { - :worker_queue => @build_list.worker_queue_with_priority, - :worker_class => @build_list.worker_queue_class, + worker_queue: @build_list.worker_queue_with_priority, + worker_class: @build_list.worker_queue_class, :worker_args => [@build_list.abf_worker_args] } end - render :json => { :job => job }.to_json + render json: { job: job }.to_json end def statistics @@ -51,25 +51,25 @@ class Api::V1::JobsController < Api::V1::BaseController :id => params[:uid], :user_id => current_user.id, :system => current_user.system?, - :worker_count => params[:worker_count], - :busy_workers => params[:busy_workers] + worker_count: params[:worker_count], + busy_workers: params[:busy_workers] ) rescue nil end - render :nothing => true + render nothing: true end def status - render :text => Resque.redis.get(params[:key]) + render text: Resque.redis.get(params[:key]) end def logs name = params[:name] if name =~ /abfworker::rpm-worker/ - if current_user.system? || current_user.id == BuildList.where(:id => name.gsub(/[^\d]/, '')).first.try(:builder_id) + if current_user.system? || current_user.id == BuildList.where(id: name.gsub(/[^\d]/, '')).first.try(:builder_id) BuildList.log_server.setex name, 15, params[:logs] end end - render :nothing => true + render nothing: true end def feedback @@ -77,11 +77,11 @@ class Api::V1::JobsController < Api::V1::BaseController worker_class = params[:worker_class] if QUEUES.include?(worker_queue) && QUEUE_CLASSES.include?(worker_class) worker_args = (params[:worker_args] || []).first || {} - worker_args = worker_args.merge(:feedback_from_user => current_user.id) + worker_args = worker_args.merge(feedback_from_user: current_user.id) Resque.push worker_queue, 'class' => worker_class, 'args' => [worker_args] - render :nothing => true + render nothing: true else - render :nothing => true, :status => 403 + render nothing: true, status: 403 end end diff --git a/app/controllers/api/v1/platforms_controller.rb b/app/controllers/api/v1/platforms_controller.rb index 2acbe71f7..4fdeccf63 100644 --- a/app/controllers/api/v1/platforms_controller.rb +++ b/app/controllers/api/v1/platforms_controller.rb @@ -1,15 +1,15 @@ 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'] + 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 + load_and_authorize_resource except: :allowed def allowed if Platform.allowed?(params[:path] || '', request) - render :nothing => true + render nothing: true else - render :nothing => true, :status => 403 + render nothing: true, status: 403 end end @@ -28,14 +28,14 @@ class Api::V1::PlatformsController < Api::V1::BaseController def create platform_params = params[:platform] || {} - owner = User.where(:id => platform_params[:owner_id]).first + owner = User.where(id: platform_params[:owner_id]).first @platform.owner = owner || get_owner create_subject @platform end def update platform_params = params[:platform] || {} - owner = User.where(:id => platform_params[:owner_id]).first + owner = User.where(id: platform_params[:owner_id]).first platform_params[:owner] = owner if owner update_subject @platform end diff --git a/app/controllers/api/v1/product_build_lists_controller.rb b/app/controllers/api/v1/product_build_lists_controller.rb index f6ed797d6..6375d1382 100644 --- a/app/controllers/api/v1/product_build_lists_controller.rb +++ b/app/controllers/api/v1/product_build_lists_controller.rb @@ -1,8 +1,8 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :product, :only => :index + load_and_authorize_resource :product, only: :index load_and_authorize_resource def index @@ -27,7 +27,7 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController end def update - params[:product_build_list] = {:not_delete => (params[:product_build_list] || {})[:not_delete]} + params[:product_build_list] = {not_delete: (params[:product_build_list] || {})[:not_delete]} update_subject @product_build_list end diff --git a/app/controllers/api/v1/products_controller.rb b/app/controllers/api/v1/products_controller.rb index fd136af78..1ca2c2bc7 100644 --- a/app/controllers/api/v1/products_controller.rb +++ b/app/controllers/api/v1/products_controller.rb @@ -1,6 +1,6 @@ class Api::V1::ProductsController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb index 89f6e0cbf..94276314d 100644 --- a/app/controllers/api/v1/projects_controller.rb +++ b/app/controllers/api/v1/projects_controller.rb @@ -1,8 +1,8 @@ class Api::V1::ProjectsController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:get_id, :show, :refs_list] if APP_CONFIG['anonymous_access'] - + skip_before_filter :authenticate_user!, only: [:get_id, :show, :refs_list] if APP_CONFIG['anonymous_access'] + load_and_authorize_resource :project def index @@ -38,7 +38,7 @@ class Api::V1::ProjectsController < Api::V1::BaseController owner_type = p_params[:owner_type] if owner_type.present? && %w(User Group).include?(owner_type) @project.owner = owner_type.constantize. - where(:id => p_params[:owner_id]).first + where(id: p_params[:owner_id]).first else @project.owner = nil end diff --git a/app/controllers/api/v1/pull_requests_controller.rb b/app/controllers/api/v1/pull_requests_controller.rb index 61cf91845..837673b37 100644 --- a/app/controllers/api/v1/pull_requests_controller.rb +++ b/app/controllers/api/v1/pull_requests_controller.rb @@ -2,37 +2,37 @@ class Api::V1::PullRequestsController < Api::V1::BaseController respond_to :json before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show, :index, :group_index, :commits, :files] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:show, :index, :group_index, :commits, :files] if APP_CONFIG['anonymous_access'] - load_resource :group, :only => :group_index, :find_by => :id, :parent => false + load_resource :group, only: :group_index, find_by: :id, parent: false load_resource :project - load_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :only => [:show, :index, :commits, :files, :merge, :update] - load_and_authorize_resource :instance_name => :pull, :through => :issue, :singleton => true, :only => [:show, :index, :commits, :files, :merge, :update] + load_resource :issue, through: :project, find_by: :serial_id, parent: false, only: [:show, :index, :commits, :files, :merge, :update] + load_and_authorize_resource instance_name: :pull, through: :issue, singleton: true, only: [:show, :index, :commits, :files, :merge, :update] def index @pulls = @project.pull_requests - @pulls_url = api_v1_project_pull_requests_path(@project, :format => :json) + @pulls_url = api_v1_project_pull_requests_path(@project, format: :json) render_pulls_list end def all_index project_ids = get_all_project_ids Project.accessible_by(current_ability, :membered).pluck(:id) @pulls = PullRequest.where('pull_requests.to_project_id IN (?)', project_ids) - @pulls_url = api_v1_pull_requests_path :format => :json + @pulls_url = api_v1_pull_requests_path format: :json render_pulls_list end def user_index project_ids = get_all_project_ids current_user.projects.pluck(:id) @pulls = PullRequest.where('pull_requests.to_project_id IN (?)', project_ids) - @pulls_url = pull_requests_api_v1_user_path :format => :json + @pulls_url = pull_requests_api_v1_user_path format: :json render_pulls_list end def group_index project_ids = @group.projects.pluck(:id) - project_ids = Project.accessible_by(current_ability, :membered).where(:id => project_ids).pluck(:id) - @pulls = PullRequest.where(:to_project_id => project_ids) + project_ids = Project.accessible_by(current_ability, :membered).where(id: project_ids).pluck(:id) + @pulls = PullRequest.where(to_project_id: project_ids) @pulls_url = pull_requests_api_v1_group_path render_pulls_list end @@ -47,7 +47,7 @@ class Api::V1::PullRequestsController < Api::V1::BaseController authorize! :read, from_project @pull = @project.pull_requests.new - @pull.build_issue :title => pull_params[:title], :body => pull_params[:body] + @pull.build_issue title: pull_params[:title], body: pull_params[:body] @pull.from_project = @project @pull.to_ref, @pull.from_ref = pull_params[:to_ref], pull_params[:from_ref] @pull.issue.assignee_id = pull_params[:assignee_id] if can?(:write, @project) @@ -59,7 +59,7 @@ class Api::V1::PullRequestsController < Api::V1::BaseController @pull.check(false) # don't make event transaction if @pull.already? @pull.destroy - error_message = I18n.t('projects.pull_requests.up_to_date', :to_ref => @pull.to_ref, :from_ref => @pull.from_ref) + error_message = I18n.t('projects.pull_requests.up_to_date', to_ref: @pull.to_ref, from_ref: @pull.from_ref) render_json_response(@pull, error_message, 422) else @pull.send(@pull.status == 'blocked' ? 'block' : @pull.status) @@ -68,12 +68,12 @@ class Api::V1::PullRequestsController < Api::V1::BaseController end def update - @pull = @project.pull_requests.includes(:issue).where(:issues => {:serial_id => params[:id]}).first + @pull = @project.pull_requests.includes(:issue).where(issues: {serial_id: params[:id]}).first authorize! :update, @pull if pull_params.present? attrs = pull_params.slice(:title, :body) - attrs.merge!(:assignee_id => pull_params[:assignee_id]) if can?(:write, @project) + attrs.merge!(assignee_id: pull_params[:assignee_id]) if can?(:write, @project) if (action = pull_params[:status]) && %w(close reopen).include?(pull_params[:status]) if @pull.send("can_#{action}?") @@ -113,7 +113,7 @@ class Api::V1::PullRequestsController < Api::V1::BaseController private def render_pulls_list - @pulls = @pulls.includes(:issue => [:user, :assignee]) + @pulls = @pulls.includes(issue: [:user, :assignee]) if params[:status] == 'closed' @pulls = @pulls.closed_or_merged else @@ -157,7 +157,7 @@ class Api::V1::PullRequestsController < Api::V1::BaseController if ['created', 'all'].include? params[:filter] # add own pulls project_ids = Project.accessible_by(current_ability, :show).joins(:issues). - where(:issues => {:user_id => current_user.id}).pluck('projects.id') + where(issues: {user_id: current_user.id}).pluck('projects.id') end project_ids |= default_project_ids end diff --git a/app/controllers/api/v1/repositories_controller.rb b/app/controllers/api/v1/repositories_controller.rb index abb24c1bf..3a53c08dd 100644 --- a/app/controllers/api/v1/repositories_controller.rb +++ b/app/controllers/api/v1/repositories_controller.rb @@ -1,9 +1,9 @@ class Api::V1::RepositoriesController < Api::V1::BaseController - - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show, :projects] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :repository, :through => :platform, :shallow => true + before_filter :authenticate_user! + skip_before_filter :authenticate_user!, only: [:show, :projects] if APP_CONFIG['anonymous_access'] + + load_and_authorize_resource :repository, through: :platform, shallow: true def show end @@ -73,7 +73,7 @@ class Api::V1::RepositoriesController < Api::V1::BaseController end def add_project - if project = Project.where(:id => params[:project_id]).first + if project = Project.where(id: params[:project_id]).first if can?(:read, project) begin @repository.projects << project @@ -91,7 +91,7 @@ class Api::V1::RepositoriesController < Api::V1::BaseController def remove_project project_id = params[:project_id] - ProjectToRepository.where(:project_id => project_id, :repository_id => @repository.id).destroy_all + ProjectToRepository.where(project_id: project_id, repository_id: @repository.id).destroy_all render_json_response @repository, "Project '#{project_id}' has been removed from repository successfully" end diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 9482eea56..fed2c8e22 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -1,9 +1,9 @@ class Api::V1::UsersController < Api::V1::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show] if APP_CONFIG['anonymous_access'] - load_and_authorize_resource :user, :only => :show - before_filter :set_current_user, :except => :show + skip_before_filter :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] + load_and_authorize_resource :user, only: :show + before_filter :set_current_user, except: :show def show @user = User.opened.find params[:id] # dont show system users diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4fe14a061..5c9ea8e62 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,24 +11,24 @@ class ApplicationController < ActionController::Base before_filter :set_locale before_filter lambda { EventLog.current_controller = self }, - :only => [:create, :destroy, :open_id, :cancel, :publish, :change_visibility] # :update + only: [:create, :destroy, :open_id, :cancel, :publish, :change_visibility] # :update after_filter lambda { EventLog.current_controller = nil } helper_method :get_owner unless Rails.env.development? - rescue_from Exception, :with => :render_500 + rescue_from Exception, with: :render_500 rescue_from ActiveRecord::RecordNotFound, # ActionController::RoutingError, # see: config/routes.rb: ActionController::UnknownController, - AbstractController::ActionNotFound, :with => :render_404 + AbstractController::ActionNotFound, with: :render_404 end rescue_from CanCan::AccessDenied do |exception| - redirect_to forbidden_url, :alert => t("flash.exception_message") + redirect_to forbidden_url, alert: t("flash.exception_message") end - rescue_from Grit::NoSuchPathError, :with => :not_found + rescue_from Grit::NoSuchPathError, with: :not_found def render_404 @@ -47,8 +47,8 @@ class ApplicationController < ActionController::Base def render_error(status) respond_to do |format| - format.json { render :json => {:status => status, :message => t("flash.#{status}_message")}.to_json, :status => status } - format.html { redirect_to "/#{status}.html", :alert => t("flash.#{status}_message") } + format.json { render json: {status: status, message: t("flash.#{status}_message")}.to_json, status: status } + format.html { redirect_to "/#{status}.html", alert: t("flash.#{status}_message") } end end diff --git a/app/controllers/groups/members_controller.rb b/app/controllers/groups/members_controller.rb index 7e7032b7c..8dba574a5 100644 --- a/app/controllers/groups/members_controller.rb +++ b/app/controllers/groups/members_controller.rb @@ -1,6 +1,6 @@ class Groups::MembersController < Groups::BaseController is_related_controller! - belongs_to :group, :finder => 'find_by_insensitive_uname!', :optional => true + belongs_to :group, finder: 'find_by_insensitive_uname!', optional: true before_filter lambda { authorize! :manage_members, @group } @@ -10,10 +10,10 @@ class Groups::MembersController < Groups::BaseController def update params['user'].keys.each do |user_id| role = params['user'][user_id] - if relation = parent.actors.where(:actor_id => user_id, :actor_type => 'User') #find_by_actor_id_and_actor_type(user_id, 'User') - relation.update_all(:role => role) if parent.owner.id.to_s != user_id + if relation = parent.actors.where(actor_id: user_id, actor_type: 'User') #find_by_actor_id_and_actor_type(user_id, 'User') + relation.update_all(role: role) if parent.owner.id.to_s != user_id else - relation = parent.actors.build(:actor_id => user_id, :actor_type => 'User', :role => role) + relation = parent.actors.build(actor_id: user_id, actor_type: 'User', role: role) relation.save! end end if params['user'] @@ -30,7 +30,7 @@ class Groups::MembersController < Groups::BaseController params['user_remove'].each do |user_id, remove| all_user_ids << user_id if remove == ["1"] end if params['user_remove'] - User.where(:id => all_user_ids).each do |user| + User.where(id: all_user_ids).each do |user| parent.remove_member(user) end redirect_to group_members_path(parent) @@ -39,7 +39,7 @@ class Groups::MembersController < Groups::BaseController def add @user = User.find_by_uname(params[:user_uname]) if !@user - flash[:error] = t("flash.collaborators.wrong_user", :uname => params[:user_uname]) + flash[:error] = t("flash.collaborators.wrong_user", uname: params[:user_uname]) elsif parent.add_member(@user, params[:role]) flash[:notice] = t("flash.members.successfully_added") else diff --git a/app/controllers/groups/profile_controller.rb b/app/controllers/groups/profile_controller.rb index 2bfb1d141..a18420dcf 100644 --- a/app/controllers/groups/profile_controller.rb +++ b/app/controllers/groups/profile_controller.rb @@ -1,10 +1,10 @@ class Groups::ProfileController < Groups::BaseController include AvatarHelper - load_and_authorize_resource :class => Group, :instance_name => 'group' - skip_before_filter :authenticate_user!, :only => :show if APP_CONFIG['anonymous_access'] + load_and_authorize_resource class: Group, instance_name: 'group' + skip_before_filter :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] def index - @groups = current_user.groups.paginate(:page => params[:group_page]) # accessible_by(current_ability) + @groups = current_user.groups.paginate(page: params[:group_page]) # accessible_by(current_ability) @groups = @groups.search(params[:query]) if params[:query].present? end @@ -18,7 +18,7 @@ class Groups::ProfileController < Groups::BaseController else @projects = @projects.by_visibilities('hidden').accessible_by(current_ability, :read) end - render :partial => 'shared/profile_projects', :layout => nil, :locals => {:projects => paginate_projects(page)} + render partial: 'shared/profile_projects', layout: nil, locals: {projects: paginate_projects(page)} else @projects = paginate_projects(page) end @@ -38,7 +38,7 @@ class Groups::ProfileController < Groups::BaseController else flash[:error] = t('flash.group.save_error') flash[:warning] = @group.errors.full_messages.join('. ') - render :action => :new + render action: :new end end @@ -49,7 +49,7 @@ class Groups::ProfileController < Groups::BaseController redirect_to group_path(@group) else flash[:error] = t('flash.group.save_error') - render :action => :edit + render action: :edit end end @@ -67,6 +67,6 @@ class Groups::ProfileController < Groups::BaseController protected def paginate_projects(page) - @projects.paginate(:page => (page>0 ? page : nil), :per_page => 24) + @projects.paginate(page: (page>0 ? page : nil), per_page: 24) end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 5834c0797..40fbdbb04 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,26 +1,26 @@ class HomeController < ApplicationController - before_filter :authenticate_user!, :only => [:activity, :issues, :pull_requests] + before_filter :authenticate_user!, only: [:activity, :issues, :pull_requests] def root - render 'pages/tour/abf-tour-project-description-1', :layout => 'tour' + render 'pages/tour/abf-tour-project-description-1', layout: 'tour' end def activity @filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all @activity_feeds = current_user.activity_feeds - @activity_feeds = @activity_feeds.where(:kind => "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all - @activity_feeds = @activity_feeds.paginate :page => params[:page] + @activity_feeds = @activity_feeds.where(kind: "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all + @activity_feeds = @activity_feeds.paginate page: params[:page] respond_to do |format| - format.html { request.xhr? ? render('_list', :layout => false) : render('activity') } + format.html { request.xhr? ? render('_list', layout: false) : render('activity') } format.atom end end def issues @created_issues = current_user.issues - @assigned_issues = Issue.where(:assignee_id => current_user.id) + @assigned_issues = Issue.where(assignee_id: current_user.id) pr_ids = Project.accessible_by(current_ability, :membered).uniq.pluck(:id) - @all_issues = Issue.where(:project_id => pr_ids) + @all_issues = Issue.where(project_id: pr_ids) @created_issues, @assigned_issues, @all_issues = if action_name == 'issues' [@created_issues.without_pull_requests, @@ -51,8 +51,8 @@ class HomeController < ApplicationController @direction = params[:direction] == 'asc' ? :asc : :desc @issues = @issues.order("issues.#{@sort}_at #{@direction}") .includes(:assignee, :user, :pull_request).uniq - .paginate :per_page => 20, :page => params[:page] - render 'issues', :layout => request.xhr? ? 'with_sidebar' : 'application' + .paginate per_page: 20, page: params[:page] + render 'issues', layout: request.xhr? ? 'with_sidebar' : 'application' end def pull_requests diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 4aafa9d16..e94e51da1 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -9,7 +9,7 @@ class PagesController < ApplicationController when 'projects' %w(control git tracker) end - render "pages/tour/tour-inside", :layout => 'tour' + render "pages/tour/tour-inside", layout: 'tour' end def forbidden diff --git a/app/controllers/platforms/key_pairs_controller.rb b/app/controllers/platforms/key_pairs_controller.rb index 8899c280c..41c5c09f8 100644 --- a/app/controllers/platforms/key_pairs_controller.rb +++ b/app/controllers/platforms/key_pairs_controller.rb @@ -1,8 +1,8 @@ class Platforms::KeyPairsController < Platforms::BaseController before_filter :authenticate_user! - load_and_authorize_resource :platform, :only => [:index] - load_and_authorize_resource :only => [:create, :destroy] + load_and_authorize_resource :platform, only: [:index] + load_and_authorize_resource only: [:create, :destroy] def create @key_pair.user_id = current_user.id diff --git a/app/controllers/platforms/maintainers_controller.rb b/app/controllers/platforms/maintainers_controller.rb index af8947d91..c589f7c6c 100644 --- a/app/controllers/platforms/maintainers_controller.rb +++ b/app/controllers/platforms/maintainers_controller.rb @@ -1,12 +1,12 @@ class Platforms::MaintainersController < ApplicationController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform def index @maintainers = BuildList::Package.includes(:project) .actual.by_platform(@platform) .like_name(params[:q]) - .paginate(:page => params[:page]) + .paginate(page: params[:page]) end end diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index 06d8d0478..b64c53b11 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -1,11 +1,11 @@ class Platforms::MassBuildsController < Platforms::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :get_list] if APP_CONFIG['anonymous_access'] load_resource :platform load_and_authorize_resource :through => :platform, :shallow => true - + def new end @@ -14,11 +14,11 @@ class Platforms::MassBuildsController < Platforms::BaseController @mass_build.user, @mass_build.arches = current_user, params[:arches] if @mass_build.save - redirect_to(platform_mass_builds_path(@platform), :notice => t("flash.platform.build_all_success")) + redirect_to(platform_mass_builds_path(@platform), notice: t("flash.platform.build_all_success")) else flash[:warning] = @mass_build.errors.full_messages.join('. ') flash[:error] = t('flash.platform.build_all_error') - render :action => :new + render action: :new end end @@ -28,11 +28,11 @@ class Platforms::MassBuildsController < Platforms::BaseController else @mass_build.publish_success_builds current_user end - redirect_to(platform_mass_builds_path(@mass_build.save_to_platform), :notice => t("flash.platform.publish_success")) + redirect_to(platform_mass_builds_path(@mass_build.save_to_platform), notice: t("flash.platform.publish_success")) end def index - @mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20) + @mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(page: params[:page], per_page: 20) end def cancel @@ -47,6 +47,6 @@ class Platforms::MassBuildsController < Platforms::BaseController elsif ['projects_list', 'missed_projects_list'].include? params[:kind] @mass_build.send params[:kind] end - render :text => text + render text: text end end diff --git a/app/controllers/platforms/platforms_controller.rb b/app/controllers/platforms/platforms_controller.rb index c0cb8f59a..2efcf0b74 100644 --- a/app/controllers/platforms/platforms_controller.rb +++ b/app/controllers/platforms/platforms_controller.rb @@ -2,11 +2,11 @@ class Platforms::PlatformsController < Platforms::BaseController include FileStoreHelper before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:advisories, :members, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource def index - @platforms = @platforms.accessible_by(current_ability, :related).order(:name).paginate(:page => params[:page], :per_page => 20) + @platforms = @platforms.accessible_by(current_ability, :related).order(:name).paginate(page: params[:page], per_page: 20) end def show @@ -34,7 +34,7 @@ class Platforms::PlatformsController < Platforms::BaseController else flash[:error] = I18n.t("flash.platform.create_error") flash[:warning] = @platform.errors.full_messages.join('. ') - render :action => :new + render action: :new end end @@ -52,7 +52,7 @@ class Platforms::PlatformsController < Platforms::BaseController else flash[:error] = I18n.t("flash.platform.save_error") flash[:warning] = @platform.errors.full_messages.join('. ') - render :action => :edit + render action: :edit end end @@ -72,7 +72,7 @@ class Platforms::PlatformsController < Platforms::BaseController else flash[:error] = I18n.t("flash.platform.save_error") flash[:warning] = @platform.errors.full_messages.join('. ') - render :action => :edit + render action: :edit end end @@ -83,7 +83,7 @@ class Platforms::PlatformsController < Platforms::BaseController end def make_clone - @cloned = @platform.full_clone params[:platform].merge(:owner => current_user) + @cloned = @platform.full_clone params[:platform].merge(owner: current_user) if @cloned.persisted? flash[:notice] = I18n.t("flash.platform.clone_success") redirect_to @cloned @@ -106,29 +106,29 @@ class Platforms::PlatformsController < Platforms::BaseController def remove_members user_ids = params[:user_remove] ? params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : [] - User.where(:id => user_ids).each{ |user| @platform.remove_member(user) } + User.where(id: user_ids).each{ |user| @platform.remove_member(user) } redirect_to members_platform_path(@platform) end def remove_member - User.where(:id => params[:member_id]).each{ |user| @platform.remove_member(user) } + User.where(id: params[:member_id]).each{ |user| @platform.remove_member(user) } redirect_to members_platform_path(@platform) end def add_member - member = User.where(:id => params[:member_id]).first + member = User.where(id: params[:member_id]).first if !member - flash[:error] = t("flash.collaborators.wrong_user", :uname => params[:member_id]) + flash[:error] = t("flash.collaborators.wrong_user", uname: params[:member_id]) elsif @platform.add_member(member) - flash[:notice] = t('flash.platform.members.successfully_added', :name => member.uname) + flash[:notice] = t('flash.platform.members.successfully_added', name: member.uname) else - flash[:error] = t('flash.platform.members.error_in_adding', :name => member.uname) + flash[:error] = t('flash.platform.members.error_in_adding', name: member.uname) end redirect_to members_platform_url(@platform) end def advisories - @advisories = @platform.advisories.paginate(:page => params[:page]) + @advisories = @platform.advisories.paginate(page: params[:page]) end def clear diff --git a/app/controllers/platforms/private_users_controller.rb b/app/controllers/platforms/private_users_controller.rb index 695a2fffb..b36163cbb 100644 --- a/app/controllers/platforms/private_users_controller.rb +++ b/app/controllers/platforms/private_users_controller.rb @@ -10,10 +10,10 @@ class Platforms::PrivateUsersController < Platforms::BaseController def create old_pair = PrivateUser.find_by_platform_id_and_user_id(params[:platform_id], current_user.id) old_pair.destroy if old_pair - + @pair = PrivateUser.generate_pair(params[:platform_id], current_user.id) @urpmi_list = @platform.urpmi_list(request.host, @pair) - redirect_to platform_private_users_path(params[:platform_id]), :notice => I18n.t('flash.private_users', :login => @pair[:login], :password => @pair[:pass]) + redirect_to platform_private_users_path(params[:platform_id]), notice: I18n.t('flash.private_users', login: @pair[:login], password: @pair[:pass]) end #def destroy @@ -21,11 +21,11 @@ class Platforms::PrivateUsersController < Platforms::BaseController # user.destroy # redirect_to platform_private_users_path(params[:platform_id]) #end - + protected - + def find_platform_and_private_users - @private_users = PrivateUser.where(:platform_id => params[:platform_id]).paginate :page => params[:page] + @private_users = PrivateUser.where(platform_id: params[:platform_id]).paginate page: params[:page] @platform = Platform.find(params[:platform_id]) end end diff --git a/app/controllers/platforms/privates_controller.rb b/app/controllers/platforms/privates_controller.rb index c6af1f38e..f1c129dca 100644 --- a/app/controllers/platforms/privates_controller.rb +++ b/app/controllers/platforms/privates_controller.rb @@ -8,9 +8,9 @@ class Platforms::PrivatesController < Platforms::BaseController file_name = "#{APP_CONFIG['root_path']}/platforms/#{params[:platform_name]}/#{params[:file_path]}" if File.directory?(file_name) || !File.exists?(file_name) - render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 + render file: "#{Rails.root}/public/404.html", layout: false, status: 404 else - send_file file_name + send_file file_name end end @@ -19,9 +19,9 @@ class Platforms::PrivatesController < Platforms::BaseController def authenticate authenticate_or_request_with_http_basic do |username, password| PrivateUser.exists?( - :login => username, - :password => Digest::SHA2.new.hexdigest(password), - :platform_id => @platform.try(:id) + login: username, + password: Digest::SHA2.new.hexdigest(password), + platform_id: @platform.try(:id) ) end end diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 41f0f15df..91ad44d67 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -2,12 +2,12 @@ class Platforms::ProductBuildListsController < Platforms::BaseController include FileStoreHelper 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 - 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 - load_and_authorize_resource :only => [:index, :show, :log, :cancel, :update] + 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 + 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 + load_and_authorize_resource only: [:index, :show, :log, :cancel, :update] def new product = @product_build_list.product @@ -25,7 +25,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController end def update - if @product_build_list.update_attributes(:not_delete => (params[:product_build_list] || {})[:not_delete]) + 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') @@ -40,13 +40,13 @@ class Platforms::ProductBuildListsController < Platforms::BaseController else notice = t('layout.build_lists.cancel_fail') end - redirect_to :back, :notice => notice + redirect_to :back, notice: notice end def log - render :json => { - :log => @product_build_list.abf_worker_log, - :building => @product_build_list.build_started? + render json: { + log: @product_build_list.abf_worker_log, + building: @product_build_list.build_started? } end @@ -62,7 +62,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController else flash[:error] = t('flash.product.build_error') flash[:warning] = pbl.errors.full_messages.join('. ') - render :action => :new + render action: :new end end @@ -71,18 +71,18 @@ class Platforms::ProductBuildListsController < Platforms::BaseController flash[:notice] = t('flash.product_build_list.delete') else flash[:error] = t('flash.product_build_list.delete_error') - end + end redirect_to [@platform, @product] end def index if params[:product_id].present? - @product_build_lists = @product_build_lists.where(:id => params[:product_id]) + @product_build_lists = @product_build_lists.where(id: params[:product_id]) else @product_build_lists = @product_build_lists.scoped_to_product_name(params[:product_name]) if params[:product_name].present? @product_build_lists = @product_build_lists.for_status(params[:status]) if params[:status].present? end - @product_build_lists = @product_build_lists.recent.paginate :page => params[:page] + @product_build_lists = @product_build_lists.recent.paginate page: params[:page] @build_server_status = AbfWorker::StatusInspector.products_status end diff --git a/app/controllers/platforms/products_controller.rb b/app/controllers/platforms/products_controller.rb index 4356e84bb..c3ca3a48e 100644 --- a/app/controllers/platforms/products_controller.rb +++ b/app/controllers/platforms/products_controller.rb @@ -1,14 +1,14 @@ class Platforms::ProductsController < Platforms::BaseController include GitHelper before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform - load_and_authorize_resource :product, :through => :platform, :except => :autocomplete_project - before_filter :set_project, :only => [:create, :update] + load_and_authorize_resource :product, through: :platform, except: :autocomplete_project + before_filter :set_project, only: [:create, :update] def index - @products = @products.paginate(:page => params[:page]) + @products = @products.paginate(page: params[:page]) end def new @@ -21,12 +21,12 @@ class Platforms::ProductsController < Platforms::BaseController def create if @product.save - flash[:notice] = t('flash.product.saved') + flash[:notice] = t('flash.product.saved') redirect_to platform_product_path(@platform, @product) else flash[:error] = t('flash.product.save_error') flash[:warning] = @product.errors.full_messages.join('. ') - render :action => :new + render action: :new end end @@ -37,7 +37,7 @@ class Platforms::ProductsController < Platforms::BaseController else flash[:error] = t('flash.product.save_error') flash[:warning] = @product.errors.full_messages.join('. ') - render :action => "edit" + render action: "edit" end end @@ -54,12 +54,12 @@ class Platforms::ProductsController < Platforms::BaseController items = Project.accessible_by(current_ability, :membered) .search(params[:term]).limit(20) #items.select! {|e| e.repo.branches.count > 0} - render :json => items.map{ |p| + render json: items.map{ |p| { - :id => p.id, - :label => p.name_with_owner, - :value => p.name_with_owner, - :project_versions => versions_for_group_select(p) + id: p.id, + label: p.name_with_owner, + value: p.name_with_owner, + project_versions: versions_for_group_select(p) } } end diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index 171229ff3..6582467b0 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -2,53 +2,53 @@ class Platforms::RepositoriesController < Platforms::BaseController include FileStoreHelper before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show, :projects_list] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :show, :projects_list] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform - load_and_authorize_resource :repository, :through => :platform, :shallow => true - before_filter :set_members, :only => [:edit, :update] + load_and_authorize_resource :repository, through: :platform, shallow: true + before_filter :set_members, only: [:edit, :update] def index - @repositories = Repository.custom_sort(@repositories).paginate(:page => params[:page]) + @repositories = Repository.custom_sort(@repositories).paginate(page: params[:page]) end def show @projects = @repository.projects.recent.search(params[:query]) - .paginate(:page => params[:project_page], :per_page => 30) + .paginate(page: params[:project_page], per_page: 30) end def edit end def update - if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications).merge(:publish_without_qa => (params[:repository][:publish_without_qa] || @repository.publish_without_qa)) + if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications).merge(publish_without_qa: (params[:repository][:publish_without_qa] || @repository.publish_without_qa)) flash[:notice] = I18n.t("flash.repository.updated") redirect_to platform_repository_path(@platform, @repository) else flash[:error] = I18n.t("flash.repository.update_error") flash[:warning] = @repository.errors.full_messages.join('. ') - render :action => :edit + render action: :edit end end def remove_members user_ids = params[:user_remove] ? params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : [] - User.where(:id => user_ids).each{ |user| @repository.remove_member(user) } + User.where(id: user_ids).each{ |user| @repository.remove_member(user) } redirect_to edit_platform_repository_path(@platform, @repository) end def remove_member - User.where(:id => params[:member_id]).each{ |user| @repository.remove_member(user) } + User.where(id: params[:member_id]).each{ |user| @repository.remove_member(user) } redirect_to edit_platform_repository_path(@platform, @repository) end def add_member - if member = User.where(:id => params[:member_id]).first + if member = User.where(id: params[:member_id]).first if @repository.add_member(member) - flash[:notice] = t('flash.repository.members.successfully_added', :name => member.uname) + flash[:notice] = t('flash.repository.members.successfully_added', name: member.uname) else - flash[:error] = t('flash.repository.members.error_in_adding', :name => member.uname) + flash[:error] = t('flash.repository.members.error_in_adding', name: member.uname) end end redirect_to edit_platform_repository_path(@platform, @repository) @@ -74,14 +74,14 @@ class Platforms::RepositoriesController < Platforms::BaseController else flash[:error] = t('flash.repository.save_error') flash[:warning] = @repository.errors.full_messages.join('. ') - render :action => :new + render action: :new end end def add_project if projects_list = params.try(:[], :repository).try(:[], :projects_list) @repository.add_projects projects_list, current_user - redirect_to platform_repository_path(@platform, @repository), :notice => t('flash.repository.projects_will_be_added') + redirect_to platform_repository_path(@platform, @repository), notice: t('flash.repository.projects_will_be_added') return end if params[:project_id].present? @@ -103,7 +103,7 @@ class Platforms::RepositoriesController < Platforms::BaseController end def projects_list - render(:text => @repository.projects.map(&:name).join("\n")) && return if params[:text] == 'true' + render(text: @repository.projects.map(&:name).join("\n")) && return if params[:text] == 'true' owner_subquery = " INNER JOIN ( @@ -126,8 +126,8 @@ class Platforms::RepositoriesController < Platforms::BaseController @projects = @projects.opened if @repository.platform.main? && !@repository.platform.hidden? end @projects = @projects.paginate( - :page => (params[:iDisplayStart].to_i/(params[:iDisplayLength].present? ? params[:iDisplayLength] : 25).to_i).to_i + 1, - :per_page => params[:iDisplayLength].present? ? params[:iDisplayLength] : 25 + page: (params[:iDisplayStart].to_i/(params[:iDisplayLength].present? ? params[:iDisplayLength] : 25).to_i).to_i + 1, + per_page: params[:iDisplayLength].present? ? params[:iDisplayLength] : 25 ) @total_projects = @projects.count @@ -135,7 +135,7 @@ class Platforms::RepositoriesController < Platforms::BaseController respond_to do |format| format.json { - render :partial => (params[:added] == "true") ? 'project' : 'proj_ajax', :layout => false + render partial: (params[:added] == "true") ? 'project' : 'proj_ajax', layout: false } end end @@ -143,11 +143,11 @@ class Platforms::RepositoriesController < Platforms::BaseController def remove_project if projects_list = params.try(:[], :repository).try(:[], :projects_list) @repository.remove_projects projects_list - redirect_to platform_repository_path(@platform, @repository), :notice => t('flash.repository.projects_will_be_removed') + redirect_to platform_repository_path(@platform, @repository), notice: t('flash.repository.projects_will_be_removed') end if params[:project_id].present? - ProjectToRepository.where(:project_id => params[:project_id], :repository_id => @repository.id).destroy_all - redirect_to platform_repository_path(@platform, @repository), :notice => t('flash.repository.project_removed') + ProjectToRepository.where(project_id: params[:project_id], repository_id: @repository.id).destroy_all + redirect_to platform_repository_path(@platform, @repository), notice: t('flash.repository.project_removed') end end diff --git a/app/controllers/platforms/tokens_controller.rb b/app/controllers/platforms/tokens_controller.rb index d192b9906..636f626a3 100644 --- a/app/controllers/platforms/tokens_controller.rb +++ b/app/controllers/platforms/tokens_controller.rb @@ -7,19 +7,19 @@ class Platforms::TokensController < Platforms::BaseController def index authorize! :local_admin_manage, @platform @tokens = @platform.tokens.includes(:creator, :updater) - .paginate(:per_page => 20, :page => params[:page]) + .paginate(per_page: 20, page: params[:page]) end def show end def withdraw - if @token.block + if @token.block @token.updater = current_user @token.save - redirect_to :back, :notice => t('flash.tokens.withdraw_success') + redirect_to :back, notice: t('flash.tokens.withdraw_success') else - redirect_to :back, :notice => t('flash.tokens.withdraw_fail') + redirect_to :back, notice: t('flash.tokens.withdraw_fail') end end diff --git a/app/controllers/projects/base_controller.rb b/app/controllers/projects/base_controller.rb index 878eb086e..7bd0dd194 100644 --- a/app/controllers/projects/base_controller.rb +++ b/app/controllers/projects/base_controller.rb @@ -6,7 +6,7 @@ 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) + 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) end diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index 95f1b00e6..fc5035c04 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -4,15 +4,15 @@ class Projects::BuildListsController < Projects::BaseController NESTED_ACTIONS = [:index, :new, :create] before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show, :index, :log] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:show, :index, :log] if APP_CONFIG['anonymous_access'] - before_filter :find_build_list, :only => [:show, :publish, :cancel, :update, :log, :create_container] + before_filter :find_build_list, only: [:show, :publish, :cancel, :update, :log, :create_container] - load_and_authorize_resource :project, :only => NESTED_ACTIONS - load_and_authorize_resource :build_list, :through => :project, :only => NESTED_ACTIONS, :shallow => true - load_and_authorize_resource :except => NESTED_ACTIONS + load_and_authorize_resource :project, only: NESTED_ACTIONS + load_and_authorize_resource :build_list, through: :project, only: NESTED_ACTIONS, shallow: true + load_and_authorize_resource except: NESTED_ACTIONS - before_filter :create_from_build_list, :only => :new + before_filter :create_from_build_list, only: :new def index params[:filter].each{|k,v| params[:filter].delete(k) if v.blank? } if params[:filter] @@ -24,16 +24,16 @@ class Projects::BuildListsController < Projects::BaseController @bls = @filter.find.recent .paginate( :page => (params[:page].to_i == 0 ? nil : params[:page]), - :per_page => BuildList::Filter::PER_PAGE.include?(params[:per_page].to_i) ? params[:per_page].to_i : 25 + per_page: BuildList::Filter::PER_PAGE.include?(params[:per_page].to_i) ? params[:per_page].to_i : 25 ) - @build_lists = BuildList.where(:id => @bls.pluck(:id)).recent + @build_lists = BuildList.where(id: @bls.pluck(:id)).recent .includes( :save_to_platform, :save_to_repository, :build_for_platform, :user, :source_packages, - :project => :project_statistics + project: :project_statistics ) @build_server_status = AbfWorker::StatusInspector.projects_status @@ -43,7 +43,7 @@ class Projects::BuildListsController < Projects::BaseController def new if params[:show] == 'inline' && params[:build_list_id].present? - render '_new_form', :layout => false, :locals => {:project => @project, :build_list => @build_list} + render '_new_form', layout: false, locals: {project: @project, build_list: @build_list} else render :new end @@ -59,17 +59,17 @@ class Projects::BuildListsController < Projects::BaseController params[:build_list][:auto_publish] = false unless @repository.publish_without_qa? build_for_platforms = Repository.select(:platform_id). - where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id) + where(id: params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id) build_lists = [] - Arch.where(:id => params[:arches]).each do |arch| - Platform.main.where(:id => build_for_platforms).each do |build_for_platform| + Arch.where(id: params[:arches]).each do |arch| + Platform.main.where(id: build_for_platforms).each do |build_for_platform| @build_list = @project.build_lists.build(params[:build_list]) @build_list.build_for_platform = build_for_platform; @build_list.arch = arch; @build_list.user = current_user @build_list.include_repos = @build_list.include_repos.select {|ir| @build_list.build_for_platform.repository_ids.include? ir.to_i} @build_list.priority = current_user.build_priority # User builds more priority than mass rebuild with zero priority - flash_options = {:project_version => @build_list.project_version, :arch => arch.name, :build_for_platform => build_for_platform.name} + flash_options = {project_version: @build_list.project_version, arch: arch.name, build_for_platform: build_for_platform.name} if authorize!(:create, @build_list) && @build_list.save build_lists << @build_list notices << t("flash.build_list.saved", flash_options) @@ -82,9 +82,9 @@ class Projects::BuildListsController < Projects::BaseController if errors.present? @build_list ||= BuildList.new flash[:error] = errors.join('
').html_safe - render :action => :new + render action: :new else - BuildList.where(:id => build_lists.map(&:id)).update_all(:group_id => build_lists[0].id) if build_lists.size > 1 + BuildList.where(id: build_lists.map(&:id)).update_all(group_id: build_lists[0].id) if build_lists.size > 1 flash[:notice] = notices.join('
').html_safe redirect_to project_build_lists_path(@project) end @@ -100,54 +100,54 @@ class Projects::BuildListsController < Projects::BaseController if params[:attach_advisory].present? and params[:attach_advisory] != 'no' and !@build_list.advisory unless @build_list.update_type.in? BuildList::RELEASE_UPDATE_TYPES - redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return + redirect_to :back, notice: t('layout.build_lists.publish_fail') and return end if params[:attach_advisory] == 'new' # create new advisory unless @build_list.associate_and_create_advisory(params[:build_list][:advisory]) - redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return + redirect_to :back, notice: t('layout.build_lists.publish_fail') and return end else # attach existing advisory - a = Advisory.where(:advisory_id => params[:attach_advisory]).first + a = Advisory.where(advisory_id: params[:attach_advisory]).first unless (a && a.attach_build_list(@build_list)) - redirect_to :back, :notice => t('layout.build_lists.publish_fail') and return + redirect_to :back, notice: t('layout.build_lists.publish_fail') and return end end end @build_list.publisher = current_user message = @build_list.publish ? 'success' : 'fail' - redirect_to :back, :notice => t("layout.build_lists.publish_#{message}") + redirect_to :back, notice: t("layout.build_lists.publish_#{message}") end def publish_into_testing @build_list.publisher = current_user message = @build_list.publish_into_testing ? 'success' : 'fail' - redirect_to :back, :notice => t("layout.build_lists.publish_#{message}") + redirect_to :back, notice: t("layout.build_lists.publish_#{message}") end def reject_publish @build_list.publisher = current_user message = @build_list.reject_publish ? 'success' : 'fail' - redirect_to :back, :notice => t("layout.build_lists.reject_publish_#{message}") + redirect_to :back, notice: t("layout.build_lists.reject_publish_#{message}") end def create_container message = @build_list.publish_container ? 'success' : 'fail' - redirect_to :back, :notice => t("layout.build_lists.create_container_#{message}") + redirect_to :back, notice: t("layout.build_lists.create_container_#{message}") end def cancel message = @build_list.cancel ? 'will_be_canceled' : 'cancel_fail' - redirect_to :back, :notice => t("layout.build_lists.#{message}") + redirect_to :back, notice: t("layout.build_lists.#{message}") end def log - render :json => { - :log => @build_list.log(params[:load_lines]), - :building => @build_list.build_started? + render json: { + log: @build_list.log(params[:load_lines]), + building: @build_list.build_started? } end @@ -157,13 +157,13 @@ class Projects::BuildListsController < Projects::BaseController sort_dir = params[:sSortDir_0] == 'asc' ? 'asc' : 'desc' order = "build_lists.updated_at #{sort_dir}" - @build_lists = @build_lists.paginate(:page => (params[:iDisplayStart].to_i/params[:iDisplayLength].to_i).to_i + 1, :per_page => params[:iDisplayLength]) + @build_lists = @build_lists.paginate(page: (params[:iDisplayStart].to_i/params[:iDisplayLength].to_i).to_i + 1, per_page: params[:iDisplayLength]) @total_build_lists = @build_lists.count - @build_lists = @build_lists.where(:user_id => current_user) if params[:owner_filter] == 'true' - @build_lists = @build_lists.where(:status => [BuildList::BUILD_ERROR, BuildList::FAILED_PUBLISH, BuildList::REJECTED_PUBLISH]) if params[:status_filter] == 'true' + @build_lists = @build_lists.where(user_id: current_user) if params[:owner_filter] == 'true' + @build_lists = @build_lists.where(status: [BuildList::BUILD_ERROR, BuildList::FAILED_PUBLISH, BuildList::REJECTED_PUBLISH]) if params[:status_filter] == 'true' @build_lists = @build_lists.order(order) - render :partial => 'build_lists_ajax', :layout => false + render partial: 'build_lists_ajax', layout: false end diff --git a/app/controllers/projects/collaborators_controller.rb b/app/controllers/projects/collaborators_controller.rb index 15fffe511..d284861da 100644 --- a/app/controllers/projects/collaborators_controller.rb +++ b/app/controllers/projects/collaborators_controller.rb @@ -20,7 +20,7 @@ class Projects::CollaboratorsController < Projects::BaseController users = users.search(params[:term]) groups = groups.search(params[:term]) end - @collaborators = (users | groups).map{|act| Collaborator.new(:actor => act, :project => @project)} + @collaborators = (users | groups).map{|act| Collaborator.new(actor: act, project: @project)} respond_with @collaborators do |format| format.json { render 'index' } end @@ -31,7 +31,7 @@ class Projects::CollaboratorsController < Projects::BaseController @collaborator.project = @project if @collaborator.save respond_with @collaborator do |format| - format.json { render :partial => 'collaborator', :locals => {:collaborator => @collaborator} } + format.json { render partial: 'collaborator', locals: {collaborator: @collaborator} } end else raise diff --git a/app/controllers/projects/comments_controller.rb b/app/controllers/projects/comments_controller.rb index 4a79b86d5..21230f2ec 100644 --- a/app/controllers/projects/comments_controller.rb +++ b/app/controllers/projects/comments_controller.rb @@ -3,7 +3,7 @@ class Projects::CommentsController < Projects::BaseController load_and_authorize_resource :project before_filter :find_commentable before_filter :find_or_build_comment - load_and_authorize_resource :new => :new_line + load_and_authorize_resource new: :new_line include CommentsHelper @@ -30,7 +30,7 @@ class Projects::CommentsController < Projects::BaseController else [400, view_context.local_alert(@comment.errors.full_messages.join('. '))] end - render :inline => message, :status => status + render inline: message, status: status end def destroy @@ -41,7 +41,7 @@ class Projects::CommentsController < Projects::BaseController def new_line @path = view_context.project_commentable_comments_path(@project, @commentable) - render :layout => false + render layout: false end protected @@ -52,7 +52,7 @@ class Projects::CommentsController < Projects::BaseController end def find_or_build_comment - @comment = params[:id].present? && Comment.where(:automatic => false).find(params[:id]) || + @comment = params[:id].present? && Comment.where(automatic: false).find(params[:id]) || current_user.comments.build(params[:comment]) {|c| c.commentable = @commentable; c.project = @project} end end diff --git a/app/controllers/projects/commit_subscribes_controller.rb b/app/controllers/projects/commit_subscribes_controller.rb index f63a46022..55e4fabce 100644 --- a/app/controllers/projects/commit_subscribes_controller.rb +++ b/app/controllers/projects/commit_subscribes_controller.rb @@ -25,6 +25,6 @@ class Projects::CommitSubscribesController < Projects::BaseController def find_commit @commit = @project.repo.commit(params[:commit_id]) - @options = {:project_id => @project.id, :subscribeable_id => @commit.id.hex, :subscribeable_type => @commit.class.name, :user_id => current_user.id} + @options = {project_id: @project.id, subscribeable_id: @commit.id.hex, subscribeable_type: @commit.class.name, user_id: current_user.id} end end diff --git a/app/controllers/projects/git/base_controller.rb b/app/controllers/projects/git/base_controller.rb index b93b3c0ad..6608f073f 100644 --- a/app/controllers/projects/git/base_controller.rb +++ b/app/controllers/projects/git/base_controller.rb @@ -1,6 +1,6 @@ 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'] + skip_before_filter :authenticate_user!, only: [:show, :index, :blame, :raw, :archive, :diff, :tags, :branches] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :project before_filter :set_treeish_and_path diff --git a/app/controllers/projects/git/blobs_controller.rb b/app/controllers/projects/git/blobs_controller.rb index 1d7ec3fcd..1ab13ab05 100644 --- a/app/controllers/projects/git/blobs_controller.rb +++ b/app/controllers/projects/git/blobs_controller.rb @@ -1,6 +1,6 @@ class Projects::Git::BlobsController < Projects::Git::BaseController before_filter :set_blob - before_filter lambda {authorize! :write, @project}, :only => [:edit, :update] + before_filter lambda {authorize! :write, @project}, only: [:edit, :update] def show end @@ -10,12 +10,12 @@ class Projects::Git::BlobsController < Projects::Git::BaseController def update if @project.update_file(params[:path], params[:content].gsub("\r", ''), - :message => params[:message].gsub("\r", ''), :actor => current_user, :head => @treeish) - flash[:notice] = t("flash.blob.successfully_updated", :name => params[:path]) + message: params[:message].gsub("\r", ''), actor: current_user, head: @treeish) + flash[:notice] = t("flash.blob.successfully_updated", name: params[:path]) else - flash[:notice] = t("flash.blob.updating_error", :name => params[:path]) + flash[:notice] = t("flash.blob.updating_error", name: params[:path]) end - redirect_to :action => :show + redirect_to action: :show end def blame @@ -25,14 +25,14 @@ class Projects::Git::BlobsController < Projects::Git::BaseController def raw repo = Grit::GitRuby::Repository.new(@project.repo.path) raw = repo.get_raw_object_by_sha1(@blob.id) - send_data raw.content, :type => @blob.content_type, :disposition => @blob.disposition + send_data raw.content, type: @blob.content_type, disposition: @blob.disposition end protected def set_blob @blob = @tree / @path or raise Grit::NoSuchPathError - redirect_to tree_path(@project, :treeish => @treeish, :path => @path) if @blob.is_a? Grit::Tree - @commit = @project.repo.log(@treeish, @path, :max_count => 1).first + redirect_to tree_path(@project, treeish: @treeish, path: @path) if @blob.is_a? Grit::Tree + @commit = @project.repo.log(@treeish, @path, max_count: 1).first end end diff --git a/app/controllers/projects/git/commits_controller.rb b/app/controllers/projects/git/commits_controller.rb index 9396497e3..119083e08 100644 --- a/app/controllers/projects/git/commits_controller.rb +++ b/app/controllers/projects/git/commits_controller.rb @@ -3,7 +3,7 @@ class Projects::Git::CommitsController < Projects::Git::BaseController if @path.present? @commits = @project.repo.log(@treeish, @path) else - @commits, @page, @last_page = @project.paginate_commits(@treeish, :page => params[:page]) + @commits, @page, @last_page = @project.paginate_commits(@treeish, page: params[:page]) end end @@ -13,8 +13,8 @@ class Projects::Git::CommitsController < Projects::Git::BaseController respond_to do |format| format.html - format.diff { render :text => (@commit.diffs.map(&:diff).join("\n") rescue ''), :content_type => "text/plain" } - format.patch { render :text => (@commit.to_patch rescue ''), :content_type => "text/plain" } + format.diff { render text: (@commit.diffs.map(&:diff).join("\n") rescue ''), content_type: "text/plain" } + format.patch { render text: (@commit.to_patch rescue ''), content_type: "text/plain" } end end diff --git a/app/controllers/projects/git/trees_controller.rb b/app/controllers/projects/git/trees_controller.rb index 7f570f3a0..b9ddd2505 100644 --- a/app/controllers/projects/git/trees_controller.rb +++ b/app/controllers/projects/git/trees_controller.rb @@ -1,16 +1,16 @@ class Projects::Git::TreesController < Projects::Git::BaseController - before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => :show - skip_before_filter :set_branch_and_tree, :set_treeish_and_path, :only => :archive - before_filter lambda { raise Grit::NoSuchPathError if params[:treeish] != @branch.try(:name) }, :only => [:branch, :destroy] + before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, only: :show + skip_before_filter :set_branch_and_tree, :set_treeish_and_path, only: :archive + before_filter lambda { raise Grit::NoSuchPathError if params[:treeish] != @branch.try(:name) }, only: [:branch, :destroy] - skip_authorize_resource :project, :only => [:destroy, :restore_branch, :create] - before_filter lambda { authorize!(:write, @project) }, :only => [:destroy, :restore_branch, :create] + skip_authorize_resource :project, only: [:destroy, :restore_branch, :create] + before_filter lambda { authorize!(:write, @project) }, only: [:destroy, :restore_branch, :create] def show unless request.xhr? render('empty') and return if @project.is_empty? @tree = @tree / @path if @path.present? - @commit = @branch.present? ? @branch.commit() : @project.repo.log(@treeish, @path, :max_count => 1).first + @commit = @branch.present? ? @branch.commit() : @project.repo.log(@treeish, @path, max_count: 1).first raise Grit::NoSuchPathError unless @commit end end @@ -28,7 +28,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController redirect_to "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}" else archive = @project.archive_by_treeish_and_format @treeish, format - send_file archive[:path], :disposition => 'attachment', :type => "application/#{format == 'zip' ? 'zip' : 'x-tar-gz'}", :filename => archive[:fullname] + send_file archive[:path], disposition: 'attachment', type: "application/#{format == 'zip' ? 'zip' : 'x-tar-gz'}", filename: archive[:fullname] end end @@ -38,7 +38,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController render :refs_list else respond_to do |format| - format.json { render :nothing => true, :status => 422 } + format.json { render nothing: true, status: 422 } format.html end end @@ -46,17 +46,17 @@ class Projects::Git::TreesController < Projects::Git::BaseController def restore_branch status = @project.create_branch(@treeish, params[:sha], current_user) ? 200 : 422 - render :nothing => true, :status => status + render nothing: true, status: status end def create status = @project.create_branch(params[:new_ref], params[:from_ref], current_user) ? 200 : 422 - render :nothing => true, :status => status + render nothing: true, status: status end def destroy status = @branch && @project.delete_branch(@branch, current_user) ? 200 : 422 - render :nothing => true, :status => status + render nothing: true, status: status end def branches @@ -65,7 +65,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController render :refs_list else respond_to do |format| - format.json { render :nothing => true, :status => 422 } + format.json { render nothing: true, status: 422 } format.html end end diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 7b57e0c1d..6c7c63145 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -1,7 +1,7 @@ class Projects::HooksController < Projects::BaseController before_filter :authenticate_user! load_and_authorize_resource :project - load_and_authorize_resource :hook, :through => :project + load_and_authorize_resource :hook, through: :project def index @@ -19,7 +19,7 @@ class Projects::HooksController < Projects::BaseController def create if @hook.save - redirect_to project_hooks_path(@project, :name => @hook.name), :notice => t('flash.hook.created') + redirect_to project_hooks_path(@project, name: @hook.name), notice: t('flash.hook.created') else flash[:error] = t('flash.hook.save_error') flash[:warning] = @hook.errors.full_messages.join('. ') @@ -29,7 +29,7 @@ class Projects::HooksController < Projects::BaseController def update if @hook.update_attributes(params[:hook]) - redirect_to project_hooks_path(@project, :name => @hook.name), :notice => t('flash.hook.updated') + redirect_to project_hooks_path(@project, name: @hook.name), notice: t('flash.hook.updated') else flash[:error] = t('flash.hook.save_error') flash[:warning] = @hook.errors.full_messages.join('. ') @@ -39,7 +39,7 @@ class Projects::HooksController < Projects::BaseController def destroy @hook.destroy - redirect_to project_hooks_path(@project, :name => @hook.name) + redirect_to project_hooks_path(@project, name: @hook.name) end end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 873a914fc..341920097 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -1,19 +1,19 @@ class Projects::IssuesController < Projects::BaseController NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label] before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] + 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, :index] - before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION - before_filter :find_collaborators, :only => [:new, :create, :show, :search_collaborators] + 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 + before_filter :find_collaborators, only: [:new, :create, :show, :search_collaborators] - layout false, :only => [:update, :search_collaborators] + layout false, only: [:update, :search_collaborators] def index(status = 200) @labels = params[:labels] || [] @issues = @project.issues.without_pull_requests - @issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'assigned' - @issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == [] + @issues = @issues.where(assignee_id: current_user.id) if @is_assigned_to_me = params[:filter] == 'assigned' + @issues = @issues.joins(:labels).where(labels: {name: @labels}) unless @labels == [] # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") @issues = @issues.search(params[:search_issue]) if params[:search_issue] !~ /#{t('layout.issues.search')}/ @@ -25,11 +25,11 @@ class Projects::IssuesController < Projects::BaseController @direction = params[:direction] == 'asc' ? :asc : :desc @issues = @issues.order("issues.#{@sort}_at #{@direction}") @issues = @issues.includes(:assignee, :user, :pull_request).uniq - .paginate :per_page => 20, :page => params[:page] + .paginate per_page: 20, page: params[:page] if status == 200 - render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application' + render 'index', layout: request.xhr? ? 'with_sidebar' : 'application' else - render :status => status, :nothing => true + render status: status, nothing: true end end @@ -49,7 +49,7 @@ class Projects::IssuesController < Projects::BaseController redirect_to project_issues_path(@project) else flash[:error] = I18n.t("flash.issue.save_error") - render :action => :new + render action: :new end end @@ -68,16 +68,16 @@ class Projects::IssuesController < Projects::BaseController if params[:issue] && status = params[:issue][:status] @issue.set_close(current_user) if status == 'closed' @issue.set_open if status == 'open' - render :partial => 'status', :status => (@issue.save ? 200 : 400) + render partial: 'status', status: (@issue.save ? 200 : 400) elsif params[:issue] status, message = if @issue.update_attributes(params[:issue]) [200, view_context.markdown(@issue.body)] else [400, view_context.local_alert(@issue.errors.full_messages.join('. '))] end - render :inline => message, :status => status + render inline: message, status: status else - render :nothing => true, :status => 200 + render nothing: true, status: 200 end end @@ -88,11 +88,11 @@ class Projects::IssuesController < Projects::BaseController end def create_label - index(@project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500) + index(@project.labels.create!(name: params[:name], color: params[:color]) ? 200 : 500) end def update_label - index(@label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500) + index(@label.update_attributes(name: params[:name], color: params[:color]) ? 200 : 500) end def destroy_label @@ -100,7 +100,7 @@ class Projects::IssuesController < Projects::BaseController end def search_collaborators - render :partial => 'search_collaborators' + render partial: 'search_collaborators' end private diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb index 9d74586b1..5dbdc4381 100644 --- a/app/controllers/projects/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -1,8 +1,8 @@ class Projects::ProjectsController < Projects::BaseController include ProjectsHelper before_filter :authenticate_user! - load_and_authorize_resource :id_param => :project_name # to force member actions load - before_filter :who_owns, :only => [:new, :create, :mass_import, :run_mass_import] + load_and_authorize_resource id_param: :project_name # to force member actions load + before_filter :who_owns, only: [:new, :create, :mass_import, :run_mass_import] def index @projects = Project.accessible_by(current_ability, :membered) @@ -11,8 +11,8 @@ class Projects::ProjectsController < Projects::BaseController format.html { @all_projects = @projects @groups = current_user.groups - @owners = User.where(:id => @projects.where(:owner_type => 'User').uniq.pluck(:owner_id)) - @projects = @projects.recent.paginate(:page => params[:page], :per_page => 25) + @owners = User.where(id: @projects.where(owner_type: 'User').uniq.pluck(:owner_id)) + @projects = @projects.recent.paginate(page: params[:page], per_page: 25) } format.json { selected_groups = params[:groups] || [] @@ -27,7 +27,7 @@ class Projects::ProjectsController < Projects::BaseController end def mass_import - @project = Project.new(:mass_import => true) + @project = Project.new(mass_import: true) end def run_mass_import @@ -61,7 +61,7 @@ class Projects::ProjectsController < Projects::BaseController else flash[:error] = t('flash.project.save_error') flash[:warning] = @project.errors.full_messages.join('. ') - render :action => :new + render action: :new end end @@ -74,7 +74,7 @@ class Projects::ProjectsController < Projects::BaseController @project.save flash[:error] = t('flash.project.save_error') flash[:warning] = @project.errors.full_messages.join('. ') - render :action => :edit + render action: :edit end end @@ -88,7 +88,7 @@ class Projects::ProjectsController < Projects::BaseController owner = (Group.find params[:group] if params[:group].present?) || current_user authorize! :write, owner if owner.class == Group if forked = @project.fork(owner, params[:fork_name]) and forked.valid? - redirect_to forked, :notice => t("flash.project.forked") + redirect_to forked, notice: t("flash.project.forked") else flash[:warning] = t("flash.project.fork_error") flash[:error] = forked.errors.full_messages.join("\n") @@ -97,8 +97,8 @@ class Projects::ProjectsController < Projects::BaseController end def possible_forks - render :partial => 'projects/git/base/forks', :layout => false, - :locals => { :owner => current_user, :name => (params[:name].presence || @project.name) } + render partial: 'projects/git/base/forks', layout: false, + locals: { owner: current_user, name: (params[:name].presence || @project.name) } end def sections @@ -123,18 +123,18 @@ class Projects::ProjectsController < Projects::BaseController term, limit = params[:term], params[:limit] || 10 items = User.member_of_project(@project) .where("users.name ILIKE ? OR users.uname ILIKE ?", "%#{term}%", "%#{term}%") - .limit(limit).map { |u| {:value => u.fullname, :label => u.fullname, :id => u.id} } - render :json => items + .limit(limit).map { |u| {value: u.fullname, label: u.fullname, id: u.id} } + render json: items end def preview - render :inline => view_context.markdown(params[:text] || ''), :layout => false + render inline: view_context.markdown(params[:text] || ''), layout: false end def refs_list refs = @project.repo.branches_and_tags.map(&:name) @selected = (refs.include? params[:selected]) ? params[:selected] : @project.default_branch - render :layout => false + render layout: false end protected @@ -167,7 +167,7 @@ class Projects::ProjectsController < Projects::BaseController length = params[:iDisplayLength].to_i page = start/length + 1 - projects.paginate(:page => page, :per_page => length) + projects.paginate(page: page, per_page: length) else projects end diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index bc470aa6a..c8486f00c 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -1,11 +1,11 @@ class Projects::PullRequestsController < Projects::BaseController before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :project - load_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :except => [:index, :autocomplete_to_project] - load_and_authorize_resource :instance_name => :pull, :through => :issue, :singleton => true, :except => [:index, :autocomplete_to_project] - before_filter :find_collaborators, :only => [:new, :create, :show] + load_resource :issue, through: :project, find_by: :serial_id, parent: false, except: [:index, :autocomplete_to_project] + load_and_authorize_resource instance_name: :pull, through: :issue, singleton: true, except: [:index, :autocomplete_to_project] + before_filter :find_collaborators, only: [:new, :create, :show] def new to_project = find_destination_project(false) @@ -21,7 +21,7 @@ class Projects::PullRequestsController < Projects::BaseController @pull.check(false) # don't make event transaction if @pull.already? @pull.destroy - flash.now[:warning] = I18n.t('projects.pull_requests.up_to_date', :to_ref => @pull.to_ref, :from_ref => @pull.from_ref) + flash.now[:warning] = I18n.t('projects.pull_requests.up_to_date', to_ref: @pull.to_ref, from_ref: @pull.from_ref) else load_diff_commits_data end @@ -48,7 +48,7 @@ class Projects::PullRequestsController < Projects::BaseController @pull.check(false) # don't make event transaction if @pull.already? @pull.destroy - flash.now[:error] = I18n.t('projects.pull_requests.up_to_date', :to_ref => @pull.to_ref, :from_ref => @pull.from_ref) + flash.now[:error] = I18n.t('projects.pull_requests.up_to_date', to_ref: @pull.to_ref, from_ref: @pull.from_ref) render :new else @pull.send(@pull.status == 'blocked' ? 'block' : @pull.status) @@ -68,7 +68,7 @@ class Projects::PullRequestsController < Projects::BaseController def merge status = @pull.merge!(current_user) ? 200 : 422 - render :nothing => true, :status => status + render nothing: true, status: status end def update @@ -81,7 +81,7 @@ class Projects::PullRequestsController < Projects::BaseController status = 200 end end - render :nothing => true, :status => status + render nothing: true, status: status end def show @@ -96,7 +96,7 @@ class Projects::PullRequestsController < Projects::BaseController def index(status = 200) @issues_with_pull_request = @project.issues.joins(:pull_request) - @issues_with_pull_request = @issues_with_pull_request.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' + @issues_with_pull_request = @issues_with_pull_request.where(assignee_id: current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me' @issues_with_pull_request = @issues_with_pull_request.search(params[:search_pull_request]) if params[:search_pull_request] !~ /#{t('layout.pull_requests.search')}/ @opened_issues, @closed_issues = @issues_with_pull_request.not_closed_or_merged.count, @issues_with_pull_request.closed_or_merged.count @@ -110,11 +110,11 @@ class Projects::PullRequestsController < Projects::BaseController @issues_with_pull_request = @issues_with_pull_request. includes(:assignee, :user, :pull_request).uniq. - paginate :per_page => 20, :page => params[:page] + paginate per_page: 20, page: params[:page] if status == 200 - render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application' + render 'index', layout: request.xhr? ? 'with_sidebar' : 'application' else - render :status => status, :nothing => true + render status: status, nothing: true end end @@ -125,7 +125,7 @@ class Projects::PullRequestsController < Projects::BaseController items.concat p.by_owner_and_name(term) end items = items.uniq{|i| i.id}.select{|e| e.repo.branches.count > 0} - render :json => json_for_autocomplete_base(items) + render json: json_for_autocomplete_base(items) end protected @@ -136,7 +136,7 @@ class Projects::PullRequestsController < Projects::BaseController def json_for_autocomplete_base items items.collect do |project| - hash = {:id => project.id.to_s, :label => project.name_with_owner, :value => project.name_with_owner} + hash = {id: project.id.to_s, label: project.name_with_owner, value: project.name_with_owner} hash[:get_refs_url] = project_refs_list_path(project) hash end diff --git a/app/controllers/projects/subscribes_controller.rb b/app/controllers/projects/subscribes_controller.rb index 16e205c41..992af9d0f 100644 --- a/app/controllers/projects/subscribes_controller.rb +++ b/app/controllers/projects/subscribes_controller.rb @@ -2,11 +2,11 @@ class Projects::SubscribesController < Projects::BaseController before_filter :authenticate_user! load_and_authorize_resource :project - load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id - load_and_authorize_resource :subscribe, :through => :issue, :find_by => :user_id + load_and_authorize_resource :issue, through: :project, find_by: :serial_id + load_and_authorize_resource :subscribe, through: :issue, find_by: :user_id def create - @subscribe = @issue.subscribes.build(:user_id => current_user.id) + @subscribe = @issue.subscribes.build(user_id: current_user.id) if @subscribe.save flash[:notice] = I18n.t("flash.subscribe.saved") redirect_to :back diff --git a/app/controllers/projects/wiki_controller.rb b/app/controllers/projects/wiki_controller.rb index 5af88e8bd..e51100486 100644 --- a/app/controllers/projects/wiki_controller.rb +++ b/app/controllers/projects/wiki_controller.rb @@ -5,11 +5,11 @@ class Projects::WikiController < Projects::BaseController WIKI_OPTIONS = {} before_filter :authenticate_user! - skip_before_filter :authenticate_user!, :only => [:show, :index, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: [:show, :index, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] if APP_CONFIG['anonymous_access'] load_resource :project - before_filter :authorize_read_actions, :only => [:index, :show, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] - before_filter :authorize_write_actions, :only => [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview] + before_filter :authorize_read_actions, only: [:index, :show, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] + before_filter :authorize_write_actions, only: [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview] before_filter :get_wiki def index @@ -49,13 +49,13 @@ class Projects::WikiController < Projects::BaseController @page = @wiki.page(@name) name = params[:rename] || @name - update_wiki_page(@wiki, @page, params[:content], {:committer => committer}, name, params[:format]) - update_wiki_page(@wiki, @page.footer, params[:footer], {:committer => committer}) if params[:footer] - update_wiki_page(@wiki, @page.sidebar, params[:sidebar], {:committer => committer}) if params[:sidebar] + update_wiki_page(@wiki, @page, params[:content], {committer: committer}, name, params[:format]) + update_wiki_page(@wiki, @page.footer, params[:footer], {committer: committer}) if params[:footer] + update_wiki_page(@wiki, @page.sidebar, params[:sidebar], {committer: committer}) if params[:sidebar] committer.commit - flash[:notice] = t('flash.wiki.successfully_updated', :name => @name) + flash[:notice] = t('flash.wiki.successfully_updated', name: @name) redirect_to project_wiki_path(@project, CGI.escape(@name)) end @@ -67,11 +67,11 @@ class Projects::WikiController < Projects::BaseController @name = CGI.unescape(params['page']) format = params['format'].intern begin - @wiki.write_page(@name, format, params['content'] || '', {:committer => committer}).commit + @wiki.write_page(@name, format, params['content'] || '', {committer: committer}).commit redirect_to project_wiki_path(@project, CGI.escape(@name)) - rescue Gollum::DuplicatePageError => e - flash[:error] = t("flash.wiki.duplicate_page", :name => @name) - render :action => :new + rescue Gollum:DuplicatePageError: e + flash[:error] = t("flash.wiki.duplicate_page", name: @name) + render action: :new end end @@ -79,10 +79,10 @@ class Projects::WikiController < Projects::BaseController @name = CGI.unescape(params[:id]) page = @wiki.page(@name) if page - @wiki.delete_page(page, {:committer => committer}).commit + @wiki.delete_page(page, {committer: committer}).commit flash[:notice] = t("flash.wiki.page_successfully_removed") else - flash[:notice] = t("flash.wiki.page_not_found", :name => params[:id]) + flash[:notice] = t("flash.wiki.page_not_found", name: params[:id]) end redirect_to project_wiki_index_path(@project) end @@ -149,12 +149,12 @@ class Projects::WikiController < Projects::BaseController sha2 = params[:sha2] sha2 = nil if params[:sha2] == 'prev' - if c = @wiki.revert_page(@page, sha1, sha2, {:committer => committer}) and c.commit + if c = @wiki.revert_page(@page, sha1, sha2, {committer: committer}) and c.commit flash[:notice] = t("flash.wiki.revert_success") redirect_to project_wiki_path(@project, CGI.escape(@name)) else # if revert wasn't successful then redirect back to comparsion. - # if second commit version is missed, then second version is + # if second commit version is missed, then second version is # params[:sha1] and first version is parent of params[:sha1] # (see Gollum::Wiki#revert_page) sha2, sha1 = sha1, "#{sha1}^" if !sha2 @@ -170,7 +170,7 @@ class Projects::WikiController < Projects::BaseController sha1 = params[:sha1] sha2 = params[:sha2] sha2 = nil if sha2 == 'prev' - if c = @wiki.revert_commit(sha1, sha2, {:committer => committer}) and c.commit + if c = @wiki.revert_commit(sha1, sha2, {committer: committer}) and c.commit flash[:notice] = t("flash.wiki.revert_success") redirect_to project_wiki_index_path(@project) else @@ -218,14 +218,14 @@ class Projects::WikiController < Projects::BaseController def get_wiki @wiki = Gollum::Wiki.new(@project.wiki_path, - WIKI_OPTIONS.merge(:base_path => project_wiki_index_path(@project))) + WIKI_OPTIONS.merge(base_path: project_wiki_index_path(@project))) end # This method was grabbed from sinatra application, shipped with Gollum gem. # See Gollum gem and Gollum License if you have any questions about license notes. # https://github.com/github/gollum https://github.com/github/gollum/blob/master/LICENSE def update_wiki_page(wiki, page, content, commit_msg, name = nil, format = nil) - return if !page || + return if !page || ((!content || page.raw_data == content) && page.format == format) name ||= page.name format = (format || page.format).to_sym @@ -247,14 +247,14 @@ class Projects::WikiController < Projects::BaseController msg << " (#{params['format']})" if params['format'] end msg = 'Unhandled action' if !msg || msg.empty? - { :message => msg } + { message: msg } end def committer unless @committer - p = commit_message.merge({:name => current_user.uname, :email => current_user.email}) + p = commit_message.merge({name: current_user.uname, email: current_user.email}) @committer = Gollum::Committer.new(@wiki, p) - GitHook.perform_later!(:notification, :process, {:project_id => @project.id, :actor_name => @committer.actor.name, :commit_sha => @committer.commit}) + GitHook.perform_later!(:notification, :process, {project_id: @project.id, actor_name: @committer.actor.name, commit_sha: @committer.commit}) end @committer end @@ -265,12 +265,12 @@ class Projects::WikiController < Projects::BaseController @editable = can?(:write, @project) render :show elsif file = @wiki.file(@name) - render :text => file.raw_data, :content_type => file.mime_type + render text: file.raw_data, content_type: file.mime_type elsif can? :write, @project @new = true render :new else - redirect_to :action => :index #forbidden_path + redirect_to action: :index #forbidden_path end end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index d57642258..03b69a6d6 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -8,7 +8,7 @@ class SearchController < ApplicationController Search.by_term_and_type( @query, @type, - {:page => params[:page]} + {page: params[:page]} ).each do |k, v| var = :"@#{k}" instance_variable_set var, v unless instance_variable_defined?(var) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 85a80aa15..11189431e 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -13,23 +13,23 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController end def passthru - render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false + render file: "#{Rails.root}/public/404.html", status: 404, layout: false end - + private def oauthorize(kind) provider = kind.downcase @user = find_for_ouath(env["omniauth.auth"], current_user) if @user && @user.persisted? - flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => action_name.classify - sign_in_and_redirect @user, :event => :authentication + flash[:notice] = I18n.t "devise.omniauth_callbacks.success", kind: action_name.classify + sign_in_and_redirect @user, event: :authentication else session["devise.#{provider}_data"] = env["omniauth.auth"] redirect_to new_user_registration_url - end + end end - + def find_for_ouath(auth, resource=nil) provider, uid = auth['provider'], auth['uid'] authentication = Authentication.find_or_initialize_by_provider_and_uid(provider, uid) @@ -59,5 +59,5 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController end return authentication.user end - + end diff --git a/app/controllers/users/profile_controller.rb b/app/controllers/users/profile_controller.rb index e632e52b5..30a7ff02c 100644 --- a/app/controllers/users/profile_controller.rb +++ b/app/controllers/users/profile_controller.rb @@ -1,5 +1,5 @@ class Users::ProfileController < Users::BaseController - skip_before_filter :authenticate_user!, :only => :show if APP_CONFIG['anonymous_access'] + skip_before_filter :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] def show @path, page = user_path, params[:page].to_i @@ -11,7 +11,7 @@ class Users::ProfileController < Users::BaseController else @projects = @projects.by_visibilities('hidden').accessible_by(current_ability, :read) end - render :partial => 'shared/profile_projects', :layout => nil, :locals => {:projects => paginate_projects(page)} + render partial: 'shared/profile_projects', layout: nil, locals: {projects: paginate_projects(page)} else @projects = paginate_projects(page) end @@ -20,6 +20,6 @@ class Users::ProfileController < Users::BaseController protected def paginate_projects(page) - @projects.paginate(:page => (page>0 ? page : nil), :per_page => 24) + @projects.paginate(page: (page>0 ? page : nil), per_page: 24) end end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index a081a2a59..ab4d6bd3b 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -3,7 +3,7 @@ class Users::RegistrationsController < Devise::RegistrationsController def create # Try stop bots if params[:recaptcha_response_field].present? - respond_with(resource, :location => after_inactive_sign_up_path_for(resource)) + respond_with(resource, location: after_inactive_sign_up_path_for(resource)) return end super diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index 70b3293e8..2a6103624 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -34,7 +34,7 @@ class Users::SettingsController < Users::BaseController else flash[:error] = t('flash.user.save_error') flash[:warning] = @user.errors.full_messages.join('. ') - render(:action => :private) + render(action: :private) end end end diff --git a/app/controllers/users/users_controller.rb b/app/controllers/users/users_controller.rb index e4eca24a6..32eee91e0 100644 --- a/app/controllers/users/users_controller.rb +++ b/app/controllers/users/users_controller.rb @@ -1,6 +1,6 @@ class Users::UsersController < Users::BaseController - skip_before_filter :authenticate_user!, :only => [:allowed, :check, :discover] - before_filter :find_user_by_key, :only => [:allowed, :discover] + skip_before_filter :authenticate_user!, only: [:allowed, :check, :discover] + before_filter :find_user_by_key, only: [:allowed, :discover] def allowed owner_name, project_name = params[:project].split '/' @@ -11,15 +11,15 @@ class Users::UsersController < Users::BaseController when 'git-receive-pack' then :write end - render :inline => (!@user.access_locked? && Ability.new(@user).can?(action, project)).to_s + render inline: (!@user.access_locked? && Ability.new(@user).can?(action, project)).to_s end def check - render :nothing => true + render nothing: true end def discover - render :json => {:name => @user.name}.to_json + render json: {name: @user.name}.to_json end protected diff --git a/app/helpers/activity_feeds_helper.rb b/app/helpers/activity_feeds_helper.rb index 060645432..ac4fd1e23 100644 --- a/app/helpers/activity_feeds_helper.rb +++ b/app/helpers/activity_feeds_helper.rb @@ -1,6 +1,6 @@ module ActivityFeedsHelper def render_activity_feed(activity_feed) - render activity_feed.partial, activity_feed.data.merge(:activity_feed => activity_feed) + render activity_feed.partial, activity_feed.data.merge(activity_feed: activity_feed) end def get_feed_title_from_content(content) diff --git a/app/helpers/advisories_helper.rb b/app/helpers/advisories_helper.rb index 8a1a99d14..1f8dc4e6b 100644 --- a/app/helpers/advisories_helper.rb +++ b/app/helpers/advisories_helper.rb @@ -1,12 +1,12 @@ module AdvisoriesHelper - def advisories_select_options(advisories, opts = {:class => 'popoverable'}) - def_values = [[t("layout.advisories.no_"), 'no'], [t("layout.advisories.new"), 'new'], [t("layout.advisories.existing"), 'existing', {:class => 'advisory_id'}]] + def advisories_select_options(advisories, opts = {class: 'popoverable'}) + def_values = [[t("layout.advisories.no_"), 'no'], [t("layout.advisories.new"), 'new'], [t("layout.advisories.existing"), 'existing', {class: 'advisory_id'}]] options_for_select(def_values, def_values.first) end def advisory_id_for_hint - sprintf(Advisory::ID_STRING_TEMPLATE, :type => "{#{Advisory::TYPES.values.join(',')}}", - :year => 'YYYY', :id => 'XXXX') + sprintf(Advisory::ID_STRING_TEMPLATE, type: "{#{Advisory::TYPES.values.join(',')}}", + year: 'YYYY', id: 'XXXX') end def construct_ref_link(ref) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ee29e7545..66ebc494b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -39,18 +39,18 @@ module ApplicationHelper def local_alert(text, type = 'error') html = "
#{text}" - html << link_to('×', '#', :class => 'close close-alert', 'data-dismiss' => 'alert') + html << link_to('×', '#', class: 'close close-alert', 'data-dismiss' => 'alert') html << '
' end # Why 42? Because it is the Answer! def short_message(message, length = 42) - truncate(message, :length => length, :omission => '…') + truncate(message, length: length, omission: '…') end def datetime_moment(date, options = {}) tag = options[:tag] || :div klass = "datetime_moment #{options[:class]}" - content_tag(tag, nil, :class => klass, :title => date.strftime('%Y-%m-%d %H:%M:%S UTC'), :origin_datetime => date.to_i) + content_tag(tag, nil, class: klass, title: date.strftime('%Y-%m-%d %H:%M:%S UTC'), origin_datetime: date.to_i) end end diff --git a/app/helpers/build_lists_helper.rb b/app/helpers/build_lists_helper.rb index 5e5e7ec4b..9de0945c0 100644 --- a/app/helpers/build_lists_helper.rb +++ b/app/helpers/build_lists_helper.rb @@ -26,9 +26,9 @@ module BuildListsHelper "#{r.platform.name}/#{r.name}", r.id, { - :publish_without_qa => r.publish_without_qa? ? 1 : 0, - :platform_id => r.platform.id, - :default_arches => (r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence || Arch.where(:name => Arch::DEFAULT).pluck(:id)).join(' ') + publish_without_qa: r.publish_without_qa? ? 1 : 0, + platform_id: r.platform.id, + default_arches: (r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence || Arch.where(name: Arch::DEFAULT).pluck(:id)).join(' ') } ] end.sort_by { |col| col[0] } @@ -68,10 +68,10 @@ module BuildListsHelper def build_list_classified_update_types advisoriable = BuildList::RELEASE_UPDATE_TYPES.map do |el| - [el, {:class => 'advisoriable'}] + [el, {class: 'advisoriable'}] end nonadvisoriable = (BuildList::UPDATE_TYPES - BuildList::RELEASE_UPDATE_TYPES).map do |el| - [el, {:class => 'nonadvisoriable'}] + [el, {class: 'nonadvisoriable'}] end return advisoriable + nonadvisoriable @@ -82,8 +82,8 @@ module BuildListsHelper if item.version =~ /^[\da-z]+$/ && item.name == item.build_list.project.name bl = item.build_list { - :text => str_version ? "#{shortest_hash_id item.version, hash_size}" : shortest_hash_id(item.version, hash_size), - :href => commit_path(bl.project.owner, bl.project, item.version) + text: str_version ? "#{shortest_hash_id item.version, hash_size}" : shortest_hash_id(item.version, hash_size), + href: commit_path(bl.project.owner, bl.project, item.version) } else {} diff --git a/app/helpers/commit_helper.rb b/app/helpers/commit_helper.rb index 743b214b0..27e544a39 100644 --- a/app/helpers/commit_helper.rb +++ b/app/helpers/commit_helper.rb @@ -6,11 +6,11 @@ module CommitHelper res << "" res << "#{h(filename.rtruncate 120)}" res << "" - res << I18n.t("layout.projects.inline_changes_count", :count => total).strip + + res << I18n.t("layout.projects.inline_changes_count", count: total).strip + " (" + - I18n.t("layout.projects.inline_additions_count", :count => adds).strip + + I18n.t("layout.projects.inline_additions_count", count: adds).strip + ", " + - I18n.t("layout.projects.inline_deletions_count", :count => deletes).strip + + I18n.t("layout.projects.inline_deletions_count", count: deletes).strip + ")" res << "" ind +=1 @@ -25,7 +25,7 @@ module CommitHelper # end def commit_date(date) - I18n.localize(date, { :format => "%d %B %Y" }) + I18n.localize(date, { format: "%d %B %Y" }) end def short_hash_id(id) @@ -39,7 +39,7 @@ module CommitHelper def commit_author_link(author) name = author.name email = author.email - u = User.where(:email => email).first + u = User.where(email: email).first u.present? ? link_to(name, user_path(u)) : mail_to(email, name) end diff --git a/app/helpers/contents_helper.rb b/app/helpers/contents_helper.rb index 87f9456e3..ca7c0048a 100644 --- a/app/helpers/contents_helper.rb +++ b/app/helpers/contents_helper.rb @@ -8,9 +8,9 @@ module ContentsHelper compound_path = '' paths.map do |p| compound_path << p << '/' if p != '/' - link_to(platform_content_path(platform, compound_path), {:remote => true}) do - content_tag(:span, p, {:class => 'text'}) + - content_tag(:span, '', {:class => 'arrow-right'}) + link_to(platform_content_path(platform, compound_path), {remote: true}) do + content_tag(:span, p, {class: 'text'}) + + content_tag(:span, '', {class: 'arrow-right'}) end end.join.html_safe end diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 1eab6d2f4..f7ccfafc3 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -6,11 +6,11 @@ module DiffHelper res << "" res << "#{link_to stat.filename.rtruncate(120), "#{path}#diff-#{ind}"}" res << "" - res << I18n.t("layout.projects.inline_changes_count", :count => stat.additions + stat.deletions).strip + + res << I18n.t("layout.projects.inline_changes_count", count: stat.additions + stat.deletions).strip + " (" + - I18n.t("layout.projects.inline_additions_count", :count => stat.additions).strip + + I18n.t("layout.projects.inline_additions_count", count: stat.additions).strip + ", " + - I18n.t("layout.projects.inline_deletions_count", :count => stat.deletions).strip + + I18n.t("layout.projects.inline_deletions_count", count: stat.deletions).strip + ")" res << "" end @@ -34,7 +34,7 @@ module DiffHelper elsif @commit commit_path @project, @commit end - prepare(args.merge({:filepath => filepath, :comments => comments, :in_discussion => in_discussion})) + prepare(args.merge({filepath: filepath, comments: comments, in_discussion: in_discussion})) res = '' res << '' @@ -228,7 +228,7 @@ module DiffHelper def line_comment return if @no_commit_comment || (@in_discussion && @add_reply_id && @line_comments[0].data[:line].to_i != @num_line) - link_to image_tag('line_comment.png', :alt => t('layout.comments.new_header')), new_comment_path, :class => 'add_line-comment' if current_user + link_to image_tag('line_comment.png', alt: t('layout.comments.new_header')), new_comment_path, class: 'add_line-comment' if current_user end def render_line_comments @@ -251,17 +251,17 @@ module DiffHelper " end def new_comment_path - hash = {:path => @filepath, :line => @num_line} + hash = {path: @filepath, line: @num_line} if @commentable.is_a? Issue - project_new_line_pull_comment_path(@project, @commentable, hash.merge({:in_reply => @add_reply_id})) + project_new_line_pull_comment_path(@project, @commentable, hash.merge({in_reply: @add_reply_id})) elsif @commentable.is_a? Grit::Commit new_line_commit_comment_path(@project, @commentable, hash) end diff --git a/app/helpers/git_helper.rb b/app/helpers/git_helper.rb index 68a589198..371bed4a3 100644 --- a/app/helpers/git_helper.rb +++ b/app/helpers/git_helper.rb @@ -69,19 +69,19 @@ module GitHelper def branch_selector_options(project) p, tag_enabled = params.dup, !(controller_name == 'trees' && action_name == 'branches') p.delete(:path) if p[:path].present? # to root path - p.merge!(:project_id => project.id, :treeish => project.default_branch).delete(:id) unless p[:treeish].present? + p.merge!(project_id: project.id, treeish: project.default_branch).delete(:id) unless p[:treeish].present? current = url_for(p).split('?', 2).first res = [] if params[:treeish].present? && !project.repo.branches_and_tags.map(&:name).include?(params[:treeish]) res << [I18n.t('layout.git.repositories.commits'), [params[:treeish].truncate(20)]] end - linking = Proc.new {|name| [name.truncate(20), url_for(p.merge :treeish => name).split('?', 2).first]} + linking = Proc.new {|name| [name.truncate(20), url_for(p.merge treeish: name).split('?', 2).first]} res << [I18n.t('layout.git.repositories.branches'), project.repo.branches.map(&:name).sort.map(&linking)] if tag_enabled res << [I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&:name).sort.map(&linking)] else - res << [I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&:name).sort.map {|name| [name.truncate(20), {:disabled => true}]}] + res << [I18n.t('layout.git.repositories.tags'), project.repo.tags.map(&:name).sort.map {|name| [name.truncate(20), {disabled: true}]}] end grouped_options_for_select(res, current) end diff --git a/app/helpers/mass_build_helper.rb b/app/helpers/mass_build_helper.rb index a193ed0c2..d44968261 100644 --- a/app/helpers/mass_build_helper.rb +++ b/app/helpers/mass_build_helper.rb @@ -1,7 +1,7 @@ module MassBuildHelper def link_to_list platform, mass_build, which link_to t("layout.mass_builds.#{which}"), - get_list_platform_mass_build_path(@platform, mass_build, :kind => which, :format => :txt), - :target => "_blank" if can?(:get_list, mass_build) + get_list_platform_mass_build_path(@platform, mass_build, kind: which, format: :txt), + target: "_blank" if can?(:get_list, mass_build) end end diff --git a/app/helpers/paginate_helper.rb b/app/helpers/paginate_helper.rb index 0b4c7eddf..645293d6f 100644 --- a/app/helpers/paginate_helper.rb +++ b/app/helpers/paginate_helper.rb @@ -6,7 +6,7 @@ module PaginateHelper per_page = 100 if per_page >100 page = params[:page].to_i page = nil if page == 0 - {:page => page, :per_page => per_page} + {page: page, per_page: per_page} end def angularjs_will_paginate(collection_or_options = nil, options = {}) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 2b58464a7..034f00ee5 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,20 +1,20 @@ module ProjectsHelper def options_for_filters(all_projects, groups, owners) - projects_count_by_groups = all_projects.where(:owner_id => groups, :owner_type => 'Group'). + projects_count_by_groups = all_projects.where(owner_id: groups, owner_type: 'Group'). group(:owner_id).count - projects_count_by_owners = all_projects.where(:owner_id => owners, :owner_type => 'User'). + projects_count_by_owners = all_projects.where(owner_id: owners, owner_type: 'User'). group(:owner_id).count (groups + owners).map do |o| class_name = o.class.name { - :id => "#{class_name.downcase}-#{o.id}", - :color => '0054a6', - :selected => false, - :check_box_name => class_name.downcase.pluralize, - :check_box_value => o.id, - :name => content_tag(:div, content_tag(:span, o.uname, :class => class_name.downcase)), - :uname => o.uname, # only for sorting - :count => o.is_a?(User) ? projects_count_by_owners[o.id] : projects_count_by_groups[o.id] + id: "#{class_name.downcase}-#{o.id}", + color: '0054a6', + selected: false, + check_box_name: class_name.downcase.pluralize, + check_box_value: o.id, + name: content_tag(:div, content_tag(:span, o.uname, class: class_name.downcase)), + uname: o.uname, # only for sorting + count: o.is_a?(User) ? projects_count_by_owners[o.id] : projects_count_by_groups[o.id] } end.sort_by{ |f| f[:uname] } end diff --git a/app/helpers/pull_request_helper.rb b/app/helpers/pull_request_helper.rb index 1690d317a..03cc9dc9c 100644 --- a/app/helpers/pull_request_helper.rb +++ b/app/helpers/pull_request_helper.rb @@ -9,13 +9,13 @@ module PullRequestHelper def pull_status_label pull_status, options = {} statuses = {'ready' => 'success', 'closed' => 'important', 'merged' => 'important', 'blocked' => 'warning'} - content_tag :span, t("projects.pull_requests.statuses.#{pull_status}"), options.merge(:class => "state label-bootstrap label-#{statuses[pull_status]}") + content_tag :span, t("projects.pull_requests.statuses.#{pull_status}"), options.merge(class: "state label-bootstrap label-#{statuses[pull_status]}") end def pull_status pull if %w(blocked merged closed ready open).include? pull.status - t("projects.pull_requests.#{pull.status}", :user => pull.issue.closer.try(:uname), :to_ref => show_ref(pull, 'to'), - :from_ref => show_ref(pull, 'from'), :time => pull.issue.closed_at).html_safe + t("projects.pull_requests.#{pull.status}", user: pull.issue.closer.try(:uname), to_ref: show_ref(pull, 'to'), + from_ref: show_ref(pull, 'from'), time: pull.issue.closed_at).html_safe else raise "pull id (#{pull.id}) wrong status #{pull.status} " end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 69d81a4da..f6f99c414 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,7 +1,7 @@ module UsersHelper def avatar_url_by_email(email, size = :small) - avatar_url(User.where(:email => email).first || User.new(:email => email), size) + avatar_url(User.where(email: email).first || User.new(email: email), size) end def avatar_url(subject, size = :small) diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 3abf35dcb..fd2429413 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -22,9 +22,9 @@ module WikiHelper def editor_path(project, name) if @new - url_for(:controller => :wiki, :action => :create, :project_id => project.id) + url_for(controller: :wiki, action: :create, project_id: project.id) else - url_for(:controller => :wiki, :action => :update, :project_id => project.id, :id => name) + url_for(controller: :wiki, action: :update, project_id: project.id, id: name) end end diff --git a/app/mailers/feedback_mailer.rb b/app/mailers/feedback_mailer.rb index 272849100..362656185 100644 --- a/app/mailers/feedback_mailer.rb +++ b/app/mailers/feedback_mailer.rb @@ -1,10 +1,10 @@ class FeedbackMailer < ActionMailer::Base FBM_CONFIG = APP_CONFIG['feedback'] - default :to => FBM_CONFIG['email'], - :cc => FBM_CONFIG['cc'], - :bcc => FBM_CONFIG['bcc'] - default_url_options.merge!(:protocol => 'https') if APP_CONFIG['mailer_https_url'] + default to: FBM_CONFIG['email'], + cc: FBM_CONFIG['cc'], + bcc: FBM_CONFIG['bcc'] + default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url'] include Resque::Mailer # send email async @@ -14,7 +14,7 @@ class FeedbackMailer < ActionMailer::Base from = "#{@data.name} <#{@data.email}>" subj = prepare_subject(@data.subject) - mail :from => from, :subject => subj + mail from: from, subject: subj end protected @@ -31,5 +31,4 @@ class FeedbackMailer < ActionMailer::Base def affix(affixes) ' %s ' % Array(affixes).map{|e| "[#{e}]"}.join end - end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 3a97f245a..fed9711ee 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -2,17 +2,17 @@ class UserMailer < ActionMailer::Base add_template_helper ActivityFeedsHelper add_template_helper CommitHelper - default :from => "\"#{APP_CONFIG['project_name']}\" <#{APP_CONFIG['do-not-reply-email']}>" - default_url_options.merge!(:protocol => 'https') if APP_CONFIG['mailer_https_url'] + default from: "\"#{APP_CONFIG['project_name']}\" <#{APP_CONFIG['do-not-reply-email']}>" + default_url_options.merge!(protocol: 'https') if APP_CONFIG['mailer_https_url'] include Resque::Mailer # send email async def new_user_notification(user) @user = user mail( - :to => email_with_name(user, user.email), - :subject => I18n.t("notifications.subjects.new_user_notification", - :project_name => APP_CONFIG['project_name']) + to: email_with_name(user, user.email), + subject: I18n.t("notifications.subjects.new_user_notification", + project_name: APP_CONFIG['project_name']) ) do |format| format.html end @@ -23,9 +23,9 @@ class UserMailer < ActionMailer::Base subject = @comment.issue_comment? ? subject_for_issue(@comment.commentable) : I18n.t('notifications.subjects.new_commit_comment_notification') mail( - :to => email_with_name(user, user.email), - :subject => subject, - :from => email_with_name(comment.user) + to: email_with_name(user, user.email), + subject: subject, + from: email_with_name(comment.user) ) do |format| format.html end @@ -34,9 +34,9 @@ class UserMailer < ActionMailer::Base def new_issue_notification(issue, user) @user, @issue = user, issue mail( - :to => email_with_name(user, user.email), - :subject => subject_for_issue(issue, true), - :from => email_with_name(issue.user) + to: email_with_name(user, user.email), + subject: subject_for_issue(issue, true), + from: email_with_name(issue.user) ) do |format| format.html end @@ -45,8 +45,8 @@ class UserMailer < ActionMailer::Base def issue_assign_notification(issue, user) @issue = issue mail( - :to => email_with_name(user, user.email), - :subject => subject_for_issue(@issue) + to: email_with_name(user, user.email), + subject: subject_for_issue(@issue) ) do |format| format.html end @@ -59,11 +59,11 @@ class UserMailer < ActionMailer::Base subject = "[№ #{build_list.id}] " subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project")) subject << " - #{build_list.human_status} " - subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name) + subject << I18n.t("notifications.subjects.for_arch", arch: @build_list.arch.name) mail( - :to => email_with_name(user, user.email), - :subject => subject, - :from => email_with_name(build_list.publisher || build_list.user) + to: email_with_name(user, user.email), + subject: subject, + from: email_with_name(build_list.publisher || build_list.user) ) do |format| format.html end @@ -73,8 +73,8 @@ class UserMailer < ActionMailer::Base set_locale register_request @register_request = register_request mail( - :to => register_request.email, - :subject => I18n.t("notifications.subjects.invite_approve_notification") + to: register_request.email, + subject: I18n.t("notifications.subjects.invite_approve_notification") ) do |format| format.html end @@ -83,20 +83,20 @@ class UserMailer < ActionMailer::Base def git_delete_branch_notification(user, options) set_locale user mail( - :to => user.email, - :subject => I18n.t('notifications.subjects.update_code', :project_name => "#{options[:project_owner]}/#{options[:project_name]}") + to: user.email, + subject: I18n.t('notifications.subjects.update_code', project_name: "#{options[:project_owner]}/#{options[:project_name]}") ) do |format| - format.html { render 'git_delete_branch_notification', :locals => options } + format.html { render 'git_delete_branch_notification', locals: options } end end def git_new_push_notification(user, options) set_locale user mail( - :to => user.email, - :subject => I18n.t('notifications.subjects.update_code', :project_name => "#{options[:project_owner]}/#{options[:project_name]}") + to: user.email, + subject: I18n.t('notifications.subjects.update_code', project_name: "#{options[:project_owner]}/#{options[:project_name]}") ) do |format| - format.html { render 'git_new_push_notification', :locals => options } + format.html { render 'git_new_push_notification', locals: options } end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 7935bf0f3..074f6e922 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -12,21 +12,21 @@ class Ability @user = user # Shared rights between guests and registered users - can [:show, :archive], Project, :visibility => 'open' - can :get_id, Project, :visibility => 'open' # api + can [:show, :archive], Project, visibility: 'open' + can :get_id, Project, visibility: 'open' # api can(:refs_list, Project) {|project| can? :show, project} - can :read, Issue, :project => {:visibility => 'open'} - can [:read, :commits, :files], PullRequest, :to_project => {:visibility => 'open'} - can [:read, :log, :everything], BuildList, :project => {:visibility => 'open'} - can [:read, :log], ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work + can :read, Issue, project: {visibility: 'open'} + can [:read, :commits, :files], PullRequest, to_project: {visibility: 'open'} + can [:read, :log, :everything], BuildList, project: {visibility: 'open'} + can [:read, :log], ProductBuildList#, product: {platform: {visibility: 'open'}} # double nested hash don't work can [:read, :search], Advisory # Platforms block - can [:show, :members, :advisories], Platform, :visibility => 'open' - can :platforms_for_build, Platform, :visibility => 'open', :platform_type => 'main' + can [:show, :members, :advisories], Platform, visibility: 'open' + can :platforms_for_build, Platform, visibility: 'open', platform_type: 'main' can([:read, :get_list], MassBuild) {|mass_build| can?(:show, mass_build.save_to_platform) } - can [:read, :projects_list, :projects], Repository, :platform => {:visibility => 'open'} - can :read, Product, :platform => {:visibility => 'open'} + can [:read, :projects_list, :projects], Repository, platform: {visibility: 'open'} + can :read, Product, platform: {visibility: 'open'} can :show, Group can :show, User @@ -38,32 +38,32 @@ class Ability if user.admin? can :manage, :all # Protection - cannot :approve, RegisterRequest, :approved => true - cannot :reject, RegisterRequest, :rejected => true + cannot :approve, RegisterRequest, approved: true + cannot :reject, RegisterRequest, rejected: true cannot [:destroy, :create], Subscribe # Act admin as simple user - cannot :read, Product, :platform => {:platform_type => 'personal'} + cannot :read, Product, platform: {platform_type: 'personal'} cannot [:owned, :related], [BuildList, Platform] cannot :membered, Project # list products which user members end if user.user? - can :edit, User, :id => user.id + can :edit, User, id: user.id can [:read, :create], Group can [:update, :manage_members, :members, :add_member, :remove_member, :update_member], Group do |group| - group.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin') # or group.owner_id = user.id + group.actors.exists?(actor_type: 'User', actor_id: user.id, role: 'admin') # or group.owner_id = user.id end can :write, Group do |group| - group.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => ['writer', 'admin']) + group.actors.exists?(actor_type: 'User', actor_id: user.id, role: ['writer', 'admin']) end - can :destroy, Group, :owner_id => user.id + can :destroy, Group, owner_id: user.id can :remove_user, Group can :create, Project can([:mass_import, :run_mass_import], Project) if user.platforms.main.find{ |p| local_admin?(p) }.present? - 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, 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(:write, Project) {|project| local_writer? project} # for grack can [:update, :sections, :manage_collaborators, :autocomplete_maintainers, :add_member, :remove_member, :update_member, :members], Project do |project| @@ -72,15 +72,15 @@ class Ability can(:fork, Project) {|project| can? :read, project} can(:fork, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner} can(:destroy, Project) {|project| owner? project} - can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')} + can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(actor_type: 'User', actor_id: user.id, role: 'admin')} can :remove_user, Project can :preview, Project can([:read, :create, :edit, :destroy, :update], Hook) {|hook| can?(:edit, hook.project)} - 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, :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(:publish_into_testing, BuildList) { |build_list| can?(:create, build_list) && build_list.save_to_platform.main? } @@ -92,7 +92,7 @@ class Ability can(:publish, BuildList) do |build_list| if build_list.build_published? - local_admin?(build_list.save_to_platform) || build_list.save_to_repository.members.exists?(:id => user.id) + local_admin?(build_list.save_to_platform) || build_list.save_to_repository.members.exists?(id: user.id) else build_list.save_to_repository.publish_without_qa ? can?(:write, build_list.project) : local_admin?(build_list.save_to_platform) @@ -107,23 +107,23 @@ class Ability end can([:cancel, :create_container], BuildList) {|build_list| can?(:write, build_list.project)} - can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id - can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user_group_ids + can [:read, :owned, :related, :members], Platform, owner_type: 'User', owner_id: user.id + 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 [:read, :related], Platform, :id => user.repositories.pluck(:platform_id) + can [:read, :related], Platform, id: user.repositories.pluck(:platform_id) can([:update, :destroy, :change_visibility], Platform) {|platform| owner?(platform) } can([:local_admin_manage, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) } can([:create, :publish], MassBuild) {|mass_build| owner?(mass_build.save_to_platform) || local_admin?(mass_build.save_to_platform)} can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.save_to_platform) || local_admin?(mass_build.save_to_platform)) && !mass_build.stop_build} - can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'User', :owner_id => user.id} - can [:read, :projects_list, :projects], Repository, :platform => {:owner_type => 'Group', :owner_id => user_group_ids} + can [:read, :projects_list, :projects], Repository, platform: {owner_type: 'User', owner_id: user.id} + can [:read, :projects_list, :projects], Repository, platform: {owner_type: 'Group', owner_id: user_group_ids} can([:read, :projects_list, :projects], Repository, read_relations_for('repositories')) {|repository| can? :show, repository.platform} can([:read, :projects_list, :projects], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform} can([:create, :edit, :update, :destroy, :projects_list, :projects, :add_project, :remove_project, :regenerate_metadata, :sync_lock_file, :add_repo_lock_file, :remove_repo_lock_file], Repository) {|repository| local_admin? repository.platform} can([:remove_members, :remove_member, :add_member, :signatures, :packages], Repository) {|repository| owner?(repository.platform) || local_admin?(repository.platform)} - can([:add_project, :remove_project], Repository) {|repository| repository.members.exists?(:id => user.id)} + can([:add_project, :remove_project], Repository) {|repository| repository.members.exists?(id: user.id)} can(:clear, Platform) {|platform| owner?(platform) && platform.personal?} can(:regenerate_metadata, Platform) {|platform| owner?(platform) || local_admin?(platform)} can([:settings, :destroy, :edit, :update], Repository) {|repository| owner? repository.platform} @@ -132,26 +132,26 @@ class Ability can([:read, :create, :withdraw], Token) {|token| local_admin?(token.subject)} - can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id, :platform_type => 'main'} - can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user_group_ids, :platform_type => 'main'} + can :read, Product, platform: {owner_type: 'User', owner_id: user.id, platform_type: 'main'} + can :read, Product, platform: {owner_type: 'Group', owner_id: user_group_ids, platform_type: 'main'} can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?} can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?} can([:create, :cancel, :update], ProductBuildList) {|pbl| can?(:update, pbl.product)} can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)} - can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id} - can [:read, :create], PrivateUser, :platform => {:owner_type => 'Group', :owner_id => user_group_ids} + can [:read, :create], PrivateUser, platform: {owner_type: 'User', owner_id: user.id} + can [:read, :create], PrivateUser, platform: {owner_type: 'Group', owner_id: user_group_ids} - can :read, Issue, :project => {:owner_type => 'User', :owner_id => user.id} - can :read, Issue, :project => {:owner_type => 'Group', :owner_id => user_group_ids} + can :read, Issue, project: {owner_type: 'User', owner_id: user.id} + can :read, Issue, project: {owner_type: 'Group', owner_id: user_group_ids} can(:read, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil} can(:create, Issue) {|issue| can? :read, issue.project} can(:update, Issue) {|issue| issue.user_id == user.id or local_admin?(issue.project)} - cannot :manage, Issue, :project => {:has_issues => false} # switch off issues + cannot :manage, Issue, project: {has_issues: false} # switch off issues - can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'User', :owner_id => user.id} - can [:read, :commits, :files], PullRequest, :to_project => {:owner_type => 'Group', :owner_id => user_group_ids} + can [:read, :commits, :files], PullRequest, to_project: {owner_type: 'User', owner_id: user.id} + can [:read, :commits, :files], PullRequest, to_project: {owner_type: 'Group', owner_id: user_group_ids} can([:read, :commits, :files], PullRequest, read_relations_for('pull_requests', 'to_projects')) {|pull| can? :read, pull.to_project} can :create, PullRequest can(:update, PullRequest) {|pull| pull.user_id == user.id or local_admin?(pull.to_project)} @@ -165,24 +165,24 @@ class Ability end # Shared cannot rights for all users (registered, admin) - cannot [:regenerate_metadata, :destroy], Platform, :platform_type => 'personal' - cannot [:create, :destroy], Repository, :platform => {:platform_type => 'personal'}, :name => 'main' - cannot [:packages], Repository, :platform => {:platform_type => 'personal'} - cannot [:remove_members, :remove_member, :add_member, :sync_lock_file, :add_repo_lock_file, :remove_repo_lock_file], Repository, :platform => {:platform_type => 'personal'} + cannot [:regenerate_metadata, :destroy], Platform, platform_type: 'personal' + cannot [:create, :destroy], Repository, platform: {platform_type: 'personal'}, name: 'main' + cannot [:packages], Repository, platform: {platform_type: 'personal'} + cannot [:remove_members, :remove_member, :add_member, :sync_lock_file, :add_repo_lock_file, :remove_repo_lock_file], Repository, platform: {platform_type: 'personal'} - cannot :clear, Platform, :platform_type => 'main' + cannot :clear, Platform, platform_type: 'main' cannot :destroy, Issue - cannot [:members, :add_member, :remove_member, :remove_members], Platform, :platform_type => 'personal' + cannot [:members, :add_member, :remove_member, :remove_members], Platform, platform_type: 'personal' - cannot [:create, :update, :destroy, :clone], Product, :platform => {:platform_type => 'personal'} - cannot [:clone], Platform, :platform_type => 'personal' + cannot [:create, :update, :destroy, :clone], Product, platform: {platform_type: 'personal'} + cannot [:clone], Platform, platform_type: 'personal' - cannot [:publish, :publish_into_testing], BuildList, :new_core => false - cannot :create_container, BuildList, :new_core => false + cannot [:publish, :publish_into_testing], BuildList, new_core: false + cannot :create_container, BuildList, new_core: false cannot(:publish, BuildList) {|build_list| !build_list.can_publish? } cannot(:publish_into_testing, BuildList) {|build_list| !build_list.can_publish_into_testing? } - cannot :publish_into_testing, BuildList, :save_to_platform => {:platform_type => 'personal'} + cannot :publish_into_testing, BuildList, save_to_platform: {platform_type: 'personal'} cannot(:cancel, MassBuild) {|mass_build| mass_build.stop_build} @@ -193,10 +193,10 @@ class Ability end can :create, Subscribe do |subscribe| - !subscribe.subscribeable.subscribes.exists?(:user_id => user.id) + !subscribe.subscribeable.subscribes.exists?(user_id: user.id) end can :destroy, Subscribe do |subscribe| - subscribe.subscribeable.subscribes.exists?(:user_id => user.id) && user.id == subscribe.user_id + subscribe.subscribeable.subscribes.exists?(user_id: user.id) && user.id == subscribe.user_id end end end @@ -205,29 +205,6 @@ class Ability key = parent ? "#{parent.singularize}_id" : 'id' parent ||= table - # Removes duplicates from subquery - # - # ["#{table}.#{key} IN - # ( - # SELECT target_id FROM relations - # INNER JOIN #{parent} ON relations.target_type = :target_type AND relations.target_id = #{parent}.id - # WHERE relations.target_type = :target_type AND - # ( - # #{parent}.owner_type = 'User' AND #{parent}.owner_id != :user OR - # #{parent}.owner_type = 'Group' AND #{parent}.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) - # ) - - # )", - # { - # :target_type => parent.classify, - # :user => @user.id, - # :groups => @user.group_ids - # } - # ] - ["#{table}.#{key} IN ( SELECT target_id FROM relations WHERE relations.target_type = ? AND (relations.actor_type = 'User' AND relations.actor_id = ? OR @@ -257,5 +234,4 @@ class Ability def user_group_ids @user_group_ids ||= @user.group_ids end - end diff --git a/app/models/advisory.rb b/app/models/advisory.rb index b1cc0c6d1..35f0b146c 100644 --- a/app/models/advisory.rb +++ b/app/models/advisory.rb @@ -3,18 +3,18 @@ class Advisory < ActiveRecord::Base has_and_belongs_to_many :projects has_many :build_lists - validates :description, :update_type, :presence => true - validates :update_type, :inclusion => BuildList::RELEASE_UPDATE_TYPES + validates :description, :update_type, presence: true + validates :update_type, inclusion: BuildList::RELEASE_UPDATE_TYPES after_create :generate_advisory_id - before_save :normalize_references, :if => :references_changed? + before_save :normalize_references, if: :references_changed? ID_TEMPLATE = 'ROSA-%s-%d:%04d' ID_STRING_TEMPLATE = 'ROSA-%s-%04s:%04s' TYPES = {'security' => 'SA', 'bugfix' => 'A'} scope :search_by_id, lambda { |aid| where("#{table_name}.advisory_id ILIKE ?", "%#{aid.to_s.strip}%") } - scope :by_update_type, lambda { |ut| where(:update_type => ut) } + scope :by_update_type, lambda { |ut| where(update_type: ut) } default_scope order("#{table_name}.created_at DESC") def to_param @@ -32,15 +32,15 @@ class Advisory < ActiveRecord::Base # this method fetches and structurize packages attached to current advisory. def fetch_packages_info packages_info = Hash.new { |h, k| h[k] = {} } # maaagic, it's maaagic ;) - build_lists.find_in_batches(:include => [:save_to_platform, :packages, :project]) do |batch| + build_lists.find_in_batches(include: [:save_to_platform, :packages, :project]) do |batch| batch.each do |build_list| - tmp = build_list.packages.inject({:srpm => nil, :rpm => []}) do |h, p| + tmp = build_list.packages.inject({srpm: nil, rpm: []}) do |h, p| p.package_type == 'binary' ? h[:rpm] << p.fullname : h[:srpm] = p.fullname h end h = { build_list.project => tmp } packages_info[build_list.save_to_platform].merge!(h) do |pr, old, new| - {:srpm => new[:srpm], :rpm => old[:rpm].concat(new[:rpm]).uniq} + {srpm: new[:srpm], rpm: old[:rpm].concat(new[:rpm]).uniq} end end end @@ -50,7 +50,7 @@ class Advisory < ActiveRecord::Base protected def generate_advisory_id - self.advisory_id = sprintf(ID_TEMPLATE, :type => TYPES[self.update_type], :year => Time.now.utc.year, :id => self.id) + self.advisory_id = sprintf(ID_TEMPLATE, type: TYPES[self.update_type], year: Time.now.utc.year, id: self.id) self.save end diff --git a/app/models/arch.rb b/app/models/arch.rb index b14ec33fc..afe2ce920 100644 --- a/app/models/arch.rb +++ b/app/models/arch.rb @@ -1,9 +1,9 @@ class Arch < ActiveRecord::Base DEFAULT = %w[i586 x86_64] - has_many :build_lists, :dependent => :destroy + has_many :build_lists, dependent: :destroy - validates :name, :presence => true, :uniqueness => true + validates :name, presence: true, uniqueness: true scope :recent, order("#{table_name}.name ASC") end diff --git a/app/models/authentication.rb b/app/models/authentication.rb index 1a037f2c0..26ee1ebdb 100644 --- a/app/models/authentication.rb +++ b/app/models/authentication.rb @@ -1,6 +1,6 @@ class Authentication < ActiveRecord::Base belongs_to :user - validates :provider, :uid, :user_id, :presence => true - validates :uid, :uniqueness => {:scope => :provider, :case_sensitive => false} + validates :provider, :uid, :user_id, presence: true + validates :uid, uniqueness: {scope: :provider, case_sensitive: false} end diff --git a/app/models/avatar.rb b/app/models/avatar.rb index 67a56878f..e11f909b5 100644 --- a/app/models/avatar.rb +++ b/app/models/avatar.rb @@ -2,15 +2,15 @@ class Avatar < ActiveRecord::Base self.abstract_class = true MAX_AVATAR_SIZE = 5.megabyte - AVATAR_SIZES = {:micro => 16, :small => 30, :medium => 40, :big => 81} + AVATAR_SIZES = {micro: 16, small: 30, medium: 40, big: 81} AVATAR_SIZES_HASH = {}.tap do |styles| AVATAR_SIZES.each do |name, size| - styles[name] = { :geometry => "#{size}x#{size}#", :format => :jpg, :convert_options => '-strip -background white -flatten -quality 70'} + styles[name] = { geometry: "#{size}x#{size}#", format: :jpg, convert_options: '-strip -background white -flatten -quality 70'} end end - has_attached_file :avatar, :styles => AVATAR_SIZES_HASH - validates_inclusion_of :avatar_file_size, :in => (0..MAX_AVATAR_SIZE), :allow_nil => true + has_attached_file :avatar, styles: AVATAR_SIZES_HASH + validates_inclusion_of :avatar_file_size, in: (0..MAX_AVATAR_SIZE), allow_nil: true attr_accessible :avatar diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 28969f3ed..afaee0d10 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -6,17 +6,17 @@ class BuildList < ActiveRecord::Base belongs_to :project belongs_to :arch - belongs_to :save_to_platform, :class_name => 'Platform' - belongs_to :save_to_repository, :class_name => 'Repository' - belongs_to :build_for_platform, :class_name => 'Platform' + belongs_to :save_to_platform, class_name: 'Platform' + belongs_to :save_to_repository, class_name: 'Repository' + belongs_to :build_for_platform, class_name: 'Platform' belongs_to :user - belongs_to :builder, :class_name => 'User' - belongs_to :publisher, :class_name => 'User' + belongs_to :builder, class_name: 'User' + belongs_to :publisher, class_name: 'User' belongs_to :advisory - belongs_to :mass_build, :counter_cache => true - has_many :items, :class_name => '::BuildList::Item', :dependent => :destroy - has_many :packages, :class_name => '::BuildList::Package', :dependent => :destroy - has_many :source_packages, :class_name => '::BuildList::Package', :conditions => {:package_type => 'source'} + belongs_to :mass_build, counter_cache: true + has_many :items, class_name: '::BuildList::Item', dependent: :destroy + has_many :packages, class_name: '::BuildList::Package', dependent: :destroy + has_many :source_packages, class_name: '::BuildList::Package', conditions: {package_type: 'source'} UPDATE_TYPES = %w[bugfix security enhancement recommended newpackage] RELEASE_UPDATE_TYPES = %w[bugfix security] @@ -24,13 +24,13 @@ class BuildList < ActiveRecord::Base EXTERNAL_NODES = %w[owned everything] 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 :update_type, :inclusion => UPDATE_TYPES, - :unless => Proc.new { |b| b.advisory.present? } - validates :update_type, :inclusion => {:in => RELEASE_UPDATE_TYPES, :message => I18n.t('flash.build_list.frozen_platform')}, - :if => Proc.new { |b| b.advisory.present? } + :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 :update_type, inclusion: UPDATE_TYPES, + unless: Proc.new { |b| b.advisory.present? } + validates :update_type, inclusion: {in: RELEASE_UPDATE_TYPES, message: I18n.t('flash.build_list.frozen_platform')}, + if: Proc.new { |b| b.advisory.present? } validate lambda { errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.main? && save_to_platform_id != build_for_platform_id } @@ -41,17 +41,17 @@ class BuildList < ActiveRecord::Base errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) if save_to_repository.platform_id != save_to_platform.id } validate lambda { - errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_include_repos')) if build_for_platform.repositories.where(:id => include_repos).count != include_repos.size + errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_include_repos')) if build_for_platform.repositories.where(id: include_repos).count != include_repos.size } validate lambda { errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_project')) unless save_to_repository.projects.exists?(project_id) } - before_validation lambda { self.include_repos = include_repos.uniq if include_repos.present? }, :on => :create - before_validation :prepare_extra_repositories, :on => :create - before_validation :prepare_extra_build_lists, :on => :create - before_validation :prepare_extra_params, :on => :create - before_validation lambda { self.auto_publish = false if external_nodes.present?; true }, :on => :create - before_validation lambda { self.auto_create_container = false if auto_publish?; true }, :on => :create + before_validation lambda { self.include_repos = include_repos.uniq if include_repos.present? }, on: :create + before_validation :prepare_extra_repositories, on: :create + before_validation :prepare_extra_build_lists, on: :create + before_validation :prepare_extra_params, on: :create + before_validation lambda { self.auto_publish = false if external_nodes.present?; true }, on: :create + before_validation lambda { self.auto_create_container = false if auto_publish?; true }, on: :create attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash, :arch_id, :project_id, :save_to_repository_id, :update_type, @@ -93,21 +93,21 @@ class BuildList < ActiveRecord::Base scope :recent, order("#{table_name}.updated_at DESC") scope :for_extra_build_lists, lambda {|ids, current_ability, save_to_platform| s = scoped - s = s.where(:id => ids).published_container.accessible_by(current_ability, :read) - s = s.where(:save_to_platform_id => save_to_platform.id) if save_to_platform && save_to_platform.main? + s = s.where(id: ids).published_container.accessible_by(current_ability, :read) + s = s.where(save_to_platform_id: save_to_platform.id) if save_to_platform && save_to_platform.main? s } - scope :for_status, lambda {|status| where(:status => status) if status.present? } - scope :for_user, lambda { |user| where(:user_id => user.id) } + scope :for_status, lambda {|status| where(status: status) if status.present? } + scope :for_user, lambda { |user| where(user_id: user.id) } scope :not_owned_external_nodes, where("#{table_name}.external_nodes is null OR #{table_name}.external_nodes != ?", :owned) scope :external_nodes, lambda { |type| where("#{table_name}.external_nodes = ?", type) } scope :oldest, lambda { where("#{table_name}.updated_at < ?", Time.zone.now - 15.seconds) } - scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform) } - scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build) } - scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) if arch.present? } - scope :scoped_to_save_platform, lambda {|pl_id| where(:save_to_platform_id => pl_id) if pl_id.present? } - scope :scoped_to_project_version, lambda {|project_version| where(:project_version => project_version) if project_version.present? } - scope :scoped_to_is_circle, lambda {|is_circle| where(:is_circle => is_circle) } + scope :for_platform, lambda { |platform| where(build_for_platform_id: platform) } + scope :by_mass_build, lambda { |mass_build| where(mass_build_id: mass_build) } + scope :scoped_to_arch, lambda {|arch| where(arch_id: arch) if arch.present? } + scope :scoped_to_save_platform, lambda {|pl_id| where(save_to_platform_id: pl_id) if pl_id.present? } + scope :scoped_to_project_version, lambda {|project_version| where(project_version: project_version) if project_version.present? } + scope :scoped_to_is_circle, lambda {|is_circle| where(is_circle: is_circle) } scope :for_creation_date_period, lambda{|start_date, end_date| s = scoped s = s.where(["#{table_name}.created_at >= ?", start_date]) if start_date @@ -121,9 +121,9 @@ class BuildList < ActiveRecord::Base s } scope :scoped_to_project_name, lambda {|project_name| joins(:project).where('projects.name LIKE ?', "%#{project_name}%") if project_name.present? } - scope :scoped_to_new_core, lambda {|new_core| where(:new_core => new_core)} + scope :scoped_to_new_core, lambda {|new_core| where(new_core: new_core)} scope :outdated, where("#{table_name}.created_at < ? AND #{table_name}.status NOT IN (?) OR #{table_name}.created_at < ?", Time.now - LIVE_TIME, [BUILD_PUBLISHED,BUILD_PUBLISHED_INTO_TESTING], Time.now - MAX_LIVE_TIME) - scope :published_container, where(:container_status => BUILD_PUBLISHED) + scope :published_container, where(container_status: BUILD_PUBLISHED) serialize :additional_repos serialize :include_repos @@ -132,10 +132,10 @@ class BuildList < ActiveRecord::Base serialize :extra_build_lists, Array serialize :extra_params, Hash - after_commit :place_build, :on => :create + after_commit :place_build, on: :create after_destroy :remove_container - state_machine :status, :initial => :waiting_for_response do + state_machine :status, initial: :waiting_for_response do # WTF? around_transition -> infinite loop before_transition do |build_list, transition| @@ -152,36 +152,36 @@ class BuildList < ActiveRecord::Base end end - after_transition :on => :place_build, :do => :add_job_to_abf_worker_queue, + after_transition on: :place_build, do: :add_job_to_abf_worker_queue, :if => lambda { |build_list| build_list.external_nodes.blank? } - after_transition :on => :published, - :do => [:set_version_and_tag, :actualize_packages] - after_transition :on => :publish, :do => :set_publisher - after_transition(:on => :publish) do |build_list, transition| + after_transition on: :published, + do: [:set_version_and_tag, :actualize_packages] + after_transition on: :publish, do: :set_publisher + after_transition(on: :publish) do |build_list, transition| if transition.from == BUILD_PUBLISHED_INTO_TESTING build_list.cleanup_packages_from_testing end end - after_transition :on => :cancel, :do => :cancel_job + after_transition on: :cancel, do: :cancel_job - after_transition :on => [:published, :fail_publish, :build_error, :tests_failed], :do => :notify_users - after_transition :on => :build_success, :do => :notify_users, - :unless => lambda { |build_list| build_list.auto_publish? } + after_transition on: [:published, :fail_publish, :build_error, :tests_failed], do: :notify_users + after_transition on: :build_success, do: :notify_users, + unless: lambda { |build_list| build_list.auto_publish? } event :place_build do - transition :waiting_for_response => :build_pending + transition waiting_for_response: :build_pending end event :start_build do - transition :build_pending => :build_started + transition build_pending: :build_started end event :cancel do transition [:build_pending, :build_started] => :build_canceling end - # :build_canceling => :build_canceled - canceling from UI - # :build_started => :build_canceled - canceling from worker by time-out (time_living has been expired) + # build_canceling: :build_canceled - canceling from UI + # build_started: :build_canceled - canceling from worker by time-out (time_living has been expired) event :build_canceled do transition [:build_canceling, :build_started] => :build_canceled end @@ -250,11 +250,11 @@ class BuildList < ActiveRecord::Base end HUMAN_STATUSES.each do |code,name| - state name, :value => code + state name, value: code end end - later :publish, :queue => :clone_build + later :publish, queue: :clone_build HUMAN_CONTAINER_STATUSES = { WAITING_FOR_RESPONSE => :waiting_for_publish, @@ -263,23 +263,23 @@ class BuildList < ActiveRecord::Base FAILED_PUBLISH => :container_failed_publish }.freeze - state_machine :container_status, :initial => :waiting_for_publish do + state_machine :container_status, initial: :waiting_for_publish do - after_transition :on => :publish_container, :do => :create_container - after_transition :on => [:fail_publish_container, :destroy_container], - :do => :remove_container + after_transition on: :publish_container, do: :create_container + after_transition on: [:fail_publish_container, :destroy_container], + do: :remove_container event :publish_container do transition [:waiting_for_publish, :container_failed_publish] => :container_publish, - :if => :can_create_container? + if: :can_create_container? end event :published_container do - transition :container_publish => :container_published + transition container_publish: :container_published end event :fail_publish_container do - transition :container_publish => :container_failed_publish + transition container_publish: :container_failed_publish end event :destroy_container do @@ -287,12 +287,12 @@ class BuildList < ActiveRecord::Base end HUMAN_CONTAINER_STATUSES.each do |code,name| - state name, :value => code + state name, value: code end end def set_version_and_tag - pkg = self.packages.where(:package_type => 'source', :project_id => self.project_id).first + pkg = self.packages.where(package_type: 'source', project_id: self.project_id).first # TODO: remove 'return' after deployment ABF kernel 2.0 return if pkg.nil? # For old client that does not sends data about packages self.package_version = "#{pkg.platform.name}-#{pkg.version}-#{pkg.release}" @@ -303,8 +303,8 @@ class BuildList < ActiveRecord::Base def actualize_packages ActiveRecord::Base.transaction do # packages from previous build_list - self.last_published.limit(2).last.packages.update_all :actual => false - self.packages.update_all :actual => true + self.last_published.limit(2).last.packages.update_all actual: false + self.packages.update_all actual: true end end @@ -316,11 +316,11 @@ class BuildList < ActiveRecord::Base return true if !save_to_repository.synchronizing_publications? || save_to_platform.personal? || project.architecture_dependent? arch_ids = save_to_platform.platform_arch_settings.by_default.pluck(:arch_id) BuildList.where( - :project_id => project_id, - :save_to_repository_id => save_to_repository_id, - :arch_id => arch_ids, - :commit_hash => commit_hash, - :status => [ + project_id: project_id, + save_to_repository_id: save_to_repository_id, + arch_id: arch_ids, + commit_hash: commit_hash, + status: [ SUCCESS, BUILD_PUBLISHED, BUILD_PUBLISH, @@ -345,7 +345,7 @@ class BuildList < ActiveRecord::Base # - true if version of packages is equal to version of pubished packages (only if platform is not released). # - true if version of packages is greater than version of pubished packages. def has_new_packages? - if last_bl = last_published.joins(:source_packages).where(:build_list_packages => {:actual => true}).last + if last_bl = last_published.joins(:source_packages).where(build_list_packages: {actual: true}).last source_packages.each do |nsp| sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name } return true unless sp @@ -363,17 +363,17 @@ class BuildList < ActiveRecord::Base end def can_publish? - [SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED, BUILD_PUBLISHED_INTO_TESTING, FAILED_PUBLISH_INTO_TESTING].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(:id => project_id) + [SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED, BUILD_PUBLISHED_INTO_TESTING, FAILED_PUBLISH_INTO_TESTING].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(id: project_id) end def extra_build_lists_published? # All extra build lists should be published before publishing this build list for main platforms! return true unless save_to_platform.main? - BuildList.where(:id => extra_build_lists).where('status != ?', BUILD_PUBLISHED).count == 0 + BuildList.where(id: extra_build_lists).where('status != ?', BUILD_PUBLISHED).count == 0 end def human_average_build_time - I18n.t('layout.project_statistics.human_average_build_time', {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i}) + I18n.t('layout.project_statistics.human_average_build_time', {hours: (average_build_time/3600).to_i, minutes: (average_build_time%3600/60).to_i}) end def formatted_average_build_time @@ -403,13 +403,13 @@ class BuildList < ActiveRecord::Base items_hash.each do |level, items| items.each do |item| - self.items << self.items.build(:name => item['name'], :version => item['version'], :level => level.to_i) + self.items << self.items.build(name: item['name'], version: item['version'], level: level.to_i) end end end def set_packages(pkg_hash, project_name) - prj = Project.joins(:repositories => :platform).where('platforms.id = ?', save_to_platform.id).find_by_name!(project_name) + prj = Project.joins(repositories: :platform).where('platforms.id = ?', save_to_platform.id).find_by_name!(project_name) build_package(pkg_hash['srpm'], 'source', prj) {|p| p.save!} pkg_hash['rpm'].each do |rpm_hash| build_package(rpm_hash, 'binary', prj) {|p| p.save!} @@ -417,7 +417,7 @@ class BuildList < ActiveRecord::Base end def event_log_message - {:project => project.name, :version => project_version, :arch => arch.name}.inspect + {project: project.name, version: project_version, arch: arch.name}.inspect end def current_duration @@ -425,11 +425,11 @@ class BuildList < ActiveRecord::Base end def human_current_duration - I18n.t("layout.build_lists.human_current_duration", {:hours => (current_duration/3600).to_i, :minutes => (current_duration%3600/60).to_i}) + I18n.t("layout.build_lists.human_current_duration", {hours: (current_duration/3600).to_i, minutes: (current_duration%3600/60).to_i}) end def human_duration - I18n.t("layout.build_lists.human_duration", {:hours => (duration.to_i/3600).to_i, :minutes => (duration.to_i%3600/60).to_i}) + I18n.t("layout.build_lists.human_duration", {hours: (duration.to_i/3600).to_i, minutes: (duration.to_i%3600/60).to_i}) end def in_work? @@ -454,8 +454,8 @@ class BuildList < ActiveRecord::Base end def last_published(testing = false) - BuildList.where(:project_id => self.project_id, - :save_to_repository_id => self.save_to_repository_id) + BuildList.where(project_id: self.project_id, + save_to_repository_id: self.save_to_repository_id) .for_platform(self.build_for_platform_id) .scoped_to_arch(self.arch_id) .for_status(testing ? BUILD_PUBLISHED_INTO_TESTING : BUILD_PUBLISHED) @@ -469,7 +469,7 @@ class BuildList < ActiveRecord::Base def abf_worker_args repos = include_repos include_repos_hash = {}.tap do |h| - Repository.where(:id => (repos | (extra_repositories || [])) ).each do |repo| + Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo| path, prefix = repo.platform.public_downloads_url( repo.platform.main? ? nil : build_for_platform.name, arch.name, @@ -481,7 +481,7 @@ class BuildList < ActiveRecord::Base end end host = EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] - BuildList.where(:id => extra_build_lists).each do |bl| + BuildList.where(id: extra_build_lists).each do |bl| path = "#{APP_CONFIG['downloads_url']}/#{bl.save_to_platform.name}/container/" path << "#{bl.id}/#{bl.arch.name}/#{bl.save_to_repository.name}/release" include_repos_hash["container_#{bl.id}"] = insert_token_to_path(path, bl.save_to_platform) @@ -500,17 +500,17 @@ class BuildList < ActiveRecord::Base }.map{ |k, v| "#{k}='#{v}'" }.join(' ') { - :id => id, - :time_living => (build_for_platform.platform_arch_settings.by_arch(arch).first.try(:time_living) || PlatformArchSetting::DEFAULT_TIME_LIVING), - :distrib_type => build_for_platform.distrib_type, - :cmd_params => cmd_params, - :include_repos => include_repos_hash, - :platform => { - :type => build_for_platform.distrib_type, - :name => build_for_platform.name, - :arch => arch.name + id: id, + time_living: (build_for_platform.platform_arch_settings.by_arch(arch).first.try(:time_living) || PlatformArchSetting::DEFAULT_TIME_LIVING), + distrib_type: build_for_platform.distrib_type, + cmd_params: cmd_params, + include_repos: include_repos_hash, + platform: { + type: build_for_platform.distrib_type, + name: build_for_platform.name, + arch: arch.name }, - :user => {:uname => user.uname, :email => user.email} + user: {uname: user.uname, email: user.email} } end @@ -583,7 +583,7 @@ class BuildList < ActiveRecord::Base self.extra_repositories = nil else self.extra_repositories = Repository.joins(:platform). - where(:id => extra_repositories, :platforms => {:platform_type => 'personal'}). + where(id: extra_repositories, platforms: {platform_type: 'personal'}). accessible_by(current_ability, :read).pluck('repositories.id') end end @@ -597,7 +597,7 @@ class BuildList < ActiveRecord::Base (projects.publish_i686_into_x86_64 is true) ', arch_id).joins(:project) else - bls = bls.where(:arch_id => arch_id) + bls = bls.where(arch_id: arch_id) end end self.extra_build_lists = bls.pluck('build_lists.id') @@ -612,5 +612,4 @@ class BuildList < ActiveRecord::Base self.extra_params = params.select{ |k,v| v.present? } end end - -end \ No newline at end of file +end diff --git a/app/models/build_list/filter.rb b/app/models/build_list/filter.rb index 197fbd58d..0ef09b86b 100644 --- a/app/models/build_list/filter.rb +++ b/app/models/build_list/filter.rb @@ -12,7 +12,7 @@ class BuildList::Filter build_lists = @project ? @project.build_lists : BuildList.scoped if @options[:id] - build_lists = build_lists.where(:id => @options[:id]) + build_lists = build_lists.where(id: @options[:id]) else build_lists = build_lists.scoped_to_new_core(@options[:new_core] == '0' ? nil : true) if @options[:new_core].present? build_lists = build_lists.by_mass_build(@options[:mass_build_id]) if @options[:mass_build_id] @@ -42,18 +42,18 @@ class BuildList::Filter def set_options(options) @options = HashWithIndifferentAccess.new(options.reverse_merge({ - :ownership => nil, - :status => nil, - :updated_at_start => nil, - :updated_at_end => nil, - :arch_id => nil, - :platform_id => nil, - :is_circle => nil, - :project_version => nil, - :id => nil, - :project_name => nil, - :mass_build_id => nil, - :new_core => nil + ownership: nil, + status: nil, + updated_at_start: nil, + updated_at_end: nil, + arch_id: nil, + platform_id: nil, + is_circle: nil, + project_version: nil, + id: nil, + project_name: nil, + mass_build_id: nil, + new_core: nil })) @options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'everything' : 'owned') diff --git a/app/models/build_list/item.rb b/app/models/build_list/item.rb index ace1bf25a..1243611bb 100644 --- a/app/models/build_list/item.rb +++ b/app/models/build_list/item.rb @@ -1,20 +1,20 @@ class BuildList::Item < ActiveRecord::Base - - belongs_to :build_list, :touch => true + + belongs_to :build_list, touch: true attr_protected :build_list_id GIT_ERROR = 5 - + STATUSES = [BuildList::SUCCESS, BuildList::BUILD_ERROR, BuildList::BUILD_STARTED, GIT_ERROR, BuildList::BUILD_CANCELED] # BuildList::DEPENDENCIES_ERROR HUMAN_STATUSES = { nil => :unknown, GIT_ERROR => :git_error, - # BuildList::DEPENDENCIES_ERROR => :dependencies_error, - BuildList::SUCCESS => :success, - BuildList::BUILD_STARTED => :build_started, - BuildList::BUILD_ERROR => :build_error, - BuildList::BUILD_CANCELED => :build_canceled + # BuildList:DEPENDENCIES_ERROR: :dependencies_error, + BuildList:SUCCESS: :success, + BuildList:BUILD_STARTED: :build_started, + BuildList:BUILD_ERROR: :build_error, + BuildList:BUILD_CANCELED: :build_canceled } scope :recent, order("#{table_name}.level ASC, #{table_name}.name ASC") @@ -40,5 +40,5 @@ class BuildList::Item < ActiveRecord::Base def human_status self.class.human_status(status) end - + end diff --git a/app/models/build_list/package.rb b/app/models/build_list/package.rb index c013b2478..924b5220f 100644 --- a/app/models/build_list/package.rb +++ b/app/models/build_list/package.rb @@ -9,17 +9,17 @@ class BuildList::Package < ActiveRecord::Base validates :build_list_id, :project_id, :platform_id, :fullname, :package_type, :name, :release, :version, - :presence => true - validates :package_type, :inclusion => PACKAGE_TYPES - validates :sha1, :presence => true, :if => Proc.new { |p| p.build_list.new_core? } + presence: true + validates :package_type, inclusion: PACKAGE_TYPES + validates :sha1, presence: true, if: Proc.new { |p| p.build_list.new_core? } default_scope order("lower(#{table_name}.name) ASC, length(#{table_name}.name) ASC") # Fetches only actual (last publised) packages. - scope :actual, where(:actual => true) - scope :by_platform, lambda {|platform| where(:platform_id => platform) } - scope :by_name, lambda {|name| where(:name => name) } - scope :by_package_type, lambda {|type| where(:package_type => type) } + scope :actual, where(actual: true) + scope :by_platform, lambda {|platform| where(platform_id: platform) } + scope :by_name, lambda {|name| where(name: name) } + scope :by_package_type, lambda {|type| where(package_type: type) } scope :like_name, lambda {|name| where("#{table_name}.name ILIKE ?", "%#{name}%") if name.present?} before_create :set_epoch diff --git a/app/models/build_list_observer.rb b/app/models/build_list_observer.rb index d9d4c0bc0..59b51499f 100644 --- a/app/models/build_list_observer.rb +++ b/app/models/build_list_observer.rb @@ -21,7 +21,7 @@ class BuildListObserver < ActiveRecord::Observer end build_count = statistic.build_count new_av_time = ( statistic.average_build_time * build_count + record.duration ) / ( build_count + 1 ) - statistic.update_attributes(:average_build_time => new_av_time, :build_count => build_count + 1) + statistic.update_attributes(average_build_time: new_av_time, build_count: build_count + 1) end end end diff --git a/app/models/collaborator.rb b/app/models/collaborator.rb index 3d78e3733..12c212613 100644 --- a/app/models/collaborator.rb +++ b/app/models/collaborator.rb @@ -10,7 +10,7 @@ class Collaborator attr_accessible :role - delegate :new_record?, :to => :relation + delegate :new_record?, to: :relation class << self def find_by_project(project) @@ -128,7 +128,7 @@ class Collaborator def from_relation(relation) return nil unless relation.present? - return self.new(:relation => relation) + return self.new(relation: relation) end end @@ -139,7 +139,7 @@ class Collaborator if @actor.present? and @project.present? @relation = Relation.by_actor(@actor).by_target(@project).limit(1).first @relation ||= Relation.new(:actor_id => @actor.id, :actor_type => @actor.class.to_s, - :target_id => @project.id, :target_type => 'Project') + target_id: @project.id, target_type: 'Project') else @relation = Relation.new @relation.actor = @actor diff --git a/app/models/comment.rb b/app/models/comment.rb index e8f0f1c03..cfcb969e0 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -7,17 +7,17 @@ class Comment < ActiveRecord::Base # #Num ISSUES_REGEX = /(?:[a-zA-Z0-9\-_]*\/)?(?:[a-zA-Z0-9\-_]*)?#[0-9]+/ - belongs_to :commentable, :polymorphic => true, :touch => true + belongs_to :commentable, polymorphic: true, touch: true belongs_to :user belongs_to :project serialize :data - validates :body, :user_id, :commentable_id, :commentable_type, :project_id, :presence => true + validates :body, :user_id, :commentable_id, :commentable_type, :project_id, presence: true - scope :for_commit, lambda {|c| where(:commentable_id => c.id.hex, :commentable_type => c.class)} + scope :for_commit, lambda {|c| where(commentable_id: c.id.hex, commentable_type: c.class)} default_scope order("#{table_name}.created_at") - after_create :subscribe_on_reply, :unless => lambda {|c| c.commit_comment?} + after_create :subscribe_on_reply, unless: lambda {|c| c.commit_comment?} after_create :subscribe_users attr_accessible :body, :data @@ -91,11 +91,11 @@ class Comment < ActiveRecord::Base def set_additional_data params return true if params[:path].blank? && params[:line].blank? # not inline comment - if params[:in_reply].present? && reply = Comment.where(:id => params[:in_reply]).first + if params[:in_reply].present? && reply = Comment.where(id: params[:in_reply]).first self.data = reply.data return true end - self.data = {:path => params[:path], :line => params[:line]} + self.data = {path: params[:path], line: params[:line]} return actual_inline_comment?(nil, true) if commentable.is_a?(Grit::Commit) if commentable.is_a?(Issue) && pull = commentable.pull_request diff_path = pull.diff.select {|d| d.a_path == params[:path]} @@ -140,13 +140,13 @@ class Comment < ActiveRecord::Base opts = {} when item.is_a?(Issue) elements = [[item, item.title], [item, item.body]] - opts = {:created_from_issue_id => item.id} + opts = {created_from_issue_id: item.id} when item.commentable_type == 'Issue' elements = [[item, item.body]] - opts = {:created_from_issue_id => item.commentable_id} + opts = {created_from_issue_id: item.commentable_id} when item.commentable_type == 'Grit::Commit' elements = [[item, item.body]] - opts = {:created_from_commit_hash => item.commentable_id} + opts = {created_from_commit_hash: item.commentable_id} else raise "Unsupported item type #{item.class.name}!" end @@ -157,18 +157,18 @@ class Comment < ActiveRecord::Base next unless issue # dont create link to the same issue next if opts[:created_from_issue_id] == issue.id - opts = {:created_from_commit_hash => element[0].hex} if item.is_a?(GitHook) + opts = {created_from_commit_hash: element[0].hex} if item.is_a?(GitHook) # dont create duplicate link to issue next if Comment.find_existing_automatic_comment issue, opts # dont create link to outdated commit next if item.is_a?(GitHook) && !item.project.repo.commit(element[0]) - comment = linker.comments.new :body => 'automatic comment' + comment = linker.comments.new body: 'automatic comment' comment.commentable, comment.project, comment.automatic = issue, issue.project, true - comment.data = {:from_project_id => item.project.id} + comment.data = {from_project_id: item.project.id} if opts[:created_from_commit_hash] comment.created_from_commit_hash = opts[:created_from_commit_hash] elsif opts[:created_from_issue_id] - comment.data.merge!(:comment_id => item.id) if item.is_a? Comment + comment.data.merge!(comment_id: item.id) if item.is_a? Comment comment.created_from_issue_id = opts[:created_from_issue_id] else raise 'Unsupported opts for automatic comment!' @@ -187,25 +187,25 @@ class Comment < ActiveRecord::Base protected def subscribe_on_reply - commentable.subscribes.create(:user_id => user_id) if !commentable.subscribes.exists?(:user_id => user_id) + commentable.subscribes.create(user_id: user_id) if !commentable.subscribes.exists?(user_id: user_id) end def subscribe_users if issue_comment? - commentable.subscribes.create(:user => user) if !commentable.subscribes.exists?(:user_id => user.id) + commentable.subscribes.create(user: user) if !commentable.subscribes.exists?(user_id: user.id) elsif commit_comment? recipients = project.admins - recipients << user << User.where(:email => commentable.try(:committer).try(:email)).first # commentor and committer + recipients << user << User.where(email: commentable.try(:committer).try(:email)).first # commentor and committer recipients.compact.uniq.each do |user| - options = {:project_id => project.id, :subscribeable_id => commentable_id, :subscribeable_type => commentable.class.name, :user_id => user.id} + options = {project_id: project.id, subscribeable_id: commentable_id, subscribeable_type: commentable.class.name, user_id: user.id} Subscribe.subscribe_to_commit(options) if Subscribe.subscribed_to_commit?(project, user, commentable) end end end def self.find_existing_automatic_comment issue, opts - find_dup = opts.merge(:automatic => true, :commentable_type => issue.class.name, - :commentable_id => issue.id) + find_dup = opts.merge(automatic: true, commentable_type: issue.class.name, + commentable_id: issue.id) Comment.exists? find_dup end end diff --git a/app/models/event_log.rb b/app/models/event_log.rb index 36d53b2f5..43987869b 100644 --- a/app/models/event_log.rb +++ b/app/models/event_log.rb @@ -1,6 +1,6 @@ class EventLog < ActiveRecord::Base belongs_to :user - belongs_to :eventable, :polymorphic => true + belongs_to :eventable, polymorphic: true # self.per_page = 1 diff --git a/app/models/event_log_observer.rb b/app/models/event_log_observer.rb index 109f8becd..4258cd445 100644 --- a/app/models/event_log_observer.rb +++ b/app/models/event_log_observer.rb @@ -2,24 +2,24 @@ class EventLogObserver < ActiveRecord::Observer observe :user, :private_user, :platform, :repository, :project, :product, :build_list, :product_build_list def after_create(record) - ActiveSupport::Notifications.instrument("event_log.observer", :eventable => record) + ActiveSupport::Notifications.instrument("event_log.observer", eventable: record) end def before_update(record) case record.class.to_s when 'BuildList' if record.status_changed? and [BuildList::BUILD_CANCELED, BuildList::BUILD_PUBLISHED].include?(record.status) - ActiveSupport::Notifications.instrument("event_log.observer", :eventable => record) + ActiveSupport::Notifications.instrument("event_log.observer", eventable: record) end when 'Platform' if record.visibility_changed? - ActiveSupport::Notifications.instrument "event_log.observer", :eventable => record, - :message => I18n.t("activerecord.attributes.platform.visibility_types.#{record.visibility}") + ActiveSupport::Notifications.instrument "event_log.observer", eventable: record, + message: I18n.t("activerecord.attributes.platform.visibility_types.#{record.visibility}") end end end def after_destroy(record) - ActiveSupport::Notifications.instrument("event_log.observer", :eventable => record) + ActiveSupport::Notifications.instrument("event_log.observer", eventable: record) end end diff --git a/app/models/feedback.rb b/app/models/feedback.rb index af9f205a4..fc079eaaf 100644 --- a/app/models/feedback.rb +++ b/app/models/feedback.rb @@ -12,10 +12,10 @@ class Feedback attr_accessible :name, :email, :subject, :message - validates :name, :subject, :message, :presence => true - validates :email, :presence => true, - :format => { :with => /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/, - :allow_blank => false } + validates :name, :subject, :message, presence: true + validates :email, presence: true, + format: { with: /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/, + allow_blank: false } def initialize(args = {}, options = {}) return args.dup if args.is_a? Feedback diff --git a/app/models/flash_notify.rb b/app/models/flash_notify.rb index 601b197b2..fe87db69e 100644 --- a/app/models/flash_notify.rb +++ b/app/models/flash_notify.rb @@ -5,10 +5,10 @@ class FlashNotify < ActiveRecord::Base STATUSES = %w[error success info] - validates :status, :inclusion => {:in => STATUSES} - validates :body_ru, :body_en, :status, :presence => true + validates :status, inclusion: {in: STATUSES} + validates :body_ru, :body_en, :status, presence: true - scope :published, where(:published => true) + scope :published, where(published: true) def hash_id @digest ||= Digest::MD5.hexdigest("#{self.id}-#{self.updated_at}") diff --git a/app/models/git_hook.rb b/app/models/git_hook.rb index c7adf7048..769159cef 100644 --- a/app/models/git_hook.rb +++ b/app/models/git_hook.rb @@ -13,8 +13,8 @@ class GitHook def initialize(owner_uname, repo, newrev, oldrev, ref, newrev_type, user = nil, message = nil) @repo, @newrev, @oldrev, @refname, @newrev_type, @user, @message = repo, newrev, oldrev, ref, newrev_type, user, message - if @owner = User.where(:uname => owner_uname).first || Group.where(:uname => owner_uname).first! - @project = @owner.own_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, @user = git_change_type, find_user(user) git_revision_types diff --git a/app/models/group.rb b/app/models/group.rb index 78983bdc9..934b53bd3 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,29 +1,29 @@ class Group < Avatar - belongs_to :owner, :class_name => 'User' + belongs_to :owner, class_name: 'User' - has_many :relations, :as => :actor, :dependent => :destroy, :dependent => :destroy - has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy - has_many :targets, :as => :actor, :class_name => 'Relation', :dependent => :destroy + has_many :relations, as: :actor, dependent: :destroy, dependent: :destroy + has_many :actors, as: :target, class_name: 'Relation', dependent: :destroy + has_many :targets, as: :actor, class_name: 'Relation', dependent: :destroy - has_many :members, :through => :actors, :source => :actor, :source_type => 'User', :autosave => true - has_many :projects, :through => :targets, :source => :target, :source_type => 'Project', :autosave => true + has_many :members, through: :actors, source: :actor, source_type: 'User', autosave: true + has_many :projects, through: :targets, source: :target, source_type: 'Project', autosave: true - has_many :own_projects, :as => :owner, :class_name => 'Project', :dependent => :destroy - has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy + has_many :own_projects, as: :owner, class_name: 'Project', dependent: :destroy + has_many :own_platforms, as: :owner, class_name: 'Platform', dependent: :destroy - validates :owner, :presence => true - validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /\A[a-z0-9_]+\z/}, :reserved_name => true + validates :owner, presence: true + validates :uname, presence: true, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z0-9_]+\z/}, reserved_name: true validate { errors.add(:uname, :taken) if User.by_uname(uname).present? } scope :opened, where('1=1') - scope :by_owner, lambda {|owner| where(:owner_id => owner.id)} + scope :by_owner, lambda {|owner| where(owner_id: owner.id)} scope :by_admin, lambda {|admin| joins(:actors).where(:'relations.role' => 'admin', :'relations.actor_id' => admin.id, :'relations.actor_type' => 'User')} scope :by_admin_and_writer, lambda {|actor| joins(:actors).where(:'relations.role' => ['admin', 'writer'], :'relations.actor_id' => actor.id, :'relations.actor_type' => 'User')} attr_accessible :uname, :description attr_readonly :uname - delegate :email, :to => :owner + delegate :email, to: :owner after_create :add_owner_to_members @@ -58,6 +58,6 @@ class Group < Avatar protected def add_owner_to_members - Relation.create_with_role(self.owner, self, 'admin') # members << self.owner if !members.exists?(:id => self.owner.id) + Relation.create_with_role(self.owner, self, 'admin') # members << self.owner if !members.exists?(id: self.owner.id) end end diff --git a/app/models/hook.rb b/app/models/hook.rb index f45c1c924..c83b07a9b 100644 --- a/app/models/hook.rb +++ b/app/models/hook.rb @@ -5,14 +5,14 @@ class Hook < ActiveRecord::Base belongs_to :project before_validation :cleanup_data - validates :project_id, :data, :presence => true - validates :name, :presence => true, :inclusion => {:in => NAMES} + validates :project_id, :data, presence: true + validates :name, presence: true, inclusion: {in: NAMES} attr_accessible :data, :name serialize :data, Hash - scope :for_name, lambda {|name| where(:name => name) if name.present? } + scope :for_name, lambda {|name| where(name: name) if name.present? } def receive_issues(issue, action) pull = issue.pull_request @@ -21,38 +21,38 @@ class Hook < ActiveRecord::Base payload = meta(issue.project, issue.user) base_params = { - :number => issue.serial_id, - :state => issue.status, - :title => issue.title, - :body => issue.body, - :user => {:login => issue.user.uname}, + number: issue.serial_id, + state: issue.status, + title: issue.title, + body: issue.body, + user: {login: issue.user.uname}, } if pull total_commits = pull.repo.commits_between(pull.to_commit, pull.from_commit).count repo_owner = pull.to_project.owner.uname post 'pull_request', { - :payload => payload.merge( - :action => (pull.ready? ? 'opened' : pull.status), - :pull_request => base_params.merge( - :commits => total_commits, - :head => {:label => "#{pull.from_project.owner.uname}:#{pull.from_ref}"}, - :base => {:label => "#{repo_owner}:#{pull.to_ref}"}, - :html_url => project_pull_request_url(pull.to_project, pull) + payload: payload.merge( + action: (pull.ready? ? 'opened' : pull.status), + pull_request: base_params.merge( + commits: total_commits, + head: {label: "#{pull.from_project.owner.uname}:#{pull.from_ref}"}, + base: {label: "#{repo_owner}:#{pull.to_ref}"}, + html_url: project_pull_request_url(pull.to_project, pull) ) ).to_json } else post 'issues', { - :payload => payload.merge( - :action => (issue.closed? ? 'closed' : 'opened'), - :issue => base_params.merge( - :html_url => project_issue_url(issue.project, issue) + payload: payload.merge( + action: (issue.closed? ? 'closed' : 'opened'), + issue: base_params.merge( + html_url: project_issue_url(issue.project, issue) ) ).to_json } end end - later :receive_issues, :queue => :notification + later :receive_issues, queue: :notification def receive_push(git_hook) default_url_options @@ -60,9 +60,9 @@ class Hook < ActiveRecord::Base user = User.find(git_hook['user']['user']['id']) payload = meta(project, user) oldrev, newrev, change_type = git_hook.values_at *%w(oldrev newrev change_type) - + commits = [] - payload.merge!(:before => oldrev, :after => newrev) + payload.merge!(before: oldrev, after: newrev) if %w(delete create).exclude? change_type payload.merge!( :compare => diff_url(project, "#{oldrev[0..6]}...#{newrev[0..6]}") @@ -76,45 +76,45 @@ class Hook < ActiveRecord::Base end post 'push', { - :payload => payload.merge( - :ref => git_hook['refname'], - :commits => commits.map{ |commit| + payload: payload.merge( + ref: git_hook['refname'], + commits: commits.map{ |commit| files = changed_files commit { - :id => commit.id, - :message => commit.message, - :distinct => true, - :url => commit_url(project, commit), - :removed => files[:removed], - :added => files[:added], - :modified => files[:modified], - :timestamp => commit.committed_date, - :author => {:name => commit.committer.name, :email => commit.committer.email} + id: commit.id, + message: commit.message, + distinct: true, + url: commit_url(project, commit), + removed: files[:removed], + added: files[:added], + modified: files[:modified], + timestamp: commit.committed_date, + author: {name: commit.committer.name, email: commit.committer.email} } } ).to_json } end - later :receive_push, :queue => :notification + later :receive_push, queue: :notification protected def post(action, params) github_services = APP_CONFIG['github_services'] uri = URI "http://#{github_services['ip']}:#{github_services['port']}/#{name}/#{action}" - Net::HTTP.post_form uri, params.merge(:data => data.to_json) + Net::HTTP.post_form uri, params.merge(data: data.to_json) rescue # Dont care about it end def meta(project, user) { - :repository => { - :name => project.name, - :url => project_url(project), - :owner => { :login => project.owner.uname } + repository: { + name: project.name, + url: project_url(project), + owner: { login: project.owner.uname } }, - :sender => {:login => user.uname}, - :pusher => {:name => user.uname} + sender: {login: user.uname}, + pusher: {name: user.uname} } end @@ -140,7 +140,7 @@ class Hook < ActiveRecord::Base modified << diff.a_path end end - {:removed => removed, :added => added, :modified => modified} + {removed: removed, added: added, modified: modified} end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 210cc7f2f..6a35bae1f 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -4,30 +4,30 @@ class Issue < ActiveRecord::Base belongs_to :project belongs_to :user - belongs_to :assignee, :class_name => 'User', :foreign_key => 'assignee_id' - belongs_to :closer, :class_name => 'User', :foreign_key => 'closed_by' + belongs_to :assignee, class_name: 'User', foreign_key: 'assignee_id' + belongs_to :closer, class_name: 'User', foreign_key: 'closed_by' - has_many :comments, :as => :commentable, :dependent => :destroy - has_many :subscribes, :as => :subscribeable, :dependent => :destroy - has_many :labelings, :dependent => :destroy - has_many :labels, :through => :labelings, :uniq => true - has_one :pull_request, :dependent => :destroy + has_many :comments, as: :commentable, dependent: :destroy + has_many :subscribes, as: :subscribeable, dependent: :destroy + has_many :labelings, dependent: :destroy + has_many :labels, through: :labelings, uniq: true + has_one :pull_request, dependent: :destroy - validates :title, :body, :project_id, :presence => true + validates :title, :body, :project_id, presence: true after_create :set_serial_id after_create :subscribe_users after_update :subscribe_issue_assigned_user attr_accessible :labelings_attributes, :title, :body, :assignee_id - accepts_nested_attributes_for :labelings, :allow_destroy => true + accepts_nested_attributes_for :labelings, allow_destroy: true - scope :opened, where(:status => 'open') - scope :closed, where(:status => 'closed') + scope :opened, where(status: 'open') + scope :closed, where(status: 'closed') - scope :needed_checking, where(:issues => {:status => ['open', 'blocked', 'ready', 'already']}) + scope :needed_checking, where(issues: {status: ['open', 'blocked', 'ready', 'already']}) scope :not_closed_or_merged, needed_checking - scope :closed_or_merged, where(:issues => {:status => ['closed', 'merged']}) + scope :closed_or_merged, where(issues: {status: ['closed', 'merged']}) # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") scope :search, lambda {|q| where("#{table_name}.title ILIKE ?", "%#{q.mb_chars.downcase}%") if q.present?} scope :without_pull_requests, where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)') @@ -41,8 +41,8 @@ class Issue < ActiveRecord::Base end def subscribe_creator(creator_id) - if !self.subscribes.exists?(:user_id => creator_id) - self.subscribes.create(:user_id => creator_id) + if !self.subscribes.exists?(user_id: creator_id) + self.subscribes.create(user_id: creator_id) end end @@ -75,7 +75,7 @@ class Issue < ActiveRecord::Base project = Project.find_by_owner_and_name(owner_uname.chomp('/'), project_name) return nil unless project return nil unless current_ability.can? :show, project - project.issues.where(:serial_id => serial_id).first + project.issues.where(serial_id: serial_id).first end protected @@ -87,17 +87,17 @@ class Issue < ActiveRecord::Base def subscribe_users collect_recipients.each do |recipient| - if recipient.notifier.new_comment && !self.subscribes.exists?(:user_id => recipient.id) - ss = self.subscribes.create(:user_id => recipient.id) + if recipient.notifier.new_comment && !self.subscribes.exists?(user_id: recipient.id) + ss = self.subscribes.create(user_id: recipient.id) end end end 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? - if self.assignee.notifier.issue_assign && !self.subscribes.exists?(:user_id => self.assignee_id) - self.subscribes.create(:user_id => self.assignee_id) + self.subscribes.where(user_id: self.assignee_id_was).first.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 end end diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index 96b00dc9b..45ee6e8c6 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -4,12 +4,12 @@ class KeyPair < ActiveRecord::Base attr_accessor :fingerprint attr_accessible :public, :secret, :repository_id - attr_encrypted :secret, :key => APP_CONFIG['keys']['key_pair_secret_key'] + attr_encrypted :secret, key: APP_CONFIG['keys']['key_pair_secret_key'] - validates :repository_id, :user_id, :presence => true - validates :secret, :public, :presence => true, :length => { :maximum => 10000 }, :on => :create + validates :repository_id, :user_id, presence: true + validates :secret, :public, presence: true, length: { maximum: 10000 }, on: :create - validates :repository_id, :uniqueness => {:message => I18n.t("activerecord.errors.key_pair.repo_key_exists")} + validates :repository_id, uniqueness: {message: I18n.t("activerecord.errors.key_pair.repo_key_exists")} validate :check_keys before_create { |record| record.key_id = @fingerprint } diff --git a/app/models/label.rb b/app/models/label.rb index 40b737724..6a74746f8 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -1,10 +1,10 @@ class Label < ActiveRecord::Base - has_many :labelings, :dependent => :destroy - has_many :issues, :through => :labelings + has_many :labelings, dependent: :destroy + has_many :issues, through: :labelings belongs_to :project - validates :name, :uniqueness => {:scope => :project_id} - validates :name, :color, :presence => true - validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')} + validates :name, uniqueness: {scope: :project_id} + validates :name, :color, presence: true + validates :color, format: { with: /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, message: I18n.t('layout.issues.invalid_labels')} end diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index ff29c772a..4d062f552 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -1,26 +1,26 @@ class MassBuild < ActiveRecord::Base - belongs_to :build_for_platform, :class_name => 'Platform', :conditions => {:platform_type => 'main'} - belongs_to :save_to_platform, :class_name => 'Platform' + belongs_to :build_for_platform, class_name: 'Platform', conditions: {platform_type: 'main'} + belongs_to :save_to_platform, class_name: 'Platform' belongs_to :user - has_many :build_lists, :dependent => :destroy + has_many :build_lists, dependent: :destroy serialize :extra_repositories, Array serialize :extra_build_lists, Array scope :recent, order("#{table_name}.created_at DESC") - scope :by_platform, lambda { |platform| where(:save_to_platform_id => platform.id) } + scope :by_platform, lambda { |platform| where(save_to_platform_id: platform.id) } scope :outdated, where("#{table_name}.created_at < ?", Time.now + 1.day - BuildList::MAX_LIVE_TIME) attr_accessor :arches attr_accessible :arches, :auto_publish, :projects_list, :build_for_platform_id, :extra_repositories, :extra_build_lists, :increase_release_tag - validates :save_to_platform_id, :build_for_platform_id, :arch_names, :name, :user_id, :presence => true - validates :projects_list, :length => {:maximum => 500_000}, :presence => true - validates_inclusion_of :auto_publish, :increase_release_tag, :in => [true, false] + validates :save_to_platform_id, :build_for_platform_id, :arch_names, :name, :user_id, presence: true + validates :projects_list, length: {maximum: 500_000}, presence: true + validates_inclusion_of :auto_publish, :increase_release_tag, in: [true, false] - after_commit :build_all, :on => :create - before_validation :set_data, :on => :create + after_commit :build_all, on: :create + before_validation :set_data, on: :create COUNT_STATUSES = [ :build_lists, @@ -35,7 +35,7 @@ class MassBuild < ActiveRecord::Base def build_all # later with resque - arches_list = arch_names ? Arch.where(:name => arch_names.split(', ')) : Arch.all + arches_list = arch_names ? Arch.where(name: arch_names.split(', ')) : Arch.all projects_list.lines.each do |name| next if name.blank? @@ -59,15 +59,15 @@ class MassBuild < ActiveRecord::Base end end end - later :build_all, :queue => :clone_build + later :build_all, queue: :clone_build def generate_failed_builds_list report = "" BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name'). where( - :status => BuildList::BUILD_ERROR, - :mass_build_id => self.id - ).joins(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists| + status: BuildList::BUILD_ERROR, + 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}; " @@ -79,28 +79,28 @@ class MassBuild < ActiveRecord::Base def cancel_all update_column(:stop_build, true) - build_lists.find_each(:batch_size => 100) do |bl| + build_lists.find_each(batch_size: 100) do |bl| bl.cancel end end - later :cancel_all, :queue => :clone_build + later :cancel_all, queue: :clone_build def publish_success_builds(user) publish user, BuildList::SUCCESS, BuildList::FAILED_PUBLISH end - later :publish_success_builds, :queue => :clone_build + later :publish_success_builds, queue: :clone_build def publish_test_failed_builds(user) publish user, BuildList::TESTS_FAILED end - later :publish_test_failed_builds, :queue => :clone_build + later :publish_test_failed_builds, queue: :clone_build private 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| + 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 } end end @@ -110,7 +110,7 @@ class MassBuild < ActiveRecord::Base self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{save_to_platform.name}" self.build_for_platform = save_to_platform if save_to_platform.main? end - self.arch_names = Arch.where(:id => arches).map(&:name).join(", ") + self.arch_names = Arch.where(id: arches).map(&:name).join(", ") self.projects_list = projects_list.lines.map do |name| name.chomp.strip if name.present? diff --git a/app/models/platform.rb b/app/models/platform.rb index 45be84861..a6dc61fcb 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -9,29 +9,29 @@ class Platform < ActiveRecord::Base NAME_PATTERN = /[\w\-\.]+/ HUMAN_STATUSES = HUMAN_STATUSES.clone.freeze - belongs_to :parent, :class_name => 'Platform', :foreign_key => 'parent_platform_id' - belongs_to :owner, :polymorphic => true + belongs_to :parent, class_name: 'Platform', foreign_key: 'parent_platform_id' + belongs_to :owner, polymorphic: true - has_many :repositories, :dependent => :destroy - has_many :products, :dependent => :destroy - has_many :tokens, :as => :subject, :dependent => :destroy - has_many :platform_arch_settings, :dependent => :destroy + has_many :repositories, dependent: :destroy + has_many :products, dependent: :destroy + has_many :tokens, as: :subject, dependent: :destroy + has_many :platform_arch_settings, dependent: :destroy has_many :repository_statuses - has_many :relations, :as => :target, :dependent => :destroy - has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy - has_many :members, :through => :actors, :source => :actor, :source_type => 'User' + has_many :relations, as: :target, dependent: :destroy + has_many :actors, as: :target, class_name: 'Relation', dependent: :destroy + has_many :members, through: :actors, source: :actor, source_type: 'User' has_and_belongs_to_many :advisories - has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy + has_many :packages, class_name: "BuildList::Package", dependent: :destroy - has_many :mass_builds, :foreign_key => :save_to_platform_id + has_many :mass_builds, foreign_key: :save_to_platform_id - validates :description, :presence => true - validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES} - validates :name, :uniqueness => {:case_sensitive => false}, :presence => true, :format => { :with => /\A#{NAME_PATTERN}\z/ } - validates :distrib_type, :presence => true, :inclusion => {:in => APP_CONFIG['distr_types']} + validates :description, presence: true + validates :visibility, presence: true, inclusion: {in: VISIBILITIES} + validates :name, uniqueness: {case_sensitive: false}, presence: true, format: { with: /\A#{NAME_PATTERN}\z/ } + validates :distrib_type, presence: true, inclusion: {in: APP_CONFIG['distr_types']} validate lambda { if released_was && !released errors.add(:released, I18n.t('flash.platform.released_status_can_not_be_changed')) @@ -41,7 +41,7 @@ class Platform < ActiveRecord::Base if personal? && (owner_id_changed? || owner_type_changed?) errors.add :owner, I18n.t('flash.platform.owner_can_not_be_changed') end - }, :on => :update + }, on: :update before_create :create_directory before_destroy :detele_directory @@ -54,35 +54,35 @@ class Platform < ActiveRecord::Base scope :search_order, order("CHAR_LENGTH(#{table_name}.name) ASC") scope :search, lambda {|q| where("#{table_name}.name ILIKE ?", "%#{q.to_s.strip}%")} - scope :by_visibilities, lambda {|v| where(:visibility => v)} - scope :opened, where(:visibility => 'open') - scope :hidden, where(:visibility => 'hidden') - scope :by_type, lambda {|type| where(:platform_type => type) if type.present?} + scope :by_visibilities, lambda {|v| where(visibility: v)} + scope :opened, where(visibility: 'open') + scope :hidden, where(visibility: 'hidden') + scope :by_type, lambda {|type| where(platform_type: type) if type.present?} scope :main, by_type('main') scope :personal, by_type('personal') - scope :waiting_for_regeneration, where(:status => WAITING_FOR_REGENERATION) + scope :waiting_for_regeneration, where(status: WAITING_FOR_REGENERATION) - accepts_nested_attributes_for :platform_arch_settings, :allow_destroy => true + accepts_nested_attributes_for :platform_arch_settings, allow_destroy: true attr_accessible :name, :distrib_type, :parent_platform_id, :platform_type, :owner, :visibility, :description, :released, :platform_arch_settings_attributes attr_readonly :name, :distrib_type, :parent_platform_id, :platform_type include Modules::Models::Owner - state_machine :status, :initial => :ready do + state_machine :status, initial: :ready do event :ready do - transition :regenerating => :ready + transition regenerating: :ready end event :regenerate do - transition :ready => :waiting_for_regeneration, :if => lambda{ |p| p.main? } + transition ready: :waiting_for_regeneration, if: lambda{ |p| p.main? } end event :start_regeneration do - transition :waiting_for_regeneration => :regenerating + transition waiting_for_regeneration: :regenerating end HUMAN_STATUSES.each do |code,name| - state name, :value => code + state name, value: code end end @@ -95,7 +95,7 @@ class Platform < ActiveRecord::Base urpmi_commands = ActiveSupport::OrderedHash.new # TODO: rename method or create separate methods for mdv and rhel - # Platform.main.opened.where(:distrib_type => APP_CONFIG['distr_types'].first).each do |pl| + # Platform.main.opened.where(distrib_type: APP_CONFIG['distr_types'].first).each do |pl| Platform.main.opened.each do |pl| urpmi_commands[pl.name] = {} # FIXME should support restricting access to the hidden platform @@ -158,7 +158,7 @@ class Platform < ActiveRecord::Base end def clone_relations(from = parent) - self.repositories = from.repositories.map{|r| r.full_clone(:platform_id => id)} + self.repositories = from.repositories.map{|r| r.full_clone(platform_id: id)} self.products = from.products.map(&:full_clone) end @@ -170,9 +170,9 @@ class Platform < ActiveRecord::Base def change_visibility if !hidden? - update_attributes(:visibility => 'hidden') + update_attributes(visibility: 'hidden') else - update_attributes(:visibility => 'open') + update_attributes(visibility: 'open') end end @@ -191,15 +191,15 @@ class Platform < ActiveRecord::Base def update_owner_relation if owner_id_was != owner_id - r = relations.where(:actor_id => owner_id_was, :actor_type => owner_type_was).first - r.update_attributes(:actor_id => owner_id, :actor_type => owner_type) + r = relations.where(actor_id: owner_id_was, actor_type: owner_type_was).first + r.update_attributes(actor_id: owner_id, actor_type: owner_type) end end def destroy with_skip {super} # avoid cascade XML RPC requests end - later :destroy, :queue => :clone_build + later :destroy, queue: :clone_build def default_host EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] @@ -217,12 +217,12 @@ class Platform < ActiveRecord::Base token, pass = *ActionController::HttpAuthentication::Basic::user_name_and_password(request) end - Rails.cache.fetch([platform_name, token, :platform_allowed], :expires_in => 2.minutes) do + 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? + next true if platform.tokens.by_active.where(authentication_token: token).exists? user = User.find_by_authentication_token token current_ability = Ability.new(user) @@ -252,11 +252,11 @@ class Platform < ActiveRecord::Base def fs_clone(old_name = parent.name, new_name = name) FileUtils.cp_r "#{parent.path}/repository", path end - later :fs_clone, :queue => :clone_build + later :fs_clone, queue: :clone_build def freeze_platform_and_update_repos if released_changed? && released == true - repositories.update_all(:publish_without_qa => false) + repositories.update_all(publish_without_qa: false) end end end diff --git a/app/models/platform_arch_setting.rb b/app/models/platform_arch_setting.rb index bed5a0c65..d59411205 100644 --- a/app/models/platform_arch_setting.rb +++ b/app/models/platform_arch_setting.rb @@ -7,11 +7,11 @@ class PlatformArchSetting < ActiveRecord::Base belongs_to :arch belongs_to :platform - validates :arch_id, :platform_id, :presence => true - validates :platform_id, :uniqueness => {:scope => :arch_id} + validates :arch_id, :platform_id, presence: true + validates :platform_id, :uniqueness => {scope: :arch_id} - scope :by_arch, lambda {|arch| where(:arch_id => arch) if arch.present?} - scope :by_default, where(:default => true) + scope :by_arch, lambda {|arch| where(arch_id: arch) if arch.present?} + scope :by_default, where(default: true) attr_accessible :arch_id, :platform_id, :default diff --git a/app/models/platform_content.rb b/app/models/platform_content.rb index 1e6e8bbf3..e944181b5 100644 --- a/app/models/platform_content.rb +++ b/app/models/platform_content.rb @@ -20,9 +20,9 @@ class PlatformContent return nil unless repository_name = @path.match(/\/[\w]+\/(release|updates)\//) repository_name = repository_name[0].gsub(/\/(release|updates)\/$/, '').gsub('/', '') - repository = @platform.repositories.where(:name => repository_name).first + repository = @platform.repositories.where(name: repository_name).first return nil unless repository - + if @platform.main? build_for_platform = @platform else @@ -36,8 +36,8 @@ class PlatformContent @build_list = BuildList.for_status(BuildList::BUILD_PUBLISHED) .for_platform(build_for_platform) .scoped_to_save_platform(@platform) - .where(:save_to_repository_id => repository) - .where(:build_list_packages => {:fullname => name, :actual => true}) + .where(save_to_repository_id: repository) + .where(build_list_packages: {fullname: name, actual: true}) .joins(:packages) .last diff --git a/app/models/private_user.rb b/app/models/private_user.rb index f8fca0a1a..53413a17d 100644 --- a/app/models/private_user.rb +++ b/app/models/private_user.rb @@ -1,32 +1,32 @@ class PrivateUser < ActiveRecord::Base require 'digest/sha2' - + belongs_to :platform belongs_to :user - validate :login, :uniqueness => true + validate :login, uniqueness: true def event_log_message - {:platform => platform.name, :user => user.uname}.inspect + {platform: platform.name, user: user.uname}.inspect end class << self def can_generate_more?(user_id, platform_id) - !PrivateUser.exists?(:user_id => user_id, :platform_id => platform_id) + !PrivateUser.exists?(user_id: user_id, platform_id: platform_id) end - + def generate_pair(platform_id, user_id) login = "login_#{ActiveSupport::SecureRandom.hex(16)}" pass = "pass_#{ActiveSupport::SecureRandom.hex(16)}" PrivateUser.create( - :login => login, - :password => Digest::SHA2.new.hexdigest(pass), - :platform_id => platform_id, - :user_id => user_id + login: login, + password: Digest::SHA2.new.hexdigest(pass), + platform_id: platform_id, + user_id: user_id ) - {:login => login, :pass => pass} + {login: login, pass: pass} end end end diff --git a/app/models/product.rb b/app/models/product.rb index b3314f148..a802150d7 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -3,7 +3,7 @@ class Product < ActiveRecord::Base belongs_to :platform belongs_to :project - has_many :product_build_lists, :dependent => :destroy + has_many :product_build_lists, dependent: :destroy ONCE_A_12_HOURS = 0 ONCE_A_DAY = 1 @@ -16,11 +16,11 @@ class Product < ActiveRecord::Base ONCE_A_WEEK => :once_a_week } - validates :name, :presence => true, :uniqueness => {:scope => :platform_id} - validates :project_id, :presence => true - validates :main_script, :params, :length => { :maximum => 255 } - validates :autostart_status, :numericality => true, - :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true + validates :name, presence: true, uniqueness: {scope: :platform_id} + validates :project_id, presence: true + validates :main_script, :params, length: { maximum: 255 } + validates :autostart_status, numericality: true, + inclusion: {in: AUTOSTART_STATUSES}, allow_blank: true scope :recent, order("#{table_name}.name ASC") @@ -61,7 +61,7 @@ class Product < ActiveRecord::Base end def self.autostart_iso_builds(autostart_status) - Product.where(:autostart_status => autostart_status).each do |product| + Product.where(autostart_status: autostart_status).each do |product| pbl = product.product_build_lists.new [:params, :main_script, :project, :project_version].each do |k| pbl.send "#{k}=", product.send(k) diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index edb7f2b50..1deb415ac 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -38,16 +38,16 @@ class ProductBuildList < ActiveRecord::Base belongs_to :user # see: Issue #6 - before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, :on => :create + before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, on: :create # field "not_delete" can be changed only if build has been completed before_validation lambda { self.not_delete = false unless build_completed?; true } validates :product_id, :status, :project_id, :main_script, - :arch_id, :presence => true - validates :status, :inclusion => { :in => STATUSES } - validates :main_script, :params, :length => { :maximum => 255 } + :arch_id, presence: true + validates :status, inclusion: { in: STATUSES } + validates :main_script, :params, length: { maximum: 255 } attr_accessor :base_url attr_accessible :status, @@ -65,45 +65,45 @@ class ProductBuildList < ActiveRecord::Base scope :default_order, 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_status, lambda {|status| where(status: status) } + scope :for_user, lambda { |user| where(user_id: user.id) } scope :scoped_to_product_name, lambda {|product_name| joins(:product).where('products.name LIKE ?', "%#{product_name}%")} scope :recent, order("#{table_name}.updated_at DESC") - scope :outdated, where(:not_delete => false). + scope :outdated, where(not_delete: false). where("(#{table_name}.created_at < ? AND #{table_name}.autostarted is TRUE) OR #{table_name}.created_at < ?", Time.now - LIVE_TIME, Time.now - MAX_LIVE_TIME) after_create :add_job_to_abf_worker_queue before_destroy :can_destroy? - state_machine :status, :initial => :build_pending do + state_machine :status, initial: :build_pending do event :start_build do - transition :build_pending => :build_started + transition build_pending: :build_started end event :cancel do transition [:build_pending, :build_started] => :build_canceling end - after_transition :on => :cancel, :do => :cancel_job + after_transition on: :cancel, do: :cancel_job - # :build_canceling => :build_canceled - canceling from UI - # :build_started => :build_canceled - canceling from worker by time-out (time_living has been expired) + # build_canceling: :build_canceled - canceling from UI + # build_started: :build_canceled - canceling from worker by time-out (time_living has been expired) event :build_canceled do transition [:build_canceling, :build_started] => :build_canceled end - # :build_canceling => :build_completed - Worker hasn't time to cancel building because build had been already completed + # build_canceling: :build_completed - Worker hasn't time to cancel building because build had been already completed event :build_success do transition [:build_started, :build_canceling] => :build_completed end - # :build_canceling => :build_failed - Worker hasn't time to cancel building because build had been already failed + # build_canceling: :build_failed - Worker hasn't time to cancel building because build had been already failed event :build_error do transition [:build_started, :build_canceling] => :build_failed end HUMAN_STATUSES.each do |code,name| - state name, :value => code + state name, value: code end end @@ -120,7 +120,7 @@ class ProductBuildList < ActiveRecord::Base end def event_log_message - {:product => product.name}.inspect + {product: product.name}.inspect end def self.human_status(status) @@ -152,7 +152,7 @@ class ProductBuildList < ActiveRecord::Base def abf_worker_args file_name = "#{project.name}-#{commit_hash}" opts = default_url_options - opts.merge!({:user => user.authentication_token, :password => ''}) if user.present? + opts.merge!({user: user.authentication_token, password: ''}) if user.present? srcpath = url_helpers.archive_url( project.owner, project.name, @@ -161,19 +161,19 @@ class ProductBuildList < ActiveRecord::Base opts ) { - :id => id, + id: id, # TODO: remove comment - # :srcpath => 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz', - :srcpath => srcpath, - :params => params, - :time_living => time_living, - :main_script => main_script, - :platform => { - :type => product.platform.distrib_type, - :name => product.platform.name, - :arch => arch.name + # srcpath: 'http://dl.dropbox.com/u/945501/avokhmin-test-iso-script-5d9b463d4e9c06ea8e7c89e1b7ff5cb37e99e27f.tar.gz', + srcpath: srcpath, + params: params, + time_living: time_living, + main_script: main_script, + platform: { + type: product.platform.distrib_type, + name: product.platform.name, + arch: arch.name }, - :user => {:uname => user.try(:uname), :email => user.try(:email)} + user: {uname: user.try(:uname), email: user.try(:email)} } end end diff --git a/app/models/project.rb b/app/models/project.rb index 9d90b3ca2..b6b2844b5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -3,38 +3,38 @@ class Project < ActiveRecord::Base MAX_OWN_PROJECTS = 32000 NAME_REGEXP = /[\w\-\+\.]+/ - belongs_to :owner, :polymorphic => true, :counter_cache => :own_projects_count - belongs_to :maintainer, :class_name => "User" + belongs_to :owner, polymorphic: true, counter_cache: :own_projects_count + belongs_to :maintainer, class_name: "User" - has_many :issues, :dependent => :destroy - has_many :pull_requests, :dependent => :destroy, :foreign_key => 'to_project_id' - has_many :labels, :dependent => :destroy + has_many :issues, dependent: :destroy + has_many :pull_requests, dependent: :destroy, foreign_key: 'to_project_id' + has_many :labels, dependent: :destroy - has_many :project_imports, :dependent => :destroy - has_many :project_to_repositories, :dependent => :destroy - has_many :repositories, :through => :project_to_repositories - has_many :project_tags, :dependent => :destroy - has_many :project_statistics, :dependent => :destroy - - has_many :build_lists, :dependent => :destroy - has_many :hooks, :dependent => :destroy + has_many :project_imports, dependent: :destroy + has_many :project_to_repositories, dependent: :destroy + has_many :repositories, through: :project_to_repositories + has_many :project_tags, dependent: :destroy + has_many :project_statistics, dependent: :destroy - has_many :relations, :as => :target, :dependent => :destroy - has_many :collaborators, :through => :relations, :source => :actor, :source_type => 'User' - has_many :groups, :through => :relations, :source => :actor, :source_type => 'Group' + has_many :build_lists, dependent: :destroy + has_many :hooks, dependent: :destroy - has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy - has_and_belongs_to_many :advisories # should be without :dependent => :destroy + has_many :relations, as: :target, dependent: :destroy + has_many :collaborators, through: :relations, source: :actor, source_type: 'User' + has_many :groups, through: :relations, source: :actor, source_type: 'Group' - validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, - :presence => true, - :format => {:with => /\A#{NAME_REGEXP}\z/, - :message => I18n.t("activerecord.errors.project.uname")} - validates :maintainer_id, :presence => true, :unless => :new_record? - validates :url, :presence => true, :format => {:with => /\Ahttps?:\/\/[\S]+\z/}, :if => :mass_import - validates :add_to_repository_id, :presence => true, :if => :mass_import - validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES} - validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS } + has_many :packages, class_name: "BuildList::Package", dependent: :destroy + has_and_belongs_to_many :advisories # should be without dependent: :destroy + + validates :name, uniqueness: {scope: [:owner_id, :owner_type], case_sensitive: false}, + presence: true, + format: {with: /\A#{NAME_REGEXP}\z/, + message: I18n.t("activerecord.errors.project.uname")} + validates :maintainer_id, presence: true, unless: :new_record? + validates :url, presence: true, format: {with: /\Ahttps?:\/\/[\S]+\z/}, if: :mass_import + validates :add_to_repository_id, presence: true, if: :mass_import + validates :visibility, presence: true, inclusion: {in: VISIBILITIES} + validate { errors.add(:base, :can_have_less_or_equal, count: MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS } validate :check_default_branch # throws validation error message from ProjectToRepository model into Project model validate do |project| @@ -61,9 +61,9 @@ class Project < ActiveRecord::Base term = params.map(&:strip).join('/').downcase where("lower(concat(owner_uname, '/', name)) ILIKE ?", "%#{term}%") if term.present? } - scope :by_visibilities, lambda {|v| where(:visibility => v)} - scope :opened, where(:visibility => 'open') - scope :package, where(:is_package => true) + scope :by_visibilities, lambda {|v| where(visibility: v)} + scope :opened, where(visibility: 'open') + scope :package, where(is_package: true) scope :addable_to_repository, lambda { |repository_id| where %Q( projects.id NOT IN ( SELECT @@ -77,14 +77,14 @@ class Project < ActiveRecord::Base where("(#{table_name}.owner_id in (?) AND #{table_name}.owner_type = 'Group') OR (#{table_name}.owner_id in (?) AND #{table_name}.owner_type = 'User')", group_owner_ids, user_owner_ids) } - before_validation :truncate_name, :on => :create + before_validation :truncate_name, on: :create before_save lambda { self.owner_uname = owner.uname if owner_uname.blank? || owner_id_changed? || owner_type_changed? } before_create :set_maintainer after_save :attach_to_personal_repository after_update :set_new_git_head - after_update lambda { update_path_to_project(name_was) }, :if => :name_changed? + after_update lambda { update_path_to_project(name_was) }, if: :name_changed? - has_ancestry :orphan_strategy => :rootify #:adopt not available yet + has_ancestry orphan_strategy: :rootify #:adopt not available yet attr_accessor :url, :srpms_list, :mass_import, :add_to_repository_id @@ -95,7 +95,7 @@ class Project < ActiveRecord::Base class << self def find_by_owner_and_name(owner_name, project_name) - where(:owner_uname => owner_name, :name => project_name).first || + where(owner_uname: owner_name, name: project_name).first || by_owner_and_name(owner_name, project_name).first end @@ -156,7 +156,7 @@ class Project < ActiveRecord::Base def git_project_address auth_user opts = default_url_options - opts.merge!({:user => auth_user.authentication_token, :password => ''}) unless self.public? + opts.merge!({user: auth_user.authentication_token, password: ''}) unless self.public? Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, opts) + '.git' #path #share by NFS end @@ -178,7 +178,7 @@ class Project < ActiveRecord::Base else default_branch end - + increase_release_tag(project_version, user, "MassBuild##{mass_build.id}: Increase release tag") if increase_rt build_list = build_lists.build do |bl| @@ -230,7 +230,7 @@ class Project < ActiveRecord::Base def get_project_tag_sha1(tag, format) format_id = ProjectTag::FORMATS["#{tag_file_format(format)}"] - project_tag = project_tags.where(:tag_name => tag.name, :format_id => format_id).first + project_tag = project_tags.where(tag_name: tag.name, format_id: format_id).first return project_tag.sha1 if project_tag && project_tag.commit_id == tag.commit.id && Modules::Models::FileStoreClean.file_exist_on_file_store?(project_tag.sha1) @@ -247,13 +247,13 @@ class Project < ActiveRecord::Base end if project_tag project_tag.destroy_files_from_file_store(project_tag.sha1) - project_tag.update_attributes(:sha1 => sha1) + project_tag.update_attributes(sha1: sha1) else project_tags.create( - :tag_name => tag.name, - :format_id => format_id, - :commit_id => tag.commit.id, - :sha1 => sha1 + tag_name: tag.name, + format_id: format_id, + commit_id: tag.commit.id, + sha1: sha1 ) end return sha1 @@ -278,7 +278,7 @@ class Project < ActiveRecord::Base else release = release.to_i + 1 end - release + release end content.gsub(/^Release:(\s+)(%mkrel\s+)?(\d+)([.\d]+)?(mdk)?$/) do |line| @@ -301,9 +301,9 @@ class Project < ActiveRecord::Base return if content == raw.content update_file(blob.name, content.gsub("\r", ''), - :message => message, - :actor => user, - :head => project_version + message: message, + actor: user, + head: project_version ) end @@ -315,8 +315,8 @@ class Project < ActiveRecord::Base system("cd #{path}; git archive --format=#{format == 'zip' ? 'zip' : 'tar'} --prefix=#{file_name}/ #{treeish} #{format == 'zip' ? '' : ' | gzip -9'} > #{file.path}") file.close { - :path => file.path, - :fullname => fullname + path: file.path, + fullname: fullname } end @@ -331,7 +331,7 @@ class Project < ActiveRecord::Base def attach_to_personal_repository owner_repos = self.owner.personal_platform.repositories if is_package - repositories << self.owner.personal_repository unless repositories.exists?(:id => owner_repos.pluck(:id)) + repositories << self.owner.personal_repository unless repositories.exists?(id: owner_repos.pluck(:id)) else repositories.delete owner_repos end @@ -352,21 +352,21 @@ class Project < ActiveRecord::Base self.name = old_name old_path = path self.name = new_name - FileUtils.mv old_path, new_path, :force => true if Dir.exists?(old_path) + FileUtils.mv old_path, new_path, force: true if Dir.exists?(old_path) pull_requests_old_path = File.join(APP_CONFIG['git_path'], 'pull_requests', owner.uname, old_name) if Dir.exists?(pull_requests_old_path) FileUtils.mv pull_requests_old_path, File.join(APP_CONFIG['git_path'], 'pull_requests', owner.uname, new_name), - :force => true + force: true end - PullRequest.where(:from_project_id => id).update_all(:from_project_name => new_name) + PullRequest.where(from_project_id: id).update_all(from_project_name: new_name) - PullRequest.where(:from_project_id => id).each{ |p| p.update_relations(old_name) } + PullRequest.where(from_project_id: id).each{ |p| p.update_relations(old_name) } pull_requests.where('from_project_id != to_project_id').each(&:update_relations) end - later :update_path_to_project, :queue => :clone_build + later :update_path_to_project, queue: :clone_build def check_default_branch if self.repo.branches.count > 0 && self.repo.branches.map(&:name).exclude?(self.default_branch) diff --git a/app/models/project_import.rb b/app/models/project_import.rb index b53d81f68..0b93b4195 100644 --- a/app/models/project_import.rb +++ b/app/models/project_import.rb @@ -2,8 +2,8 @@ class ProjectImport < ActiveRecord::Base belongs_to :project belongs_to :platform - validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false} - validates :name, :platform_id, :version, :presence => true + validates :name, uniqueness: {scope: :platform_id, case_sensitive: false} + validates :name, :platform_id, :version, presence: true scope :by_name, lambda {|name| where("#{table_name}.name ILIKE ?", name)} diff --git a/app/models/project_statistic.rb b/app/models/project_statistic.rb index 717c5d8ad..67641c959 100644 --- a/app/models/project_statistic.rb +++ b/app/models/project_statistic.rb @@ -3,8 +3,8 @@ class ProjectStatistic < ActiveRecord::Base belongs_to :arch belongs_to :project - validates :arch_id, :project_id, :average_build_time, :build_count, :presence => true - validates :project_id, :uniqueness => {:scope => :arch_id} + validates :arch_id, :project_id, :average_build_time, :build_count, presence: true + validates :project_id, uniqueness: {scope: :arch_id} attr_accessible :average_build_time, :build_count end diff --git a/app/models/project_tag.rb b/app/models/project_tag.rb index 1b414b097..e6c700814 100644 --- a/app/models/project_tag.rb +++ b/app/models/project_tag.rb @@ -8,8 +8,8 @@ class ProjectTag < ActiveRecord::Base belongs_to :project - validates :project_id, :commit_id, :sha1, :tag_name, :format_id, :presence => true - validates :project_id, :uniqueness => {:scope => [:tag_name, :format_id]} + validates :project_id, :commit_id, :sha1, :tag_name, :format_id, presence: true + validates :project_id, uniqueness: {scope: [:tag_name, :format_id]} attr_accessible :project_id, :commit_id, diff --git a/app/models/project_to_repository.rb b/app/models/project_to_repository.rb index 1f128ca77..595a23592 100644 --- a/app/models/project_to_repository.rb +++ b/app/models/project_to_repository.rb @@ -1,17 +1,17 @@ class ProjectToRepository < ActiveRecord::Base belongs_to :project belongs_to :repository - - delegate :path, :to => :project - after_destroy lambda { project.destroy_project_from_repository(repository) }, :unless => lambda {Thread.current[:skip]} + delegate :path, to: :project - validate :one_project_in_platform_repositories, :on => :create + after_destroy lambda { project.destroy_project_from_repository(repository) }, unless: lambda {Thread.current[:skip]} + + validate :one_project_in_platform_repositories, on: :create protected def one_project_in_platform_repositories - errors.add(:base, I18n.t('activerecord.errors.project_to_repository.project')) if Project.joins(:repositories => :platform). + errors.add(:base, I18n.t('activerecord.errors.project_to_repository.project')) if Project.joins(repositories: :platform). where('platforms.id = ?', repository.platform_id).by_name(project.name).exists? end end diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index aaeec2e26..542e2e6f2 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -1,13 +1,13 @@ class PullRequest < ActiveRecord::Base STATUSES = %w(ready already blocked merged closed) - belongs_to :issue, :autosave => true, :dependent => :destroy, :touch => true, :validate => true - belongs_to :to_project, :class_name => 'Project', :foreign_key => 'to_project_id' - belongs_to :from_project, :class_name => 'Project', :foreign_key => 'from_project_id' + belongs_to :issue, autosave: true, dependent: :destroy, touch: true, validate: true + belongs_to :to_project, class_name: 'Project', foreign_key: 'to_project_id' + belongs_to :from_project, class_name: 'Project', foreign_key: 'from_project_id' delegate :user, :user_id, :title, :body, :serial_id, :assignee, :status, :to_param, - :created_at, :updated_at, :comments, :status=, :to => :issue, :allow_nil => true + :created_at, :updated_at, :comments, :status=, to: :issue, allow_nil: true - validates :from_project, :to_project, :presence => true - validate :uniq_merge, :if => Proc.new { |pull| pull.to_project.present? } + validates :from_project, :to_project, presence: true + validate :uniq_merge, if: Proc.new { |pull| pull.to_project.present? } validates_each :from_ref, :to_ref do |record, attr, value| check_ref record, attr, value end @@ -19,11 +19,11 @@ class PullRequest < ActiveRecord::Base accepts_nested_attributes_for :issue attr_accessible :issue_attributes, :to_ref, :from_ref - scope :needed_checking, includes(:issue).where(:issues => {:status => ['open', 'blocked', 'ready']}) + scope :needed_checking, includes(:issue).where(issues: {status: ['open', 'blocked', 'ready']}) scope :not_closed_or_merged, needed_checking - scope :closed_or_merged, where(:issues => {:status => ['closed', 'merged']}) + scope :closed_or_merged, where(issues: {status: ['closed', 'merged']}) - state_machine :status, :initial => :open do + state_machine :status, initial: :open do event :ready do transition [:ready, :open, :blocked] => :ready end @@ -37,7 +37,7 @@ class PullRequest < ActiveRecord::Base end event :merging do - transition :ready => :merged + transition ready: :merged end event :close do @@ -45,19 +45,19 @@ class PullRequest < ActiveRecord::Base end event :reopen do - transition :closed => :open + transition closed: :open end end def update_relations(old_from_project_name = nil) - FileUtils.mv path(old_from_project_name), path, :force => true if old_from_project_name + FileUtils.mv path(old_from_project_name), path, force: true if old_from_project_name return unless Dir.exists?(path) Dir.chdir(path) do system 'git', 'remote', 'set-url', 'origin', to_project.path system 'git', 'remote', 'set-url', 'head', from_project.path if cross_pull? - end + end end - later :update_relations, :queue => :clone_build + later :update_relations, queue: :clone_build def cross_pull? from_project_id != to_project_id @@ -66,7 +66,7 @@ class PullRequest < ActiveRecord::Base def check(do_transaction = true) if do_transaction && !valid? issue.set_close nil - issue.save(:validate => false) # FIXME remove this hack + issue.save(validate: false) # FIXME remove this hack return false end res = merge @@ -155,10 +155,10 @@ class PullRequest < ActiveRecord::Base def uniq_merge if to_project && to_project.pull_requests.needed_checking - .where(:from_project_id => from_project_id, - :to_ref => to_ref, :from_ref => from_ref) - .where('pull_requests.id <> :id or :id is null', :id => id).count > 0 - errors.add(:base_branch, I18n.t('projects.pull_requests.duplicate', :from_ref => from_ref)) + .where(from_project_id: from_project_id, + to_ref: to_ref, from_ref: from_ref) + .where('pull_requests.id <> :id or :id is null', id: id).count > 0 + errors.add(:base_branch, I18n.t('projects.pull_requests.duplicate', from_ref: from_ref)) end end @@ -184,7 +184,7 @@ class PullRequest < ActiveRecord::Base if new_record? || !git.exist? #~ FileUtils.mkdir_p(path) #~ system("git clone --local --no-hardlinks #{to_project.path} #{path}") - options = {:bare => false, :shared => false, :branch => to_ref} # shared? + options = {bare: false, shared: false, branch: to_ref} # shared? `rm -rf #{path}` git.fs_mkdir('..') git.clone(options, to_project.path, path) diff --git a/app/models/register_request.rb b/app/models/register_request.rb index 028c615e9..42cff47cd 100644 --- a/app/models/register_request.rb +++ b/app/models/register_request.rb @@ -2,21 +2,21 @@ class RegisterRequest < ActiveRecord::Base default_scope order('created_at ASC') - scope :rejected, where(:rejected => true) - scope :approved, where(:approved => true) - scope :unprocessed, where(:approved => false, :rejected => false) + scope :rejected, where(rejected: true) + scope :approved, where(approved: true) + scope :unprocessed, where(approved: false, rejected: false) - validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i } + validates :email, presence: true, uniqueness: {case_sensitive: false}, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i } # before_create :generate_token before_update :invite_approve_notification def approve - update_attributes(:approved => true, :rejected => false) + update_attributes(approved: true, rejected: false) end def reject - update_attributes(:approved => false, :rejected => true) + update_attributes(approved: false, rejected: true) end protected diff --git a/app/models/relation.rb b/app/models/relation.rb index 98ddf964a..c4f4ab267 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -1,17 +1,17 @@ class Relation < ActiveRecord::Base - belongs_to :target, :polymorphic => true - belongs_to :actor, :polymorphic => true + belongs_to :target, polymorphic: true + belongs_to :actor, polymorphic: true ROLES = %w[reader writer admin] - validates :role, :inclusion => {:in => ROLES} + validates :role, inclusion: {in: ROLES} -# validate { errors.add(:actor, :taken) if Relation.where(:actor_type => self.actor_type, :actor_id => self.actor_id).present? } +# validate { errors.add(:actor, :taken) if Relation.where(actor_type: self.actor_type, actor_id: self.actor_id).present? } before_validation :add_default_role scope :by_user_through_groups, lambda {|u| where("actor_type = 'User' AND actor_id = ? OR actor_type = 'Group' AND actor_id IN (?)", u.id, u.group_ids)} - scope :by_actor, lambda {|obj| where(:actor_id => obj.id, :actor_type => obj.class.to_s)} - scope :by_target, lambda {|tar| where(:target_id => tar.id, :target_type => tar.class.to_s)} - scope :by_role, lambda {|role| where(:role => role)} + scope :by_actor, lambda {|obj| where(actor_id: obj.id, actor_type: obj.class.to_s)} + scope :by_target, lambda {|tar| where(target_id: tar.id, target_type: tar.class.to_s)} + scope :by_role, lambda {|role| where(role: role)} def self.create_with_role(actor, target, role) r = self.new @@ -22,10 +22,10 @@ class Relation < ActiveRecord::Base end def self.add_member(member, target, role, relation = :relations) - if target.send(relation).exists?(:actor_id => member.id, :actor_type => member.class.to_s) || (target.respond_to?(:owner) && target.owner == member) + if target.send(relation).exists?(actor_id: member.id, actor_type: member.class.to_s) || (target.respond_to?(:owner) && target.owner == member) true else - rel = target.send(relation).build(:role => role) + rel = target.send(relation).build(role: role) rel.actor = member rel.save end diff --git a/app/models/repository.rb b/app/models/repository.rb index 667988ede..46f87f820 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -2,24 +2,24 @@ class Repository < ActiveRecord::Base extend FriendlyId friendly_id :name - LOCK_FILE_NAMES = {:sync => '.sync.lock', :repo => '.repo.lock'} + LOCK_FILE_NAMES = {sync: '.sync.lock', repo: '.repo.lock'} SORT = {'base' => 1, 'main' => 2, 'contrib' => 3, 'non-free' => 4, 'restricted' => 5} belongs_to :platform - has_many :relations, :as => :target, :dependent => :destroy - has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy - has_many :members, :through => :actors, :source => :actor, :source_type => 'User' + has_many :relations, as: :target, dependent: :destroy + has_many :actors, as: :target, class_name: 'Relation', dependent: :destroy + has_many :members, through: :actors, source: :actor, source_type: 'User' - has_many :project_to_repositories, :dependent => :destroy, :validate => true - has_many :projects, :through => :project_to_repositories - has_many :repository_statuses, :dependent => :destroy - has_one :key_pair, :dependent => :destroy + has_many :project_to_repositories, dependent: :destroy, validate: true + has_many :projects, through: :project_to_repositories + has_many :repository_statuses, dependent: :destroy + has_one :key_pair, dependent: :destroy - has_many :build_lists, :foreign_key => :save_to_repository_id, :dependent => :destroy + has_many :build_lists, foreign_key: :save_to_repository_id, dependent: :destroy - validates :description, :presence => true - validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}, :presence => true, :format => {:with => /\A[a-z0-9_\-]+\z/} + validates :description, presence: true + validates :name, uniqueness: {scope: :platform_id, case_sensitive: false}, presence: true, format: {with: /\A[a-z0-9_\-]+\z/} scope :recent, order("#{table_name}.name ASC") @@ -55,7 +55,7 @@ class Repository < ActiveRecord::Base from.projects.find_each {|p| self.projects << p} end end - later :clone_relations, :loner => true, :queue => :clone_build + later :clone_relations, loner: true, queue: :clone_build def add_projects(list, user) current_ability = Ability.new(user) @@ -65,25 +65,25 @@ class Repository < ActiveRecord::Base owner, name = line.split('/') next if owner.blank? || name.blank? - project = Project.where(:owner_uname => owner, :name => name).accessible_by(current_ability, :read).first + project = Project.where(owner_uname: owner, name: name).accessible_by(current_ability, :read).first projects << project if project rescue RuntimeError, Exception end end end - later :add_projects, :queue => :clone_build + later :add_projects, queue: :clone_build def remove_projects(list) list.lines.each do |name| begin name.chomp!; name.strip! next if name.blank? - project_to_repositories.where(:projects => { :name => name }).joins(:project).destroy_all + project_to_repositories.where(projects: { name: name }).joins(:project).destroy_all rescue RuntimeError, Exception end end end - later :remove_projects, :queue => :clone_build + later :remove_projects, queue: :clone_build def full_clone(attrs = {}) base_clone(attrs).tap do |c| @@ -144,7 +144,7 @@ class Repository < ActiveRecord::Base def destroy with_skip {super} # avoid cascade XML RPC requests end - later :destroy, :queue => :clone_build + later :destroy, queue: :clone_build def self.custom_sort(repos) repos.select{ |r| SORT.keys.include?(r.name) }.sort{ |a,b| SORT[a.name] <=> SORT[b.name] } | repos.sort_by(&:name) diff --git a/app/models/repository_status.rb b/app/models/repository_status.rb index 1b2c84630..eb59ada70 100644 --- a/app/models/repository_status.rb +++ b/app/models/repository_status.rb @@ -13,7 +13,7 @@ class RepositoryStatus < ActiveRecord::Base WAITING_FOR_RESIGN_AND_REGENERATION = 1100 - HUMAN_STATUSES = HUMAN_STATUSES.clone.merge({ + HUMAN_STATUSES = HUMAN_STATUSES.clone.merge({ WAITING_FOR_RESIGN => :waiting_for_resign, PUBLISH => :publish, RESIGN => :resign, @@ -28,56 +28,56 @@ class RepositoryStatus < ActiveRecord::Base belongs_to :platform belongs_to :repository - validates :repository_id, :platform_id, :presence => true - validates :repository_id, :uniqueness => {:scope => :platform_id} + validates :repository_id, :platform_id, presence: true + validates :repository_id, uniqueness: {scope: :platform_id} attr_accessible :platform_id, :repository_id - scope :platform_ready, where(:platforms => {:status => READY}).joins(:platform) - scope :for_regeneration, where(:status => WAITING_FOR_REGENERATION) - scope :for_resign, where(:status => [WAITING_FOR_RESIGN, WAITING_FOR_RESIGN_AND_REGENERATION]) + scope :platform_ready, where(platforms: {status: READY}).joins(:platform) + scope :for_regeneration, where(status: WAITING_FOR_REGENERATION) + scope :for_resign, where(status: [WAITING_FOR_RESIGN, WAITING_FOR_RESIGN_AND_REGENERATION]) scope :not_ready, where('repository_statuses.status != ?', READY) - state_machine :status, :initial => :ready do + state_machine :status, initial: :ready do event :ready do transition [:regenerating, :publish, :resign] => :ready transition [:waiting_for_resign_after_publish, :waiting_for_resign_after_regeneration] => :waiting_for_resign transition [:waiting_for_regeneration_after_publish, :waiting_for_regeneration_after_resign] => :waiting_for_regeneration - transition :waiting_for_resign_and_regeneration_after_publish => :waiting_for_resign_and_regeneration + transition waiting_for_resign_and_regeneration_after_publish: :waiting_for_resign_and_regeneration end event :regenerate do - transition :ready => :waiting_for_regeneration - transition :publish => :waiting_for_regeneration_after_publish - transition :resign => :waiting_for_regeneration_after_resign - transition :waiting_for_resign_after_publish => :waiting_for_resign_and_regeneration_after_publish - transition :waiting_for_resign => :waiting_for_resign_and_regeneration + transition ready: :waiting_for_regeneration + transition publish: :waiting_for_regeneration_after_publish + transition resign: :waiting_for_regeneration_after_resign + transition waiting_for_resign_after_publish: :waiting_for_resign_and_regeneration_after_publish + transition waiting_for_resign: :waiting_for_resign_and_regeneration end event :start_regeneration do - transition :waiting_for_regeneration => :regenerating - transition :waiting_for_resign_and_regeneration => :waiting_for_resign_after_regeneration + transition waiting_for_regeneration: :regenerating + transition waiting_for_resign_and_regeneration: :waiting_for_resign_after_regeneration end event :resign do - transition :ready => :waiting_for_resign - transition :publish => :waiting_for_resign_after_publish - transition :waiting_for_regeneration => :waiting_for_resign_and_regeneration - transition :waiting_for_regeneration_after_publish => :waiting_for_resign_and_regeneration_after_publish - transition :regenerating => :waiting_for_resign_after_regeneration + transition ready: :waiting_for_resign + transition publish: :waiting_for_resign_after_publish + transition waiting_for_regeneration: :waiting_for_resign_and_regeneration + transition waiting_for_regeneration_after_publish: :waiting_for_resign_and_regeneration_after_publish + transition regenerating: :waiting_for_resign_after_regeneration end event :start_resign do - transition :waiting_for_resign => :resign - transition :waiting_for_resign_and_regeneration => :waiting_for_regeneration_after_resign + transition waiting_for_resign: :resign + transition waiting_for_resign_and_regeneration: :waiting_for_regeneration_after_resign end event :publish do - transition :ready => :publish + transition ready: :publish end HUMAN_STATUSES.each do |code,name| - state name, :value => code + state name, value: code end end diff --git a/app/models/rpm_build_node.rb b/app/models/rpm_build_node.rb index c620f7521..f03a5b161 100644 --- a/app/models/rpm_build_node.rb +++ b/app/models/rpm_build_node.rb @@ -14,7 +14,7 @@ class RpmBuildNode < Ohm::Model attribute :system def user - User.where(:id => user_id).first + User.where(id: user_id).first end def self.cleanup! @@ -33,7 +33,7 @@ class RpmBuildNode < Ohm::Model end busy += n.busy_workers.to_i end - { :systems => systems, :others => others, :busy => busy } + { systems: systems, others: others, busy: busy } end end \ No newline at end of file diff --git a/app/models/settings_notifier.rb b/app/models/settings_notifier.rb index d721e1597..edfce4d98 100644 --- a/app/models/settings_notifier.rb +++ b/app/models/settings_notifier.rb @@ -1,5 +1,5 @@ class SettingsNotifier < ActiveRecord::Base belongs_to :user - validates :user_id, :presence => true + validates :user_id, presence: true end diff --git a/app/models/ssh_key.rb b/app/models/ssh_key.rb index ec09df1ce..2921d28c5 100644 --- a/app/models/ssh_key.rb +++ b/app/models/ssh_key.rb @@ -10,9 +10,9 @@ class SshKey < ActiveRecord::Base before_validation lambda { self.key = key.strip if key.present? } before_validation :set_fingerprint - validates :name, :length => {:maximum => 255} - validates :key, :length => {:maximum => 5000}, format: { :with => /ssh-.{3} / } # Public key? - validates :fingerprint, uniqueness: true, :presence => { :message => I18n.t('activerecord.errors.ssh_key.wrong_key') } + validates :name, length: {maximum: 255} + validates :key, length: {maximum: 5000}, format: { with: /ssh-.{3} / } # Public key? + validates :fingerprint, uniqueness: true, presence: { message: I18n.t('activerecord.errors.ssh_key.wrong_key') } after_create :add_key before_destroy :remove_key diff --git a/app/models/subscribe.rb b/app/models/subscribe.rb index c6fea3abf..791a2a4ab 100644 --- a/app/models/subscribe.rb +++ b/app/models/subscribe.rb @@ -1,5 +1,5 @@ class Subscribe < ActiveRecord::Base - belongs_to :subscribeable, :polymorphic => true + belongs_to :subscribeable, polymorphic: true belongs_to :user belongs_to :project @@ -12,11 +12,11 @@ class Subscribe < ActiveRecord::Base end def self.comment_subscribes(comment) - Subscribe.where(:subscribeable_id => comment.commentable_id, :subscribeable_type => comment.commentable.class.name, :project_id => comment.project) + Subscribe.where(subscribeable_id: comment.commentable_id, subscribeable_type: comment.commentable.class.name, project_id: comment.project) end def self.subscribed_to_commit?(project, user, commit) - subscribe = user.subscribes.where(:subscribeable_id => commit.id.hex, :subscribeable_type => commit.class.name, :project_id => project.id).first + subscribe = user.subscribes.where(subscribeable_id: commit.id.hex, subscribeable_type: commit.class.name, project_id: project.id).first return subscribe.subscribed? if subscribe # return status if already subscribe present true end @@ -33,9 +33,9 @@ class Subscribe < ActiveRecord::Base def self.set_subscribe_to_commit(options, status) if subscribe = Subscribe.where(options).first - subscribe.update_attributes(:status => status) + subscribe.update_attributes(status: status) else - Subscribe.create(options.merge(:status => status)) + Subscribe.create(options.merge(status: status)) end end diff --git a/app/models/token.rb b/app/models/token.rb index 58c6dbf33..ea867af6a 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,19 +1,19 @@ class Token < ActiveRecord::Base - belongs_to :subject, :polymorphic => true, :touch => true - belongs_to :creator, :class_name => 'User' - belongs_to :updater, :class_name => 'User' + belongs_to :subject, polymorphic: true, touch: true + belongs_to :creator, class_name: 'User' + belongs_to :updater, class_name: 'User' - validates :creator_id, :subject_id, :subject_type, :presence => true - validates :authentication_token, :presence => true, :uniqueness => {:case_sensitive => true} + validates :creator_id, :subject_id, :subject_type, presence: true + validates :authentication_token, presence: true, uniqueness: {case_sensitive: true} default_scope order("#{table_name}.created_at desc") - scope :by_active, where(:status => 'active') + scope :by_active, where(status: 'active') - before_validation :generate_token, :on => :create + before_validation :generate_token, on: :create attr_accessible :description - state_machine :status, :initial => :active do + state_machine :status, initial: :active do event :block do transition [:active, :blocked] => :blocked end @@ -24,7 +24,7 @@ class Token < ActiveRecord::Base def generate_token self.authentication_token = loop do token = SecureRandom.urlsafe_base64(32) - break token unless Token.where(:authentication_token => token).exists? + break token unless Token.where(authentication_token: token).exists? end end diff --git a/app/models/user.rb b/app/models/user.rb index 9d0c03dc4..969fc622a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,38 +6,38 @@ class User < Avatar devise :database_authenticatable, :registerable, :omniauthable, :token_authenticatable,# :encryptable, :timeoutable :recoverable, :rememberable, :validatable, :lockable, :confirmable#, :reconfirmable, :trackable - devise :omniauthable, :omniauth_providers => [:facebook, :google_oauth2, :github] + devise :omniauthable, omniauth_providers: [:facebook, :google_oauth2, :github] - has_one :notifier, :class_name => 'SettingsNotifier', :dependent => :destroy #:notifier + has_one :notifier, class_name: 'SettingsNotifier', dependent: :destroy #:notifier - has_many :activity_feeds, :dependent => :destroy + has_many :activity_feeds, dependent: :destroy - has_many :authentications, :dependent => :destroy - has_many :build_lists, :dependent => :destroy - has_many :subscribes, :foreign_key => :user_id, :dependent => :destroy - has_many :comments, :dependent => :destroy + has_many :authentications, dependent: :destroy + has_many :build_lists, dependent: :destroy + has_many :subscribes, foreign_key: :user_id, dependent: :destroy + has_many :comments, dependent: :destroy - has_many :relations, :as => :actor, :dependent => :destroy - has_many :targets, :as => :actor, :class_name => 'Relation', :dependent => :destroy + has_many :relations, as: :actor, dependent: :destroy + has_many :targets, as: :actor, class_name: 'Relation', dependent: :destroy - has_many :projects, :through => :targets, :source => :target, :source_type => 'Project', :autosave => true - has_many :groups, :through => :targets, :source => :target, :source_type => 'Group', :autosave => true - has_many :platforms, :through => :targets, :source => :target, :source_type => 'Platform', :autosave => true - has_many :repositories, :through => :targets, :source => :target, :source_type => 'Repository' + has_many :projects, through: :targets, source: :target, source_type: 'Project', autosave: true + has_many :groups, through: :targets, source: :target, source_type: 'Group', autosave: true + has_many :platforms, through: :targets, source: :target, source_type: 'Platform', autosave: true + has_many :repositories, through: :targets, source: :target, source_type: 'Repository' - has_many :own_projects, :as => :owner, :class_name => 'Project', :dependent => :destroy - has_many :own_groups, :foreign_key => :owner_id, :class_name => 'Group', :dependent => :destroy - has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy + has_many :own_projects, as: :owner, class_name: 'Project', dependent: :destroy + has_many :own_groups, foreign_key: :owner_id, class_name: 'Group', dependent: :destroy + has_many :own_platforms, as: :owner, class_name: 'Platform', dependent: :destroy has_many :issues - has_many :assigned_issues, :foreign_key => :assignee_id, :class_name => 'Issue', :dependent => :nullify + has_many :assigned_issues, foreign_key: :assignee_id, class_name: 'Issue', dependent: :nullify has_many :key_pairs - has_many :ssh_keys, :dependent => :destroy + has_many :ssh_keys, dependent: :destroy - validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /\A[a-z0-9_]+\z/}, :reserved_name => true + validates :uname, presence: true, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z0-9_]+\z/}, reserved_name: true validate { errors.add(:uname, :taken) if Group.by_uname(uname).present? } - validates :role, :inclusion => {:in => EXTENDED_ROLES}, :allow_blank => true - validates :language, :inclusion => {:in => LANGUAGES}, :allow_blank => true + validates :role, inclusion: {in: EXTENDED_ROLES}, allow_blank: true + validates :language, inclusion: {in: LANGUAGES}, allow_blank: true attr_accessible :email, :password, :password_confirmation, :current_password, :remember_me, :login, :name, :uname, :language, :site, :company, :professional_experience, :location, :sound_notifications @@ -45,9 +45,9 @@ class User < Avatar attr_accessor :login scope :opened, where('users.role != \'system\' OR users.role IS NULL') - scope :real, where(:role => ['', nil]) + scope :real, where(role: ['', nil]) EXTENDED_ROLES.select {|type| type.present?}.each do |type| - scope type.to_sym, where(:role => type) + scope type.to_sym, where(role: type) end scope :member_of_project, lambda {|item| @@ -99,11 +99,11 @@ class User < Avatar login = conditions.delete(:login) where(conditions) .where(["lower(uname) = :value OR lower(email) = :value OR authentication_token = :orig_value", - { :value => login.downcase, :orig_value => login }]).first + { value: login.downcase, orig_value: login }]).first end def auth_by_token_or_login_pass(user, pass) - u = User.find_for_database_authentication(:login => user) + u = User.find_for_database_authentication(login: user) u if u && !u.access_locked? && (u.authentication_token == user || u.valid_password?(pass)) end end @@ -121,7 +121,7 @@ class User < Avatar # end def commentor?(commentable) - comments.exists?(:commentable_type => commentable.class.name, :commentable_id => commentable.id.hex) + comments.exists?(commentable_type: commentable.class.name, commentable_id: commentable.id.hex) end def committer?(commit) @@ -146,14 +146,14 @@ class User < Avatar def check_assigned_issues target if target.is_a? Project - assigned_issues.where(:project_id => target.id).update_all(:assignee_id => nil) + assigned_issues.where(project_id: target.id).update_all(assignee_id: nil) else ability = Ability.new self project_ids = Project.accessible_by(ability, :membered).uniq.pluck(:id) issues = assigned_issues issues = issues.where('project_id not in (?)', project_ids) if project_ids.present? - issues.update_all(:assignee_id => nil) + issues.update_all(assignee_id: nil) end end @@ -163,13 +163,13 @@ class User < Avatar 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 + 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 += 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 diff --git a/app/presenters/comment_presenter.rb b/app/presenters/comment_presenter.rb index b421ec414..51999dc31 100644 --- a/app/presenters/comment_presenter.rb +++ b/app/presenters/comment_presenter.rb @@ -12,7 +12,7 @@ class CommentPresenter < ApplicationPresenter unless @is_reference_to_issue @content = @comment.body else - issue = Issue.where(:id => comment.created_from_issue_id).first + issue = Issue.where(id: comment.created_from_issue_id).first @referenced_issue = issue.pull_request || issue @reference_project = issue.project if issue && (comment.data[:comment_id].nil? || Comment.exists?(comment.data[:comment_id])) @@ -56,13 +56,13 @@ class CommentPresenter < ApplicationPresenter project, commentable = options[:project], options[:commentable] path = helpers.project_commentable_comment_path(project, commentable, comment) - res = [link_to(t('layout.link'), "#{helpers.project_commentable_path(project, commentable)}##{comment_anchor}", :class => "#{@options[:in_discussion].present? ? 'in_discussion_' : ''}link_to_comment").html_safe] + res = [link_to(t('layout.link'), "#{helpers.project_commentable_path(project, commentable)}##{comment_anchor}", class: "#{@options[:in_discussion].present? ? 'in_discussion_' : ''}link_to_comment").html_safe] if controller.can? :update, @comment - res << link_to(t('layout.edit'), path, :id => "comment-#{comment.id}", :class => "edit_comment").html_safe + res << link_to(t('layout.edit'), path, id: "comment-#{comment.id}", class: "edit_comment").html_safe end if controller.can? :destroy, @comment - res << link_to(t('layout.delete'), path, :method => "delete", - :confirm => t('layout.comments.confirm_delete')).html_safe + res << link_to(t('layout.delete'), path, method: "delete", + confirm: t('layout.comments.confirm_delete')).html_safe end res end @@ -72,7 +72,7 @@ class CommentPresenter < ApplicationPresenter res = unless @is_reference_to_issue "#{user_link} #{t 'layout.comments.has_commented'}" else - t 'layout.comments.reference', :user => user_link + t 'layout.comments.reference', user: user_link end res.html_safe end @@ -106,7 +106,7 @@ class CommentPresenter < ApplicationPresenter def issue_referenced_state if @referenced_issue.is_a? Issue statuses = {'open' => 'success', 'closed' => 'important'} - content_tag :span, t("layout.issues.status.#{@referenced_issue.status}"), :class => "state label-bootstrap label-#{statuses[@referenced_issue.status]}" + content_tag :span, t("layout.issues.status.#{@referenced_issue.status}"), class: "state label-bootstrap label-#{statuses[@referenced_issue.status]}" else pull_status_label @referenced_issue.status end.html_safe diff --git a/app/presenters/git_presenters/commit_as_message_presenter.rb b/app/presenters/git_presenters/commit_as_message_presenter.rb index 8c0d02f49..420b45ca5 100644 --- a/app/presenters/git_presenters/commit_as_message_presenter.rb +++ b/app/presenters/git_presenters/commit_as_message_presenter.rb @@ -9,14 +9,14 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter comment = opts[:comment] @is_reference_to_issue = !!comment # is it reference issue from commit @project = if comment - Project.where(:id => comment.data[:from_project_id]).first + Project.where(id: comment.data[:from_project_id]).first else opts[:project] end commit = commit || @project.repo.commit(Comment.hex_to_commit_hash comment.created_from_commit_hash) if @project if @project && commit - @committer = User.where(:email => commit.committer.email).first || commit.committer + @committer = User.where(email: commit.committer.email).first || commit.committer @commit_hash = commit.id @committed_date, @authored_date = commit.committed_date, commit.authored_date @commit_message = commit.message @@ -31,10 +31,10 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter def header @header ||= if @is_reference_to_issue - I18n.t('layout.commits.reference', :committer => committer_link, :commit => commit_link) + I18n.t('layout.commits.reference', committer: committer_link, commit: commit_link) elsif @project.present? I18n.t('layout.messages.commits.header', - :committer => committer_link, :commit => commit_link, :project => @project.name) + committer: committer_link, commit: commit_link, project: @project.name) end.html_safe end @@ -109,6 +109,6 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter @caption = @caption[0..68] + '...' end # @content = @content.gsub("\n", "
").html_safe if @content - @content = simple_format(@content, {}, :sanitize => true).html_safe if @content + @content = simple_format(@content, {}, sanitize: true).html_safe if @content end end diff --git a/app/presenters/maintainer_presenter.rb b/app/presenters/maintainer_presenter.rb index 186266061..14247766c 100644 --- a/app/presenters/maintainer_presenter.rb +++ b/app/presenters/maintainer_presenter.rb @@ -5,7 +5,7 @@ class MaintainerPresenter < ApplicationPresenter :package_updated_at attr_reader :maintainer, :maintainer_fullname, :maintainer_email, :maintainer_link, :maintainer_mail_link - delegate :package_type, :to => :package + delegate :package_type, to: :package [:name, :version, :release, :updated_at].each do |meth| define_method "package_#{meth}" do @@ -37,7 +37,7 @@ class MaintainerPresenter < ApplicationPresenter end def maintainer_email_link - mail_to @maintainer.email, @maintainer.email, :encode => "javascript" + mail_to @maintainer.email, @maintainer.email, encode: "javascript" end end diff --git a/app/views/admin/base/_submenu.html.haml b/app/views/admin/base/_submenu.html.haml index 2255ddfd1..d0fac1ed0 100644 --- a/app/views/admin/base/_submenu.html.haml +++ b/app/views/admin/base/_submenu.html.haml @@ -1,2 +1,2 @@ - content_for :submenu do - %nav= render 'layouts/menu/top', :which_menu => 'admins_menu' + %nav= render 'layouts/menu/top', which_menu: 'admins_menu' diff --git a/app/views/admin/event_logs/_description.html.haml b/app/views/admin/event_logs/_description.html.haml index 5f8359787..9c53f2405 100644 --- a/app/views/admin/event_logs/_description.html.haml +++ b/app/views/admin/event_logs/_description.html.haml @@ -1,6 +1,6 @@ = 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}" + = 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 diff --git a/app/views/admin/event_logs/_event_log.html.haml b/app/views/admin/event_logs/_event_log.html.haml index 10620b79a..91e8562e4 100644 --- a/app/views/admin/event_logs/_event_log.html.haml +++ b/app/views/admin/event_logs/_event_log.html.haml @@ -1,7 +1,7 @@ -%tr{:class => cycle("odd", "even")} +%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= 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 \ No newline at end of file + %td= render 'description', el: event_log \ No newline at end of file diff --git a/app/views/admin/flash_notifies/_form.html.haml b/app/views/admin/flash_notifies/_form.html.haml index e7de4d9de..46b41be64 100644 --- a/app/views/admin/flash_notifies/_form.html.haml +++ b/app/views/admin/flash_notifies/_form.html.haml @@ -1,21 +1,21 @@ -.leftlist= f.label :body_ru, t("activerecord.attributes.flash_notify.body_ru"), :class => :label -.rightlist= f.text_area :body_ru, :class => 'text_field' +.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' +.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 +.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 +.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')} + = 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" + = link_to t("layout.cancel"), admin_flash_notifies_path, class: "button" diff --git a/app/views/admin/flash_notifies/edit.html.haml b/app/views/admin/flash_notifies/edit.html.haml index a1f10e1cd..240d1cad4 100644 --- a/app/views/admin/flash_notifies/edit.html.haml +++ b/app/views/admin/flash_notifies/edit.html.haml @@ -1,6 +1,6 @@ %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 += form_for @flash_notify, url: admin_flash_notify_path(@flash_notify), html: { class: :form } do |f| + = render "form", f: f = render 'submenu' diff --git a/app/views/admin/flash_notifies/index.html.haml b/app/views/admin/flash_notifies/index.html.haml index 9578d1a0e..a3d62485b 100644 --- a/app/views/admin/flash_notifies/index.html.haml +++ b/app/views/admin/flash_notifies/index.html.haml @@ -1,6 +1,6 @@ -= link_to t("layout.flash_notifies.new"), new_admin_flash_notify_path, :class => 'button' if can? :create, FlashNotify += 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"} +%table#myTable.tablesorter.flash_notifys{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.flash_notify.body_en") @@ -9,13 +9,13 @@ %th.th3= t("layout.flash_notifies.actions") %tbody - @flash_notifies.each do |flash_notify| - %tr{:class => cycle("odd", "even")} + %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, :confirm => t("layout.mass_builds.cancel_confirm") if can?(:delete, flash_notify) + = link_to t("layout.flash_notifies.delete"), admin_flash_notify_path(flash_notify), method: :delete, confirm: t("layout.mass_builds.cancel_confirm") if can?(:delete, flash_notify) = will_paginate @flash_notifies diff --git a/app/views/admin/flash_notifies/new.html.haml b/app/views/admin/flash_notifies/new.html.haml index 0177e384e..c1f9ec45d 100644 --- a/app/views/admin/flash_notifies/new.html.haml +++ b/app/views/admin/flash_notifies/new.html.haml @@ -1,6 +1,6 @@ %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 += form_for @flash_notify, url: admin_flash_notifies_path, html: { class: :form } do |f| + = render "form", f: f = render 'submenu' diff --git a/app/views/admin/register_requests/index.html.haml b/app/views/admin/register_requests/index.html.haml index 90c609fc0..045d87d72 100644 --- a/app/views/admin/register_requests/index.html.haml +++ b/app/views/admin/register_requests/index.html.haml @@ -1,9 +1,9 @@ -%div{:style => 'float: right; margin: 20px'} - = link_to t("layout.register_request.approved"), admin_register_requests_path(:scope => :approved) +%div{style: 'float: right; margin: 20px'} + = link_to t("layout.register_request.approved"), admin_register_requests_path(scope: :approved) \| - = link_to t("layout.register_request.rejected"), admin_register_requests_path(:scope => :rejected) + = link_to t("layout.register_request.rejected"), admin_register_requests_path(scope: :rejected) %h2.title= title t("layout.register_request.list_header") -= form_tag admin_register_requests_path, :method => :put, :class => 'update_form' do += form_tag admin_register_requests_path, method: :put, class: 'update_form' do = hidden_field_tag 'update_type' %table.tablesorter %tr @@ -15,7 +15,7 @@ %th= t("activerecord.attributes.register_request.created_at") %th - @register_requests.each do |request| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td= check_box_tag 'request_ids[]', request.id %td= request.name - @user = User.find_by_email(request.email) if request.approved @@ -30,12 +30,12 @@ - if can? :reject, request - links << link_to(t("layout.reject"), reject_admin_register_request_path(request)) - if request.token - - links << link_to('Link', new_user_registration_url(:invitation_token => request.token)) + - links << link_to('Link', new_user_registration_url(invitation_token: request.token)) = raw links.join('|') .actions - %input#approve_registration{:type => 'button', :value => "Approve Selected"} - %input#reject_registration{:type => 'button', :value => "Reject Selected"} + %input#approve_registration{type: 'button', value: "Approve Selected"} + %input#reject_registration{type: 'button', value: "Reject Selected"} = will_paginate @register_requests diff --git a/app/views/admin/users/_sidebar.html.haml b/app/views/admin/users/_sidebar.html.haml index 229795abb..59b4f85b9 100644 --- a/app/views/admin/users/_sidebar.html.haml +++ b/app/views/admin/users/_sidebar.html.haml @@ -1,22 +1,22 @@ - content_for :sidebar do -if @filter == 'system' .bordered - = link_to t("layout.users.list_header"), admin_users_path, :class => 'button' + = link_to t("layout.users.list_header"), admin_users_path, class: 'button' .bordered - if can? :create, User.new - = link_to t("layout.users.new"), new_admin_user_path(:system => @filter == 'system'), :class => 'button' + = link_to t("layout.users.new"), new_admin_user_path(system: @filter == 'system'), class: 'button' %h3= t("layout.users.filter_header") %table -if @filter != 'system' - t('layout.users.users_filter').each_key do |base| %tr - %td.width18=radio_button_tag :myradio, base, @filter.to_sym == base, {:id => 'users_filter', :class => 'niceRadio', :name => 'filter'} + %td.width18=radio_button_tag :myradio, base, @filter.to_sym == base, {id: 'users_filter', class: 'niceRadio', name: 'filter'} %td.width135=t("layout.users.users_filter.#{base}") -else %tr - %td.width18=radio_button_tag :myradio, 'system', true, {:id => 'users_filter', :class => 'niceRadio', :name => 'filter'} + %td.width18=radio_button_tag :myradio, 'system', true, {id: 'users_filter', class: 'niceRadio', name: 'filter'} %td.width135=t("layout.users.system") .both -if @filter != 'system' .bordered - = link_to t("layout.users.system"), system_admin_users_path, :class => 'button' + = link_to t("layout.users.system"), system_admin_users_path, class: 'button' diff --git a/app/views/admin/users/_users_ajax.json.jbuilder b/app/views/admin/users/_users_ajax.json.jbuilder index 363e968da..425d4b6de 100644 --- a/app/views/admin/users/_users_ajax.json.jbuilder +++ b/app/views/admin/users/_users_ajax.json.jbuilder @@ -1,8 +1,8 @@ users = @users.map do |user| link_block = [ (link_to t('layout.edit'), edit_admin_user_path(user) if can?(:edit, user) && !@system_list), - (link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), :method => :put, :confirm => t('layout.users.confirm_reset_token') if can?(:edit, user) && @system_list), - (link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user) + (link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), method: :put, confirm: t('layout.users.confirm_reset_token') if can?(:edit, user) && @system_list), + (link_to t('layout.delete'), admin_user_path(user), method: :delete, confirm: t('layout.users.confirm_delete') if can? :destroy, user) ].compact.join(' | ').html_safe if !@system_list @@ -11,7 +11,7 @@ users = @users.map do |user| (can?(:read, user) ? link_to(user.uname, user) : user.uname), user.email, user.created_at.to_date, - content_tag(:span, user.role, :style => user.access_locked? ? 'background: #FEDEDE' : ''), + content_tag(:span, user.role, style: user.access_locked? ? 'background: #FEDEDE' : ''), link_block ] else diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index 7a591b180..d4a59e1ad 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -2,8 +2,8 @@ .content %h2.title= title t("layout.users.edit_header") .inner - = form_for @user, :url => admin_user_path(@user), :html => {:class => :form} do |f| - = render "users/base/form", :f => f + = form_for @user, url: admin_user_path(@user), html: {class: :form} do |f| + = render "users/base/form", f: f - content_for :sidebar do .bordered.nopadding diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 632b16c10..178cf6a4f 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -1,20 +1,20 @@ %h3.fix= title t("layout.users.#{@filter == 'system' ? 'system' : 'list_header'}") -if @filter == 'system' - - columns = [{:type => 'html'}, {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}] + - columns = [{type: 'html'}, {type: nil, sortable: false, searchable: false, class: 'buttons'}] -else - - columns = [{:type => 'html'}, {:type => 'html'}, {:type => 'html'}, {:type => 'html'}, {:type => 'html', :sortable => false, :searchable => false}, {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}] -= raw datatable(columns, {:sort_by => "[0, 'asc']", :processing => t("layout.processing"), :search_label => t("layout.search.header"), - :pagination_labels => {:previous => t("datatables.previous_label"), :next => t("datatables.next_label")}, - :empty_label => t("datatables.empty_label"), - :info_label => t("datatables.info_label"), - :info_empty_label => t("datatables.info_empty_label"), - :filtered_label => t("datatables.filtered_label"), - :table_dom_id => 'datatable', - :auto_width => 'false', - :ajax_source => "#{url_for :controller => 'admin/users', :action => :list, :system => (@filter == 'system')}", - :additional_data => {:filter => "' + $('#users_filter[type=\"radio\"]:checked').val() + '"} }) + - columns = [{type: 'html'}, {type: 'html'}, {type: 'html'}, {type: 'html'}, {type: 'html', sortable: false, searchable: false}, {type: nil, sortable: false, searchable: false, class: 'buttons'}] += raw datatable(columns, {sort_by: "[0, 'asc']", processing: t("layout.processing"), search_label: t("layout.search.header"), + pagination_labels: {previous: t("datatables.previous_label"), next: t("datatables.next_label")}, + empty_label: t("datatables.empty_label"), + info_label: t("datatables.info_label"), + info_empty_label: t("datatables.info_empty_label"), + filtered_label: t("datatables.filtered_label"), + table_dom_id: 'datatable', + auto_width: 'false', + ajax_source: "#{url_for controller: 'admin/users', action: :list, system: (@filter == 'system')}", + additional_data: {filter: "' + $('#users_filter[type=\"radio\"]:checked').val() + '"} }) -%table#datatable.tablesorter.list-users{:cellspacing => 0, :cellpadding => 0} +%table#datatable.tablesorter.list-users{cellspacing: 0, cellpadding: 0} %thead %tr -if @filter == 'system' diff --git a/app/views/admin/users/new.html.haml b/app/views/admin/users/new.html.haml index d49a54e6a..50651a081 100644 --- a/app/views/admin/users/new.html.haml +++ b/app/views/admin/users/new.html.haml @@ -2,17 +2,17 @@ .content %h2.title= title t("layout.users.new_#{@user.system? ? 'system_' : ''}header") .inner - = form_for @user, :url => admin_users_path, :html => {:class => :form} do |f| + = form_for @user, url: admin_users_path, html: {class: :form} do |f| -if @user.system? =hidden_field_tag :role, 'system' .leftlist= f.label :uname, t("activerecord.attributes.user.uname") .rightlist= f.text_field :uname .leftlist \  - .rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + .rightlist= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} .both -else - = render "users/base/form", :f => f + = render "users/base/form", f: f - content_for :sidebar do .bordered.nopadding = render 'submenu' diff --git a/app/views/advisories/_advisories.json.jbuilder b/app/views/advisories/_advisories.json.jbuilder index 2719429c1..9be943673 100644 --- a/app/views/advisories/_advisories.json.jbuilder +++ b/app/views/advisories/_advisories.json.jbuilder @@ -2,7 +2,7 @@ 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.popover_desc truncate(a.description, length: 500); json.references a.references.split("\n").map{|ref| construct_ref_link(ref)}.join('
') json.update_type a.update_type end diff --git a/app/views/advisories/_form.html.haml b/app/views/advisories/_form.html.haml index a21ff2acb..d8e3b9bee 100644 --- a/app/views/advisories/_form.html.haml +++ b/app/views/advisories/_form.html.haml @@ -3,7 +3,7 @@ .leftlist = f.label :description, t("activerecord.attributes.advisory.description") .rightlist - = f.text_area :description, :class => 'text_field', :cols => 80 + = f.text_area :description, class: 'text_field', cols: 80 .both .leftlist @@ -11,5 +11,5 @@ %span.hint = t("layout.advisories.ref_comment") .rightlist - = f.text_area :references, :class => 'text_field', :cols => 80 + = f.text_area :references, class: 'text_field', cols: 80 .both diff --git a/app/views/advisories/_list.html.haml b/app/views/advisories/_list.html.haml index a5b24b6b0..3f8fa0db0 100644 --- a/app/views/advisories/_list.html.haml +++ b/app/views/advisories/_list.html.haml @@ -1,4 +1,4 @@ -%table#myTable.tablesorter.advisories.static-search{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.advisories.static-search{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.advisory.advisory_id") @@ -6,20 +6,20 @@ %th.th3= t("activerecord.attributes.advisory.description") %tr.search -# TODO: change filter to Backbone.js - %th{:colspan => 3, :rowspan => 1} - = form_tag advisories_path, :method => :get do |f| - = text_field_tag('q', params[:q], :placeholder => t('layout.advisories.search_by_id'), :class => params[:q].present? ? 'black' : 'gray', :style => 'width:600px;') - = submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')} - =# link_to t('layout.back'), advisories_path, :class => 'button' - = button_to t('layout.clear'), {:action => :index} , :method => :get + %th{colspan: 3, rowspan: 1} + = form_tag advisories_path, method: :get do |f| + = text_field_tag('q', params[:q], placeholder: t('layout.advisories.search_by_id'), class: params[:q].present? ? 'black' : 'gray', style: 'width:600px;') + = submit_tag t('layout.search.header'), data: {'disable-with' => t('layout.processing')} + =# link_to t('layout.back'), advisories_path, class: 'button' + = button_to t('layout.clear'), {action: :index} , method: :get %tbody - if list.size > 0 - = render :partial => 'list_item', :collection => list, :as => :advisory + = render partial: 'list_item', collection: list, as: :advisory - else %tr.odd - %td.no_results{:colspan => 3} - = t("layout.search.no_results", :query => params[:q]) + %td.no_results{colspan: 3} + = t("layout.search.no_results", query: params[:q]) :javascript $(function() { diff --git a/app/views/advisories/_list_item.html.haml b/app/views/advisories/_list_item.html.haml index 21486904f..08288a12a 100644 --- a/app/views/advisories/_list_item.html.haml +++ b/app/views/advisories/_list_item.html.haml @@ -1,7 +1,7 @@ -%tr{:class => cycle("odd", "even")} +%tr{class: cycle("odd", "even")} %td= link_to advisory.advisory_id, advisory_path(advisory) %td - advisory.platforms.each do |platform| = link_to platform_printed_name(platform), platform_path(platform) %br - %td= truncate(advisory.description, :length => 50) + %td= truncate(advisory.description, length: 50) diff --git a/app/views/advisories/_submenu.html.haml b/app/views/advisories/_submenu.html.haml index 00ad6e3cc..9c0262e19 100644 --- a/app/views/advisories/_submenu.html.haml +++ b/app/views/advisories/_submenu.html.haml @@ -4,4 +4,4 @@ = @advisory.advisory_id if @advisory.present? %nav %ul - %li= link_to t('layout.list'), advisories_path, :class => act.in?([:index]) ? 'active' : nil + %li= link_to t('layout.list'), advisories_path, class: act.in?([:index]) ? 'active' : nil diff --git a/app/views/advisories/index.atom.builder b/app/views/advisories/index.atom.builder index 1a27b5c32..31018eda5 100644 --- a/app/views/advisories/index.atom.builder +++ b/app/views/advisories/index.atom.builder @@ -3,11 +3,11 @@ atom_feed do |feed| feed.updated(@advisories.first.created_at) if @advisories.length > 0 @advisories.each do |advisory| - feed.entry(advisory, :url => advisory_url(advisory)) do |entry| - content = raw(render(:inline => true, :partial => 'feed_partial', :locals => { :advisory => advisory })) + feed.entry(advisory, url: advisory_url(advisory)) do |entry| + content = raw(render(inline: true, partial: 'feed_partial', locals: { advisory: advisory })) entry.title("#{t("activerecord.models.advisory")} #{advisory.advisory_id}") - entry.content(content, :type => 'html') + entry.content(content, type: 'html') end end diff --git a/app/views/advisories/index.html.haml b/app/views/advisories/index.html.haml index 3e73c2095..3e80f2268 100644 --- a/app/views/advisories/index.html.haml +++ b/app/views/advisories/index.html.haml @@ -1,8 +1,8 @@ -- set_meta_tags :title => t('layout.advisories.list_header') -- render :partial => 'submenu' +- set_meta_tags title: t('layout.advisories.list_header') +- render partial: 'submenu' %h3.fix = t("layout.advisories.list_header") - = link_to image_tag("rss.ico", :width => '15px', :height => '15px', :class => 'atom_icon'), - APP_CONFIG['anonymous_access'] ? advisories_path(:format => 'atom') : advisories_path(:format => 'atom', :token => current_user.authentication_token) -= render :partial => 'list', :object => @advisories + = link_to image_tag("rss.ico", width: '15px', height: '15px', class: 'atom_icon'), + APP_CONFIG['anonymous_access'] ? advisories_path(format: 'atom') : advisories_path(format: 'atom', token: current_user.authentication_token) += render partial: 'list', object: @advisories = will_paginate @advisories diff --git a/app/views/advisories/show.html.haml b/app/views/advisories/show.html.haml index 422ccd0ec..f9afdaf35 100644 --- a/app/views/advisories/show.html.haml +++ b/app/views/advisories/show.html.haml @@ -1,5 +1,5 @@ -- set_meta_tags :title => [title_object(@advisory), t('activerecord.models.advisory')] -- render :partial => 'submenu' +- set_meta_tags title: [title_object(@advisory), t('activerecord.models.advisory')] +- render partial: 'submenu' %h3= "#{t("activerecord.models.advisory")} #{@advisory.advisory_id}".html_safe @@ -39,7 +39,7 @@ = raw @advisory.build_lists.map{ |bl| link_to bl.id, build_list_path(bl) }.join(', ') .both -= render :partial => 'packages_info' += render partial: 'packages_info' :javascript $('article .all').addClass('bigpadding'); diff --git a/app/views/api/v1/advisories/_advisory.json.jbuilder b/app/views/api/v1/advisories/_advisory.json.jbuilder index 882db3411..056c2b304 100644 --- a/app/views/api/v1/advisories/_advisory.json.jbuilder +++ b/app/views/api/v1/advisories/_advisory.json.jbuilder @@ -2,11 +2,11 @@ json.id advisory.advisory_id json.(advisory, :description) json.platforms advisory.platforms do |platform| json.(platform, :id, :released) - json.url api_v1_platform_path(platform.id, :format => :json) + json.url api_v1_platform_path(platform.id, format: :json) end json.projects advisory.projects do |project| json.(project, :id, :name) json.fullname project.name_with_owner - json.url api_v1_project_path(project.id, :format => :json) + json.url api_v1_project_path(project.id, format: :json) end -json.url api_v1_advisory_path(advisory.advisory_id, :format => :json) \ No newline at end of file +json.url api_v1_advisory_path(advisory.advisory_id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/advisories/index.json.jbuilder b/app/views/api/v1/advisories/index.json.jbuilder index d2af972c9..178715ad1 100644 --- a/app/views/api/v1/advisories/index.json.jbuilder +++ b/app/views/api/v1/advisories/index.json.jbuilder @@ -1,4 +1,4 @@ json.advisories @advisories do |advisory| - json.partial! 'advisory', :advisory => advisory + json.partial! 'advisory', advisory: advisory end -json.url api_v1_advisories_path(:format => :json) \ No newline at end of file +json.url api_v1_advisories_path(format: :json) \ No newline at end of file diff --git a/app/views/api/v1/advisories/show.json.jbuilder b/app/views/api/v1/advisories/show.json.jbuilder index c1ec4dfa5..85c727901 100644 --- a/app/views/api/v1/advisories/show.json.jbuilder +++ b/app/views/api/v1/advisories/show.json.jbuilder @@ -1,21 +1,21 @@ json.advisory do - json.partial! 'advisory', :advisory => @advisory + json.partial! 'advisory', advisory: @advisory json.created_at @advisory.created_at.to_i json.updated_at @advisory.updated_at.to_i json.(@advisory, :update_type) json.references @advisory.references.split('\n') - + json.build_lists @advisory.build_lists do |build_list| json.(build_list, :id) - json.url api_v1_build_list_path(build_list.id, :format => :json) + json.url api_v1_build_list_path(build_list.id, format: :json) end json.affected_in @packages_info do |package_info| - json.partial! 'api/v1/platforms/platform', :platform => package_info[0] + json.partial! 'api/v1/platforms/platform', platform: package_info[0] json.projects package_info[1] do |info| - json.partial! 'api/v1/projects/project', :project => info[0] - + json.partial! 'api/v1/projects/project', project: info[0] + packages = info[1] json.srpm packages[:srpm] json.rpm packages[:rpm] diff --git a/app/views/api/v1/build_lists/_repositories.json.jbuilder b/app/views/api/v1/build_lists/_repositories.json.jbuilder index e776bd258..162824293 100644 --- a/app/views/api/v1/build_lists/_repositories.json.jbuilder +++ b/app/views/api/v1/build_lists/_repositories.json.jbuilder @@ -1,5 +1,5 @@ -json.partial! 'api/v1/repositories/repository', :repository => repository +json.partial! 'api/v1/repositories/repository', repository: repository json.platform do - json.partial! 'api/v1/platforms/platform', :platform => repository.platform + json.partial! 'api/v1/platforms/platform', platform: repository.platform end \ No newline at end of file diff --git a/app/views/api/v1/build_lists/index.json.jbuilder b/app/views/api/v1/build_lists/index.json.jbuilder index ae5ddeb41..6bc5eba1a 100644 --- a/app/views/api/v1/build_lists/index.json.jbuilder +++ b/app/views/api/v1/build_lists/index.json.jbuilder @@ -1,7 +1,7 @@ json.build_lists @build_lists do |build_list| json.(build_list, :id, :status) - json.url api_v1_build_list_path(build_list, :format => :json) + json.url api_v1_build_list_path(build_list, format: :json) end -json.url api_v1_build_lists_path(:format => :json, :params => {:filter => params[:filter] } ) +json.url api_v1_build_lists_path(format: :json, params: {filter: params[:filter] } ) diff --git a/app/views/api/v1/build_lists/show.json.jbuilder b/app/views/api/v1/build_lists/show.json.jbuilder index 41eef4778..2b146ca40 100644 --- a/app/views/api/v1/build_lists/show.json.jbuilder +++ b/app/views/api/v1/build_lists/show.json.jbuilder @@ -18,47 +18,47 @@ json.build_list do json.updated_at @build_list.updated_at.to_i json.project do - json.partial! 'api/v1/projects/project', :project => @build_list.project + json.partial! 'api/v1/projects/project', project: @build_list.project end json.save_to_repository do json.partial! 'api/v1/repositories/repository', - :repository => @build_list.save_to_repository + repository: @build_list.save_to_repository json.platform do json.partial! 'api/v1/platforms/platform', - :platform => @build_list.save_to_repository.platform + platform: @build_list.save_to_repository.platform end end json.build_for_platform do json.partial! 'api/v1/platforms/platform', - :platform => @build_list.build_for_platform + platform: @build_list.build_for_platform end json.user do - json.partial! 'api/v1/shared/member', :member => @build_list.user + json.partial! 'api/v1/shared/member', member: @build_list.user end json.publisher do - json.partial! 'api/v1/shared/member', :member => @build_list.publisher + json.partial! 'api/v1/shared/member', member: @build_list.publisher end if @build_list.publisher - inc_repos = Repository.includes(:platform).where(:id => @build_list.include_repos) + inc_repos = Repository.includes(:platform).where(id: @build_list.include_repos) json.include_repos inc_repos do |repo| - json.partial! 'repositories', :repository => repo + json.partial! 'repositories', repository: repo end - extra_repos = Repository.includes(:platform).where(:id => @build_list.extra_repositories) + extra_repos = Repository.includes(:platform).where(id: @build_list.extra_repositories) json.extra_repositories extra_repos do |repo| - json.partial! 'repositories', :repository => repo + json.partial! 'repositories', repository: repo end - extra_build_lists = BuildList.where(:id => @build_list.extra_build_lists) + extra_build_lists = BuildList.where(id: @build_list.extra_build_lists) json.extra_build_lists extra_build_lists do |bl| json.(bl, :id, :status) json.container_path container_url(bl) - json.url api_v1_build_list_path(bl, :format => :json) + json.url api_v1_build_list_path(bl, format: :json) end json.extra_params @build_list.extra_params @@ -79,8 +79,8 @@ json.build_list do end if @build_list.new_core? json.packages @build_list.packages do |package| - json.partial! 'api/v1/maintainers/package', :package => package + json.partial! 'api/v1/maintainers/package', package: package end - json.url api_v1_build_list_path(@build_list, :format => :json) + json.url api_v1_build_list_path(@build_list, format: :json) end diff --git a/app/views/api/v1/groups/index.json.jbuilder b/app/views/api/v1/groups/index.json.jbuilder index ed313a4e4..0dc38c89b 100644 --- a/app/views/api/v1/groups/index.json.jbuilder +++ b/app/views/api/v1/groups/index.json.jbuilder @@ -2,10 +2,10 @@ json.groups @groups do |group| json.(group, :id, :uname, :own_projects_count, :description) json.created_at group.created_at.to_i json.updated_at group.updated_at.to_i - json.partial! 'api/v1/shared/owner', :owner => group.owner + json.partial! 'api/v1/shared/owner', owner: group.owner json.avatar_url avatar_url(group, :big) - json.url api_v1_group_path(group.id, :format => :json) + json.url api_v1_group_path(group.id, format: :json) json.html_url group_path(group.uname) end -json.url api_v1_groups_path(:format => :json) \ No newline at end of file +json.url api_v1_groups_path(format: :json) \ No newline at end of file diff --git a/app/views/api/v1/groups/members.json.jbuilder b/app/views/api/v1/groups/members.json.jbuilder index 48e0ba8c4..90fc0036b 100644 --- a/app/views/api/v1/groups/members.json.jbuilder +++ b/app/views/api/v1/groups/members.json.jbuilder @@ -2,4 +2,4 @@ json.group do json.(@group, :id) json.partial! 'api/v1/shared/members' end -json.url members_api_v1_group_path(@group.id, :format => :json) \ No newline at end of file +json.url members_api_v1_group_path(@group.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/groups/show.json.jbuilder b/app/views/api/v1/groups/show.json.jbuilder index ff4a982e2..f778122c4 100644 --- a/app/views/api/v1/groups/show.json.jbuilder +++ b/app/views/api/v1/groups/show.json.jbuilder @@ -2,8 +2,8 @@ json.group do json.(@group, :id, :uname, :own_projects_count, :description) json.created_at @group.created_at.to_i json.updated_at @group.updated_at.to_i - json.partial! 'api/v1/shared/owner', :owner => @group.owner + json.partial! 'api/v1/shared/owner', owner: @group.owner json.avatar_url avatar_url(@group, :big) - json.url api_v1_group_path(@group.id, :format => :json) + json.url api_v1_group_path(@group.id, format: :json) json.html_url group_path(@group.uname) end \ No newline at end of file diff --git a/app/views/api/v1/issues/_issue.json.jbuilder b/app/views/api/v1/issues/_issue.json.jbuilder index 2c128fb11..cccbd1f8f 100644 --- a/app/views/api/v1/issues/_issue.json.jbuilder +++ b/app/views/api/v1/issues/_issue.json.jbuilder @@ -1,11 +1,11 @@ json.number issue.serial_id json.(issue, :title, :status) json.labels issue.labels do |label| - json.partial! 'label', :label => label + json.partial! 'label', label: label end json.assignee do - json.partial! 'api/v1/shared/member', :member => issue.assignee + json.partial! 'api/v1/shared/member', member: issue.assignee end if issue.assignee -json.url api_v1_project_issue_path(issue.project.id, issue.serial_id, :format => :json) +json.url api_v1_project_issue_path(issue.project.id, issue.serial_id, format: :json) diff --git a/app/views/api/v1/issues/index.json.jbuilder b/app/views/api/v1/issues/index.json.jbuilder index 9b43cc7be..e9145135e 100644 --- a/app/views/api/v1/issues/index.json.jbuilder +++ b/app/views/api/v1/issues/index.json.jbuilder @@ -1,10 +1,10 @@ json.issues @issues do |issue| - json.partial! 'issue', :issue => issue + json.partial! 'issue', issue: issue json.issue issue.body - json.partial! 'api/v1/shared/owner', :owner => issue.user + json.partial! 'api/v1/shared/owner', owner: issue.user json.closed_at issue.closed_at.to_i json.closed_by do - json.partial! 'api/v1/shared/member', :member => issue.closer + json.partial! 'api/v1/shared/member', member: issue.closer end if issue.closer json.created_at issue.created_at.to_i json.updated_at issue.updated_at.to_i diff --git a/app/views/api/v1/issues/show.json.jbuilder b/app/views/api/v1/issues/show.json.jbuilder index f9f7e8648..4649b8226 100644 --- a/app/views/api/v1/issues/show.json.jbuilder +++ b/app/views/api/v1/issues/show.json.jbuilder @@ -1,10 +1,10 @@ json.issue do - json.partial! 'issue', :issue => @issue + json.partial! 'issue', issue: @issue json.issue @issue.body - json.partial! 'api/v1/shared/owner', :owner => @issue.user + json.partial! 'api/v1/shared/owner', owner: @issue.user json.closed_at @issue.closed_at.to_i json.closed_by do - json.partial! 'api/v1/shared/member', :member => @issue.closer + json.partial! 'api/v1/shared/member', member: @issue.closer end if @issue.closer json.created_at @issue.created_at.to_i json.updated_at @issue.updated_at.to_i diff --git a/app/views/api/v1/maintainers/index.json.jbuilder b/app/views/api/v1/maintainers/index.json.jbuilder index e771a2d7a..d466c4d7f 100644 --- a/app/views/api/v1/maintainers/index.json.jbuilder +++ b/app/views/api/v1/maintainers/index.json.jbuilder @@ -1,15 +1,15 @@ json.maintainers @maintainers do |maintainer| json.project do - json.partial! 'api/v1/projects/project', :project => maintainer.project + json.partial! 'api/v1/projects/project', project: maintainer.project end json.package do - json.partial! 'package', :package => maintainer + json.partial! 'package', package: maintainer end json.maintainer do if user = maintainer.try(:assignee) - json.partial! 'maintainer', :maintainer => user + json.partial! 'maintainer', maintainer: user end end end diff --git a/app/views/api/v1/platforms/_platform.json.jbuilder b/app/views/api/v1/platforms/_platform.json.jbuilder index d16180771..a28a99d54 100644 --- a/app/views/api/v1/platforms/_platform.json.jbuilder +++ b/app/views/api/v1/platforms/_platform.json.jbuilder @@ -1,2 +1,2 @@ json.(platform, :id, :name) -json.url api_v1_platform_path(platform.id, :format => :json) \ No newline at end of file +json.url api_v1_platform_path(platform.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/platforms/index.json.jbuilder b/app/views/api/v1/platforms/index.json.jbuilder index 71fdd4976..4995ecda8 100644 --- a/app/views/api/v1/platforms/index.json.jbuilder +++ b/app/views/api/v1/platforms/index.json.jbuilder @@ -1,11 +1,11 @@ json.platforms @platforms do |platform| - json.partial! 'platform', :platform => platform + json.partial! 'platform', platform: platform json.(platform, :platform_type, :visibility) - json.partial! 'api/v1/shared/owner', :owner => platform.owner + json.partial! 'api/v1/shared/owner', owner: platform.owner json.repositories platform.repositories do |repo| json.(repo, :id, :name) - json.url api_v1_repository_path(repo.id, :format => :json) + json.url api_v1_repository_path(repo.id, format: :json) end end -json.url api_v1_platforms_path(:format => :json) +json.url api_v1_platforms_path(format: :json) diff --git a/app/views/api/v1/platforms/members.json.jbuilder b/app/views/api/v1/platforms/members.json.jbuilder index ec4eca437..d5dde228b 100644 --- a/app/views/api/v1/platforms/members.json.jbuilder +++ b/app/views/api/v1/platforms/members.json.jbuilder @@ -1,5 +1,5 @@ json.platform do - json.partial! 'platform', :platform => @platform + json.partial! 'platform', platform: @platform json.partial! 'api/v1/shared/members' end -json.url members_api_v1_platform_path(@platform.id, :format => :json) \ No newline at end of file +json.url members_api_v1_platform_path(@platform.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/platforms/show.json.jbuilder b/app/views/api/v1/platforms/show.json.jbuilder index b7dbb49a7..9c64cc7e9 100644 --- a/app/views/api/v1/platforms/show.json.jbuilder +++ b/app/views/api/v1/platforms/show.json.jbuilder @@ -1,14 +1,14 @@ json.platform do - json.partial! 'platform', :platform => @platform + json.partial! 'platform', platform: @platform json.(@platform, :description, :parent_platform_id, :released, :visibility, :platform_type, :distrib_type) json.created_at @platform.created_at.to_i json.updated_at @platform.updated_at.to_i - json.partial! 'api/v1/shared/owner', :owner => @platform.owner + json.partial! 'api/v1/shared/owner', owner: @platform.owner json.repositories @platform.repositories do |repo| json.(repo, :id, :name) - json.url api_v1_repository_path(repo.id, :format => :json) + json.url api_v1_repository_path(repo.id, format: :json) end json.products @platform.products do |product| - json.partial! 'api/v1/products/product', :product => product + json.partial! 'api/v1/products/product', product: product end end diff --git a/app/views/api/v1/product_build_lists/_product_build_list.json.jbuilder b/app/views/api/v1/product_build_lists/_product_build_list.json.jbuilder index 8dee48d37..42c63b639 100644 --- a/app/views/api/v1/product_build_lists/_product_build_list.json.jbuilder +++ b/app/views/api/v1/product_build_lists/_product_build_list.json.jbuilder @@ -1,4 +1,4 @@ json.(product_build_list, :id, :status, :time_living) json.notified_at product_build_list.updated_at -json.url api_v1_product_build_list_path(product_build_list, :format => :json) +json.url api_v1_product_build_list_path(product_build_list, format: :json) diff --git a/app/views/api/v1/product_build_lists/index.json.jbuilder b/app/views/api/v1/product_build_lists/index.json.jbuilder index 2af72653b..16919aa4c 100644 --- a/app/views/api/v1/product_build_lists/index.json.jbuilder +++ b/app/views/api/v1/product_build_lists/index.json.jbuilder @@ -1,6 +1,6 @@ json.product_build_lists @product_build_lists do |json, product_build_list| - json.partial! 'product_build_list', :product_build_list => product_build_list, :json => json + json.partial! 'product_build_list', product_build_list: product_build_list, json: json end -json.url api_v1_product_build_lists_path(:format => :json) +json.url api_v1_product_build_lists_path(format: :json) diff --git a/app/views/api/v1/product_build_lists/show.json.jbuilder b/app/views/api/v1/product_build_lists/show.json.jbuilder index 65e9a0524..dd094eb7a 100644 --- a/app/views/api/v1/product_build_lists/show.json.jbuilder +++ b/app/views/api/v1/product_build_lists/show.json.jbuilder @@ -1,15 +1,15 @@ json.product_build_list do |json| - json.partial! 'product_build_list', :product_build_list => @product_build_list, :json => json + json.partial! 'product_build_list', product_build_list: @product_build_list, json: json json.(@product_build_list, :commit_hash, :main_script, :params, :not_delete, :autostarted) json.product do |json_product| json.partial! 'api/v1/products/product', - :product => @product_build_list.product, :json => json_product + product: @product_build_list.product, json: json_product end json.project do |json_project| json.partial! 'api/v1/projects/project', - :project => @product_build_list.project, :json => json_project + project: @product_build_list.project, json: json_project end json.created_at @product_build_list.created_at.to_i diff --git a/app/views/api/v1/products/_product.json.jbuilder b/app/views/api/v1/products/_product.json.jbuilder index afb3907b9..3b52bcae0 100644 --- a/app/views/api/v1/products/_product.json.jbuilder +++ b/app/views/api/v1/products/_product.json.jbuilder @@ -1,3 +1,3 @@ json.(product, :id, :name, :description, :main_script, :params, :time_living, :autostart_status) -json.url api_v1_product_path(product, :format => :json) +json.url api_v1_product_path(product, format: :json) diff --git a/app/views/api/v1/products/show.json.jbuilder b/app/views/api/v1/products/show.json.jbuilder index f74a1a0a8..ae5337488 100644 --- a/app/views/api/v1/products/show.json.jbuilder +++ b/app/views/api/v1/products/show.json.jbuilder @@ -1,11 +1,11 @@ json.product do - json.partial! 'product', :product => @product + json.partial! 'product', product: @product json.platform do - json.partial! 'api/v1/platforms/platform', :platform => @product.platform + json.partial! 'api/v1/platforms/platform', platform: @product.platform end if @product.project.present? json.project do - json.partial! 'api/v1/projects/project', :project => @product.project + json.partial! 'api/v1/projects/project', project: @product.project end end json.created_at @product.created_at.to_i diff --git a/app/views/api/v1/projects/_project.json.jbuilder b/app/views/api/v1/projects/_project.json.jbuilder index 2e05cc048..3a336cfe9 100644 --- a/app/views/api/v1/projects/_project.json.jbuilder +++ b/app/views/api/v1/projects/_project.json.jbuilder @@ -1,4 +1,4 @@ json.(project, :id, :name) json.fullname project.name_with_owner -json.url api_v1_project_path(project.id, :format => :json) +json.url api_v1_project_path(project.id, format: :json) json.git_url git_repo_url(project.name_with_owner) diff --git a/app/views/api/v1/projects/get_id.json.jbuilder b/app/views/api/v1/projects/get_id.json.jbuilder index 6dd156f60..d134c3870 100644 --- a/app/views/api/v1/projects/get_id.json.jbuilder +++ b/app/views/api/v1/projects/get_id.json.jbuilder @@ -1,5 +1,5 @@ json.project do - json.partial! 'project', :project => @project + json.partial! 'project', project: @project json.(@project, :visibility) - json.partial! 'api/v1/shared/owner', :owner => @project.owner + json.partial! 'api/v1/shared/owner', owner: @project.owner end diff --git a/app/views/api/v1/projects/index.json.jbuilder b/app/views/api/v1/projects/index.json.jbuilder index b6d4296c8..b141b59a7 100644 --- a/app/views/api/v1/projects/index.json.jbuilder +++ b/app/views/api/v1/projects/index.json.jbuilder @@ -1,9 +1,9 @@ json.projects @projects do |project| - json.partial! 'project', :project => project + json.partial! 'project', project: project json.(project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) json.created_at project.created_at.to_i json.updated_at project.updated_at.to_i - json.partial! 'api/v1/shared/owner', :owner => project.owner + json.partial! 'api/v1/shared/owner', owner: project.owner end -json.url api_v1_projects_path(:format => :json) \ No newline at end of file +json.url api_v1_projects_path(format: :json) \ No newline at end of file diff --git a/app/views/api/v1/projects/members.json.jbuilder b/app/views/api/v1/projects/members.json.jbuilder index d237705f9..32f1c07bd 100644 --- a/app/views/api/v1/projects/members.json.jbuilder +++ b/app/views/api/v1/projects/members.json.jbuilder @@ -1,5 +1,5 @@ json.project do - json.partial! 'project', :project => @project + json.partial! 'project', project: @project json.partial! 'api/v1/shared/members' end -json.url members_api_v1_project_path(@project.id, :format => :json) \ No newline at end of file +json.url members_api_v1_project_path(@project.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/projects/refs_list.json.jbuilder b/app/views/api/v1/projects/refs_list.json.jbuilder index b41dacba7..557a449b6 100644 --- a/app/views/api/v1/projects/refs_list.json.jbuilder +++ b/app/views/api/v1/projects/refs_list.json.jbuilder @@ -5,4 +5,4 @@ json.refs_list @refs do |grit| json.sha grit.commit.id end end -json.url refs_list_api_v1_project_path(@project.id, :format => :json) \ No newline at end of file +json.url refs_list_api_v1_project_path(@project.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/projects/show.json.jbuilder b/app/views/api/v1/projects/show.json.jbuilder index b820cf415..dfd1c3689 100644 --- a/app/views/api/v1/projects/show.json.jbuilder +++ b/app/views/api/v1/projects/show.json.jbuilder @@ -1,11 +1,11 @@ json.project do - json.partial! 'project', :project => @project + json.partial! 'project', project: @project json.(@project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :publish_i686_into_x86_64) json.created_at @project.created_at.to_i json.updated_at @project.updated_at.to_i - json.partial! 'api/v1/shared/owner', :owner => @project.owner + json.partial! 'api/v1/shared/owner', owner: @project.owner json.maintainer do - json.partial! 'api/v1/shared/member', :member => @project.maintainer + json.partial! 'api/v1/shared/member', member: @project.maintainer end json.project_statistics @project.project_statistics do |statistic| @@ -14,10 +14,10 @@ json.project do json.repositories @project.repositories do |repo| json.(repo, :id, :name) - json.url api_v1_repository_path(repo.name, :format => :json) + json.url api_v1_repository_path(repo.name, format: :json) json.platform do json.(repo.platform, :id, :name) - json.url api_v1_platform_path(repo.platform, :format => :json) + json.url api_v1_platform_path(repo.platform, format: :json) end end end \ No newline at end of file diff --git a/app/views/api/v1/pull_requests/_pull.json.jbuilder b/app/views/api/v1/pull_requests/_pull.json.jbuilder index fbe7fb555..8337a2068 100644 --- a/app/views/api/v1/pull_requests/_pull.json.jbuilder +++ b/app/views/api/v1/pull_requests/_pull.json.jbuilder @@ -4,21 +4,21 @@ json.to_ref do json.ref pull.to_ref json.sha pull.to_commit.try(:id) json.project do - json.partial! 'api/v1/projects/project', :project => pull.to_project + json.partial! 'api/v1/projects/project', project: pull.to_project end end json.from_ref do json.ref pull.from_ref json.sha pull.from_commit.try(:id) json.project do - json.partial! 'api/v1/projects/project', :project => pull.from_project + json.partial! 'api/v1/projects/project', project: pull.from_project end end -json.partial! 'api/v1/shared/owner', :owner => pull.user +json.partial! 'api/v1/shared/owner', owner: pull.user json.assignee do - json.partial! 'api/v1/shared/member', :member => pull.issue.assignee + json.partial! 'api/v1/shared/member', member: pull.issue.assignee end if pull.issue.assignee json.mergeable pull.can_merging? json.merged_at pull.issue.closed_at.to_i if pull.merged? -json.url api_v1_project_pull_request_path(pull.to_project.id, pull.id, :format => :json) +json.url api_v1_project_pull_request_path(pull.to_project.id, pull.id, format: :json) diff --git a/app/views/api/v1/pull_requests/commits.json.jbuilder b/app/views/api/v1/pull_requests/commits.json.jbuilder index 6ce77453d..2de2932b1 100644 --- a/app/views/api/v1/pull_requests/commits.json.jbuilder +++ b/app/views/api/v1/pull_requests/commits.json.jbuilder @@ -22,4 +22,4 @@ json.commits @commits do |commit| end end -json.url commits_api_v1_project_pull_request_path(:format => :json) +json.url commits_api_v1_project_pull_request_path(format: :json) diff --git a/app/views/api/v1/pull_requests/files.json.jbuilder b/app/views/api/v1/pull_requests/files.json.jbuilder index cc7fcbeee..c2e94fff5 100644 --- a/app/views/api/v1/pull_requests/files.json.jbuilder +++ b/app/views/api/v1/pull_requests/files.json.jbuilder @@ -21,4 +21,4 @@ json.files @stats do |stat| json.raw_https_url raw_path(@project, commit_id, diff.b_path) end -json.url files_api_v1_project_pull_request_path(:format => :json) +json.url files_api_v1_project_pull_request_path(format: :json) diff --git a/app/views/api/v1/pull_requests/index.json.jbuilder b/app/views/api/v1/pull_requests/index.json.jbuilder index df3fb3381..b37e26879 100644 --- a/app/views/api/v1/pull_requests/index.json.jbuilder +++ b/app/views/api/v1/pull_requests/index.json.jbuilder @@ -1,5 +1,5 @@ json.pull_requests @pulls do |pull| - json.partial! 'pull', :pull => pull + json.partial! 'pull', pull: pull end json.url @pulls_url diff --git a/app/views/api/v1/pull_requests/show.json.jbuilder b/app/views/api/v1/pull_requests/show.json.jbuilder index c388af95e..d4882284f 100644 --- a/app/views/api/v1/pull_requests/show.json.jbuilder +++ b/app/views/api/v1/pull_requests/show.json.jbuilder @@ -1,5 +1,5 @@ json.pull_request do - json.partial! 'pull', :pull => @pull + json.partial! 'pull', pull: @pull json.body @pull.body json.closed_at @pull.issue.closed_at.to_i if @pull.merged? || @pull.closed? diff --git a/app/views/api/v1/repositories/_repository.json.jbuilder b/app/views/api/v1/repositories/_repository.json.jbuilder index ecd0ec545..d179617aa 100644 --- a/app/views/api/v1/repositories/_repository.json.jbuilder +++ b/app/views/api/v1/repositories/_repository.json.jbuilder @@ -1,2 +1,2 @@ json.(repository, :id, :name) -json.url api_v1_repository_path(repository.id, :format => :json) \ No newline at end of file +json.url api_v1_repository_path(repository.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/repositories/key_pair.json.jbuilder b/app/views/api/v1/repositories/key_pair.json.jbuilder index ea474b812..0f908751f 100644 --- a/app/views/api/v1/repositories/key_pair.json.jbuilder +++ b/app/views/api/v1/repositories/key_pair.json.jbuilder @@ -1,5 +1,5 @@ json.repository do - json.partial! 'repository', :repository => @repository + json.partial! 'repository', repository: @repository json.key_pair do if @repository.key_pair json.(@repository.key_pair, :public, :secret) diff --git a/app/views/api/v1/repositories/projects.json.jbuilder b/app/views/api/v1/repositories/projects.json.jbuilder index cafc750f3..6bcf01394 100644 --- a/app/views/api/v1/repositories/projects.json.jbuilder +++ b/app/views/api/v1/repositories/projects.json.jbuilder @@ -1,7 +1,7 @@ json.repository do - json.partial! 'repository', :repository => @repository + json.partial! 'repository', repository: @repository json.projects @projects do |project| - json.partial! 'api/v1/projects/project', :project => project + json.partial! 'api/v1/projects/project', project: project end end -json.url projects_api_v1_repository_path(@repository.id, :format => :json) \ No newline at end of file +json.url projects_api_v1_repository_path(@repository.id, format: :json) \ No newline at end of file diff --git a/app/views/api/v1/repositories/show.json.jbuilder b/app/views/api/v1/repositories/show.json.jbuilder index 7dd9ec1f3..1fea4696e 100644 --- a/app/views/api/v1/repositories/show.json.jbuilder +++ b/app/views/api/v1/repositories/show.json.jbuilder @@ -1,10 +1,10 @@ json.repository do - json.partial! 'repository', :repository => @repository + json.partial! 'repository', repository: @repository json.(@repository, :description, :publish_without_qa) json.created_at @repository.created_at.to_i json.updated_at @repository.updated_at.to_i json.platform do json.(@repository.platform, :id, :name) - json.url api_v1_platform_path(@repository.platform, :format => :json) + json.url api_v1_platform_path(@repository.platform, format: :json) end end \ No newline at end of file diff --git a/app/views/api/v1/search/_groups.json.jbuilder b/app/views/api/v1/search/_groups.json.jbuilder index a0e8f8ff5..f69702347 100644 --- a/app/views/api/v1/search/_groups.json.jbuilder +++ b/app/views/api/v1/search/_groups.json.jbuilder @@ -1,3 +1,3 @@ json.groups results do |group| - json.partial! 'member', :member => group + json.partial! 'member', member: group end \ No newline at end of file diff --git a/app/views/api/v1/search/_platforms.json.jbuilder b/app/views/api/v1/search/_platforms.json.jbuilder index 5d708234e..0894173a7 100644 --- a/app/views/api/v1/search/_platforms.json.jbuilder +++ b/app/views/api/v1/search/_platforms.json.jbuilder @@ -1,3 +1,3 @@ json.platforms results do |platform| - json.partial! 'api/v1/platforms/platform', :platform => platform + json.partial! 'api/v1/platforms/platform', platform: platform end \ No newline at end of file diff --git a/app/views/api/v1/search/_projects.json.jbuilder b/app/views/api/v1/search/_projects.json.jbuilder index 37935c367..5a5449ecf 100644 --- a/app/views/api/v1/search/_projects.json.jbuilder +++ b/app/views/api/v1/search/_projects.json.jbuilder @@ -1,3 +1,3 @@ json.projects results do |project| - json.partial! 'api/v1/projects/project', :project => project + json.partial! 'api/v1/projects/project', project: project end \ No newline at end of file diff --git a/app/views/api/v1/search/_users.json.jbuilder b/app/views/api/v1/search/_users.json.jbuilder index 714a1e4ed..412f6ceb7 100644 --- a/app/views/api/v1/search/_users.json.jbuilder +++ b/app/views/api/v1/search/_users.json.jbuilder @@ -1,3 +1,3 @@ json.users results do |user| - json.partial! 'member', :member => user + json.partial! 'member', member: user end \ No newline at end of file diff --git a/app/views/api/v1/search/index.json.jbuilder b/app/views/api/v1/search/index.json.jbuilder index f6afacba6..a5417385c 100644 --- a/app/views/api/v1/search/index.json.jbuilder +++ b/app/views/api/v1/search/index.json.jbuilder @@ -1,6 +1,6 @@ json.results do @results.each do |tag, results| - json.partial! tag.dup, :results => results + json.partial! tag.dup, results: results end end -json.url api_v1_search_index_path(:format => :json) \ No newline at end of file +json.url api_v1_search_index_path(format: :json) \ No newline at end of file diff --git a/app/views/api/v1/shared/_members.json.jbuilder b/app/views/api/v1/shared/_members.json.jbuilder index a930a9db1..a8f88ac5a 100644 --- a/app/views/api/v1/shared/_members.json.jbuilder +++ b/app/views/api/v1/shared/_members.json.jbuilder @@ -1,3 +1,3 @@ json.members @members do |member| - json.partial! 'api/v1/shared/member', :member => member + json.partial! 'api/v1/shared/member', member: member end \ No newline at end of file diff --git a/app/views/api/v1/shared/_owner.json.jbuilder b/app/views/api/v1/shared/_owner.json.jbuilder index 9b34683b5..8ff97759b 100644 --- a/app/views/api/v1/shared/_owner.json.jbuilder +++ b/app/views/api/v1/shared/_owner.json.jbuilder @@ -1,3 +1,3 @@ json.owner do - json.partial! 'api/v1/shared/member', :member => owner + json.partial! 'api/v1/shared/member', member: owner end \ No newline at end of file diff --git a/app/views/api/v1/users/show.json.jbuilder b/app/views/api/v1/users/show.json.jbuilder index 086afbb6b..ef970de13 100644 --- a/app/views/api/v1/users/show.json.jbuilder +++ b/app/views/api/v1/users/show.json.jbuilder @@ -3,7 +3,7 @@ json.user do json.created_at @user.created_at.to_i json.updated_at @user.updated_at.to_i json.avatar_url avatar_url(@user,:big) - json.url api_v1_user_path(@user.id, :format => :json) + json.url api_v1_user_path(@user.id, format: :json) json.html_url user_path(@user.uname) json.(@user, :role) if action_name == 'show_current_user' end \ No newline at end of file diff --git a/app/views/contacts/new.html.haml b/app/views/contacts/new.html.haml index 4a62c5780..671580dc1 100644 --- a/app/views/contacts/new.html.haml +++ b/app/views/contacts/new.html.haml @@ -1,4 +1,4 @@ -- set_meta_tags :title => t('layout.contact.page_header') +- set_meta_tags title: t('layout.contact.page_header') %h1= t("layout.contact.header") %p= t("layout.contact.subheader") @@ -7,34 +7,34 @@ .inner-columns.equal %section.first %div - = form_for @form, :url => contact_path, :html => {:class => 'inline_errors'} do |f| + = form_for @form, url: contact_path, html: {class: 'inline_errors'} do |f| %dl.form %dt= f.label :name, t("activerecord.attributes.user.name") %dd - = f.text_field :name, :placeholder => t("layout.contact.placeholders.name"), - :class => @form.errors.messages[:name].present? ? 'error' : '' + = f.text_field :name, placeholder: t("layout.contact.placeholders.name"), + class: @form.errors.messages[:name].present? ? 'error' : '' %dl.form %dt= f.label :email, t("activerecord.attributes.user.email") %dd - = f.text_field :email, :placeholder => t("layout.contact.placeholders.email"), - :class => @form.errors.messages[:email].present? ? 'error' : '' + = f.text_field :email, placeholder: t("layout.contact.placeholders.email"), + class: @form.errors.messages[:email].present? ? 'error' : '' %dl.form %dt= f.label :subject, t("layout.contact.subject") %dd - = f.text_field :subject, :placeholder => t("layout.contact.placeholders.subject"), - :class => @form.errors.messages[:subject].present? ? 'error' : '' + = f.text_field :subject, placeholder: t("layout.contact.placeholders.subject"), + class: @form.errors.messages[:subject].present? ? 'error' : '' %dl.form %dt= f.label :message, t("layout.contact.message") %dd - = f.text_area :message, :placeholder => t("layout.contact.placeholders.message"), - :class => @form.errors.messages[:message].present? ? 'error' : '' + = f.text_area :message, placeholder: t("layout.contact.placeholders.message"), + class: @form.errors.messages[:message].present? ? 'error' : '' .form-actions - = f.submit t('layout.contact.send_request'), :class => 'button', :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.contact.send_request'), class: 'button', data: {'disable-with' => t('layout.processing')} %section.last %div diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index 4331a6dee..b4fa14592 100644 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -7,17 +7,17 @@ - messages = resource.errors.full_messages.map { |msg| content_tag(:p, msg) }.join.html_safe = messages - = form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, :class => "form" }) do |f| + = 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" + = f.label :email, class: "label" .right - = f.text_field :email, :class => "text_field" + = f.text_field :email, class: "text_field" .group.navform.wat-cf - %button.button{:tyle => "submit"} - = image_tag("choose.png", :alt => t("devise.confirmations.send")) + %button.button{tyle: "submit"} + = image_tag("choose.png", alt: t("devise.confirmations.send")) = t("devise.confirmations.send") %span.text_button_padding = render "devise/shared/links" \ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.en.haml b/app/views/devise/mailer/confirmation_instructions.en.haml index 2a423bfe0..398c38d2b 100644 --- a/app/views/devise/mailer/confirmation_instructions.en.haml +++ b/app/views/devise/mailer/confirmation_instructions.en.haml @@ -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: @resource.confirmation_token) %br %p== Support team «ROSA ABF» diff --git a/app/views/devise/mailer/confirmation_instructions.ru.haml b/app/views/devise/mailer/confirmation_instructions.ru.haml index 276661d93..167378049 100644 --- a/app/views/devise/mailer/confirmation_instructions.ru.haml +++ b/app/views/devise/mailer/confirmation_instructions.ru.haml @@ -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: @resource.confirmation_token) %br %p== Команда поддержки «ROSA ABF» diff --git a/app/views/devise/mailer/reset_password_instructions.en.haml b/app/views/devise/mailer/reset_password_instructions.en.haml index 4cfb92a68..0dc18ebde 100644 --- a/app/views/devise/mailer/reset_password_instructions.en.haml +++ b/app/views/devise/mailer/reset_password_instructions.en.haml @@ -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: @resource.reset_password_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 diff --git a/app/views/devise/mailer/reset_password_instructions.ru.haml b/app/views/devise/mailer/reset_password_instructions.ru.haml index 62cd4d724..e89020a59 100644 --- a/app/views/devise/mailer/reset_password_instructions.ru.haml +++ b/app/views/devise/mailer/reset_password_instructions.ru.haml @@ -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: @resource.reset_password_token) %p Пожалуйста, проигнорируйте это письмо, если оно попало к Вам по ошибке. %p Ваш пароль не поменяется, пока вы не перейдете по ссылке и не создадите новый. %br diff --git a/app/views/devise/mailer/unlock_instructions.en.haml b/app/views/devise/mailer/unlock_instructions.en.haml index b62c054fd..39526c551 100644 --- a/app/views/devise/mailer/unlock_instructions.en.haml +++ b/app/views/devise/mailer/unlock_instructions.en.haml @@ -2,6 +2,6 @@ Hello #{@resource.email}! %p Your account has been locked due to an excessive amount of unsuccessful sign in attempts. %p Click the link below to unlock your account: -%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) +%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token) %br %p== Support team «ROSA ABF» diff --git a/app/views/devise/mailer/unlock_instructions.ru.haml b/app/views/devise/mailer/unlock_instructions.ru.haml index a936b0419..aec244164 100644 --- a/app/views/devise/mailer/unlock_instructions.ru.haml +++ b/app/views/devise/mailer/unlock_instructions.ru.haml @@ -2,6 +2,6 @@ Здравствуйте, #{@resource.email}! %p Ваш аккаунт был заблокирован из-за слишком большого количества неудачных попыток авторизации. %p Пожалуйста, перейдите по ссылке ниже, чтобы разблокировать Ваш аккаунт: -%p= link_to 'Разблокировать мой аккаунт', unlock_url(@resource, :unlock_token => @resource.unlock_token) +%p= link_to 'Разблокировать мой аккаунт', unlock_url(@resource, unlock_token: @resource.unlock_token) %br %p== Команда поддержки «ROSA ABF» diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index c6c230c64..d80104e34 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,6 +1,6 @@ .wrap %nav - %a{:href => new_register_request_path} + %a{href: new_register_request_path} %p=t("layout.devise.shared_links.sign_up") %header .logo @@ -11,17 +11,17 @@ .content - password_error, reset_password_token_error = getDeviseErrors(:password, :reset_password_token) - = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, :class => "form" }) do |f| + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "form" }) do |f| = f.hidden_field :reset_password_token .left.first=t('activerecord.attributes.user.password') .right.first - = f.password_field :password, :id => 'password', :class => "registartion-input #{password_error ? 'registartion-input-error' : ''}" + = f.password_field :password, id: 'password', class: "registartion-input #{password_error ? 'registartion-input-error' : ''}" .both .left=t('activerecord.attributes.user.password_confirm') .right - = f.password_field :password_confirmation, :id => 'password2', :class => "registartion-input #{password_error ? 'registartion-input-error' : ''}" + = f.password_field :password_confirmation, id: 'password2', class: "registartion-input #{password_error ? 'registartion-input-error' : ''}" .both %br - =f.submit t("devise.passwords.edit_button"), :class => 'button', :id => 'btnLogin' + =f.submit t("devise.passwords.edit_button"), class: 'button', id: 'btnLogin' =showDeviseHintError(:password, password_error, 'reset') diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 6f0733103..c0eba041c 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,6 +1,6 @@ .wrap %nav - %a{:href => new_register_request_path} + %a{href: new_register_request_path} %p=t("layout.devise.shared_links.sign_up") / Top block %header @@ -17,8 +17,8 @@ - messages = resource.errors.full_messages.map { |msg| content_tag(:p, msg) }.join.html_safe = messages - = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => "form" }) do |f| - = f.text_field :login, :name => 'user[email]', :class => "registartion-input", :onblur => "if(this.value==''){this.value='#{t('activerecord.attributes.user.email')}';this.className='registartion-input';} else{this.className='registartion-input-no-focus';};", :onfocus => "if(this.value=='#{t('activerecord.attributes.user.email')}'){this.value='';this.className='registartion-input-focus';};", :value => t('activerecord.attributes.user.email') + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: "form" }) do |f| + = f.text_field :login, name: 'user[email]', class: "registartion-input", onblur: "if(this.value==''){this.value='#{t('activerecord.attributes.user.email')}';this.className='registartion-input';} else{this.className='registartion-input-no-focus';};", onfocus: "if(this.value=='#{t('activerecord.attributes.user.email')}'){this.value='';this.className='registartion-input-focus';};", value: t('activerecord.attributes.user.email') .both %br - =f.submit t("devise.passwords.send"), :class => 'button', :id => 'btnLogin' + =f.submit t("devise.passwords.send"), class: 'button', id: 'btnLogin' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 4dd7b02d0..7899fc6d2 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -5,35 +5,35 @@ / Page - uname_error, name_error, email_error, password_error = getDeviseErrors(:uname, :name, :email, :password) %article - = form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "form" }) do |f| + = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "form" }) do |f| = hidden_field_tag :invitation_token, @invitation_token - = f.password_field :password, :name => 'password', :style => 'display: none;' + = f.password_field :password, name: 'password', style: 'display: none;' .left.first=t('activerecord.attributes.user.uname') .right.first - = f.text_field :uname, :id => 'login', :class => "registartion-input #{uname_error ? 'registartion-input-error' : ''}" + = f.text_field :uname, id: 'login', class: "registartion-input #{uname_error ? 'registartion-input-error' : ''}" .both .left=t('activerecord.attributes.user.name') .right - = f.text_field :name, :id => 'name', :class => "registartion-input #{name_error ? 'registartion-input-error' : ''}" + = f.text_field :name, id: 'name', class: "registartion-input #{name_error ? 'registartion-input-error' : ''}" .both .left=t('activerecord.attributes.user.email') .right - klass = "registartion-input #{email_error ? 'registartion-input-error' : ''}" - if APP_CONFIG['preregistration'] - = f.text_field :email, :id => 'email', :readonly => 'readonly', :class => klass + = f.text_field :email, id: 'email', readonly: 'readonly', class: klass - else - = f.text_field :email, :id => 'email', :class => 'registartion-input', :class => klass + = f.text_field :email, id: 'email', class: 'registartion-input', class: klass .both .left=t('activerecord.attributes.user.password') .right - = f.password_field :password, :id => 'password', :class => "registartion-input #{password_error ? 'registartion-input-error' : ''}" + = f.password_field :password, id: 'password', class: "registartion-input #{password_error ? 'registartion-input-error' : ''}" .both .left=t('activerecord.attributes.user.password_confirm') .right - = f.password_field :password_confirmation, :id => 'password2', :class => "registartion-input #{password_error ? 'registartion-input-error' : ''}" + = f.password_field :password_confirmation, id: 'password2', class: "registartion-input #{password_error ? 'registartion-input-error' : ''}" .both .in - =f.submit t("layout.devise.shared_links.sign_up"), :class => 'button', :id => 'btnLogin' + =f.submit t("layout.devise.shared_links.sign_up"), class: 'button', id: 'btnLogin' .both = hidden_field_tag :recaptcha_challenge_field = hidden_field_tag :recaptcha_response_field, 'manual_challenge' diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 1598f8dcf..420499116 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,6 +1,6 @@ .wrap %nav - %a{:href => new_register_request_path} + %a{href: new_register_request_path} %p=t("layout.devise.shared_links.sign_up") / Top block %header @@ -13,20 +13,20 @@ - login = t('devise.sessions.login'); password = t('devise.sessions.password') =hidden_field_tag :login_default, login =hidden_field_tag :password_default, password - = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "form login" }) do |f| + = form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "form login" }) do |f| %h1= title t("layout.sessions.sign_in_header") - = f.text_field :login, :class => "registartion-input #{error ? "registartion-input-error" : ''}", :value => login + = f.text_field :login, class: "registartion-input #{error ? "registartion-input-error" : ''}", value: login %br/ - = f.password_field :password, :class => "registartion-input #{error ? "registartion-input-error" : ''}", :value => password + = f.password_field :password, class: "registartion-input #{error ? "registartion-input-error" : ''}", value: password %br/ .registration .remember .check - %span#niceCheckbox1.niceCheck{:style => 'background-position: 0px -18px;'} - = f.check_box :remember_me, :checked => true + %span#niceCheckbox1.niceCheck{style: 'background-position: 0px -18px;'} + = f.check_box :remember_me, checked: true .text=t('devise.sessions.remember_me') - .in=f.submit t('layout.devise.shared_links.sign_in'), :class => 'button', :id => 'btnLogin' - %div{:style => "clear: both;"} + .in=f.submit t('layout.devise.shared_links.sign_in'), class: 'button', id: 'btnLogin' + %div{style: "clear: both;"} = render 'devise/shared/providers' .forgot .password diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml index 3ae0900da..a5bf50157 100644 --- a/app/views/devise/shared/_links.haml +++ b/app/views/devise/shared/_links.haml @@ -1,14 +1,14 @@ - if controller_name != 'sessions' - = link_to t("layout.devise.shared_links.sign_in"), new_session_path(resource_name), :class => "text_button_padding link_button" + = link_to t("layout.devise.shared_links.sign_in"), new_session_path(resource_name), class: "text_button_padding link_button" - if devise_mapping.registerable? && controller_name != 'registrations' - =# link_to t("layout.devise.shared_links.sign_up"), new_registration_path(resource_name), :class => "text_button_padding link_button" - = link_to t("layout.devise.shared_links.sign_up"), new_register_request_path, :class => "text_button_padding link_button" # to prereg form + =# link_to t("layout.devise.shared_links.sign_up"), new_registration_path(resource_name), class: "text_button_padding link_button" + = link_to t("layout.devise.shared_links.sign_up"), new_register_request_path, class: "text_button_padding link_button" # to prereg form - if devise_mapping.recoverable? && controller_name != 'passwords' - = link_to t("layout.devise.shared_links.forgot_password"), new_password_path(resource_name), :class => "text_button_padding link_button" + = link_to t("layout.devise.shared_links.forgot_password"), new_password_path(resource_name), class: "text_button_padding link_button" - if devise_mapping.confirmable? && controller_name != 'confirmations' - = link_to t("layout.devise.shared_links.confirm_again"), new_confirmation_path(resource_name), :class => "text_button_padding link_button" + = link_to t("layout.devise.shared_links.confirm_again"), new_confirmation_path(resource_name), class: "text_button_padding link_button" - if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' - = link_to t("layout.devise.shared_links.unlock"), new_unlock_path(resource_name), :class => "text_button_padding link_button" + = link_to t("layout.devise.shared_links.unlock"), new_unlock_path(resource_name), class: "text_button_padding link_button" -# if devise_mapping.omniauthable? - resource_class.omniauth_providers.each do |provider| - = link_to t("layout.devise.shared_links.sign_in_through", :provider => provider.to_s.classify), omniauth_authorize_path(resource_name, provider), :class => "text_button_padding link_button" + = link_to t("layout.devise.shared_links.sign_in_through", provider: provider.to_s.classify), omniauth_authorize_path(resource_name, provider), class: "text_button_padding link_button" diff --git a/app/views/devise/shared/_providers.haml b/app/views/devise/shared/_providers.haml index d173f01d0..6e5e0e711 100644 --- a/app/views/devise/shared/_providers.haml +++ b/app/views/devise/shared/_providers.haml @@ -7,5 +7,5 @@ - resource_class.omniauth_providers.each do |provider| = link_to omniauth_authorize_path(resource_name, provider) do - provider = provider.to_s.gsub(/_oauth2/,'') - = image_tag("#{provider}.png", :alt => provider, :class => provider) + = image_tag("#{provider}.png", alt: provider, class: provider) .both \ No newline at end of file diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml index 15a031a7c..2055e8717 100644 --- a/app/views/devise/unlocks/new.html.haml +++ b/app/views/devise/unlocks/new.html.haml @@ -1,5 +1,5 @@ %h2 Resend unlock instructions -= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| += form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| = devise_error_messages! %p = f.label :email diff --git a/app/views/feedback_mailer/feedback_form_send.html.haml b/app/views/feedback_mailer/feedback_form_send.html.haml index 4b022eb0f..fe97535ca 100644 --- a/app/views/feedback_mailer/feedback_form_send.html.haml +++ b/app/views/feedback_mailer/feedback_form_send.html.haml @@ -1,7 +1,7 @@ !!! %html %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"} + %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} %body = simple_format @data.message_with_links diff --git a/app/views/groups/base/_sidebar.html.haml b/app/views/groups/base/_sidebar.html.haml index 0cf0595b0..7c09f6192 100644 --- a/app/views/groups/base/_sidebar.html.haml +++ b/app/views/groups/base/_sidebar.html.haml @@ -6,8 +6,8 @@ .admin-preferences %ul - if can? :edit, @group - %li{:class => (act == :edit && contr == :profile) ? 'active' : ''} + %li{class: (act == :edit && contr == :profile) ? 'active' : ''} = link_to t("layout.groups.edit"), edit_group_path(@group) - if can? :manage_members, @group - %li{:class => (act == :index && contr == :members) ? 'active' : ''} - = link_to t("layout.groups.edit_members"), group_members_path(@group) + %li{class: (act == :index && contr == :members) ? 'active' : ''} + = link_to t("layout.groups.edit_members"), group_members_path(@group) diff --git a/app/views/groups/members/index.html.haml b/app/views/groups/members/index.html.haml index dc65e3463..c01b4bc47 100644 --- a/app/views/groups/members/index.html.haml +++ b/app/views/groups/members/index.html.haml @@ -1,13 +1,13 @@ --set_meta_tags :title => [title_object(@group), t('layout.groups.members')] -= form_tag group_members_path(@group), :id => 'members_form', :delete_url => remove_group_members_path(@group) do +-set_meta_tags title: [title_object(@group), t('layout.groups.members')] += form_tag group_members_path(@group), id: 'members_form', delete_url: remove_group_members_path(@group) do = hidden_field_tag "_method", "post" - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th \  %th= t("layout.collaborators.members") - %th{:colspan => "3"}= t("layout.collaborators.roles") + %th{colspan: "3"}= t("layout.collaborators.roles") %tbody - (parent.members - [parent.owner]).each do |user| %tr @@ -18,9 +18,9 @@ .forimg= link_to user.fullname, user_path(user) - Relation::ROLES.each_with_index do |role, i| %td - .radio= radio_button_tag "user[#{user.id}]", role, ((parent.actors.exists? :actor_id => user.id, :actor_type => 'User', :role => role) ? :checked : nil), :class => 'niceRadio' + .radio= radio_button_tag "user[#{user.id}]", role, ((parent.actors.exists? actor_id: user.id, actor_type: 'User', role: role) ? :checked : nil), class: 'niceRadio' .forradio= t("layout.collaborators.role_names.#{ role }") - = link_to_function t("layout.delete"), "deleteAdminMember();", :class => 'button' + = link_to_function t("layout.delete"), "deleteAdminMember();", class: 'button' .both .hr.top @@ -30,10 +30,10 @@ .lineForm= select_tag 'role', options_for_collaborators_roles_select .both %br - = submit_tag t('layout.add'), :class => 'button', :data => {'disable-with' => t('layout.processing')} + = submit_tag t('layout.add'), class: 'button', data: {'disable-with' => t('layout.processing')} .hr.bottom .both -= link_to_function t("layout.save"), "saveAdminMember();", :class => 'button' += link_to_function t("layout.save"), "saveAdminMember();", class: 'button' - content_for :sidebar, render('sidebar') diff --git a/app/views/groups/profile/_form.html.haml b/app/views/groups/profile/_form.html.haml index db6b6a95f..7925ba609 100644 --- a/app/views/groups/profile/_form.html.haml +++ b/app/views/groups/profile/_form.html.haml @@ -1,16 +1,16 @@ - act = controller.action_name.to_sym - if [:new, :create].include? act - .leftlist= f.label :uname, t("activerecord.attributes.group.uname"), :class => :label + .leftlist= f.label :uname, t("activerecord.attributes.group.uname"), class: :label .rightlist.nomargin= f.text_field :uname .both %br -.leftlist= f.label :description, t("activerecord.attributes.group.description"), :class => :label +.leftlist= f.label :description, t("activerecord.attributes.group.description"), class: :label .rightlist.nomargin= f.text_area :description .both %br -= render 'shared/avatar_form', :subject => @group, :f => f += render 'shared/avatar_form', subject: @group, f: f %br .leftlist \  -.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} +.rightlist= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} .both diff --git a/app/views/groups/profile/edit.html.haml b/app/views/groups/profile/edit.html.haml index e4846961f..077b4dbee 100644 --- a/app/views/groups/profile/edit.html.haml +++ b/app/views/groups/profile/edit.html.haml @@ -1,6 +1,6 @@ --set_meta_tags :title => [title_object(@group), t('layout.groups.edit')] -= form_for @group, :url => profile_group_path(@group) do |f| - = render "form", :f => f +-set_meta_tags title: [title_object(@group), t('layout.groups.edit')] += form_for @group, url: profile_group_path(@group) do |f| + = render "form", f: f .hr .groups-profile= image_tag('code.png') @@ -9,7 +9,7 @@ .hr .leftside= t("layout.groups.delete_warning") .rightside - = link_to t("layout.delete"), profile_group_path(@group), :method => :delete, :confirm => t("layout.groups.confirm_delete"), :class => 'button' if can? :destroy, @group + = link_to t("layout.delete"), profile_group_path(@group), method: :delete, confirm: t("layout.groups.confirm_delete"), class: 'button' if can? :destroy, @group .both - content_for :sidebar, render('sidebar') diff --git a/app/views/groups/profile/index.html.haml b/app/views/groups/profile/index.html.haml index ab3b12855..1b7a839cf 100644 --- a/app/views/groups/profile/index.html.haml +++ b/app/views/groups/profile/index.html.haml @@ -1,6 +1,6 @@ --set_meta_tags :title => t('layout.groups.list_header') -= link_to t("layout.groups.new"), new_group_path, :class => "button" -%table#myTable.tablesorter.group-list{:cellpadding => "0", :cellspacing => "0"} +-set_meta_tags title: t('layout.groups.list_header') += link_to t("layout.groups.new"), new_group_path, class: "button" +%table#myTable.tablesorter.group-list{cellpadding: "0", cellspacing: "0"} %thead %tr %th.th1= t("layout.groups.group") @@ -12,4 +12,4 @@ %td= link_to group.name, group_path(group) %td.td2= group.description %td.td5 - = link_to image_tag('x.png'), remove_user_group_path(group), :method => :delete unless group.owner_id == current_user.id + = link_to image_tag('x.png'), remove_user_group_path(group), method: :delete unless group.owner_id == current_user.id diff --git a/app/views/groups/profile/new.html.haml b/app/views/groups/profile/new.html.haml index 077c32394..a8fc47656 100644 --- a/app/views/groups/profile/new.html.haml +++ b/app/views/groups/profile/new.html.haml @@ -1,6 +1,6 @@ %h3.bpadding10= title t("layout.groups.new_header") = form_for @group do |f| - = render "form", :f => f + = render "form", f: f :javascript $('article .all').addClass('bigpadding'); diff --git a/app/views/groups/profile/show.html.haml b/app/views/groups/profile/show.html.haml index a4e7e436f..10cb64d01 100644 --- a/app/views/groups/profile/show.html.haml +++ b/app/views/groups/profile/show.html.haml @@ -1,8 +1,8 @@ --set_meta_tags :title => title_object(@group) +-set_meta_tags title: title_object(@group) - edit_url = can?(:edit, @group) ? edit_group_path(@group) : nil -= render 'shared/profile', :uname => @group.name, - :group => @group, - :search_path => group_path, - :projects => @projects, - :edit_url => edit_url += render 'shared/profile', uname: @group.name, + group: @group, + search_path: group_path, + projects: @projects, + edit_url: edit_url diff --git a/app/views/home/_feed_tabs.html.haml b/app/views/home/_feed_tabs.html.haml index 2531a11d4..fbf09a3bb 100644 --- a/app/views/home/_feed_tabs.html.haml +++ b/app/views/home/_feed_tabs.html.haml @@ -2,4 +2,4 @@ %nav %ul - (collection = t 'feed_menu').each do |base, title| - %li= link_to title, root_path(:filter => base), :class => @filter == base ? 'active' : '' + %li= link_to title, root_path(filter: base), class: @filter == base ? 'active' : '' diff --git a/app/views/home/_list.html.haml b/app/views/home/_list.html.haml index b3c9fe5b2..506b27fb7 100644 --- a/app/views/home/_list.html.haml +++ b/app/views/home/_list.html.haml @@ -1,6 +1,6 @@ - @activity_feeds.each do |activity_feed| - .activity{:id => "#feed#{activity_feed.id}"} + .activity{id: "#feed#{activity_feed.id}"} = render_activity_feed(activity_feed) - if @activity_feeds.next_page - %a{:href => root_path({:filter => @filter, :page => @activity_feeds.next_page}), :class => 'more_activities'} + %a{href: root_path({filter: @filter, page: @activity_feeds.next_page}), class: 'more_activities'} .messages.messages-last=t('layout.activity_feed.load_messages') diff --git a/app/views/home/_sidebar.html.haml b/app/views/home/_sidebar.html.haml index 013547142..ef1bd8adf 100644 --- a/app/views/home/_sidebar.html.haml +++ b/app/views/home/_sidebar.html.haml @@ -1,5 +1,5 @@ .bordered - = link_to t("layout.activity_feed.new_project"), new_project_path, :class => 'button' + = link_to t("layout.activity_feed.new_project"), new_project_path, class: 'button' %h3= t("layout.activity_feed.my_last_projects") %table %tbody @@ -20,12 +20,12 @@ .block - midnight = Time.now.utc.to_date %h3= t("layout.activity_feed.my_builds_by_day") - %table{:cellpadding => "0", :cellspacing => "0"} + %table{cellpadding: "0", cellspacing: "0"} %tbody - ['BuildList::BUILD_PUBLISHED', 'BuildList::SUCCESS', 'BuildList::BUILD_STARTED', 'BuildList::BUILD_PENDING', 'BuildList::BUILD_ERROR'].each do |state| %tr %td.first - = link_to t("layout.build_lists.statuses.#{state.demodulize.downcase}"), build_lists_path(:filter => {:status => state.constantize, :'updated_at_start(1i)' => midnight.year, :'updated_at_start(2i)' => midnight.month, :'updated_at_start(3i)' => midnight.day}) + = link_to t("layout.build_lists.statuses.#{state.demodulize.downcase}"), build_lists_path(filter: {status: state.constantize, :'updated_at_start(1i)' => midnight.year, :'updated_at_start(2i)' => midnight.month, :'updated_at_start(3i)' => midnight.day}) %td= BuildList.for_status(state.constantize).for_user(current_user).for_notified_date_period(midnight, nil).count %tr %td.first diff --git a/app/views/home/_top_menu.html.haml b/app/views/home/_top_menu.html.haml index 43bae255c..240854e25 100644 --- a/app/views/home/_top_menu.html.haml +++ b/app/views/home/_top_menu.html.haml @@ -2,6 +2,6 @@ .sub-menu %nav %ul - %li= link_to t('activity_menu.activity_feed'), root_path, :class => action_name == 'activity' ? 'active' : '' - %li= link_to t('activity_menu.tracker'), issues_path, :class => action_name == 'issues' ? 'active' : '' - %li= link_to t('activity_menu.pull_requests'), pull_requests_path, :class => action_name == 'pull_requests' ? 'active' : '' \ No newline at end of file + %li= link_to t('activity_menu.activity_feed'), root_path, class: action_name == 'activity' ? 'active' : '' + %li= link_to t('activity_menu.tracker'), issues_path, class: action_name == 'issues' ? 'active' : '' + %li= link_to t('activity_menu.pull_requests'), pull_requests_path, class: action_name == 'pull_requests' ? 'active' : '' \ No newline at end of file diff --git a/app/views/home/activity.atom.builder b/app/views/home/activity.atom.builder index 8c1ae9cd4..b54d1eb09 100644 --- a/app/views/home/activity.atom.builder +++ b/app/views/home/activity.atom.builder @@ -3,11 +3,11 @@ atom_feed do |feed| feed.updated(@activity_feeds[0].created_at) if @activity_feeds.length > 0 @activity_feeds.each do |activity_feed| - feed.entry(activity_feed, :url => root_url(:anchor => "feed#{activity_feed.id}")) do |entry| - feed_content = raw(render(:inline => true, :partial => activity_feed.partial, :locals => activity_feed.data.merge(:activity_feed => activity_feed))) + feed.entry(activity_feed, url: root_url(anchor: "feed#{activity_feed.id}")) do |entry| + feed_content = raw(render(inline: true, partial: activity_feed.partial, locals: activity_feed.data.merge(activity_feed: activity_feed))) - entry.title(truncate(get_feed_title_from_content(feed_content), :length => 50)) - entry.content(feed_content, :type => 'html') + entry.title(truncate(get_feed_title_from_content(feed_content), length: 50)) + entry.content(feed_content, type: 'html') entry.author do |author| author.name(activity_feed.data[:user_name]) diff --git a/app/views/home/activity.html.haml b/app/views/home/activity.html.haml index ed75e4efe..9ed9b737d 100644 --- a/app/views/home/activity.html.haml +++ b/app/views/home/activity.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => nil +-set_meta_tags title: nil %h3.fix = t("layout.activity_feed.header") - = link_to image_tag("rss.ico", :width => '15px', :height => '15px', :class => 'atom_icon'), atom_activity_feeds_path(:format => 'atom', :token => current_user.authentication_token) + = link_to image_tag("rss.ico", width: '15px', height: '15px', class: 'atom_icon'), atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token) =render 'feed_tabs' =render 'list' diff --git a/app/views/home/issues.html.haml b/app/views/home/issues.html.haml index 91e729667..cfd2b1a29 100644 --- a/app/views/home/issues.html.haml +++ b/app/views/home/issues.html.haml @@ -1,12 +1,12 @@ --set_meta_tags :title => t("home.#{action_name}.title") +-set_meta_tags title: t("home.#{action_name}.title") -render 'top_menu' -content_for :sidebar do - =form_tag send("#{action_name}_path"), :id => 'filter_issues', :method => :get do + =form_tag send("#{action_name}_path"), id: 'filter_issues', method: :get do .bordered %table -%w[all assigned created].each do |filter| %tr - %td.width18=radio_button_tag :myradio, filter, filter == @filter, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td.width18=radio_button_tag :myradio, filter, filter == @filter, {id: 'myradio1', class: 'niceRadio', name: 'filter'} %td.width135=t("layout.#{action_name}.#{filter}") %td.width30.right=instance_variable_get("@#{filter}_issues").not_closed_or_merged.count -=render 'projects/issues/issues_table', :issues => @issues +=render 'projects/issues/issues_table', issues: @issues diff --git a/app/views/home/partials/_build_list_notification.haml b/app/views/home/partials/_build_list_notification.haml index 1dcc17961..2e1c14aae 100644 --- a/app/views/home/partials/_build_list_notification.haml +++ b/app/views/home/partials/_build_list_notification.haml @@ -1,10 +1,10 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t('notifications.bodies.build_task', :id => build_list_id, :task_link => build_list_path(build_list_id)) - = raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t('notifications.bodies.build_task', id: build_list_id, task_link: build_list_path(build_list_id)) + = raw t('notifications.bodies.project', project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) - message, error = case status - when BuildList::BUILD_PENDING - ['pending', nil] @@ -13,7 +13,7 @@ - when BuildList::SUCCESS - ['success', nil] - else ['failed', t("layout.build_lists.statuses.#{BuildList::HUMAN_STATUSES[status]}")] - = raw t("notifications.bodies.build_status.#{message}", :error => error) + = raw t("notifications.bodies.build_status.#{message}", error: error) .both - = datetime_moment updated_at, :tag => :span, :class => 'date' + = datetime_moment updated_at, tag: :span, class: 'date' .both diff --git a/app/views/home/partials/_git_delete_branch_notification.haml b/app/views/home/partials/_git_delete_branch_notification.haml index c207d9df8..4bd299d77 100644 --- a/app/views/home/partials/_git_delete_branch_notification.haml +++ b/app/views/home/partials/_git_delete_branch_notification.haml @@ -1,11 +1,11 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.try(:persisted?) + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.try(:persisted?) .text %span -_user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email) : nil - = t('notifications.bodies.delete_branch', :branch_name => branch_name, :user_link => _user_link).html_safe - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = t('notifications.bodies.delete_branch', branch_name: branch_name, user_link: _user_link).html_safe + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both diff --git a/app/views/home/partials/_git_new_push_notification.haml b/app/views/home/partials/_git_new_push_notification.haml index f9553f91f..dd7254024 100644 --- a/app/views/home/partials/_git_new_push_notification.haml +++ b/app/views/home/partials/_git_new_push_notification.haml @@ -1,13 +1,13 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.try(:persisted?) + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.try(:persisted?) .text %span -_user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email) : nil - = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => _user_link}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.#{change_type}_branch", {branch_name: branch_name, user_link: _user_link}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both %span.subject - last_commits.each do |commit| @@ -16,5 +16,5 @@ %br - if defined? other_commits %br - =link_to t('notifications.bodies.more_commits', :count => other_commits_count, :commits => commits_pluralize(other_commits_count)), - diff_path(project_owner, project_name, :diff => other_commits) + =link_to t('notifications.bodies.more_commits', count: other_commits_count, commits: commits_pluralize(other_commits_count)), + diff_path(project_owner, project_name, diff: other_commits) diff --git a/app/views/home/partials/_issue_assign_notification.haml b/app/views/home/partials/_issue_assign_notification.haml index 4c58df39b..31f768ec3 100644 --- a/app/views/home/partials/_issue_assign_notification.haml +++ b/app/views/home/partials/_issue_assign_notification.haml @@ -1,8 +1,8 @@ .top .text %span - = raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id))}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.issue_assign_notification", { issue_link: link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id))}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both diff --git a/app/views/home/partials/_new_comment_commit_notification.haml b/app/views/home/partials/_new_comment_commit_notification.haml index e5401ee74..21d65a4b7 100644 --- a/app/views/home/partials/_new_comment_commit_notification.haml +++ b/app/views/home/partials/_new_comment_commit_notification.haml @@ -1,12 +1,12 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_comment_notification.title", :user_link => user_link(user, user_name)) - = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment#{comment_id}")}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.new_comment_notification.title", user_link: user_link(user, user_name)) + = raw t("notifications.bodies.new_comment_notification.commit_content", {commit_link: link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment#{comment_id}")}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both %span.subject= comment_body diff --git a/app/views/home/partials/_new_comment_notification.haml b/app/views/home/partials/_new_comment_notification.haml index 7a3cbcb01..4298eabe2 100644 --- a/app/views/home/partials/_new_comment_notification.haml +++ b/app/views/home/partials/_new_comment_notification.haml @@ -1,12 +1,12 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_comment_notification.title", {:user_link => user_link(user, user_name)}) - = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment#{comment_id}")}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.new_comment_notification.title", {user_link: user_link(user, user_name)}) + = raw t("notifications.bodies.new_comment_notification.content", {issue_link: link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment#{comment_id}")}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both %span.subject= comment_body diff --git a/app/views/home/partials/_new_issue_notification.haml b/app/views/home/partials/_new_issue_notification.haml index 5b3fdb5c9..8f6c58b22 100644 --- a/app/views/home/partials/_new_issue_notification.haml +++ b/app/views/home/partials/_new_issue_notification.haml @@ -1,11 +1,11 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_issue_notification", { :user_link => user_link(user, user_name), :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.new_issue_notification", { user_link: user_link(user, user_name), issue_link: project_issue_path(project_owner, project_name, issue_serial_id)}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both %span.subject= issue_title diff --git a/app/views/home/partials/_new_user_notification.haml b/app/views/home/partials/_new_user_notification.haml index 870fa68f9..4be8329ed 100644 --- a/app/views/home/partials/_new_user_notification.haml +++ b/app/views/home/partials/_new_user_notification.haml @@ -1,16 +1,16 @@ .top .image - = image_tag(avatar_url_by_email(activity_feed.user.email, :small), :alt => 'avatar') + = image_tag(avatar_url_by_email(activity_feed.user.email, :small), alt: 'avatar') .text %span.name = link_to activity_feed.user.uname, user_path(activity_feed.user.uname) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both .both - %span.subject #{ t("notifications.bodies.new_user_notification.title", :user_name => user_name) } + %span.subject #{ t("notifications.bodies.new_user_notification.title", user_name: user_name) } .both .fulltext #{ t("notifications.bodies.new_user_notification.content") } %br - #{ t("notifications.bodies.new_user_notification.email", :user_email => user_email) } + #{ t("notifications.bodies.new_user_notification.email", user_email: user_email) } diff --git a/app/views/home/partials/_wiki_new_commit_notification.haml b/app/views/home/partials/_wiki_new_commit_notification.haml index 4659792d0..1a9a25711 100644 --- a/app/views/home/partials/_wiki_new_commit_notification.haml +++ b/app/views/home/partials/_wiki_new_commit_notification.haml @@ -1,10 +1,10 @@ --user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +-user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) .top - .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? + .image= link_to(image_tag(avatar_url(user, :small), alt: 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_link(user, user_name), :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) + = raw t("notifications.bodies.wiki_new_commit_notification", {user_link: user_link(user, user_name), history_link: link_to("wiki", history_project_wiki_index_path(project_owner, project_name))}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both - = datetime_moment activity_feed.created_at, :tag => :span, :class => 'date' + = datetime_moment activity_feed.created_at, tag: :span, class: 'date' .both diff --git a/app/views/layouts/_flashes.html.haml b/app/views/layouts/_flashes.html.haml index a135909b8..a3afb495a 100644 --- a/app/views/layouts/_flashes.html.haml +++ b/app/views/layouts/_flashes.html.haml @@ -1,3 +1,3 @@ .flash - flash.each do |type, message| - .message{:class => type}= message \ No newline at end of file + .message{class: type}= message \ No newline at end of file diff --git a/app/views/layouts/_noscript.html.haml b/app/views/layouts/_noscript.html.haml index 76768e245..7b923a3b5 100644 --- a/app/views/layouts/_noscript.html.haml +++ b/app/views/layouts/_noscript.html.haml @@ -1,2 +1,2 @@ %noscript - %div{:style => 'font-size: 12px; color: red; font-weight: bold;'}= t 'layout.noscript_message' \ No newline at end of file + %div{style: 'font-size: 12px; color: red; font-weight: bold;'}= t 'layout.noscript_message' \ No newline at end of file diff --git a/app/views/layouts/_notifies.html.haml b/app/views/layouts/_notifies.html.haml index 1c1f9c98f..b4dce69a8 100644 --- a/app/views/layouts/_notifies.html.haml +++ b/app/views/layouts/_notifies.html.haml @@ -1,9 +1,9 @@ - if current_user || APP_CONFIG['anonymous_access'] .flash_notify - if (flash_notify = FlashNotify.published.first) && flash_notify.should_show?(cookies[:flash_notify_hash]) - .alert{:class => "alert-#{flash_notify.status}"} + .alert{class: "alert-#{flash_notify.status}"} = flash_notify.body(I18n.locale).html_safe - %a.close#close-alert{:'data-dismiss'=>"alert", :href=>"#"} × + %a.close#close-alert{:'data-dismiss'=>"alert", href: "#"} × :javascript var FLASH_HASH_ID = "#{flash_notify.hash_id}"; diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7143d44d4..5232d25b3 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,42 +1,42 @@ !!! %html %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"} - = stylesheet_link_tag 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', :media => 'screen, projection' + %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"} + = stylesheet_link_tag 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/base/jquery-ui.css', media: 'screen, projection' = stylesheet_link_tag "application" /[if lt IE 9] = javascript_include_tag 'https://html5shiv.googlecode.com/svn/trunk/html5.js' = javascript_include_tag 'application' = javascript_include_tag 'moment/ru.js' if I18n.locale == :ru = csrf_meta_tag - = display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-' + = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' - if user_signed_in? - = auto_discovery_link_tag :atom, atom_activity_feeds_path(:format => 'atom', :token => current_user.authentication_token), :title => t("layout.atom_link_tag_title", :nickname => current_user.uname, :app_name => APP_CONFIG['project_name']) + = auto_discovery_link_tag :atom, atom_activity_feeds_path(format: 'atom', token: current_user.authentication_token), title: t("layout.atom_link_tag_title", nickname: current_user.uname, app_name: APP_CONFIG['project_name']) %body{'ng-app' => 'RosaABF', 'ng-controller' => 'RosaABFController', 'ng-init' => "init('#{I18n.locale}', #{!!current_user.try(:sound_notifications)})"} - .wrap{:class => content_for?(:sidebar) ? 'columns' : ''} + .wrap{class: content_for?(:sidebar) ? 'columns' : ''} %header .left .middle %menu - .logo= link_to image_tag('logo-mini.png', :alt => 'logo'), root_path - = render 'layouts/menu/top', :which_menu => 'top_menu' + .logo= link_to image_tag('logo-mini.png', alt: 'logo'), root_path + = render 'layouts/menu/top', which_menu: 'top_menu' .information = render 'search/form' - if current_user .user - .avatar= image_tag avatar_url(current_user), :alt => 'avatar', :height => "30" + .avatar= image_tag avatar_url(current_user), alt: 'avatar', height: "30" .profile - %a{:href => "#"} + %a{href: "#"} = current_user.uname - = image_tag 'expand-white.png', :alt => 'ex' + = image_tag 'expand-white.png', alt: 'ex' .both .both .droplist-wrap #droplist.droplist .a= link_to current_user.uname, current_user .a= link_to t('layout.settings.label'), profile_settings_path - .a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete + .a= link_to t('layout.logout'), destroy_user_session_path, method: :delete - else .user .profile= link_to t("layout.devise.shared_links.sign_up"), new_register_request_path @@ -54,7 +54,7 @@ %article - if content_for?(:sidebar) %aside= yield :sidebar - %div{:class => layout_class}= yield + %div{class: layout_class}= yield .both %footer= render "layouts/menu/bottom" diff --git a/app/views/layouts/invite.html.haml b/app/views/layouts/invite.html.haml index a0834a466..246ff32ad 100644 --- a/app/views/layouts/invite.html.haml +++ b/app/views/layouts/invite.html.haml @@ -1,10 +1,10 @@ !!! %html %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ + %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ %title=t 'invites.title' - %script{:src => "http://html5shiv.googlecode.com/svn/trunk/html5.js", :type => "text/javascript"} - %link{:href => "/styles/prereg.css", :rel => "stylesheet", :type => "text/css"}/ + %script{src: "http://html5shiv.googlecode.com/svn/trunk/html5.js", type: "text/javascript"} + %link{href: "/styles/prereg.css", rel: "stylesheet", type: "text/css"}/ %body .wrap = yield :nav if content_for?(:nav) diff --git a/app/views/layouts/menu/_bottom.html.haml b/app/views/layouts/menu/_bottom.html.haml index fa2e4c43d..3901b8a4f 100644 --- a/app/views/layouts/menu/_bottom.html.haml +++ b/app/views/layouts/menu/_bottom.html.haml @@ -1,10 +1,10 @@ %ul %li = image_tag 'square.png' - = t('bottom_menu.copyright', :year => Date.today.year) + = t('bottom_menu.copyright', year: Date.today.year) %li = image_tag 'square.png' - = image_tag 'flag.png', :alt => 'flag' + = image_tag 'flag.png', alt: 'flag' %li = image_tag 'square.png' = link_to t('bottom_menu.about'), t('bottom_menu.about_url') diff --git a/app/views/layouts/menu/_top.html.haml b/app/views/layouts/menu/_top.html.haml index f74e0d84e..af327be48 100644 --- a/app/views/layouts/menu/_top.html.haml +++ b/app/views/layouts/menu/_top.html.haml @@ -2,6 +2,6 @@ %ul - (collection = t which_menu).each do |base, title| - if can? :index, base.to_s.classify.constantize - %li= link_to title, send(:"#{namespace}#{base}_path"), :class => top_menu_class(base) + %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') \ No newline at end of file + %li= link_to t('admins_menu_header'), admin_users_path, class: top_menu_class('admin') \ No newline at end of file diff --git a/app/views/layouts/sessions.html.haml b/app/views/layouts/sessions.html.haml index 1a1a8b0b8..f03ebbd52 100644 --- a/app/views/layouts/sessions.html.haml +++ b/app/views/layouts/sessions.html.haml @@ -1,7 +1,7 @@ !!! %html %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "content-type"} + %meta{content: "text/html; charset=utf-8", "http-equiv" => "content-type"} - if controller_name == 'sessions' && action_name == 'new' = stylesheet_link_tag "login" - elsif ['registrations', 'passwords'].include?(controller_name) && ['new', 'create', 'edit', 'update'].include?(action_name) @@ -10,7 +10,7 @@ = javascript_include_tag 'https://html5shiv.googlecode.com/svn/trunk/html5.js' = javascript_include_tag "login" = csrf_meta_tag - = display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-' + = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' %body = render 'layouts/noscript' diff --git a/app/views/layouts/tour.html.haml b/app/views/layouts/tour.html.haml index 631f0175f..52763951d 100644 --- a/app/views/layouts/tour.html.haml +++ b/app/views/layouts/tour.html.haml @@ -1,37 +1,37 @@ !!! %html %head - %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ + %meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ = stylesheet_link_tag "tour" /[if lt IE 9] = javascript_include_tag 'https://html5shiv.googlecode.com/svn/trunk/html5.js' = javascript_include_tag "tour" = csrf_meta_tag - = display_meta_tags :site => APP_CONFIG['project_name'], :reverse => true, :separator => '-' + = display_meta_tags site: APP_CONFIG['project_name'], reverse: true, separator: '-' %body .wrap %header.top .left .middle %menu - .logo= link_to image_tag('logo-mini.png', :alt => 'logo'), root_path - = render 'layouts/menu/top', :which_menu => 'top_menu' + .logo= link_to image_tag('logo-mini.png', alt: 'logo'), root_path + = render 'layouts/menu/top', which_menu: 'top_menu' .information = render 'search/form' - if current_user .user - .avatar= image_tag avatar_url(current_user), :alt => 'avatar', :height => "30" + .avatar= image_tag avatar_url(current_user), alt: 'avatar', height: "30" .profile - %a{:href => "#"} + %a{href: "#"} = current_user.uname - = image_tag 'expand-white.png', :alt => 'ex' + = image_tag 'expand-white.png', alt: 'ex' .both .both .droplist-wrap #droplist.droplist .a= link_to current_user.uname, current_user .a= link_to t('layout.settings.label'), profile_settings_path - .a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete + .a= link_to t('layout.logout'), destroy_user_session_path, method: :delete - else .user .profile= link_to t("layout.devise.shared_links.sign_up"), new_register_request_path @@ -40,7 +40,7 @@ .both / Page .tour - =image_tag "tour-top#{I18n.locale == :en ? '-eng' : ''}.png", :alt => 'ABF' + =image_tag "tour-top#{I18n.locale == :en ? '-eng' : ''}.png", alt: 'ABF' .both = render 'layouts/noscript' = render 'layouts/flashes' diff --git a/app/views/pages/forbidden.html.haml b/app/views/pages/forbidden.html.haml index fc4a31c98..f1c7dc57f 100644 --- a/app/views/pages/forbidden.html.haml +++ b/app/views/pages/forbidden.html.haml @@ -1 +1 @@ --set_meta_tags :title => t('flash.exception_message') \ No newline at end of file +-set_meta_tags title: t('flash.exception_message') \ No newline at end of file diff --git a/app/views/pages/tos.html.haml b/app/views/pages/tos.html.haml index bebfa9852..b5ba74e11 100644 --- a/app/views/pages/tos.html.haml +++ b/app/views/pages/tos.html.haml @@ -1,7 +1,7 @@ - render 'tos_sidebar' .tos - %a{:name => '#'} + %a{name: '#'} %h1 Terms of Service %p @@ -30,7 +30,7 @@ on the Service and you nonetheless may be exposed to such materials. You agree to use the Service at your own risk. - %a{:name => 'Account_Terms'} + %a{name: 'Account_Terms'} %h2 I. Account Terms %ol @@ -57,7 +57,7 @@ not, in the use of the Service, violate any laws in your jurisdiction (includingbut not limited to copyright or trademark laws). - %a{:name => 'Cancellation_and_Termination'} + %a{name: 'Cancellation_and_Termination'} %h2 II. Cancellation and Termination %ol @@ -78,7 +78,7 @@ Account. ROSA reserves the right to refuse service to anyone for any reason at any time. - %a{:name => 'Service_Modifications'} + %a{name: 'Service_Modifications'} %h2 III. Modifications to the Service and Conditions %ol @@ -93,7 +93,7 @@ ROSA shall not be liable to you or to any third party for any modification, suspension or discontinuance of the Service. - %a{:name => 'Copyright_and_Ownership'} + %a{name: 'Copyright_and_Ownership'} %h2 IV. Copyright and Content Ownership %ol @@ -127,7 +127,7 @@ You may not duplicate, copy, or reuse any portion of the HTML/CSS, Javascript, or visual design elements or concepts without express written permission from ROSA. - %a{:name => 'General_Conditions'} + %a{name: 'General_Conditions'} %h2 V. General Conditions %ol diff --git a/app/views/pages/tour/_entry.html.haml b/app/views/pages/tour/_entry.html.haml index c1bb10011..13dd40d18 100644 --- a/app/views/pages/tour/_entry.html.haml +++ b/app/views/pages/tour/_entry.html.haml @@ -6,11 +6,11 @@ %p =raw t "tour.#{entry}_description" .right - %a.pirobox{:href => image_path("tour/big/#{entry}.png"), :rel => "single", :title => t("tour.#{entry}")} + %a.pirobox{href: image_path("tour/big/#{entry}.png"), rel: "single", title: t("tour.#{entry}")} =image_tag "tour/#{entry}.png" -else .left - %a.pirobox{:href => image_path("tour/big/#{entry}.png"), :rel => "single", :title => t("tour.#{entry}")} + %a.pirobox{href: image_path("tour/big/#{entry}.png"), rel: "single", title: t("tour.#{entry}")} =image_tag "tour/#{entry}.png" .right %h1=t "tour.#{entry}" diff --git a/app/views/pages/tour/_submenu.html.haml b/app/views/pages/tour/_submenu.html.haml index 057944464..0aec5e80d 100644 --- a/app/views/pages/tour/_submenu.html.haml +++ b/app/views/pages/tour/_submenu.html.haml @@ -1,4 +1,4 @@ %ul -%w(projects sources builds).each do |entry| %li - =link_to t("tour.#{entry}"), tour_inside_path(entry), :class => params[:id] == entry ? 'active' : '' + =link_to t("tour.#{entry}"), tour_inside_path(entry), class: params[:id] == entry ? 'active' : '' diff --git a/app/views/pages/tour/abf-tour-project-description-1.html.haml b/app/views/pages/tour/abf-tour-project-description-1.html.haml index f74145da7..ba111adff 100644 --- a/app/views/pages/tour/abf-tour-project-description-1.html.haml +++ b/app/views/pages/tour/abf-tour-project-description-1.html.haml @@ -1,10 +1,10 @@ .feature-wrap .feature .left - %a.pirobox{:href => image_path('tour/big/control.png'), :rel => "single", :title => t('tour.projects')} + %a.pirobox{href: image_path('tour/big/control.png'), rel: "single", title: t('tour.projects')} =image_tag 'tour/control.png' .right - %a{:href => tour_inside_path('projects')} + %a{href: tour_inside_path('projects')} %h1=t 'tour.projects' %p =t 'tour.projects_header' @@ -14,23 +14,23 @@ .feature-wrap .feature .left - %a{:href => tour_inside_path('sources')} + %a{href: tour_inside_path('sources')} %h1=t 'tour.sources' %p =t 'tour.sources_header' %br/ =link_to t('tour.read_more'), tour_inside_path('sources') .right - %a.pirobox{:href => image_path('tour/big/source.png'), :rel => "single", :title => t('tour.sources')} + %a.pirobox{href: image_path('tour/big/source.png'), rel: "single", title: t('tour.sources')} =image_tag 'tour/source.png' .both .feature-wrap .feature .left - %a.pirobox{:href => image_path('tour/big/monitoring.png'), :rel => "single", :title => t('tour.builds')} + %a.pirobox{href: image_path('tour/big/monitoring.png'), rel: "single", title: t('tour.builds')} =image_tag 'tour/monitoring.png' .right - %a{:href => tour_inside_path('builds')} + %a{href: tour_inside_path('builds')} %h1=t 'tour.builds' %p =t 'tour.builds_header' diff --git a/app/views/pages/tour/tour-inside.html.haml b/app/views/pages/tour/tour-inside.html.haml index 308533de4..2ccdd8307 100644 --- a/app/views/pages/tour/tour-inside.html.haml +++ b/app/views/pages/tour/tour-inside.html.haml @@ -6,4 +6,4 @@ %article / Single page content -@entries.each_with_index do |el, ind| - =render :partial => 'pages/tour/entry', :locals => {:entry => el, :is_left => ind.odd?} + =render partial: 'pages/tour/entry', locals: {entry: el, is_left: ind.odd?} diff --git a/app/views/platforms/base/_sidebar.html.haml b/app/views/platforms/base/_sidebar.html.haml index 827837b02..99818f383 100644 --- a/app/views/platforms/base/_sidebar.html.haml +++ b/app/views/platforms/base/_sidebar.html.haml @@ -6,34 +6,34 @@ .admin-preferences %nav %ul - %li{:class => (act == :show && contr == :platforms) ? 'active' : ''} + %li{class: (act == :show && contr == :platforms) ? 'active' : ''} = link_to t("layout.platforms.about"), platform_path(@platform) - %li{:class => (contr == :repositories) ? 'active' : ''} + %li{class: (contr == :repositories) ? 'active' : ''} = link_to t("layout.repositories.list_header"), platform_repositories_path(@platform) - %li{:class => (contr == :contents) ? 'active' : ''} + %li{class: (contr == :contents) ? 'active' : ''} = link_to t('layout.platforms.contents'), platform_contents_path(@platform) - if can? :show, @platform - %li{:class => (act == :index && contr == :maintainers) ? 'active' : nil} + %li{class: (act == :index && contr == :maintainers) ? 'active' : nil} = link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform) - %li{:class => (contr == :mass_builds) ? 'active' : ''} + %li{class: (contr == :mass_builds) ? 'active' : ''} = link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform) - if can? :read, @platform.products.build - %li{:class => (contr == :products) ? 'active' : ''} + %li{class: (contr == :products) ? 'active' : ''} = link_to t("layout.products.list_header"), platform_products_path(@platform) - if can? :advisories, @platform - %li{:class => (contr == :platforms and act == :advisories) ? 'active' : ''} + %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} + %li{class: (act == :edit && contr == :platforms) ? 'active' : nil} = link_to t("platform_menu.settings"), edit_platform_path(@platform) - if can? :members, @platform - %li{:class => (act == :members && contr == :platforms) ? 'active' : nil} + %li{class: (act == :members && contr == :platforms) ? 'active' : nil} = link_to t("layout.platforms.members"), members_platform_path(@platform) - if can? :edit, @platform - %li{:class => (act == :index && contr == :key_pairs) ? 'active' : ''} + %li{class: (act == :index && contr == :key_pairs) ? 'active' : ''} = link_to t("layout.key_pairs.header"), platform_key_pairs_path(@platform) - %li{:class => (contr == :tokens) ? 'active' : ''} + %li{class: (contr == :tokens) ? 'active' : ''} = link_to t('layout.tokens.header'), platform_tokens_path(@platform) -#- if current_user.owner_of? @platform or current_user.admin? - %li{:class => (act == :index && contr == :private_users) ? 'active' : ''} + %li{class: (act == :index && contr == :private_users) ? 'active' : ''} = link_to t("layout.platforms.private_users"), platform_private_users_path(@platform) diff --git a/app/views/platforms/contents/_contents.html.haml b/app/views/platforms/contents/_contents.html.haml index a94551c71..a37350086 100644 --- a/app/views/platforms/contents/_contents.html.haml +++ b/app/views/platforms/contents/_contents.html.haml @@ -1,26 +1,26 @@ #contents - = form_for @platform, :url => platform_content_path(@platform, @path), :html => { :class => :form, :remote => true, :method => :get } do |f| + = form_for @platform, url: platform_content_path(@platform, @path), html: { class: :form, remote: true, method: :get } do |f| = tracker_search_field(:term, @term.present? ? @term : t('layout.platforms.search_contents')) - = f.submit t('layout.search.header'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.search.header'), data: {'disable-with' => t('layout.processing')} %br .path= build_content_paths(@platform, @path) .both - %table.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter.project{cellpadding: "0", cellspacing: "0"} %tbody - if @path.present? %tr - %td= link_to '../', platform_content_path(@platform, @path, '../'), {:remote => true} + %td= link_to '../', platform_content_path(@platform, @path, '../'), {remote: true} %td %td - (@contents.select(&:is_folder?) | @contents).each do |content| %tr %td - - options = {:class => 'files-see'} + - options = {class: 'files-see'} - if content.is_folder? - pic = 'folder.png' - path = platform_content_path(@platform, @path, content.name) @@ -31,4 +31,4 @@ %td= number_to_human_size(content.size) unless content.is_folder? .both - = will_paginate @contents, {:remote => true} \ No newline at end of file + = will_paginate @contents, {remote: true} \ No newline at end of file diff --git a/app/views/platforms/contents/index.html.haml b/app/views/platforms/contents/index.html.haml index 84898f087..3cff240da 100644 --- a/app/views/platforms/contents/index.html.haml +++ b/app/views/platforms/contents/index.html.haml @@ -1,4 +1,4 @@ -- set_meta_tags :title => [title_object(@platform), t('layout.platforms.contents')] +- set_meta_tags title: [title_object(@platform), t('layout.platforms.contents')] = render 'platforms/base/submenu' = render 'platforms/base/sidebar' diff --git a/app/views/platforms/key_pairs/_list.html.haml b/app/views/platforms/key_pairs/_list.html.haml index ca39da716..540515841 100644 --- a/app/views/platforms/key_pairs/_list.html.haml +++ b/app/views/platforms/key_pairs/_list.html.haml @@ -1,4 +1,4 @@ -%table#myTable.tablesorter.platform-repos{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platform-repos{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.key_pair.repository_id") @@ -8,11 +8,11 @@ %tbody - @platform.repositories.each do |repository| - if repository.key_pair - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td= repository.name %td= repository.key_pair.key_id %td= link_to repository.key_pair.user.fullname, user_path(repository.key_pair.user) %td.buttons - if can? :destroy, repository.key_pair - = link_to platform_key_pair_path(@platform, repository.key_pair), :method => :delete, :confirm => t("layout.key_pairs.confirm_delete") do + = link_to platform_key_pair_path(@platform, repository.key_pair), method: :delete, confirm: t("layout.key_pairs.confirm_delete") do %span.delete   diff --git a/app/views/platforms/key_pairs/_new.html.haml b/app/views/platforms/key_pairs/_new.html.haml index c41dbb1d7..56e282532 100644 --- a/app/views/platforms/key_pairs/_new.html.haml +++ b/app/views/platforms/key_pairs/_new.html.haml @@ -1,15 +1,15 @@ %h3= t("layout.key_pairs.header") -= form_for :key_pair, :url => platform_key_pairs_path(@platform), :method => :post, :html => { :class => :form } do |f| - .leftlist= f.label :public, t("activerecord.attributes.key_pair.public"), :class => :label - .rightlist= f.text_area :public, :class => 'text_field resizable', :cols => 80 += form_for :key_pair, url: platform_key_pairs_path(@platform), method: :post, html: { class: :form } do |f| + .leftlist= f.label :public, t("activerecord.attributes.key_pair.public"), class: :label + .rightlist= f.text_area :public, class: 'text_field resizable', cols: 80 .both - .leftlist= f.label :secret, t("activerecord.attributes.key_pair.secret"), :class => :label - .rightlist= f.text_area :secret, :class => 'text_field resizable', :cols => 80 + .leftlist= f.label :secret, t("activerecord.attributes.key_pair.secret"), class: :label + .rightlist= f.text_area :secret, class: 'text_field resizable', cols: 80 .both - .leftlist= f.label :repository_id, t("activerecord.attributes.key_pair.repository_id"), :class => :label + .leftlist= f.label :repository_id, t("activerecord.attributes.key_pair.repository_id"), class: :label .rightlist= f.select :repository_id, options_from_collection_for_select(@platform.repositories, 'id', 'name') .both .button_block - = submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} diff --git a/app/views/platforms/key_pairs/index.html.haml b/app/views/platforms/key_pairs/index.html.haml index 1d1959d5e..ac9980bff 100644 --- a/app/views/platforms/key_pairs/index.html.haml +++ b/app/views/platforms/key_pairs/index.html.haml @@ -1,4 +1,4 @@ -- set_meta_tags :title => [title_object(@platform), t('layout.key_pairs.header')] +- set_meta_tags title: [title_object(@platform), t('layout.key_pairs.header')] = render 'platforms/base/submenu' = render 'platforms/base/sidebar' diff --git a/app/views/platforms/maintainers/_list.html.haml b/app/views/platforms/maintainers/_list.html.haml index 153e5f88b..fedde37c2 100644 --- a/app/views/platforms/maintainers/_list.html.haml +++ b/app/views/platforms/maintainers/_list.html.haml @@ -1,23 +1,23 @@ -%table#myTable.tablesorter.platform-maintainers.static-search{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platform-maintainers.static-search{cellspacing: "0", cellpadding: "0"} %thead %tr %th.centered= t("activerecord.attributes.maintainer.package_name") %th.centered= t("activerecord.attributes.maintainer.package_type") %th.centered= t("activerecord.attributes.maintainer.version") - %th.centered{:colspan => 2}= t("activerecord.models.maintainer") + %th.centered{colspan: 2}= t("activerecord.models.maintainer") %th.centered= t("activerecord.attributes.maintainer.updated_at") %tr.search -# TODO: change filter to Backbone.js - %th{:colspan => 6, :rowspan => 1} - = form_tag platform_maintainers_path(@platform), :method => :get do |f| - = text_field_tag('q', params[:q], :placeholder => t("layout.maintainers.search_by_package"), :class => params[:q].present? ? 'black' : 'gray') - %input{:type => 'submit', :value => t("layout.search.header")} - = submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')} - = button_to t('layout.clear'), {:action => :index} , :method => :get + %th{colspan: 6, rowspan: 1} + = form_tag platform_maintainers_path(@platform), method: :get do |f| + = text_field_tag('q', params[:q], placeholder: t("layout.maintainers.search_by_package"), class: params[:q].present? ? 'black' : 'gray') + %input{type: 'submit', value: t("layout.search.header")} + = submit_tag t('layout.search.header'), data: {'disable-with' => t('layout.processing')} + = button_to t('layout.clear'), {action: :index} , method: :get %tbody - MaintainerPresenter.present_collection(@maintainers) do |pr| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td= pr.package_link %td= pr.package_type %td= pr.package_version_release diff --git a/app/views/platforms/maintainers/index.html.haml b/app/views/platforms/maintainers/index.html.haml index fd52033d6..b0433050b 100644 --- a/app/views/platforms/maintainers/index.html.haml +++ b/app/views/platforms/maintainers/index.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => [title_object(@platform), t('layout.maintainers.list_header')] +-set_meta_tags title: [title_object(@platform), t('layout.maintainers.list_header')] -# FIXME: no these 'base' links! = render 'platforms/base/submenu' = render 'platforms/base/sidebar' -= render :partial => 'list', :object => @maintainers += render partial: 'list', object: @maintainers = will_paginate @maintainers diff --git a/app/views/platforms/mass_builds/index.html.haml b/app/views/platforms/mass_builds/index.html.haml index 03f756f50..3d12ece7b 100644 --- a/app/views/platforms/mass_builds/index.html.haml +++ b/app/views/platforms/mass_builds/index.html.haml @@ -1,9 +1,9 @@ = render 'platforms/base/submenu' = render 'platforms/base/sidebar' -= link_to t('layout.mass_builds.new'), new_platform_mass_build_path(@platform), :class => 'button' if can? :create, @platform.mass_builds.build += link_to t('layout.mass_builds.new'), new_platform_mass_build_path(@platform), class: 'button' if can? :create, @platform.mass_builds.build -%table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"} +%table.tablesorter.unbordered{cellpadding: "0", cellspacing: "0"} %thead %tr %th.lpadding16= t('activerecord.attributes.mass_build.id') @@ -15,10 +15,10 @@ - @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, :ownership => 'everything'}) + %td= link_to mass_build.name, build_lists_path(filter: {mass_build_id: mass_build.id, ownership: 'everything'}) %td.min_width_120 - MassBuild::COUNT_STATUSES.each do |status| - = link_to t("layout.build_lists.statuses.#{status}") + ": ", build_lists_path(:filter => {:mass_build_id => mass_build.id, :ownership => 'everything'}.merge(status != :build_lists ? {:status => BuildList.status_by_human(status)} : {})) + = link_to t("layout.build_lists.statuses.#{status}") + ": ", build_lists_path(filter: {mass_build_id: mass_build.id, ownership: 'everything'}.merge(status != :build_lists ? {status: BuildList.status_by_human(status)} : {})) = mass_build.read_attribute "#{status}_count" .both -if mass_build.projects_list.present? @@ -31,18 +31,18 @@ - unless mass_build.auto_publish? = link_to t('layout.mass_builds.publish_success'), publish_platform_mass_build_path(@platform, mass_build.id), - :method => :post, :confirm => t("layout.confirm"), :class => 'button' + method: :post, confirm: t("layout.confirm"), class: 'button' = link_to t('layout.mass_builds.publish_test_failed'), - publish_platform_mass_build_path(@platform, mass_build.id, :status => 'test_failed'), - :method => :post, :confirm => t("layout.confirm"), :class => 'button' + publish_platform_mass_build_path(@platform, mass_build.id, status: 'test_failed'), + method: :post, confirm: t("layout.confirm"), class: 'button' - if can?(:cancel, mass_build) = link_to t('layout.cancel'), cancel_platform_mass_build_path(@platform, mass_build.id), - :method => :post, :class => 'button', - :confirm => t('layout.mass_builds.cancel_confirm') + method: :post, class: 'button', + confirm: t('layout.mass_builds.cancel_confirm') %td - %a.toggle_btn{:href => "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data") - .toggle{:id => "toggle_#{ mass_build.id }"} + %a.toggle_btn{href: "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data") + .toggle{id: "toggle_#{ mass_build.id }"} -if mass_build.projects_list.present? = link_to_list @platform, mass_build, 'projects_list' .both diff --git a/app/views/platforms/mass_builds/new.html.haml b/app/views/platforms/mass_builds/new.html.haml index d7c1eaea0..da9e2a2ab 100644 --- a/app/views/platforms/mass_builds/new.html.haml +++ b/app/views/platforms/mass_builds/new.html.haml @@ -1,24 +1,24 @@ -- set_meta_tags :title => [title_object(@platform), t('layout.mass_builds.new')] +- set_meta_tags title: [title_object(@platform), t('layout.mass_builds.new')] = render 'platforms/base/submenu' = render 'platforms/base/sidebar' -= form_for [@platform, @mass_build], :html => { :class => 'form mass_build', :method => :post } do |f| += form_for [@platform, @mass_build], 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}", :href => "#{projects_list_platform_repository_path(@platform, rep)}?text=true" + = check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), id: "repositories_#{rep.id}", href: "#{projects_list_platform_repository_path(@platform, rep)}?text=true" = label_tag "repositories_#{rep.id}", rep.name %h3=t('layout.mass_builds.projects_list') = f.text_area :projects_list %br - = f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.projects.build_button'), data: {'disable-with' => t('layout.processing')} %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}" + = 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 - if @platform.personal? @@ -26,19 +26,19 @@ = f.collection_select :build_for_platform_id, Platform.main, :id, :name .both = hidden_field_tag :autocomplete_extra_repos_path, - "#{autocomplete_extra_repositories_autocompletes_path}?#{{:platform_id => @mass_build.save_to_platform.try(:id)}.to_param}" + "#{autocomplete_extra_repositories_autocompletes_path}?#{{platform_id: @mass_build.save_to_platform.try(:id)}.to_param}" = render 'shared/autocomplete_form', - :field => :extra_repositories, - :field_class => Repository, - :placeholder => 'uxteam_personal', - :subject => @mass_build, - :autocomplete_path => autocomplete_extra_repositories_autocompletes_path + field: :extra_repositories, + field_class: Repository, + placeholder: 'uxteam_personal', + subject: @mass_build, + autocomplete_path: autocomplete_extra_repositories_autocompletes_path = render 'shared/autocomplete_form', - :field => :extra_build_lists, - :field_class => BuildList, - :placeholder => '1000000', - :subject => @mass_build, - :autocomplete_path => autocomplete_extra_build_list_autocompletes_path + field: :extra_build_lists, + field_class: BuildList, + placeholder: '1000000', + subject: @mass_build, + autocomplete_path: autocomplete_extra_build_list_autocompletes_path %h3= t("activerecord.attributes.build_list.preferences") - [:auto_publish, :increase_release_tag].each do |field| .both diff --git a/app/views/platforms/platforms/_advisories.html.haml b/app/views/platforms/platforms/_advisories.html.haml index 910a9d643..74a140300 100644 --- a/app/views/platforms/platforms/_advisories.html.haml +++ b/app/views/platforms/platforms/_advisories.html.haml @@ -1,7 +1,7 @@ -%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"} +%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 + = render partial: 'advisory', collection: @advisories, as: :advisory diff --git a/app/views/platforms/platforms/_advisory.html.haml b/app/views/platforms/platforms/_advisory.html.haml index 071f86d48..64884058a 100644 --- a/app/views/platforms/platforms/_advisory.html.haml +++ b/app/views/platforms/platforms/_advisory.html.haml @@ -1,3 +1,3 @@ -%tr{:class => cycle("odd", "even")} +%tr{class: cycle("odd", "even")} %td= link_to advisory.advisory_id, advisory_path(advisory) - %td= truncate(advisory.description, :length => 50) + %td= truncate(advisory.description, length: 50) diff --git a/app/views/platforms/platforms/_connection_info.html.haml b/app/views/platforms/platforms/_connection_info.html.haml index ced0b5cf2..5838944ba 100644 --- a/app/views/platforms/platforms/_connection_info.html.haml +++ b/app/views/platforms/platforms/_connection_info.html.haml @@ -1,4 +1,4 @@ -- platforms = Platform.main.opened.where(:distrib_type => APP_CONFIG['distr_types'].first).order('name ASC') +- platforms = Platform.main.opened.where(distrib_type: APP_CONFIG['distr_types'].first).order('name ASC') - if platforms.count > 0 .command_select @@ -14,7 +14,7 @@ .both .rightlist - %textarea{:id => 'command_string', :readonly => 'readonly'} + %textarea{id: 'command_string', readonly: 'readonly'} .both :javascript diff --git a/app/views/platforms/platforms/_form.html.haml b/app/views/platforms/platforms/_form.html.haml index 9d7400dcd..459ffeda7 100644 --- a/app/views/platforms/platforms/_form.html.haml +++ b/app/views/platforms/platforms/_form.html.haml @@ -1,34 +1,34 @@ - unless ['edit', 'update'].include? controller.action_name - .leftlist= f.label :name, :class => :label - .rightlist= f.text_field :name, :class => 'text_field' + .leftlist= f.label :name, class: :label + .rightlist= f.text_field :name, class: 'text_field' .both -.leftlist= f.label :description, :class => :label -.rightlist= f.text_area :description, :class => 'text_field' +.leftlist= f.label :description, class: :label +.rightlist= f.text_area :description, class: 'text_field' .both - unless ['edit', 'update'].include? controller.action_name - .leftlist= f.label :distrib_type, :class => :label + .leftlist= f.label :distrib_type, class: :label .rightlist= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types']) .both - -#.leftlist= f.label :parent, :class => :label - .rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true + -#.leftlist= f.label :parent, class: :label + .rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, include_blank: true .both - unless @platform.platform_type.in? ['personal'] - .leftlist= f.label :released, :class => :label - .rightlist= f.check_box :released, :class => 'check_box' + .leftlist= f.label :released, class: :label + .rightlist= f.check_box :released, class: 'check_box' .both - .leftlist= label_tag "", t("layout.platforms.admin_id"), :class => :label - .rightlist= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_autocompletes_path, :id_element => '#admin_id_field' - = hidden_field_tag 'admin_id', @admin_id, :id => 'admin_id_field' + .leftlist= label_tag "", t("layout.platforms.admin_id"), class: :label + .rightlist= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_autocompletes_path, id_element: '#admin_id_field' + = hidden_field_tag 'admin_id', @admin_id, id: 'admin_id_field' .both %h3= t('layout.platform_arch_settings.extra_settings') - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.lpadding16= t("activerecord.models.arch") @@ -36,16 +36,16 @@ %th.lpadding16= t("activerecord.attributes.platform_arch_setting.time_living") %tbody - platform_arch_settings(@platform).each do |setting| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} = f.fields_for :platform_arch_settings, setting do |s_form| %td = setting.arch.name = s_form.hidden_field :arch_id - %td.center= s_form.check_box :default, :class => 'check_box' - %td.right= s_form.text_field :time_living, :value => setting.time_living / 60, :class => 'text_field', :size => 10 + %td.center= s_form.check_box :default, class: 'check_box' + %td.right= s_form.text_field :time_living, value: setting.time_living / 60, class: 'text_field', size: 10 .both .button_block - = f.submit t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = f.submit t('layout.save'), data: {'disable-with' => t('layout.saving')} %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), @platform.new_record? ? root_path : platform_path(@platform), :class => "button" + = link_to t("layout.cancel"), @platform.new_record? ? root_path : platform_path(@platform), class: "button" diff --git a/app/views/platforms/platforms/_list.html.haml b/app/views/platforms/platforms/_list.html.haml index 1ac3c3353..052a86884 100644 --- a/app/views/platforms/platforms/_list.html.haml +++ b/app/views/platforms/platforms/_list.html.haml @@ -1,10 +1,10 @@ -%table#myTable.tablesorter.platforms{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platforms{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.platform.name") %th.th2= t("activerecord.attributes.platform.distrib_type") %tbody - @platforms.each do |platform| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td= link_to platform_printed_name(platform), platform_path(platform) %td= platform.distrib_type diff --git a/app/views/platforms/platforms/advisories.html.haml b/app/views/platforms/platforms/advisories.html.haml index caf2cc666..75255b69f 100644 --- a/app/views/platforms/platforms/advisories.html.haml +++ b/app/views/platforms/platforms/advisories.html.haml @@ -1,6 +1,6 @@ -- set_meta_tags :title => [title_object(@platform), t('layout.advisories.list_header')] +- set_meta_tags title: [title_object(@platform), t('layout.advisories.list_header')] = render 'submenu' = render 'sidebar' -= render :partial => 'advisories', :object => @advisories += render partial: 'advisories', object: @advisories = will_paginate @advisories diff --git a/app/views/platforms/platforms/clone.html.haml b/app/views/platforms/platforms/clone.html.haml index b4f65eee6..1ea007b58 100644 --- a/app/views/platforms/platforms/clone.html.haml +++ b/app/views/platforms/platforms/clone.html.haml @@ -1,17 +1,17 @@ --set_meta_tags :title => [title_object(@platform), t('layout.platforms.clone_header')] +-set_meta_tags title: [title_object(@platform), t('layout.platforms.clone_header')] = render 'submenu' = render 'sidebar' -= form_for @cloned, :url => make_clone_platform_path(@platform), :html => { :class => :form } do |f| - .leftlist= f.label :name, :class => :label - .rightlist= f.text_field :name, :class => 'text_field' += form_for @cloned, url: make_clone_platform_path(@platform), html: { class: :form } do |f| + .leftlist= f.label :name, class: :label + .rightlist= f.text_field :name, class: 'text_field' - .leftlist= f.label :description, :class => :label - .rightlist= f.text_field :description, :class => 'text_field' + .leftlist= f.label :description, class: :label + .rightlist= f.text_field :description, class: 'text_field' .both .button_block - = submit_tag t('layout.clone'), :data => {'disable-with' => t('layout.processing')} + = submit_tag t('layout.clone'), data: {'disable-with' => t('layout.processing')} %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), platform_path(@platform), :class => "button" \ No newline at end of file + = link_to t("layout.cancel"), platform_path(@platform), class: "button" \ No newline at end of file diff --git a/app/views/platforms/platforms/edit.html.haml b/app/views/platforms/platforms/edit.html.haml index 9d8323e44..5e90fd195 100644 --- a/app/views/platforms/platforms/edit.html.haml +++ b/app/views/platforms/platforms/edit.html.haml @@ -1,18 +1,18 @@ --set_meta_tags :title => [title_object(@platform), t('layout.platforms.edit')] +-set_meta_tags title: [title_object(@platform), t('layout.platforms.edit')] = render 'submenu' = render 'sidebar' -= form_for @platform, :url => platform_path(@platform), :html => { :class => :form } do |f| - = render "form", :f => f += form_for @platform, url: platform_path(@platform), html: { class: :form } do |f| + = render "form", f: f - if can? :change_visibility, @platform .hr .leftside= t('activerecord.attributes.platform.visibility') .rightside= link_to t("layout.platforms.change_visibility_from_#{@platform.visibility}"), change_visibility_platform_path(@platform), - :method => :post, - :confirm => t("layout.platforms.confirm_change_visibility"), - :class => 'button' + method: :post, + confirm: t("layout.platforms.confirm_change_visibility"), + class: 'button' .both - if can? :regenerate_metadata, @platform @@ -31,15 +31,15 @@ .rightlist= link_to_file_store('regeneration.log', @platform.last_regenerated_log_sha1) .both .leftside - .rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), :method => :put, :confirm => t('layout.confirm'), :class => 'button' + .rightside= link_to t('layout.regeneration_statuses.regenerate_metadata'), regenerate_metadata_platform_path(@platform), method: :put, confirm: t('layout.confirm'), class: 'button' .both - if can? :destroy, @platform .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' + .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 => :put + .rightside= link_to t("layout.repositories.clear"), clear_platform_path(@platform), class: 'button', confirm: t('layout.repositories.clear_confirm'), method: :put .both diff --git a/app/views/platforms/platforms/index.html.haml b/app/views/platforms/platforms/index.html.haml index e8e000676..89abeaab6 100644 --- a/app/views/platforms/platforms/index.html.haml +++ b/app/views/platforms/platforms/index.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => t('layout.platforms.list_header') -= link_to t("layout.platforms.new"), new_platform_path, :class => 'button' if can? :create, Platform -= render 'list', :object => @platforms +-set_meta_tags title: t('layout.platforms.list_header') += link_to t("layout.platforms.new"), new_platform_path, class: 'button' if can? :create, Platform += render 'list', object: @platforms = will_paginate @platforms diff --git a/app/views/platforms/platforms/members.html.haml b/app/views/platforms/platforms/members.html.haml index 89bd0bedd..d32434ed0 100644 --- a/app/views/platforms/platforms/members.html.haml +++ b/app/views/platforms/platforms/members.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => [title_object(@platform), t('layout.platforms.members')] +-set_meta_tags title: [title_object(@platform), t('layout.platforms.members')] = render 'submenu' = render 'sidebar' = render "shared/members_table", - :remove_members_path => remove_members_platform_path(@platform), - :remove_member_path => remove_member_platform_path(@platform), - :add_member_path => add_member_platform_path(@platform), - :members => @members.select{|u| u != @platform.owner}, - :editable_object => @platform + remove_members_path: remove_members_platform_path(@platform), + remove_member_path: remove_member_platform_path(@platform), + add_member_path: add_member_platform_path(@platform), + members: @members.select{|u| u != @platform.owner}, + editable_object: @platform diff --git a/app/views/platforms/platforms/new.html.haml b/app/views/platforms/platforms/new.html.haml index 5f9dc3767..7be26baf1 100644 --- a/app/views/platforms/platforms/new.html.haml +++ b/app/views/platforms/platforms/new.html.haml @@ -1,4 +1,4 @@ %h3= title t("layout.platforms.new_header") -= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f| - = render "form", :f => f += form_for :platform, url: platforms_path, html: { class: :form } do |f| + = render "form", f: f diff --git a/app/views/platforms/platforms/show.html.haml b/app/views/platforms/platforms/show.html.haml index 14aa01776..00dd0148b 100644 --- a/app/views/platforms/platforms/show.html.haml +++ b/app/views/platforms/platforms/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => title_object(@platform) +-set_meta_tags title: title_object(@platform) = render 'submenu' = render 'sidebar' @@ -32,6 +32,6 @@ %td= @platform.distrib_type .buttons_block - = link_to I18n.t("layout.platforms.clone"), clone_platform_path(@platform), :class => "button left_floated" if can? :clone, @platform + = 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' diff --git a/app/views/platforms/private_users/index.html.haml b/app/views/platforms/private_users/index.html.haml index f48cd9647..ad70e003a 100644 --- a/app/views/platforms/private_users/index.html.haml +++ b/app/views/platforms/private_users/index.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(current_user.repository), t('layout.personal_repositories.private_users')] +-set_meta_tags title: [title_object(current_user.repository), t('layout.personal_repositories.private_users')] .block .secondary-navigation %ul.wat-cf @@ -17,11 +17,11 @@ = t("activerecord.attributes.repository.platform") \: = link_to @platform.name, platform_path(@platform) - + - if @urpmi_list - = render 'shared/urpmi_list', :urpmi_commands => @urpmi_list + = render 'shared/urpmi_list', urpmi_commands: @urpmi_list .wat-cf - =# link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete") + =# link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), method: "delete", class: "button", confirm: t("layout.repositories.confirm_delete") %br .inner =t('layout.private_users.warning_message') @@ -30,7 +30,7 @@ .secondary-navigation %ul.wat-cf %li.first.active= link_to t("layout.private_users.list"), platform_private_users_path(@platform) - %li= link_to t("layout.private_users.new"), platform_private_users_path(@platform), :method => :post if PrivateUser.can_generate_more?(current_user.id, @platform.id) + %li= link_to t("layout.private_users.new"), platform_private_users_path(@platform), method: :post if PrivateUser.can_generate_more?(current_user.id, @platform.id) .content %h2.title = t("layout.private_users.list_header") @@ -40,11 +40,11 @@ %th.first= t("activerecord.attributes.private_user.login") %th.last   - @private_users.each do |private_user| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td = private_user.login %td.last - #{link_to t("layout.private_users.regenerate_btn"), platform_private_users_path(@platform), :method => :post, :confirm => t("layout.private_users.confirm_regenerate")} + #{link_to t("layout.private_users.regenerate_btn"), platform_private_users_path(@platform), method: :post, confirm: t("layout.private_users.confirm_regenerate")} .actions-bar.wat-cf .actions = will_paginate @private_users \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/_filter.html.haml b/app/views/platforms/product_build_lists/_filter.html.haml index 5104d3208..33a4468c4 100644 --- a/app/views/platforms/product_build_lists/_filter.html.haml +++ b/app/views/platforms/product_build_lists/_filter.html.haml @@ -1,14 +1,14 @@ - content_for :sidebar do = render 'server_status' - = form_tag product_build_lists_path, :method => :get, :html => {:class => :form} do + = form_tag product_build_lists_path, method: :get, html: {class: :form} do .block %h3.small= t("activerecord.attributes.product_build_list.status") - .lineForm.aside= select_tag :status, options_for_select(ProductBuildList::STATUSES.map{|s| [ProductBuildList.human_status(s), s]}, params[:status]), {:include_blank => true, :class => 'sel80 aside'} + .lineForm.aside= select_tag :status, options_for_select(ProductBuildList::STATUSES.map{|s| [ProductBuildList.human_status(s), s]}, params[:status]), {include_blank: true, class: 'sel80 aside'} %h3.small= t("layout.product_build_lists.product_name_search") = text_field_tag :product_name, params[:product_name] %h3.small= t("layout.product_build_lists.id_search") = text_field_tag :product_id, params[:product_id] %br %br - = submit_tag t('layout.search.header'), :data => {'disable-with' => t('layout.processing')} \ No newline at end of file + = submit_tag t('layout.search.header'), data: {'disable-with' => t('layout.processing')} \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/_form.html.haml b/app/views/platforms/product_build_lists/_form.html.haml index 5fb076193..4d51dd73a 100644 --- a/app/views/platforms/product_build_lists/_form.html.haml +++ b/app/views/platforms/product_build_lists/_form.html.haml @@ -1,6 +1,6 @@ -.leftlist= f.label :lst, t("activerecord.attributes.product.lst"), :class => :label -.rightlist= f.text_field :lst, :class => 'text_field' +.leftlist= f.label :lst, t("activerecord.attributes.product.lst"), class: :label +.rightlist= f.text_field :lst, class: 'text_field' .both -.leftlist= f.label :project, t("activerecord.attributes.product.project"), :class => :label -.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) \ No newline at end of file +.leftlist= f.label :project, t("activerecord.attributes.product.project"), class: :label +.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), id_element: 'src_project_id', name: 'src_project', value: @product.project.try(:name_with_owner) \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/_product_build_list.html.haml b/app/views/platforms/product_build_lists/_product_build_list.html.haml index dd5bd8107..0f8dcda0d 100644 --- a/app/views/platforms/product_build_lists/_product_build_list.html.haml +++ b/app/views/platforms/product_build_lists/_product_build_list.html.haml @@ -1,4 +1,4 @@ -%tr{:class => cycle("odd", "even")} +%tr{class: cycle("odd", "even")} - pbl = product_build_list - product = pbl.product - platform = product.platform @@ -9,5 +9,5 @@ %td= pbl.human_status %td= link_to(nil, pbl.container_path) unless pbl.project %td= link_to pbl.product.name, platform_product_path(platform, product) - %td= link_to image_tag('x.png'), platform_product_product_build_list_path(platform, product, pbl), :method => :delete, :confirm => t("layout.confirm") if can?(:destroy, pbl) && pbl.can_destroy? && !pbl.project - = datetime_moment pbl.updated_at, :tag => :td \ No newline at end of file + %td= link_to image_tag('x.png'), platform_product_product_build_list_path(platform, product, pbl), method: :delete, confirm: t("layout.confirm") if can?(:destroy, pbl) && pbl.can_destroy? && !pbl.project + = datetime_moment pbl.updated_at, tag: :td \ No newline at end of file diff --git a/app/views/platforms/product_build_lists/index.html.haml b/app/views/platforms/product_build_lists/index.html.haml index 494484f71..b7a9c6306 100644 --- a/app/views/platforms/product_build_lists/index.html.haml +++ b/app/views/platforms/product_build_lists/index.html.haml @@ -1,5 +1,5 @@ --set_meta_tags :title => t('.title') -%table.tablesorter{:cellpadding => "0", :cellspacing => "0"} +-set_meta_tags title: t('.title') +%table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.lpadding16= t("activerecord.attributes.product_build_list.id") @@ -8,7 +8,7 @@ %th.lpadding16= t("activerecord.attributes.product_build_list.product") %th= t("layout.product_build_lists.action") %th.lpadding16= t("activerecord.attributes.product_build_list.notified_at") - %tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product_build_lists + %tbody= render partial: 'platforms/product_build_lists/product_build_list', collection: @product_build_lists .both = will_paginate @product_build_lists diff --git a/app/views/platforms/product_build_lists/new.html.haml b/app/views/platforms/product_build_lists/new.html.haml index 4a9f130bf..889654e31 100644 --- a/app/views/platforms/product_build_lists/new.html.haml +++ b/app/views/platforms/product_build_lists/new.html.haml @@ -1,20 +1,20 @@ --set_meta_tags :title => [title_object(@product), t('layout.product_build_lists.new')] +-set_meta_tags title: [title_object(@product), t('layout.product_build_lists.new')] = render 'submenu' %h3= t("layout.product_build_lists.main_data") - pbl = @product_build_list -= form_for pbl, :url => platform_product_product_build_lists_path(@platform, @product), :html => {:class => :form} do |f| - .leftlist= f.label :project, t("activerecord.attributes.product_build_list.project"), :class => :label += form_for pbl, url: platform_product_product_build_lists_path(@platform, @product), html: {class: :form} do |f| + .leftlist= f.label :project, t("activerecord.attributes.product_build_list.project"), class: :label .rightlist= pbl.project.name_with_owner .both - .leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), :class => :label - .rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || @product.project_version || pbl.project.default_branch + .leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), class: :label + .rightlist= f.select :project_version, versions_for_group_select(pbl.project), selected: params[:product_build_lists].try(:fetch, :project_version) || @product.project_version || pbl.project.default_branch .both - = render 'platforms/products/def_fields', :f => f + = render 'platforms/products/def_fields', f: f - = f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.projects.build_button'), data: {'disable-with' => t('layout.processing')} %br %div diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index 563b43317..415d25c8a 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@product_build_list.product), t('layout.product_build_lists.show')] +-set_meta_tags title: [title_object(@product_build_list.product), t('layout.product_build_lists.show')] = render 'submenu' - pbl = @product_build_list @@ -8,61 +8,61 @@ %h3= t("layout.product_build_lists.main_data") .both %div{'ng-controller' => 'ProductBuildListController'} - = render 'show_field', :key => :id, :value => pbl.id + = render 'show_field', key: :id, value: pbl.id = hidden_field_tag :product_build_list_id, pbl.id - = render 'show_field', :key => :status, :value => '{{pbl.human_status}}' + = render 'show_field', key: :status, value: '{{pbl.human_status}}' - if pbl.user - = render 'show_field', :key => :user, :value => link_to(pbl.user.try(:fullname), pbl.user) + = render 'show_field', key: :user, value: link_to(pbl.user.try(:fullname), pbl.user) - = render 'show_field', :key => :product, :value => link_to(pbl.product.name, platform_product_path(platform, product)) + = render 'show_field', key: :product, value: link_to(pbl.product.name, platform_product_path(platform, product)) - = render 'show_field', :key => :project, :value => link_to(pbl.project.name_with_owner, project_path(pbl.project)) + = render 'show_field', key: :project, value: link_to(pbl.project.name_with_owner, project_path(pbl.project)) - = render 'show_field', :key => :project_version, :value => product_build_list_version_link(pbl, true) + = render 'show_field', key: :project_version, value: product_build_list_version_link(pbl, true) - [:main_script, :params].each do |el| - = render 'show_field', :key => el, :value => pbl.send(el) + = render 'show_field', key: el, value: pbl.send(el) - = render 'show_field', :key => :time_living, :value => (pbl.time_living / 60) + = render 'show_field', key: :time_living, value: (pbl.time_living / 60) - = render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_") + = render 'show_field', key: :autostarted, value: t("layout.#{pbl.autostarted}_") - = render 'show_field', :key => :notified_at, :value => '{{pbl.notified_at}}' + = render 'show_field', key: :notified_at, value: '{{pbl.notified_at}}' - if can?(:cancel, pbl) = link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl), - :method => :put, :confirm => t("layout.confirm"), :class => 'button', + method: :put, confirm: t("layout.confirm"), class: 'button', 'ng-show' => 'pbl.can_cancel' .both %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| + 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 .rightlist - = f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete} + = 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')} + = submit_tag t('layout.update'), data: {'disable-with' => t('layout.processing')} .both .flash_notify{'ng-hide' => 'pbl.not_delete'} .alert.alert-error - days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME - days = (pbl.created_at.to_date - days.ago.to_date).to_i - if days > 1 - = t('layout.product_build_lists.will_be_removed_n_days', :n => days) + = t('layout.product_build_lists.will_be_removed_n_days', n: days) - else = t('layout.product_build_lists.will_be_removed_today') .both %div{'ng-show' => "pbl.status == #{ProductBuildList::BUILD_STARTED}"} - = render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } + = render 'shared/log', { build_started: true, get_log_path: log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) } - = render 'shared/build_results', :subject => pbl + = render 'shared/build_results', subject: pbl :javascript $(function(){ diff --git a/app/views/platforms/product_build_lists/show.json.jbuilder b/app/views/platforms/product_build_lists/show.json.jbuilder index 543fb0dce..502a92275 100644 --- a/app/views/platforms/product_build_lists/show.json.jbuilder +++ b/app/views/platforms/product_build_lists/show.json.jbuilder @@ -1,6 +1,6 @@ json.product_build_list do json.(@product_build_list, :id, :status, :human_status, :not_delete) - json.notified_at l(@product_build_list.updated_at, :format => :long) + json.notified_at l(@product_build_list.updated_at, format: :long) json.can_cancel @product_build_list.can_cancel? diff --git a/app/views/platforms/products/_def_fields.html.haml b/app/views/platforms/products/_def_fields.html.haml index 211155580..5c00f283f 100644 --- a/app/views/platforms/products/_def_fields.html.haml +++ b/app/views/platforms/products/_def_fields.html.haml @@ -1,8 +1,8 @@ - [:main_script, :params].each do |el| - .leftlist= f.label el, t("activerecord.attributes.product_build_list.#{el}"), :class => :label + .leftlist= f.label el, t("activerecord.attributes.product_build_list.#{el}"), class: :label .rightlist= f.text_field el .both -.leftlist= f.label :time_living, t("activerecord.attributes.product_build_list.time_living"), :class => :label -.rightlist= f.text_field :time_living, :value => (@product.time_living.to_i / 60) +.leftlist= f.label :time_living, t("activerecord.attributes.product_build_list.time_living"), class: :label +.rightlist= f.text_field :time_living, value: (@product.time_living.to_i / 60) .both \ No newline at end of file diff --git a/app/views/platforms/products/_form.html.haml b/app/views/platforms/products/_form.html.haml index 919fd0538..fc0e5a50b 100644 --- a/app/views/platforms/products/_form.html.haml +++ b/app/views/platforms/products/_form.html.haml @@ -1,27 +1,27 @@ .leftlist= f.label :name -.rightlist= f.text_field :name, :class => 'text_field' +.rightlist= f.text_field :name, class: 'text_field' .both .leftlist= f.label :description -.rightlist= f.text_area :description, :class => 'text_field resizable', :cols => 80 +.rightlist= f.text_area :description, class: 'text_field resizable', cols: 80 .both .leftlist= f.label :project -.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner) +.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), id_element: 'src_project_id', name: 'src_project', value: @product.project.try(:name_with_owner) .both .leftlist= f.label :project_version -.rightlist= f.select :project_version, versions_for_group_select(@product.project), {:selected => params[:products].try(:fetch, :project_version) || @product.project_version, :include_blank => true} +.rightlist= f.select :project_version, versions_for_group_select(@product.project), {selected: params[:products].try(:fetch, :project_version) || @product.project_version, include_blank: true} .both -= render 'def_fields', :f => f += render 'def_fields', f: f .leftlist= f.label :autostart_status -.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {:include_blank => true, :selected => @product.autostart_status} +.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {include_blank: true, selected: @product.autostart_status} .both .button_block - = submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), @product.new_record? ? platform_path(@platform) : platform_product_path(@platform, @product), :class => "button" + = link_to t("layout.cancel"), @product.new_record? ? platform_path(@platform) : platform_product_path(@platform, @product), class: "button" diff --git a/app/views/platforms/products/_list.html.haml b/app/views/platforms/products/_list.html.haml index 0ee555749..3b74dcf8e 100644 --- a/app/views/platforms/products/_list.html.haml +++ b/app/views/platforms/products/_list.html.haml @@ -1,14 +1,14 @@ -%table#myTable.tablesorter.platform-products{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platform-products{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.product.name") %th= t("layout.delete") %tbody - @products.each do |product| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td = link_to product.name, platform_product_path(@platform, product) %td.buttons - if can? :destroy, product - = link_to platform_product_path(@platform, product), :method => :delete, :confirm => t("layout.products.confirm_delete") do + = link_to platform_product_path(@platform, product), method: :delete, confirm: t("layout.products.confirm_delete") do %span.delete   diff --git a/app/views/platforms/products/edit.html.haml b/app/views/platforms/products/edit.html.haml index 90cc286c7..77179363b 100644 --- a/app/views/platforms/products/edit.html.haml +++ b/app/views/platforms/products/edit.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@product), t('title_editing')] +-set_meta_tags title: [title_object(@product), t('title_editing')] = render 'submenu' = render 'sidebar' @@ -7,6 +7,6 @@ = link_to @product.name, platform_product_path(@platform, @product) %br -= form_for [@platform, @product], :html => { :class => :form, :multipart => true } do |f| - = render "form", :f => f += form_for [@platform, @product], html: { class: :form, multipart: true } do |f| + = render "form", f: f diff --git a/app/views/platforms/products/index.html.haml b/app/views/platforms/products/index.html.haml index a2788c4f4..7adb5d333 100644 --- a/app/views/platforms/products/index.html.haml +++ b/app/views/platforms/products/index.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => [title_object(@platform), t('layout.products.list_header')] +-set_meta_tags title: [title_object(@platform), t('layout.products.list_header')] = render 'submenu' if params[:platform_id] = render 'sidebar' if params[:platform_id] -= link_to t("layout.products.new"), new_platform_product_path(@platform), :class => 'button' if can? :create, @platform.products.build -= render 'list', :object => @products += link_to t("layout.products.new"), new_platform_product_path(@platform), class: 'button' if can? :create, @platform.products.build += render 'list', object: @products = will_paginate @products diff --git a/app/views/platforms/products/new.html.haml b/app/views/platforms/products/new.html.haml index 5ed82d8ac..9179c48f5 100644 --- a/app/views/platforms/products/new.html.haml +++ b/app/views/platforms/products/new.html.haml @@ -1,6 +1,6 @@ --set_meta_tags :title => [title_object(@platform), t('layout.products.new')] +-set_meta_tags title: [title_object(@platform), t('layout.products.new')] = render 'submenu' = render 'sidebar' -= form_for [@platform, @product], :html => { :class => :form, :multipart => true } do |f| - = render "form", :f => f += form_for [@platform, @product], html: { class: :form, multipart: true } do |f| + = render "form", f: f diff --git a/app/views/platforms/products/show.html.haml b/app/views/platforms/products/show.html.haml index 61d92e8bb..8a3593ba8 100644 --- a/app/views/platforms/products/show.html.haml +++ b/app/views/platforms/products/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => title_object(@product) +-set_meta_tags title: title_object(@product) = render 'submenu' = render 'sidebar' @@ -8,15 +8,15 @@ .buttons_block - if can? :update, @product - = link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), :class => "button" + = link_to image_tag("code.png", alt: t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), class: "button" - if can? :destroy, @product - = link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), :method => "delete", :class => "button", :confirm => t("layout.products.confirm_delete") + = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), method: "delete", class: "button", confirm: t("layout.products.confirm_delete") - if can?(:create, @product.product_build_lists.build) - = link_to t("layout.products.build"), new_platform_product_product_build_list_path(@platform, @product), :class => "button" + = link_to t("layout.products.build"), new_platform_product_product_build_list_path(@platform, @product), class: "button" %h3= t("layout.products.build_lists_monitoring") -%table#myTable.tablesorter.platform-product-main{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platform-product-main{cellspacing: "0", cellpadding: "0"} %thead %tr %th= t("activerecord.attributes.product_build_list.id") @@ -24,5 +24,5 @@ %th= t("activerecord.attributes.product_build_list.container_path") %th= t("activerecord.attributes.product_build_list.product") %th= t("layout.product_build_lists.action") - %th= t("activerecord.attributes.product_build_list.notified_at") - %tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product.product_build_lists.default_order + %th= t("activerecord.attributes.product_build_list.notified_at") + %tbody= render partial: 'platforms/product_build_lists/product_build_list', collection: @product.product_build_lists.default_order diff --git a/app/views/platforms/repositories/_form.html.haml b/app/views/platforms/repositories/_form.html.haml index 3ae96c914..695cf2e1c 100644 --- a/app/views/platforms/repositories/_form.html.haml +++ b/app/views/platforms/repositories/_form.html.haml @@ -1,12 +1,12 @@ - if ['edit', 'update'].exclude? controller.action_name - .leftlist= f.label :name, t("activerecord.attributes.repository.name"), :class => :label - .rightlist= f.text_field :name, :class => 'text_field' + .leftlist= f.label :name, t("activerecord.attributes.repository.name"), class: :label + .rightlist= f.text_field :name, class: 'text_field' -.leftlist= f.label :description, t("activerecord.attributes.repository.description"), :class => :label -.rightlist= f.text_field :description, :class => 'text_field' +.leftlist= f.label :description, t("activerecord.attributes.repository.description"), class: :label +.rightlist= f.text_field :description, class: 'text_field' -.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), :class => :label -.rightlist= f.check_box :publish_without_qa, :class => 'check_box' +.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), class: :label +.rightlist= f.check_box :publish_without_qa, class: 'check_box' .leftlist= f.label :synchronizing_publications .rightlist= f.check_box :synchronizing_publications @@ -16,6 +16,6 @@ .hr .button_block - = submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), @repository.new_record? ? platform_repositories_path(@platform) : platform_repository_path(@platform, @repository), :class => "button" + = link_to t("layout.cancel"), @repository.new_record? ? platform_repositories_path(@platform) : platform_repository_path(@platform, @repository), class: "button" diff --git a/app/views/platforms/repositories/_list.html.haml b/app/views/platforms/repositories/_list.html.haml index a1a4371f7..ce4f2d084 100644 --- a/app/views/platforms/repositories/_list.html.haml +++ b/app/views/platforms/repositories/_list.html.haml @@ -1,4 +1,4 @@ -%table#myTable.tablesorter.platform-repos{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.platform-repos{cellspacing: "0", cellpadding: "0"} %thead %tr %th.th1= t("activerecord.attributes.repository.name") @@ -6,7 +6,7 @@ %th= t("activerecord.attributes.repository.publish_without_qa") %tbody - @repositories.each do |repository| - %tr{:class => cycle("odd", "even")} + %tr{class: cycle("odd", "even")} %td = link_to repository.name, platform_repository_path(@platform, repository) %td diff --git a/app/views/platforms/repositories/_proj_ajax.json.jbuilder b/app/views/platforms/repositories/_proj_ajax.json.jbuilder index 39d2b7a3a..b610ce811 100644 --- a/app/views/platforms/repositories/_proj_ajax.json.jbuilder +++ b/app/views/platforms/repositories/_proj_ajax.json.jbuilder @@ -1,12 +1,12 @@ projs = @projects.map do |project| [ link_to(project.name_with_owner, project), - truncate(project.description || '', :length => 60).gsub(/\n|\r|\t/, ' '), - link_to(t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id)) + truncate(project.description || '', length: 60).gsub(/\n|\r|\t/, ' '), + link_to(t("layout.add"), url_for(controller: :repositories, action: :add_project, project_id: project.id)) ] end json.sEcho params[:sEcho] || -1 json.iTotalRecords @total_projects json.iTotalDisplayRecords @projects.count -json.aaData projs +json.aaData projs diff --git a/app/views/platforms/repositories/_proj_list.html.haml b/app/views/platforms/repositories/_proj_list.html.haml index a470d9dd2..3e0b4b546 100644 --- a/app/views/platforms/repositories/_proj_list.html.haml +++ b/app/views/platforms/repositories/_proj_list.html.haml @@ -1,15 +1,15 @@ -- columns = [{:type => 'html'}, {:type => 'html', :sortable => false, :searchable => false}, {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}] -= raw datatable(columns, {:sort_by => "[0, 'asc']", :search_label => t("layout.search_by_name"), :processing => t("layout.processing"), - :pagination_labels => {:previous => t("datatables.previous_label"), :next => t("datatables.next_label")}, - :empty_label => t("datatables.empty_label"), - :info_label => t("datatables.info_label"), - :info_empty_label => t("datatables.info_empty_label"), - :filtered_label => t("datatables.filtered_label"), - :table_dom_id => 'datatable', - :auto_width => 'false', - :ajax_source => "#{url_for :controller => :repositories, :action => :projects_list, :id => @repository.id, :added => "#{controller.action_name.to_sym == :show}", :format => :json}" }) +- columns = [{type: 'html'}, {type: 'html', sortable: false, searchable: false}, {type: nil, sortable: false, searchable: false, class: 'buttons'}] += raw datatable(columns, {sort_by: "[0, 'asc']", search_label: t("layout.search_by_name"), processing: t("layout.processing"), + pagination_labels: {previous: t("datatables.previous_label"), next: t("datatables.next_label")}, + empty_label: t("datatables.empty_label"), + info_label: t("datatables.info_label"), + info_empty_label: t("datatables.info_empty_label"), + filtered_label: t("datatables.filtered_label"), + table_dom_id: 'datatable', + auto_width: 'false', + ajax_source: "#{url_for controller: :repositories, action: :projects_list, id: @repository.id, added: "#{controller.action_name.to_sym == :show}", format: :json}" }) -%table#datatable.tablesorter.repo-projects{:cellspacing => 0, :cellpadding => 0} +%table#datatable.tablesorter.repo-projects{cellspacing: 0, cellpadding: 0} %thead %tr %th.th1= t("activerecord.attributes.project.name") diff --git a/app/views/platforms/repositories/_project.json.jbuilder b/app/views/platforms/repositories/_project.json.jbuilder index f3e1a20c2..70d91cd55 100644 --- a/app/views/platforms/repositories/_project.json.jbuilder +++ b/app/views/platforms/repositories/_project.json.jbuilder @@ -1,15 +1,15 @@ projs = @projects.map do |pr| [ - content_tag(:div, image_tag(visibility_icon(pr.visibility)), :class => 'table-sort-left') + - content_tag(:div, link_to(pr.name_with_owner, pr), :class => 'table-sort-right'), + content_tag(:div, image_tag(visibility_icon(pr.visibility)), class: 'table-sort-left') + + content_tag(:div, link_to(pr.name_with_owner, pr), class: 'table-sort-right'), - truncate(pr.description || '', :length => 60).gsub(/\n|\r|\t/, ' '), + truncate(pr.description || '', length: 60).gsub(/\n|\r|\t/, ' '), if can? :remove_project, @repository link_to( - remove_project_platform_repository_path(@platform, @repository, :project_id => pr.id), - :method => :delete, :confirm => t("layout.confirm")) do - content_tag(:span, " ".html_safe, :class => 'delete') + remove_project_platform_repository_path(@platform, @repository, project_id: pr.id), + method: :delete, confirm: t("layout.confirm")) do + content_tag(:span, " ".html_safe, class: 'delete') end else '' diff --git a/app/views/platforms/repositories/edit.html.haml b/app/views/platforms/repositories/edit.html.haml index 7e6698996..af9dea764 100644 --- a/app/views/platforms/repositories/edit.html.haml +++ b/app/views/platforms/repositories/edit.html.haml @@ -1,26 +1,26 @@ --set_meta_tags :title => [title_object(@repository), t('layout.repositories.edit')] +-set_meta_tags title: [title_object(@repository), t('layout.repositories.edit')] = render 'submenu' = render 'sidebar' %h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}" -= form_for @repository, :url => platform_repository_path(@platform, @repository), :html => { :class => :form } do |f| - = render "form", :f => f += form_for @repository, url: platform_repository_path(@platform, @repository), html: { class: :form } do |f| + = render "form", f: f %br - if can?(:update, @repository) .hr %h3= t('layout.repositories.extra_actions') - = form_for @repository, :url => regenerate_metadata_platform_repository_path(@platform, @repository), :html => { :class => :form, :method => :put } do |f| + = form_for @repository, url: regenerate_metadata_platform_repository_path(@platform, @repository), html: { class: :form, method: :put } do |f| .leftlist= t('layout.repositories.regenerate_metadata') .rightlist = select_tag :build_for_platform_id, options_from_collection_for_select(Platform.main, :id, :name) if @platform.personal? - = f.submit t('layout.repositories.regenerate_metadata'), :confirm => t('layout.confirm') + = f.submit t('layout.repositories.regenerate_metadata'), confirm: t('layout.confirm') .both - if @repository.repository_statuses.present? - %table#myTable.tablesorter.platform-repos{:cellspacing => "0", :cellpadding => "0"} + %table#myTable.tablesorter.platform-repos{cellspacing: "0", cellpadding: "0"} %thead %tr %th= t('activerecord.attributes.regeneration_status.status') @@ -31,7 +31,7 @@ %th= t('activerecord.models.platform') %tbody - @repository.repository_statuses.sort_by{ |s| s.platform.name }.each do |status| - %tr{:class => cycle('odd', 'even')} + %tr{class: cycle('odd', 'even')} %td= t("layout.regeneration_statuses.statuses.#{status.human_status}") %td= t("layout.regeneration_statuses.last_regenerated_statuses.#{status.human_regeneration_status}") %td= link_to_file_store('regeneration.log', status.last_regenerated_log_sha1) @@ -43,13 +43,13 @@ - if @platform.main? - if @repository.sync_lock_file_exists? - label = t('layout.repositories.remove_sync_lock_file') - - path = sync_lock_file_platform_repository_path(@platform, @repository, :remove => true) + - path = sync_lock_file_platform_repository_path(@platform, @repository, remove: true) - else - label = t('layout.repositories.add_sync_lock_file') - path = sync_lock_file_platform_repository_path(@platform, @repository) - = form_for @repository, :url => path, :html => { :class => :form, :method => :put } do |f| + = form_for @repository, url: path, html: { class: :form, method: :put } do |f| .leftlist= t('layout.repositories.sync_lock_file_info') - .rightlist= f.submit label, :confirm => t('layout.confirm') + .rightlist= f.submit label, confirm: t('layout.confirm') .both .hr @@ -57,8 +57,8 @@ - if @platform.main? = render "shared/members_table", - :remove_members_path => remove_members_platform_repository_path(@platform, @repository), - :remove_member_path => remove_member_platform_repository_path(@platform, @repository), - :add_member_path => add_member_platform_repository_path(@platform, @repository), - :members => @members, - :editable_object => @repository + remove_members_path: remove_members_platform_repository_path(@platform, @repository), + remove_member_path: remove_member_platform_repository_path(@platform, @repository), + add_member_path: add_member_platform_repository_path(@platform, @repository), + members: @members, + editable_object: @repository diff --git a/app/views/platforms/repositories/index.html.haml b/app/views/platforms/repositories/index.html.haml index bdadba3ac..697c200b5 100644 --- a/app/views/platforms/repositories/index.html.haml +++ b/app/views/platforms/repositories/index.html.haml @@ -1,6 +1,6 @@ --set_meta_tags :title => [title_object(@platform), t('layout.repositories.list_header')] +-set_meta_tags title: [title_object(@platform), t('layout.repositories.list_header')] = render 'submenu' if params[:platform_id] = render 'sidebar' if params[:platform_id] -= link_to t("layout.repositories.new"), new_platform_repository_path(@platform), :class => 'button' if can? :create, @platform.repositories.build -= render 'list', :object => @repositories += link_to t("layout.repositories.new"), new_platform_repository_path(@platform), class: 'button' if can? :create, @platform.repositories.build += render 'list', object: @repositories = will_paginate @repositories diff --git a/app/views/platforms/repositories/new.html.haml b/app/views/platforms/repositories/new.html.haml index 72740cbb4..1be73a4c4 100644 --- a/app/views/platforms/repositories/new.html.haml +++ b/app/views/platforms/repositories/new.html.haml @@ -1,8 +1,8 @@ --set_meta_tags :title => [title_object(@platform), t('layout.repositories.new')] +-set_meta_tags title: [title_object(@platform), t('layout.repositories.new')] = render 'submenu' = render 'sidebar' %h3= t("layout.repositories.new_header") -= form_for :repository, :url => platform_repositories_path(@platform), :html => { :class => :form } do |f| - = render "form", :f => f += form_for :repository, url: platform_repositories_path(@platform), html: { class: :form } do |f| + = render "form", f: f diff --git a/app/views/platforms/repositories/projects_list.html.haml b/app/views/platforms/repositories/projects_list.html.haml index e744a5d90..36df13dd7 100644 --- a/app/views/platforms/repositories/projects_list.html.haml +++ b/app/views/platforms/repositories/projects_list.html.haml @@ -3,12 +3,12 @@ %h3= raw "#{t("layout.repositories.add_projects_to")}: #{link_to @repository.name, platform_repository_path(@platform, @repository)}" -= form_for :repository, :url => add_project_platform_repository_path(@platform, @repository), :method => :put, :html => { :class => :form } do |f| += form_for :repository, url: add_project_platform_repository_path(@platform, @repository), method: :put, html: { class: :form } do |f| .leftlist= f.label :projects_list .rightlist= f.text_area :projects_list .both .hr .button_block - = submit_tag t('layout.add'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.add'), data: {'disable-with' => t('layout.saving')} -= render 'proj_list', :object => @projects += render 'proj_list', object: @projects diff --git a/app/views/platforms/repositories/remove_project.html.haml b/app/views/platforms/repositories/remove_project.html.haml index 1fc5b0ed1..820624dbf 100644 --- a/app/views/platforms/repositories/remove_project.html.haml +++ b/app/views/platforms/repositories/remove_project.html.haml @@ -3,10 +3,10 @@ %h3= raw "#{t("layout.repositories.remove_projects_from")}: #{link_to @repository.name, platform_repository_path(@platform, @repository)}" -= form_for :repository, :url => remove_project_platform_repository_path(@platform, @repository), :method => :delete, :html => { :class => :form } do |f| += form_for :repository, url: remove_project_platform_repository_path(@platform, @repository), method: :delete, html: { class: :form } do |f| .leftlist= f.label :projects_list .rightlist= f.text_area :projects_list .both .hr .button_block - = submit_tag t('layout.delete'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.delete'), data: {'disable-with' => t('layout.saving')} diff --git a/app/views/platforms/repositories/show.html.haml b/app/views/platforms/repositories/show.html.haml index ddfba3750..c23beb6a9 100644 --- a/app/views/platforms/repositories/show.html.haml +++ b/app/views/platforms/repositories/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => title_object(@repository) +-set_meta_tags title: title_object(@repository) = render 'submenu' = render 'sidebar' @@ -8,15 +8,15 @@ .buttons_block - if can? :update, @repository - = link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_repository_path(@platform, @repository), :class => "button" + = link_to image_tag("code.png", alt: t("layout.edit")) + " " + t("layout.edit"), edit_platform_repository_path(@platform, @repository), class: "button" - if can? :destroy, @repository - = link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete") + = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), method: "delete", class: "button", confirm: t("layout.repositories.confirm_delete") %br %br %h3.fix= t("layout.projects.list_header") - if can? :add_project, @repository - = link_to t("layout.projects.add"), add_project_platform_repository_path(@platform, @repository), :class => 'button' + = link_to t("layout.projects.add"), add_project_platform_repository_path(@platform, @repository), class: 'button' - if can? :remove_project, @repository - = link_to t("layout.repositories.mass_delete"), remove_project_platform_repository_path(@platform, @repository), :class => 'button' + = link_to t("layout.repositories.mass_delete"), remove_project_platform_repository_path(@platform, @repository), class: 'button' = render 'proj_list' diff --git a/app/views/platforms/tokens/index.html.haml b/app/views/platforms/tokens/index.html.haml index efbe92cfd..e759bcf4f 100644 --- a/app/views/platforms/tokens/index.html.haml +++ b/app/views/platforms/tokens/index.html.haml @@ -1,9 +1,9 @@ --set_meta_tags :title => [title_object(@platform), t('layout.tokens.header')] +-set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] = render 'submenu' = render 'sidebar' -= link_to t('layout.tokens.new'), new_platform_token_path(@platform), :class => 'button' += link_to t('layout.tokens.new'), new_platform_token_path(@platform), class: 'button' -%table#myTable.tablesorter.tokens{:cellspacing => "0", :cellpadding => "0"} +%table#myTable.tablesorter.tokens{cellspacing: "0", cellpadding: "0"} %thead %tr %th= t('activerecord.attributes.token.description') @@ -12,8 +12,8 @@ %th %tbody - @tokens.each do |token| - %tr{:class => cycle('odd', 'even')} - %td= truncate token.description, :length => 50 + %tr{class: cycle('odd', 'even')} + %td= truncate token.description, length: 50 %td= link_to token.creator.try(:fullname), token.creator %td= t("layout.tokens.statuses.#{token.status}") %td= link_to t('layout.show'), platform_token_path(@platform, token) diff --git a/app/views/platforms/tokens/new.html.haml b/app/views/platforms/tokens/new.html.haml index c4d22153c..f48c73f46 100644 --- a/app/views/platforms/tokens/new.html.haml +++ b/app/views/platforms/tokens/new.html.haml @@ -1,16 +1,16 @@ --set_meta_tags :title => [title_object(@platform), t('layout.tokens.new')] +-set_meta_tags title: [title_object(@platform), t('layout.tokens.new')] = render 'submenu' = render 'sidebar' %h3= t('layout.tokens.new') -= form_for @token, :url => platform_tokens_path(@platform), :method => :post, :html => { :class => :form } do |f| += form_for @token, url: platform_tokens_path(@platform), method: :post, html: { class: :form } do |f| .leftlist= f.label :description .rightlist= f.text_area :description .both .hr .button_block - = submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} %span.text_button_padding= t('layout.or') - = link_to t('layout.cancel'), platform_tokens_path(@platform), :class => 'button' + = link_to t('layout.cancel'), platform_tokens_path(@platform), class: 'button' diff --git a/app/views/platforms/tokens/show.html.haml b/app/views/platforms/tokens/show.html.haml index 59084b6c5..b90277aaf 100644 --- a/app/views/platforms/tokens/show.html.haml +++ b/app/views/platforms/tokens/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@platform), t('layout.tokens.header')] +-set_meta_tags title: [title_object(@platform), t('layout.tokens.header')] = render 'submenu' = render 'sidebar' @@ -37,5 +37,5 @@ .buttons_block = link_to t('layout.tokens.withdraw'), withdraw_platform_token_path(@platform, @token), - :method => :post, :class => 'button', - :confirm => t('layout.tokens.withdraw_confirm') + method: :post, class: 'button', + confirm: t('layout.tokens.withdraw_confirm') diff --git a/app/views/projects/base/_branch_select.html.haml b/app/views/projects/base/_branch_select.html.haml index 2371453bc..7c81e5ab2 100644 --- a/app/views/projects/base/_branch_select.html.haml +++ b/app/views/projects/base/_branch_select.html.haml @@ -1,6 +1,6 @@ .lineForm.fork - = select_tag :branch, branch_selector_options(project), :id => 'branch_selector', :class => 'sel80' - %form{:action => '', :method => :get, :id => 'branch_changer', :'data-action' => "#{controller_name}"} + = select_tag :branch, branch_selector_options(project), id: 'branch_selector', class: 'sel80' + %form{action: '', method: :get, id: 'branch_changer', :'data-action' => "#{controller_name}"} .fork %p #{t('layout.projects.current_branch')}: .both diff --git a/app/views/projects/base/_layout.html.haml b/app/views/projects/base/_layout.html.haml index 601a41b28..a91d2374a 100644 --- a/app/views/projects/base/_layout.html.haml +++ b/app/views/projects/base/_layout.html.haml @@ -1,10 +1,10 @@ = render 'submenu' -= render 'repo_block', :project => @project -= render 'about_block', :project => @project += render 'repo_block', project: @project += render 'about_block', project: @project %h3= t("layout.projects.last_commit") -- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter| - = render 'shared/feed_message', :presenter => presenter, :item_no => 1 +- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter| + = render 'shared/feed_message', presenter: presenter, item_no: 1 .both diff --git a/app/views/projects/base/_repo_block.html.haml b/app/views/projects/base/_repo_block.html.haml index e641613dc..3d302ba6b 100644 --- a/app/views/projects/base/_repo_block.html.haml +++ b/app/views/projects/base/_repo_block.html.haml @@ -5,46 +5,46 @@ -if @commit %ul.nav.zip %li#menu-archive.dropdown - %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#menu-archive"} - =image_tag 'zip.png', :alt => 'ZIP' + %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#menu-archive"} + =image_tag 'zip.png', alt: 'ZIP' %b.caret %ul.dropdown-menu - file_name = "#{@project.name}-#{treeish}" %li=link_to "tar.gz", archive_path(project, file_name, 'tar.gz') %li=link_to "zip", archive_path(project, file_name, 'zip') .btn-group#clone-urls - %button.git-protocol-selector.btn{:value => 'http_url', :class => current_user ? '' : 'active'} HTTP - %button.git-protocol-selector.btn{:value => 'ssh_url', :class => current_user ? 'active' : ''} SSH + %button.git-protocol-selector.btn{value: 'http_url', class: current_user ? '' : 'active'} HTTP + %button.git-protocol-selector.btn{value: 'ssh_url', class: current_user ? 'active' : ''} SSH =hidden_field_tag :http_url, http_url =hidden_field_tag :ssh_url, ssh_url - = text_field_tag :url, (current_user ? ssh_url : http_url), :class => 'name', :spellcheck => 'false', :readonly => true + = text_field_tag :url, (current_user ? ssh_url : http_url), class: 'name', spellcheck: 'false', readonly: true .git_help ? .role= can?(:write, project) ? t("layout.read_write_access") : t("layout.read_access") - = render 'branch_select', :project => project if act != :tags + = render 'branch_select', project: project if act != :tags .both #git_help_data %p= t("layout.projects.git_help.cloning") + ":" %p - %p.http_url{:class => current_user ? 'hidden' : ''}~ "git clone #{http_url} #{project.name}" - %p.ssh_url{:class => current_user ? '' : 'hidden'}~ "git clone #{ssh_url} #{project.name}" + %p.http_url{class: current_user ? 'hidden' : ''}~ "git clone #{http_url} #{project.name}" + %p.ssh_url{class: current_user ? '' : 'hidden'}~ "git clone #{ssh_url} #{project.name}" %p~ "cd #{project.name}" %p %p= t("layout.projects.git_help.remote") + ":" %p - %p.http_url{:class => current_user ? 'hidden' : ''}~ "git remote add #{project.name} #{http_url}" - %p.ssh_url{:class => current_user ? '' : 'hidden'}~ "git remote add #{project.name} #{ssh_url}" + %p.http_url{class: current_user ? 'hidden' : ''}~ "git remote add #{project.name} #{http_url}" + %p.ssh_url{class: current_user ? '' : 'hidden'}~ "git remote add #{project.name} #{ssh_url}" %p~ "git fetch #{project.name}" %p~ "git checkout -b my-local-tracking-branch #{project.name}/master_or_other_branch" .project-tabnav %ul.tabnav-tabs - %li{:class => ('selected' if act == :show && contr == :trees )} + %li{class: ('selected' if act == :show && contr == :trees )} = link_to t('project_menu.files'), tree_path(project, treeish) - %li{:class => ('selected' if act == :index && contr == :commits )} + %li{class: ('selected' if act == :index && contr == :commits )} = link_to t('project_menu.commits'), commits_path(project, treeish) - %li{:class => ('selected' if act == :branches && contr == :trees )} - = link_to t('project_menu.branches', :count => '{{singleton.project.branches_count}}'), branch_path(project, branch) - %li.tags{:class => ('selected' if act == :tags && contr == :trees )} - = link_to t('project_menu.tags', :count => project.repo.tags.count), tags_path(project) + %li{class: ('selected' if act == :branches && contr == :trees )} + = link_to t('project_menu.branches', count: '{{singleton.project.branches_count}}'), branch_path(project, branch) + %li.tags{class: ('selected' if act == :tags && contr == :trees )} + = link_to t('project_menu.tags', count: project.repo.tags.count), tags_path(project) .both :javascript $(document).ready(function() { diff --git a/app/views/projects/base/_sidebar.html.haml b/app/views/projects/base/_sidebar.html.haml index 4b5429d7d..c00489402 100644 --- a/app/views/projects/base/_sidebar.html.haml +++ b/app/views/projects/base/_sidebar.html.haml @@ -6,12 +6,12 @@ .admin-preferences %ul - if can? :edit, @project - %li{:class => (act == :edit && contr == :projects) ? 'active' : ''} + %li{class: (act == :edit && contr == :projects) ? 'active' : ''} = link_to t("layout.projects.edit"), edit_project_path(@project) - %li{:class => (act == :sections && contr == :projects) ? 'active' : ''} + %li{class: (act == :sections && contr == :projects) ? 'active' : ''} = link_to t("layout.projects.sections"), sections_project_path(@project) - %li{:class => (contr == :hooks) ? 'active' : ''} + %li{class: (contr == :hooks) ? 'active' : ''} = link_to t("layout.projects.hooks"), project_hooks_path(@project) - if can? :manage_collaborators, @project - %li{:class => (act == :index && contr == :collaborators) ? 'active' : ''} + %li{class: (act == :index && contr == :collaborators) ? 'active' : ''} = link_to t("layout.projects.edit_collaborators"), project_collaborators_path(@project) diff --git a/app/views/projects/base/_submenu.html.haml b/app/views/projects/base/_submenu.html.haml index 3c4dfbd29..8742834eb 100644 --- a/app/views/projects/base/_submenu.html.haml +++ b/app/views/projects/base/_submenu.html.haml @@ -5,14 +5,14 @@ .table-sort-right=@project.name %nav %ul - %li= link_to t("project_menu.code"), tree_path(@project, treeish), :class => (act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits ? 'active' : nil) + %li= link_to t("project_menu.code"), tree_path(@project, treeish), class: (act.in?([:show, :edit, :branches, :tags]) && contr.in?([:trees, :blobs]) || contr == :commits ? 'active' : nil) - if @project.is_package and can?(:read, @project => BuildList) - %li= link_to t("project_menu.builds"), project_build_lists_path(@project), :class => (contr == :build_lists ? 'active' : nil) + %li= link_to t("project_menu.builds"), project_build_lists_path(@project), class: (contr == :build_lists ? 'active' : nil) - if @project.has_issues - %li= link_to t("project_menu.tracker", :count => @opened_issues_count), project_issues_path(@project), :class => (contr == :issues ? 'active' : nil) - %li=link_to t("project_menu.pull_requests", :count => @opened_pull_requests_count), project_pull_requests_path(@project), :class => (contr == :pull_requests ? 'active' : nil) + %li= link_to t("project_menu.tracker", count: @opened_issues_count), project_issues_path(@project), class: (contr == :issues ? 'active' : nil) + %li=link_to t("project_menu.pull_requests", count: @opened_pull_requests_count), project_pull_requests_path(@project), class: (contr == :pull_requests ? 'active' : nil) - if @project.has_wiki - %li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), :class => (contr == :wiki ? 'active' : nil) + %li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), class: (contr == :wiki ? 'active' : nil) %li=# link_to t("project_menu.readme"), "#" #pending - if can? :update, @project - %li= link_to t("project_menu.settings"), edit_project_path(@project), :class => (act == :edit && contr == :projects ? 'active' : nil) + %li= link_to t("project_menu.settings"), edit_project_path(@project), class: (act == :edit && contr == :projects ? 'active' : nil) diff --git a/app/views/projects/build_lists/_build_lists_ajax.json.jbuilder b/app/views/projects/build_lists/_build_lists_ajax.json.jbuilder index e56af59b0..a0f1c4ebd 100644 --- a/app/views/projects/build_lists/_build_lists_ajax.json.jbuilder +++ b/app/views/projects/build_lists/_build_lists_ajax.json.jbuilder @@ -2,8 +2,8 @@ build_lists = @build_lists.map do |build_list| build_for = " (#{build_list.build_for_platform.name})" if build_list.build_for_platform && build_list.save_to_platform.personal? [ [link_to(build_list.id, build_list), - link_to(t('layout.clone'), new_project_build_list_path(@project, :build_list_id => build_list.id), - :id => 'clone_build_list') + link_to(t('layout.clone'), new_project_build_list_path(@project, build_list_id: build_list.id), + id: 'clone_build_list') ].join('
').html_safe, build_list.human_status, build_list_version_link(build_list), diff --git a/app/views/projects/build_lists/_filter.html.haml b/app/views/projects/build_lists/_filter.html.haml index b0fad9ee4..f8650ce07 100644 --- a/app/views/projects/build_lists/_filter.html.haml +++ b/app/views/projects/build_lists/_filter.html.haml @@ -1,7 +1,7 @@ --html_options = {:class => 'sel80 medium input_cleanse', :tabindex => 2} +-html_options = {class: 'sel80 medium input_cleanse', tabindex: 2} .top.box .filter - = form_for :filter, :html => {:class => :form, :id => 'monitoring_filter', 'ng-submit' => 'refresh(true)'}, :authenticity_token => false do |f| + = form_for :filter, html: {class: :form, id: 'monitoring_filter', 'ng-submit' => 'refresh(true)'}, authenticity_token: false do |f| .column = render 'server_status' = hidden_field_tag :owner_name, @project.try(:owner).try(:uname) @@ -14,58 +14,58 @@ - if current_user .bordered.nopadding %h3.medium= t("layout.build_lists.ownership.header") - =f.hidden_field :ownership, :value => '{{params.filter.ownership}}' + =f.hidden_field :ownership, value: '{{params.filter.ownership}}' .btn-group - ['owned', (@project ? nil : 'related'), 'everything'].compact.each do |ownership| - -options = {'ng-class' =>"{active: params.filter.ownership == '#{ownership}'}",:value => ownership, :style => (@project ? 'width:50%;' : '')} + -options = {'ng-class' =>"{active: params.filter.ownership == '#{ownership}'}",value: ownership, style: (@project ? 'width:50%;' : '')} %button.btn.ownership{options}= t "layout.build_lists.ownership.#{ownership}" %h3.medium= t 'number_rows' =hidden_field_tag :per_page, '{{params.per_page}}' =hidden_field_tag :page, '{{params.page}}' .btn-group -BuildList::Filter::PER_PAGE.each do |num| - %button.btn.per_page{:value => num, 'ng-class' => "{active: params.per_page == #{num}}"}=num + %button.btn.per_page{value: num, 'ng-class' => "{active: params.per_page == #{num}}"}=num %h3.medium= t 'activerecord.attributes.build_list.status' .lineForm.aside - = f.select :status, BuildList::STATUSES.collect{|status| [BuildList.human_status(status), status]}, {:include_blank => true}, - html_options.merge(:id => 'status', 'ng-model' => 'params.filter.status') + = f.select :status, BuildList::STATUSES.collect{|status| [BuildList.human_status(status), status]}, {include_blank: true}, + html_options.merge(id: 'status', 'ng-model' => 'params.filter.status') .both %br/ .column %h3.medium= t 'activerecord.models.platform' .lineForm.aside - = f.select :platform_id, availables_main_platforms.collect{|pl| [pl.name, pl.id]}, {:include_blank => true}, html_options.merge(:id => 'platform', 'ng-model' => 'params.filter.platform_id') + = f.select :platform_id, availables_main_platforms.collect{|pl| [pl.name, pl.id]}, {include_blank: true}, html_options.merge(id: 'platform', 'ng-model' => 'params.filter.platform_id') %h3.medium= t 'activerecord.attributes.build_list.arch' .lineForm.aside - = f.select :arch_id, Arch.recent.collect{|arch| [arch.name, arch.id]}, {:include_blank => true}, html_options.merge(:id => 'architecture', 'ng-model' => 'params.filter.arch_id') + = f.select :arch_id, Arch.recent.collect{|arch| [arch.name, arch.id]}, {include_blank: true}, html_options.merge(id: 'architecture', 'ng-model' => 'params.filter.arch_id') %h3.medium= t 'activerecord.models.mass_build' .lineForm.aside - = f.select :mass_build_id, mass_build_options, {:include_blank => true}, - html_options.merge(:id => 'mass_build', 'ng-model' => 'params.filter.mass_build_id') + = f.select :mass_build_id, mass_build_options, {include_blank: true}, + html_options.merge(id: 'mass_build', 'ng-model' => 'params.filter.mass_build_id') .column -[:updated_at_start, :updated_at_end].each do |attr| -class_name, message = attr == :updated_at_start ? %w[floatleft _on] : %w[floatright until] - %div{:class => class_name} + %div{class: class_name} %h3.medium= t message - =f.text_field attr, :readonly => "readonly", :size => 10, :class => 'mediumheight min input_cleanse', :value => "{{params.filter.#{attr}}}" - =link_to image_tag('x.png', :alt => 'x', :class => 'semi'), "#filter_#{attr}", :id => 'updated_at_clear' + =f.text_field attr, readonly: "readonly", size: 10, class: 'mediumheight min input_cleanse', value: "{{params.filter.#{attr}}}" + =link_to image_tag('x.png', alt: 'x', class: 'semi'), "#filter_#{attr}", id: 'updated_at_clear' .both -%w[project_name id].each do |filter| %h3.medium= t "layout.build_lists.#{filter}_search" - %input.mediumheight.input_cleanse{:id => "filter_#{filter}", :name => "filter[#{filter}]", :size => "30", :type => "text", :value => "{{params.filter.#{filter}}}"} + %input.mediumheight.input_cleanse{id: "filter_#{filter}", name: "filter[#{filter}]", size: "30", type: "text", value: "{{params.filter.#{filter}}}"} %br/ %br/ .butgrp = f.submit t('layout.search.header'), 'ng-hide' => 'isRequest' - = f.submit t('layout.processing'), :disabled => true, 'ng-show' => 'isRequest' - = f.submit t('reset'), :id => 'filter_clear' + = f.submit t('layout.processing'), disabled: true, 'ng-show' => 'isRequest' + = f.submit t('reset'), id: 'filter_clear' -if @project and can?(:create, @project.build_lists.build) - %input{:id => 'filter_new_build', :type => 'button', :onclick => "location.href='#{new_project_build_list_path(@project)}'", :value => t('layout.build_lists.new_header')} + %input{id: 'filter_new_build', type: 'button', onclick: "location.href='#{new_project_build_list_path(@project)}'", value: t('layout.build_lists.new_header')} .both .both .switch - %a{:href => "#"}= t 'layout.build_lists.hide_filter' + %a{href: "#"}= t 'layout.build_lists.hide_filter' :javascript var MONITORING_FILTER_HIDE = "monitoring_filter_hide"; $(".switch").toggle( diff --git a/app/views/projects/build_lists/_include_repos.html.haml b/app/views/projects/build_lists/_include_repos.html.haml index a2ce04b12..25b46492a 100644 --- a/app/views/projects/build_lists/_include_repos.html.haml +++ b/app/views/projects/build_lists/_include_repos.html.haml @@ -4,6 +4,6 @@ - checked = (params[:build_list].try(:[], :include_repos).map(&:to_s) || []).include?(repo.id.to_s) - else checked = false = check_box_tag 'build_list[include_repos][]', repo.id, checked, - :disabled => ((params[:build_list].try(:[], :build_for_platform_id).to_i != platform.id) && @build_list.build_for_platform.try(:main?)), - :id => "include_repos_#{repo.id}", :rep_name => repo.name + disabled: ((params[:build_list].try(:[], :build_for_platform_id).to_i != platform.id) && @build_list.build_for_platform.try(:main?)), + id: "include_repos_#{repo.id}", rep_name: repo.name = label_tag "include_repos_#{repo.id}", repo.name diff --git a/app/views/projects/build_lists/_last_build_lists.html.haml b/app/views/projects/build_lists/_last_build_lists.html.haml index 256b034a5..5de00e452 100644 --- a/app/views/projects/build_lists/_last_build_lists.html.haml +++ b/app/views/projects/build_lists/_last_build_lists.html.haml @@ -8,21 +8,21 @@ = check_box_tag :status_filter_build_lists, true, (params[:status_filter] || 'true') == 'true' = label_tag t('layout.build_lists.failed_build_lists') - - columns, default_column = [], {:type => 'html', :sortable => false, :searchable => false} + - columns, default_column = [], {type: 'html', sortable: false, searchable: false} - 8.times { columns << default_column } - = raw datatable(columns, {:sort_by => "[7, 'asc']", :processing => t('layout.processing'), :search => 'false', - :pagination_labels => {:previous => t('datatables.previous_label'), :next => t('datatables.next_label')}, - :empty_label => t('datatables.empty_label'), - :info_label => t('datatables.info_label'), - :info_empty_label => t('datatables.info_empty_label'), - :filtered_label => t('datatables.filtered_label'), - :table_dom_id => 'datatable', - :auto_width => 'false', - :ajax_source => "#{url_for :controller => 'projects/build_lists', :action => :list}", - :additional_data => {:owner_filter => "' + $('#owner_filter_build_lists:checked').val() + '", - :status_filter => "' + $('#status_filter_build_lists:checked').val() + '"} }) + = raw datatable(columns, {sort_by: "[7, 'asc']", processing: t('layout.processing'), search: 'false', + pagination_labels: {previous: t('datatables.previous_label'), next: t('datatables.next_label')}, + empty_label: t('datatables.empty_label'), + info_label: t('datatables.info_label'), + info_empty_label: t('datatables.info_empty_label'), + filtered_label: t('datatables.filtered_label'), + table_dom_id: 'datatable', + auto_width: 'false', + ajax_source: "#{url_for controller: 'projects/build_lists', action: :list}", + additional_data: {owner_filter: "' + $('#owner_filter_build_lists:checked').val() + '", + status_filter: "' + $('#status_filter_build_lists:checked').val() + '"} }) - %table#datatable.tablesorter.list-users{:cellspacing => 0, :cellpadding => 0} + %table#datatable.tablesorter.list-users{cellspacing: 0, cellpadding: 0} %thead %tr %th.th1= t('activerecord.attributes.build_list.id') diff --git a/app/views/projects/build_lists/_new_form.html.haml b/app/views/projects/build_lists/_new_form.html.haml index bd8d47fe9..45579ad3d 100644 --- a/app/views/projects/build_lists/_new_form.html.haml +++ b/app/views/projects/build_lists/_new_form.html.haml @@ -1,62 +1,62 @@ -= form_for [@project, @build_list], :html => { :class => :form, :method => :post } do |f| += form_for [@project, @build_list], html: { class: :form, method: :post } do |f| %section.left %h3= t("activerecord.attributes.build_list.build_for_platform") .all_platforms - availables_main_platforms.each do |pl| .both - %div{:id => "build_for_pl_#{pl.id}", :class => 'build_for_pl'}= pl.name - .offset25= render 'include_repos', :platform => pl + %div{id: "build_for_pl_#{pl.id}", class: 'build_for_pl'}= pl.name + .offset25= render 'include_repos', platform: pl %section.right %h3= t('activerecord.attributes.build_list.save_to_repository') - - selected = params[:build_list].try(:[], :save_to_repository_id) ? {:selected => params[:build_list][:save_to_repository_id]} : {} + - selected = params[:build_list].try(:[], :save_to_repository_id) ? {selected: params[:build_list][:save_to_repository_id]} : {} .lineForm= f.select :save_to_repository_id, save_to_repositories(project), selected %h3= t("activerecord.attributes.build_list.project_version") - .lineForm= f.select :project_version, versions_for_group_select(project), :selected => params[:build_list].try(:[], :project_version) || project.default_branch + .lineForm= f.select :project_version, versions_for_group_select(project), selected: params[:build_list].try(:[], :project_version) || project.default_branch %h3= t("activerecord.attributes.build_list.arch") - Arch.recent.each do |arch| .both - checked = (params[:arches]||[]).include?(arch.id.to_s) || (params[:arches].blank? && controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name)) - = check_box_tag "arches[]", arch.id, checked, :id => "arches_#{arch.id}" + = check_box_tag "arches[]", arch.id, checked, id: "arches_#{arch.id}" = label_tag "arches_#{arch.id}", arch.name %h3= t('activerecord.attributes.build_list.update_type') - - selected = params[:build_list].try(:[], :update_type) ? {:selected => params[:build_list][:update_type]} : {} + - selected = params[:build_list].try(:[], :update_type) ? {selected: params[:build_list][:update_type]} : {} .lineForm= f.select :update_type, BuildList::UPDATE_TYPES, selected = render 'shared/autocomplete_form', - :field => :extra_repositories, - :field_class => Repository, - :placeholder => 'uxteam_personal', - :subject => @build_list, - :autocomplete_path => autocomplete_extra_repositories_autocompletes_path, - :default_values => project.repositories.select{ |r| r.platform.personal? } + field: :extra_repositories, + field_class: Repository, + placeholder: 'uxteam_personal', + subject: @build_list, + autocomplete_path: autocomplete_extra_repositories_autocompletes_path, + default_values: project.repositories.select{ |r| r.platform.personal? } = render 'shared/autocomplete_form', - :field => :extra_build_lists, - :field_class => BuildList, - :placeholder => '1000000', - :subject => build_list, - :autocomplete_path => autocomplete_extra_build_list_autocompletes_path + field: :extra_build_lists, + field_class: BuildList, + placeholder: '1000000', + subject: build_list, + autocomplete_path: autocomplete_extra_build_list_autocompletes_path %h3= t('activerecord.attributes.build_list.extra_params.label') - BuildList::EXTRA_PARAMS.each do |field| - text = params[:build_list].try(:[], :extra_params).try(:[], field) - = text_field_tag "build_list[extra_params][#{field}]", text, :placeholder => t("activerecord.attributes.build_list.extra_params.#{field}"), :class => 'full-size' + = text_field_tag "build_list[extra_params][#{field}]", text, placeholder: t("activerecord.attributes.build_list.extra_params.#{field}"), class: 'full-size' .both %h3= t("activerecord.attributes.build_list.preferences") - [:auto_publish, :auto_create_container, :include_testing_subrepository].each do |kind| .both - checked, field = params[:build_list].try(:[], kind), "build_list[#{kind}]" - = hidden_field_tag field, false, :id => nil + = hidden_field_tag field, false, id: nil = check_box_tag field, true, checked = f.label kind .both - - selected = params[:build_list].try(:[], :external_nodes) ? {:selected => params[:build_list][:external_nodes]} : {} - = f.select :external_nodes, external_nodes, selected.merge(:include_blank => true) + - selected = params[:build_list].try(:[], :external_nodes) ? {selected: params[:build_list][:external_nodes]} : {} + = f.select :external_nodes, external_nodes, selected.merge(include_blank: true) = f.label :external_nodes .both %br = hidden_field_tag :from_build_list_id, params[:build_list_id] if params[:build_list_id].present? - = f.submit t('layout.projects.build_button'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.projects.build_button'), data: {'disable-with' => t('layout.processing')} .both diff --git a/app/views/projects/build_lists/_platform_build_list.html.haml b/app/views/projects/build_lists/_platform_build_list.html.haml index d21b445f7..750e324c1 100644 --- a/app/views/projects/build_lists/_platform_build_list.html.haml +++ b/app/views/projects/build_lists/_platform_build_list.html.haml @@ -1,4 +1,4 @@ -%tr{:id => "row#{platform_build_list_counter}"} +%tr{id: "row#{platform_build_list_counter}"} %td= link_to platform_build_list.id, platform_build_list %td= platform_build_list.human_status %td= link_to platform_build_list.project.name, platform_build_list.project diff --git a/app/views/projects/build_lists/_recreate_build_list.html.haml b/app/views/projects/build_lists/_recreate_build_list.html.haml index d6ce8ff0c..4a0890e66 100644 --- a/app/views/projects/build_lists/_recreate_build_list.html.haml +++ b/app/views/projects/build_lists/_recreate_build_list.html.haml @@ -1,5 +1,5 @@ -= form_for [build_list.project, build_list.project.build_lists.new], :html => { :class => :form, :method => :post } do |f| += form_for [build_list.project, build_list.project.build_lists.new], html: { class: :form, method: :post } do |f| = hidden_field_tag :build_list_id, build_list.id = f.hidden_field :project_id - = f.submit t('layout.build_lists.recreate_build_list'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.build_lists.recreate_build_list'), data: {'disable-with' => t('layout.processing')} .both \ No newline at end of file diff --git a/app/views/projects/build_lists/_submenu.html.haml b/app/views/projects/build_lists/_submenu.html.haml index 50673084d..b48608a77 100644 --- a/app/views/projects/build_lists/_submenu.html.haml +++ b/app/views/projects/build_lists/_submenu.html.haml @@ -7,5 +7,5 @@ .left %nav %ul - %li= link_to t('layout.projects.list_header'), build_lists_path, :class => (controller_name == 'build_lists' ? 'active' : nil) - %li= link_to t('layout.products.list_header'), product_build_lists_path, :class => (controller_name == 'product_build_lists' ? 'active' : nil) + %li= link_to t('layout.projects.list_header'), build_lists_path, class: (controller_name == 'build_lists' ? 'active' : nil) + %li= link_to t('layout.products.list_header'), product_build_lists_path, class: (controller_name == 'product_build_lists' ? 'active' : nil) diff --git a/app/views/projects/build_lists/index.html.haml b/app/views/projects/build_lists/index.html.haml index e24b6b7ea..dc76338d8 100644 --- a/app/views/projects/build_lists/index.html.haml +++ b/app/views/projects/build_lists/index.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => t('.title') +-set_meta_tags title: t('.title') %div{'ng-controller' => 'BuildListsController'} = render 'filter' - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.lpadding16= t("activerecord.attributes.build_list.id") @@ -17,7 +17,7 @@ %th.lpadding16= t("activerecord.attributes.build_list.user") %th.lpadding6= t("activerecord.attributes.build_list.updated_at") %tbody - %tr{'ng-repeat' => 'bl in build_lists', :class => '{{bl.status_color}}', :id => 'build-list-{{bl.id}}', 'ng-class' => "{'group-start': !bl.relatedHidden, 'group-end': bl.lastRelated}", 'ng-show' => 'bl.show'} + %tr{'ng-repeat' => 'bl in build_lists', class: '{{bl.status_color}}', id: 'build-list-{{bl.id}}', 'ng-class' => "{'group-start': !bl.relatedHidden, 'group-end': bl.lastRelated}", 'ng-show' => 'bl.show'} / id %td.build-list-statuses @@ -26,7 +26,7 @@ %span.icon-chevron-up{'ng-hide' => 'bl.relatedHidden', 'ng-click' => 'hideRelated(bl)'} %a{'ng-href' => '{{bl.url}}' } {{bl.id}} %div{'ng-show' => 'bl.hasRelated'} - .status{'ng-repeat' => 'related in bl.related', :class => '{{related.status_color}}'}   + .status{'ng-repeat' => 'related in bl.related', class: '{{related.status_color}}'}   / status %td @@ -38,7 +38,7 @@ \/{{bl.average_build_time}} / project - %td.centered{'ng-hide' => 'bl.project', :colspan => 2} + %td.centered{'ng-hide' => 'bl.project', colspan: 2} = t('layout.projects.unexisted_project') %td{'ng-show' => 'bl.project'} %a{'ng-href' => '{{bl.project.url}}' } {{bl.project.name_with_owner}} @@ -64,7 +64,7 @@ %a{'ng-href' => '{{bl.user.url}}' } {{bl.user.fullname}} / updated_at - %td{'am-time-ago' => 'bl.updated_at', :title => '{{bl.updated_at_utc}}'} + %td{'am-time-ago' => 'bl.updated_at', title: '{{bl.updated_at_utc}}'} .both diff --git a/app/views/projects/build_lists/new.html.haml b/app/views/projects/build_lists/new.html.haml index 974f0e091..3e62bac33 100644 --- a/app/views/projects/build_lists/new.html.haml +++ b/app/views/projects/build_lists/new.html.haml @@ -1,5 +1,5 @@ --set_meta_tags :title => [title_object(@project), t('layout.build_lists.new_header')] -#new_form= render 'new_form', :project => @project, :build_list => @build_list +-set_meta_tags title: [title_object(@project), t('layout.build_lists.new_header')] +#new_form= render 'new_form', project: @project, build_list: @build_list %br -= render 'last_build_lists', :project => @project += render 'last_build_lists', project: @project = render 'projects/base/submenu' diff --git a/app/views/projects/build_lists/show.html.haml b/app/views/projects/build_lists/show.html.haml index d81448ccd..fa9d39c57 100644 --- a/app/views/projects/build_lists/show.html.haml +++ b/app/views/projects/build_lists/show.html.haml @@ -1,11 +1,11 @@ --set_meta_tags :title => [title_object(@build_list.project), t('activerecord.models.build_list')] +-set_meta_tags title: [title_object(@build_list.project), t('activerecord.models.build_list')] .build-list{'ng-controller' => 'BuildListController'} .notify.blue - %div{:class => '{{build_list.status_color}}'} + %div{class: '{{build_list.status_color}}'} %p {{build_list.human_status | i18n}} - %p{'am-time-ago' => 'build_list.updated_at', :title => '{{build_list.updated_at_utc}}'} + %p{'am-time-ago' => 'build_list.updated_at', title: '{{build_list.updated_at_utc}}'} .both - =form_for @build_list, :url => publish_build_list_path(@build_list), :html => { :class => :form } do |f| + =form_for @build_list, url: publish_build_list_path(@build_list), html: { class: :form } do |f| %h3= t("layout.build_lists.main_data") .leftlist= t("activerecord.attributes.build_list.container_path") .rightlist{'ng-show' => "build_list.container_status == #{BuildList::BUILD_PUBLISHED}"} @@ -43,7 +43,7 @@ .rightlist= t("layout.#{@build_list.include_testing_subrepository?}_") .both .leftlist= t("activerecord.attributes.build_list.include_repos") - .rightlist= (@build_list.include_repos||[]).map{|r| Repository.where(:id => r).first.try(:name)}.join(', ') + .rightlist= (@build_list.include_repos||[]).map{|r| Repository.where(id: r).first.try(:name)}.join(', ') .both .leftlist= t("activerecord.attributes.build_list.update_type") .rightlist @@ -87,9 +87,9 @@ - if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present? .leftlist= t("activerecord.attributes.build_list.extra_repositories") .rightlist - - Repository.where(:id => @build_list.extra_repositories).each do |repo| + - Repository.where(id: @build_list.extra_repositories).each do |repo| %p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo] - - BuildList.where(:id => @build_list.extra_build_lists).each do |bl| + - BuildList.where(id: @build_list.extra_build_lists).each do |bl| %p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl .both @@ -127,23 +127,23 @@ .leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory") .rightlist = select_tag :attach_advisory, advisories_select_options(@advisories), 'ng-model' => 'attach_advisory', 'ng-change' => 'attachAdvisoryChanged()' - %p.hint_text= t("layout.advisories.publication_info", :update_types => BuildList::RELEASE_UPDATE_TYPES.join(', ')) + %p.hint_text= t("layout.advisories.publication_info", update_types: BuildList::RELEASE_UPDATE_TYPES.join(', ')) .both #advisory_search_block{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'} %h3= t("layout.advisories.search_by_id") .leftlist= label_tag :advisory_search, t("layout.advisories.search_hint") .rightlist - %input#advisory_search{:type => 'text', 'ng-model' => 'term', 'ng-keyup' => 'search()'} - %p.hint_text= t("layout.advisories.advisory_id_info", :advisory_format => advisory_id_for_hint) + %input#advisory_search{type: 'text', 'ng-model' => 'term', 'ng-keyup' => 'search()'} + %p.hint_text= t("layout.advisories.advisory_id_info", advisory_format: advisory_id_for_hint) .both - I18n.t('layout.advisories.banners').keys.each do |key| - .info{:class => key, 'ng-show' => "search_status == '#{key}'"} + .info{class: key, 'ng-show' => "search_status == '#{key}'"} %p= t("layout.advisories.banners.#{key}") #new_advisory_form{'ng-show' => 'attach_advisory == "new"'} = f.fields_for @build_list.build_advisory do |f| - = render :partial => 'advisories/form', :locals => {:f => f} + = render partial: 'advisories/form', locals: {f: f} #advisory_preview{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'} %h3= t('activerecord.models.advisory') << ' {{advisory.advisory_id}}' @@ -167,38 +167,38 @@ - if can?(:cancel, @build_list) = link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list), - :method => :put, :confirm => t("layout.confirm"), :class => 'button', + method: :put, confirm: t("layout.confirm"), class: 'button', 'ng-show' => 'build_list.can_cancel' = submit_tag t('layout.publish_again'), - :confirm => t("layout.publish_again_warning"), - :name => 'publish', + confirm: t("layout.publish_again_warning"), + name: 'publish', 'ng-show' => "build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}" = submit_tag t("layout.publish"), - :confirm => t('layout.build_lists.tests_failed'), :name => 'publish', + confirm: t('layout.build_lists.tests_failed'), name: 'publish', 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}" = submit_tag t("layout.publish"), - :confirm => t('layout.confirm'), :name => 'publish', + confirm: t('layout.confirm'), name: 'publish', 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}" = link_to t('layout.publish_into_testing'), publish_into_testing_build_list_path(@build_list), - :method => :put, :confirm => t("layout.confirm"), - :class => 'button', + method: :put, confirm: t("layout.confirm"), + class: 'button', 'ng-show' => 'build_list.can_publish_into_testing' - if can?(:reject_publish, @build_list) = link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list), - :method => :put, :confirm => t("layout.confirm"), - :class => 'button', + method: :put, confirm: t("layout.confirm"), + class: 'button', 'ng-show' => 'build_list.can_reject_publish' - if can?(:create_container, @build_list) = link_to t("layout.build_lists.create_container"), create_container_build_list_path(@build_list), - :method => :put, :confirm => t("layout.confirm"), - :class => 'button', + method: :put, confirm: t("layout.confirm"), + class: 'button', 'ng-show' => 'build_list.can_create_container' - if can? :create, @build_list - = link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button' + = link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, build_list_id: @build_list.id), class: 'button' %div{'ng-show' => "build_list.status == #{BuildList::BUILD_STARTED}"} - = render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) } + = render 'shared/log', { build_started: true, get_log_path: log_build_list_path(@build_list) } .hr %h3= t("layout.build_lists.items_header") @@ -207,14 +207,14 @@ %div{'ng-repeat' => 'group in build_list.item_groups'} %div{'ng-repeat' => 'item in group'} %h4.nomargin {{item.name + ' #' + item.level}} - %table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter.width565{cellpadding: "0", cellspacing: "0"} %thead %tr %th= t("activerecord.attributes.build_list/item.name") %th= t("activerecord.attributes.build_list/item.version") %th= t("activerecord.attributes.build_list/item.status") %tbody - %tr{:class => "{{build_list.itemStatusColor(item.status)}}"} + %tr{class: "{{build_list.itemStatusColor(item.status)}}"} %td {{item.name}} %td %a{'ng-href' => '{{item.path.href}}' } {{item.path.text}} @@ -224,7 +224,7 @@ %div{'ng-show' => 'build_list.packages'} .hr %h3= t("layout.build_lists.packages_header") - %table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter.width565{cellpadding: "0", cellspacing: "0"} %thead %tr %th= t("activerecord.attributes.build_list/package.fullname") @@ -245,7 +245,7 @@ - if @build_list.new_core? .hr - = render 'shared/build_results', :subject => @build_list + = render 'shared/build_results', subject: @build_list :javascript $('article .all').addClass('bigpadding'); diff --git a/app/views/projects/collaborators/_collaborators.json.jbuilder b/app/views/projects/collaborators/_collaborators.json.jbuilder index f7fba1505..9d33ffd67 100644 --- a/app/views/projects/collaborators/_collaborators.json.jbuilder +++ b/app/views/projects/collaborators/_collaborators.json.jbuilder @@ -1,3 +1,3 @@ json.array!(collaborators) do |collaborator| - json.partial! 'projects/collaborators/collaborator', :collaborator => collaborator + json.partial! 'projects/collaborators/collaborator', collaborator: collaborator end diff --git a/app/views/projects/collaborators/index.html.haml b/app/views/projects/collaborators/index.html.haml index 6e633abab..afc25aaf3 100644 --- a/app/views/projects/collaborators/index.html.haml +++ b/app/views/projects/collaborators/index.html.haml @@ -1,8 +1,8 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.members')] +-set_meta_tags title: [title_object(@project), t('layout.projects.members')] = render 'sidebar' = render 'submenu' -%a{:name => 'users'} +%a{name: 'users'} %h3= t("layout.users.list_header") #collaborators{'ng-controller' => 'CollaboratorsController'} @@ -12,14 +12,14 @@ #add_collaborator_form .admin-search.withimage .img - %img{:alt => 'avatar', 'ng-src' => '{{new_collaborator.avatar}}', 'ng-show' => 'new_collaborator.avatar'} + %img{alt: 'avatar', 'ng-src' => '{{new_collaborator.avatar}}', 'ng-show' => 'new_collaborator.avatar'} = text_field_tag :collaborator_name, nil, 'ng-model' => 'new_collaborator.term', 'ng-keyup' => 'search()' .admin-role .lineForm = select_tag 'role', options_for_collaborators_roles_select, 'ng-model' => 'new_collaborator.collaborator.role' .admin-add - %a.button{:rel => 'nofollow', :href => '', 'ng-click' => 'add()'} + %a.button{rel: 'nofollow', href: '', 'ng-click' => 'add()'} = t('layout.add') .both @@ -33,28 +33,28 @@ %img{width: '16px', 'ng-src' => '{{c.avatar}}', alt: 'avatar'} .name {{c.actor_name}} .both - + .nothing{'ng-hide' => 'new_collaborators.length > 0'}= t('layout.issues.nothing_to_show') .both .both - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.centered %span.delete{'ng-click' => 'deleteCollaborators()'}    %th = t("layout.collaborators.members") - %th{:colspan => "3"} + %th{colspan: "3"} = t("layout.collaborators.roles") %tr.search - %th{:colspan => "5"} - %input{:type => "text", :placeholder => "#{t('layout.filter_by_name')}", 'ng-model' => 'query.actor_name'} + %th{colspan: "5"} + %input{type: "text", placeholder: "#{t('layout.filter_by_name')}", 'ng-model' => 'query.actor_name'} %tbody %tr{'ng-repeat' => 'c in collaborators | filter:query'} %td - %input{:type => 'checkbox', 'ng-model' => 'c.removed' } + %input{type: 'checkbox', 'ng-model' => 'c.removed' } %td .img %img{'ng-src' => '{{c.avatar}}', alt: 'avatar' } @@ -64,7 +64,7 @@ - Relation::ROLES.each do |role| %td .radio - %input{:type => 'radio', 'ng-model' => 'c.collaborator.role', :value => role, 'ng-click' => 'update(c)'} + %input{type: 'radio', 'ng-model' => 'c.collaborator.role', value: role, 'ng-click' => 'update(c)'} .forradio %label= t("layout.collaborators.role_names.#{role}") diff --git a/app/views/projects/collaborators/index.json.jbuilder b/app/views/projects/collaborators/index.json.jbuilder index 259ed6bc4..ee9ca9932 100644 --- a/app/views/projects/collaborators/index.json.jbuilder +++ b/app/views/projects/collaborators/index.json.jbuilder @@ -1 +1 @@ -json.partial! 'collaborators', :collaborators => @collaborators +json.partial! 'collaborators', collaborators: @collaborators diff --git a/app/views/projects/comments/_add.html.haml b/app/views/projects/comments/_add.html.haml index 132f81541..88096e81c 100644 --- a/app/views/projects/comments/_add.html.haml +++ b/app/views/projects/comments/_add.html.haml @@ -3,15 +3,15 @@ %h3.tmargin0= t("layout.comments.new_header") - if Comment.issue_comment?(commentable.class) - new_path = project_issue_comments_path(project, commentable) - - is_subscribed = commentable.subscribes.exists?(:user_id => current_user.id) + - is_subscribed = commentable.subscribes.exists?(user_id: current_user.id) - subscribe_path = is_subscribed ? project_issue_subscribe_path(project, commentable, current_user.id) : project_issue_subscribes_path(project, commentable) - else Comment.commit_comment?(commentable.class) - new_path = project_commit_comments_path(project, commentable) - is_subscribed = Subscribe.subscribed_to_commit?(project, current_user, commentable) - subscribe_path = is_subscribed ? unsubscribe_commit_path(project, commentable) : subscribe_commit_path(project, commentable) - = form_for :comment, :url => new_path, :method => :post, :html => { :class => :form } do |f| - = render "projects/comments/form", :f => f, :id => 'new' + = form_for :comment, url: new_path, method: :post, html: { class: :form } do |f| + = render "projects/comments/form", f: f, id: 'new' .comment-left = t("layout.comments.notifications_are") %span.bold @@ -22,7 +22,7 @@ \. - if is_subscribed - = link_to t('layout.commits.unsubscribe_btn'), subscribe_path, :method => :delete + = link_to t('layout.commits.unsubscribe_btn'), subscribe_path, method: :delete - else - = link_to t('layout.commits.subscribe_btn'), subscribe_path, :method => :post + = link_to t('layout.commits.subscribe_btn'), subscribe_path, method: :post .both diff --git a/app/views/projects/comments/_body.html.haml b/app/views/projects/comments/_body.html.haml index 4b57f37b1..b86dda1b6 100644 --- a/app/views/projects/comments/_body.html.haml +++ b/app/views/projects/comments/_body.html.haml @@ -1,13 +1,13 @@ %ul.nav.nav-tabs#md_tabs %li - %a{"data-toggle" => "tab", :href => "##{id}_edit"}=t 'layout.edit' + %a{"data-toggle" => "tab", href: "##{id}_edit"}=t 'layout.edit' %li - %a{"data-toggle" => "tab", :href => "##{id}_preview"}=t 'layout.preview' + %a{"data-toggle" => "tab", href: "##{id}_preview"}=t 'layout.preview' .tab-content - .tab-pane.active{:id => "#{id}_edit"} - =f.text_area :body, :cols => 80, :id => "#{id}_edit_input" - =hidden_field_tag :body_dup, nil, :name => 'text', :id => "#{id}_edit_input_dup" - .tab-pane{:id => "#{id}_preview"} + .tab-pane.active{id: "#{id}_edit"} + =f.text_area :body, cols: 80, id: "#{id}_edit_input" + =hidden_field_tag :body_dup, nil, name: 'text', id: "#{id}_edit_input_dup" + .tab-pane{id: "#{id}_preview"} .formatted.cm-s-default.md_and_cm diff --git a/app/views/projects/comments/_button_md_help.html.haml b/app/views/projects/comments/_button_md_help.html.haml index 3cc040988..bed25ef6f 100644 --- a/app/views/projects/comments/_button_md_help.html.haml +++ b/app/views/projects/comments/_button_md_help.html.haml @@ -1,2 +1,2 @@ -=link_to t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;' +=link_to t('layout.comments.md_cheatsheet_header'), '#md_help', 'data-toggle' => 'modal', style: 'float:right;' diff --git a/app/views/projects/comments/_comment.html.haml b/app/views/projects/comments/_comment.html.haml index 88c0e9f78..a34fbdfb3 100644 --- a/app/views/projects/comments/_comment.html.haml +++ b/app/views/projects/comments/_comment.html.haml @@ -1,11 +1,11 @@ - CommentPresenter.present(comment, data) do |presenter| - = render 'shared/feed_message', :presenter => presenter + = render 'shared/feed_message', presenter: presenter -unless comment.automatic - #open-comment.comment.hidden{:class => "comment-#{comment.id}"} + #open-comment.comment.hidden{class: "comment-#{comment.id}"} =render 'projects/comments/button_md_help' %h3.tmargin0= t("layout.comments.edit_header") - = form_for comment, :url => project_commentable_comment_path(data[:project], data[:commentable], comment), :html => { :class => 'form edit_comment' } do |f| - = render "projects/comments/form", :f => f, :id => "#{data[:add_id]}edit_#{comment.id}" + = form_for comment, url: project_commentable_comment_path(data[:project], data[:commentable], comment), html: { class: 'form edit_comment' } do |f| + = render "projects/comments/form", f: f, id: "#{data[:add_id]}edit_#{comment.id}" .comment-left - =link_to t('layout.cancel'), '#', :id => "comment-#{comment.id}", :class => 'cancel_edit_comment button' + =link_to t('layout.cancel'), '#', id: "comment-#{comment.id}", class: 'cancel_edit_comment button' .both diff --git a/app/views/projects/comments/_form.html.haml b/app/views/projects/comments/_form.html.haml index 07e6b688d..306b7b379 100644 --- a/app/views/projects/comments/_form.html.haml +++ b/app/views/projects/comments/_form.html.haml @@ -1,2 +1,2 @@ -=render 'projects/comments/body', :f => f, :id => id -.comment-right= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} +=render 'projects/comments/body', f: f, id: id +.comment-right= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} diff --git a/app/views/projects/comments/_list.html.haml b/app/views/projects/comments/_list.html.haml index f7edaff1d..e3b4ad037 100644 --- a/app/views/projects/comments/_list.html.haml +++ b/app/views/projects/comments/_list.html.haml @@ -1,10 +1,10 @@ -%a{ :name => "comments" } +%a{ name: "comments" } .hr %h3#block-list= t("layout.comments.comments_header") - list.each do |comment| -unless comment.created_from_commit_hash - = render 'projects/comments/comment', :comment => comment, :data => {:project => project, :commentable => commentable} + = render 'projects/comments/comment', comment: comment, data: {project: project, commentable: commentable} -else - - GitPresenters::CommitAsMessagePresenter.present(nil, :comment => comment) do |presenter| - = render 'shared/feed_message', :presenter => presenter, :item_no => "-#{comment.id}" + - GitPresenters::CommitAsMessagePresenter.present(nil, comment: comment) do |presenter| + = render 'shared/feed_message', presenter: presenter, item_no: "-#{comment.id}" = render "projects/comments/markdown_help" diff --git a/app/views/projects/comments/_markdown_help.html.haml b/app/views/projects/comments/_markdown_help.html.haml index 3c9a27af4..abfb8e709 100644 --- a/app/views/projects/comments/_markdown_help.html.haml +++ b/app/views/projects/comments/_markdown_help.html.haml @@ -1,6 +1,6 @@ #md_help.modal.hidden .modal-header - %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} × + %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", type: "button"} × %h3#myModalLabel=t('layout.comments.md_cheatsheet_header') .modal-body .mod @@ -17,16 +17,16 @@ _This will also be italic_ **This text will be bold** __This will also be bold__ - %p=link_to t('layout.comments.md_cheatsheet.emoji_header'), 'http://www.emoji-cheat-sheet.com/', :target => '_blank' + %p=link_to t('layout.comments.md_cheatsheet.emoji_header'), 'http://www.emoji-cheat-sheet.com/', target: '_blank' %pre =":smile:" - =image_tag(image_path('emoji/smile.png'), :class => 'emoji', :title => 'smile', :alt => 'smile', :size => "20x20") + =image_tag(image_path('emoji/smile.png'), class: 'emoji', title: 'smile', alt: 'smile', size: "20x20") =" :+1:" - =image_tag(image_path('emoji/+1.png'), :class => 'emoji', :title => '+1', :alt => '+1', :size => "20x20") + =image_tag(image_path('emoji/+1.png'), class: 'emoji', title: '+1', alt: '+1', size: "20x20") .col %h3=t 'layout.comments.md_cheatsheet.lists' - %p{:style => 'float:left;margin-left:20px;'}=t 'layout.comments.md_cheatsheet.unordered' - %p{:style => 'float:right;margin-right:40px;'}=t 'layout.comments.md_cheatsheet.ordered' + %p{style: 'float:left;margin-left:20px;'}=t 'layout.comments.md_cheatsheet.unordered' + %p{style: 'float:right;margin-right:40px;'}=t 'layout.comments.md_cheatsheet.ordered' .both %pre :preserve diff --git a/app/views/projects/comments/edit.html.haml b/app/views/projects/comments/edit.html.haml index 0fd4907c1..3ff974111 100644 --- a/app/views/projects/comments/edit.html.haml +++ b/app/views/projects/comments/edit.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@comment.project), t('layout.comments.edit_header')] +-set_meta_tags title: [title_object(@comment.project), t('layout.comments.edit_header')] .block .secondary-navigation %ul.wat-cf @@ -7,7 +7,7 @@ %h2.title = t("layout.comments.edit_header") .inner - = form_for @comment, :url => project_commentable_comment_path(@project, @commentable, @comment), :html => {:class => :form} do |f| - = render "form", :f => f, :id => "edit_#{@comment.id}" + = form_for @comment, url: project_commentable_comment_path(@project, @commentable, @comment), html: {class: :form} do |f| + = render "form", f: f, id: "edit_#{@comment.id}" =hidden_field_tag :preview_url, project_md_preview_path(@project) diff --git a/app/views/projects/comments/new_line.html.haml b/app/views/projects/comments/new_line.html.haml index 15dc609be..ec763e79d 100644 --- a/app/views/projects/comments/new_line.html.haml +++ b/app/views/projects/comments/new_line.html.haml @@ -1,10 +1,10 @@ #open-comment.comment.view.new_line_comment =render 'projects/comments/button_md_help' %h3.tmargin0= t("layout.comments.new_header") - = form_for :comment, :url => @path, :method => :post, :html => { :class => :form } do |f| - = render "projects/comments/form", :f => f, :id => 'new_line' + = form_for :comment, url: @path, method: :post, html: { class: :form } do |f| + = render "projects/comments/form", f: f, id: 'new_line' .comment-left - =link_to t('layout.cancel'), '#', :class => 'cancel_inline_comment button' + =link_to t('layout.cancel'), '#', class: 'cancel_inline_comment button' =hidden_field_tag :path, params[:path] =hidden_field_tag :line, params[:line] =hidden_field_tag :in_reply, params[:in_reply] if params[:in_reply].present? diff --git a/app/views/projects/git/base/_choose_fork.html.haml b/app/views/projects/git/base/_choose_fork.html.haml index f71676821..d6e2c48e3 100644 --- a/app/views/projects/git/base/_choose_fork.html.haml +++ b/app/views/projects/git/base/_choose_fork.html.haml @@ -1,15 +1,15 @@ - is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : '' - full_name = "#{owner.uname}/#{name} #{is_group}" -- if owner.own_projects.exists? :name => name +- if owner.own_projects.exists? name: name %p.center =t 'layout.projects.already_exists' =link_to full_name, project_path(owner, name) - else - = form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f| + = form_for @project, url: fork_project_path(@project), html: { class: :form, multipart: true, method: :post } do |f| = hidden_field_tag :group, owner.id if owner.class == Group - = hidden_field_tag :fork_name, name, :name => 'fork_name' - =f.submit t('layout.projects.fork_to', :to => full_name), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), :id => 'create_fork' + = hidden_field_tag :fork_name, name, name: 'fork_name' + =f.submit t('layout.projects.fork_to', to: full_name), class: 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), id: 'create_fork' :javascript $('#create_fork').click(function () { diff --git a/app/views/projects/git/base/_fork.html.haml b/app/views/projects/git/base/_fork.html.haml index 6f15afbcb..0b3ad23ff 100644 --- a/app/views/projects/git/base/_fork.html.haml +++ b/app/views/projects/git/base/_fork.html.haml @@ -1,19 +1,19 @@ = hidden_field_tag :possible_forks_path, possible_forks_project_path(@project) - if can? :write, @project - .r{:style => "display: block"} - =link_to t("projects.pull_requests.show.pull"), new_project_pull_request_path(@project, :treeish => @treeish), :id => 'send_pull_request', :class => 'button' + .r{style: "display: block"} + =link_to t("projects.pull_requests.show.pull"), new_project_pull_request_path(@project, treeish: @treeish), id: 'send_pull_request', class: 'button' - if can? :fork, @project - .r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), '#forkModal', :class => 'button', 'data-toggle' => 'modal' - #forkModal.modal.fork-modal{:style => 'display: none;'} + .r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), '#forkModal', class: 'button', 'data-toggle' => 'modal' + #forkModal.modal.fork-modal{style: 'display: none;'} .modal-header %a.close{"data-dismiss" => "modal"} × %h3=t 'layout.projects.fork_modal_header' = hidden_field_tag :possible_forks, possible_forks_project_path(@project) - %div{:align => 'center'}= text_field_tag 'fork_name', @project.name, :id => 'fork_name', :class => 'fork_name' + %div{align: 'center'}= text_field_tag 'fork_name', @project.name, id: 'fork_name', class: 'fork_name' #forks_list.modal-body.modal-body-fork - = render 'forks', :owner => current_user, :name => @project.name + = render 'forks', owner: current_user, name: @project.name - if @project.is_package && can?(:create, @project.build_lists.new) - .r{:style => "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), :class => 'button' + .r{style: "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), class: 'button' diff --git a/app/views/projects/git/base/_forks.html.haml b/app/views/projects/git/base/_forks.html.haml index a4d442860..85367f9f7 100644 --- a/app/views/projects/git/base/_forks.html.haml +++ b/app/views/projects/git/base/_forks.html.haml @@ -1,5 +1,5 @@ -=render 'projects/git/base/choose_fork', :owner => current_user, :name => name +=render 'projects/git/base/choose_fork', owner: current_user, name: name %hr.bootstrap - Group.can_own_project(current_user).each do |group| - =render 'projects/git/base/choose_fork', :owner => group, :name => name + =render 'projects/git/base/choose_fork', owner: group, name: name %hr.bootstrap \ No newline at end of file diff --git a/app/views/projects/git/base/_whereami.html.haml b/app/views/projects/git/base/_whereami.html.haml index e54f2ba0f..1dbc68842 100644 --- a/app/views/projects/git/base/_whereami.html.haml +++ b/app/views/projects/git/base/_whereami.html.haml @@ -1,5 +1,5 @@ %p#file-name1 - = link_to @project.name, tree_path(@project, :treeish => @treeish) + = link_to @project.name, tree_path(@project, treeish: @treeish) = File::SEPARATOR - if @path.present? - paths = File.split(@path) diff --git a/app/views/projects/git/blobs/_blame_table.html.haml b/app/views/projects/git/blobs/_blame_table.html.haml index eb79fd716..4c08e12fa 100644 --- a/app/views/projects/git/blobs/_blame_table.html.haml +++ b/app/views/projects/git/blobs/_blame_table.html.haml @@ -2,7 +2,7 @@ - index = 1 - @blame.each do |elem| %tr.firstrow - %td.commit_info{ :rowspan => elem[1].length, :nowrap => 'nowrap' } + %td.commit_info{ rowspan: elem[1].length, nowrap: 'nowrap' } %code #{link_to shortest_hash_id(elem[0].id), commit_path(@project, elem[0].id)} #{t('layout.by')} - author = elem[0].author @@ -12,7 +12,7 @@ (#{commit_author_link(committer)}) %br %span.date= commit_date(elem[0].committed_date) - %span.message{:title => elem[0].message}= short_message(elem[0].message) + %span.message{title: elem[0].message}= short_message(elem[0].message) %td.lines = index diff --git a/app/views/projects/git/blobs/_editor.html.haml b/app/views/projects/git/blobs/_editor.html.haml index 9ed1345f9..3cd2658b2 100644 --- a/app/views/projects/git/blobs/_editor.html.haml +++ b/app/views/projects/git/blobs/_editor.html.haml @@ -4,18 +4,18 @@ = render 'fork' .both -= form_tag edit_blob_path(@project, @treeish, @path), :name => 'blob-editor', :method => :put do - .file-editor= text_area_tag :content, @blob.data, :id => 'code' += form_tag edit_blob_path(@project, @treeish, @path), name: 'blob-editor', method: :put do + .file-editor= text_area_tag :content, @blob.data, id: 'code' .both = t("layout.enter_commit_message") - = text_area_tag :message, "Updated #{@blob.name}", :class => 'commit-message' + = text_area_tag :message, "Updated #{@blob.name}", class: 'commit-message' %br %br - = submit_tag t('layout.save'), :title => t('layout.save'), :data => {'disable-with' => t('layout.saving')} + = submit_tag t('layout.save'), title: t('layout.save'), data: {'disable-with' => t('layout.saving')} = t("layout.or") - = link_to t("layout.cancel"), blob_path(@project, @treeish, @path), :class => 'button' + = link_to t("layout.cancel"), blob_path(@project, @treeish, @path), class: 'button' :javascript $(function() { diff --git a/app/views/projects/git/blobs/blame.html.haml b/app/views/projects/git/blobs/blame.html.haml index eadbf22c8..5210e891c 100644 --- a/app/views/projects/git/blobs/blame.html.haml +++ b/app/views/projects/git/blobs/blame.html.haml @@ -1,12 +1,12 @@ --set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" +-set_meta_tags title: "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" = render 'submenu' -= render 'repo_block', :project => @project -= render 'about_block', :project => @project += render 'repo_block', project: @project += render 'about_block', project: @project %h3= t("layout.projects.last_commit") -- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter| - = render 'shared/feed_message', :presenter => presenter, :item_no => 1 +- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter| + = render 'shared/feed_message', presenter: presenter, item_no: 1 .both diff --git a/app/views/projects/git/blobs/edit.html.haml b/app/views/projects/git/blobs/edit.html.haml index ac520f0b3..9c1b3f589 100644 --- a/app/views/projects/git/blobs/edit.html.haml +++ b/app/views/projects/git/blobs/edit.html.haml @@ -1,2 +1,2 @@ --set_meta_tags :title => [title_object(@project), "#{t :title_editing} #{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] -= render :partial => "editor", :layout => 'layout' +-set_meta_tags title: [title_object(@project), "#{t :title_editing} #{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] += render partial: "editor", layout: 'layout' diff --git a/app/views/projects/git/blobs/show.html.haml b/app/views/projects/git/blobs/show.html.haml index 6b116dccb..24aae1a2b 100644 --- a/app/views/projects/git/blobs/show.html.haml +++ b/app/views/projects/git/blobs/show.html.haml @@ -1,2 +1,2 @@ --set_meta_tags :title => [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] -= render :partial => "show", :layout => 'layout' +-set_meta_tags title: [title_object(@project), "#{@project.name}/#{@path} #{t('at') if @branch} #{@branch.try :name}"] += render partial: "show", layout: 'layout' diff --git a/app/views/projects/git/commits/_commit_diff.html.haml b/app/views/projects/git/commits/_commit_diff.html.haml index fcb232f2b..d9943b7f9 100644 --- a/app/views/projects/git/commits/_commit_diff.html.haml +++ b/app/views/projects/git/commits/_commit_diff.html.haml @@ -1,6 +1,6 @@ - commit_id = commit_diff.deleted_file ? @commit.parents.first.id : @commit.id .file - %a{:name => "diff-#{commit_diff_counter}"} + %a{name: "diff-#{commit_diff_counter}"} .top .l= h(commit_diff.a_path.rtruncate 120) - if commit_diff.b_path.present? @@ -8,4 +8,4 @@ .clear -if commit_diff.diff.present? && !(@project.repo.tree(commit_id) / commit_diff.a_path).binary? ="a_path=#{commit_diff.a_path}; b_path=#{commit_diff.b_path}" if (@project.repo.tree(commit_id) / commit_diff.b_path).nil? - .diff_data=render_diff(commit_diff, :diff_counter => commit_diff_counter, :comments => @comments) + .diff_data=render_diff(commit_diff, diff_counter: commit_diff_counter, comments: @comments) diff --git a/app/views/projects/git/commits/_commits.html.haml b/app/views/projects/git/commits/_commits.html.haml index e815935a7..c28dcd0c8 100644 --- a/app/views/projects/git/commits/_commits.html.haml +++ b/app/views/projects/git/commits/_commits.html.haml @@ -9,10 +9,10 @@ - by_month.each_pair do |month, by_day| - by_day.each_pair do |day, commits| .date-block - .date= raw l(commits.first.authored_date, :format => :date_block_format) + .date= raw l(commits.first.authored_date, format: :date_block_format) .messages - commits.each_with_index do |commit| - - GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter| - = render 'shared/feed_message', :presenter => presenter, :item_no => counter + - GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter| + = render 'shared/feed_message', presenter: presenter, item_no: counter - counter += 1 .both diff --git a/app/views/projects/git/commits/_commits_small.html.haml b/app/views/projects/git/commits/_commits_small.html.haml index dc4b84831..58289671d 100644 --- a/app/views/projects/git/commits/_commits_small.html.haml +++ b/app/views/projects/git/commits/_commits_small.html.haml @@ -3,19 +3,19 @@ %tbody - commits.each do |commit| - item_no = commit.id - - GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter| + - GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter| %tr %td - %img{:height => 16, :alt => "avatar", :src => presenter.image} - = datetime_moment presenter.date, :tag => :td, :class => :date + %img{height: 16, alt: "avatar", src: presenter.image} + = datetime_moment presenter.date, tag: :td, class: :date %td.name = presenter.header %td.subject - if presenter.caption? = presenter.caption - if presenter.expandable? and presenter.content? - %span.data-expander.collapsed{:id => "expand#{item_no}"}   + %span.data-expander.collapsed{id: "expand#{item_no}"}   - if presenter.content? - .fulltext{:class => "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}", + .fulltext{class: "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}", :id => presenter.expandable? ? "content-expand#{item_no}" : ''} .cm-s-default.md_and_cm=markdown presenter.content diff --git a/app/views/projects/git/commits/_paginate.html.haml b/app/views/projects/git/commits/_paginate.html.haml index c53177767..d37621273 100644 --- a/app/views/projects/git/commits/_paginate.html.haml +++ b/app/views/projects/git/commits/_paginate.html.haml @@ -2,9 +2,9 @@ - if @page == 1 %span.previous_page.disabled= t('will_paginate.previous_label') - else - %a.previous_page{:rel => "prev", :href => commits_path(@project, :treeish => @treeish, :page => (@page - 1))}= t('will_paginate.previous_label') + %a.previous_page{rel: "prev", href: commits_path(@project, treeish: @treeish, page: (@page - 1))}= t('will_paginate.previous_label') - if @last_page %span.next_page.disabled= t('will_paginate.next_label') - else - %a.next_page{:rel => "next", :href => commits_path(@project, :treeish => @treeish, :page => (@page + 1))}= t('will_paginate.next_label') \ No newline at end of file + %a.next_page{rel: "next", href: commits_path(@project, treeish: @treeish, page: (@page + 1))}= t('will_paginate.next_label') \ No newline at end of file diff --git a/app/views/projects/git/commits/_show.html.haml b/app/views/projects/git/commits/_show.html.haml index 9815b5e2d..d90b982fc 100644 --- a/app/views/projects/git/commits/_show.html.haml +++ b/app/views/projects/git/commits/_show.html.haml @@ -1,9 +1,9 @@ - stats = @commit.stats .leftside %h5= t("layout.projects.diff_show_header", - :files => t("layout.projects.commit_files_count", :count => stats.files.size), - :additions => t("layout.projects.commit_additions_count", :count => stats.additions), - :deletions => t("layout.projects.commit_deletions_count", :count => stats.deletions)) + files: t("layout.projects.commit_files_count", count: stats.files.size), + additions: t("layout.projects.commit_additions_count", count: stats.additions), + deletions: t("layout.projects.commit_deletions_count", count: stats.deletions)) .both .rightside = link_to "raw diff", commit_path(@project, @commit.id, :diff) @@ -13,6 +13,6 @@ -begin = render_commit_stats(stats) - = render :partial => 'commit_diff', :collection => @commit.diffs + = render partial: 'commit_diff', collection: @commit.diffs - rescue Grit::Git::GitTimeout %p= t 'layout.git.repositories.commit_diff_too_big' diff --git a/app/views/projects/git/commits/diff.html.haml b/app/views/projects/git/commits/diff.html.haml index 46c69176a..bddcd80e1 100644 --- a/app/views/projects/git/commits/diff.html.haml +++ b/app/views/projects/git/commits/diff.html.haml @@ -1,5 +1,5 @@ -title = "#{t('diff')} #{shortest_hash_id @commit1.id}...#{shortest_hash_id @commit.id}" --set_meta_tags :title => [title_object(@project), title] +-set_meta_tags title: [title_object(@project), title] =render 'submenu' %h3=title @@ -9,22 +9,22 @@ -total_additions = @stats.inject(0) {|sum, n| sum + n.additions} -total_deletions = @stats.inject(0) {|sum, n| sum + n.deletions} %h5= t("layout.projects.diff_show_header", - :files => t("layout.projects.commit_files_count", :count => @stats.count), - :additions => t("layout.projects.commit_additions_count", :count => total_additions), - :deletions => t("layout.projects.commit_deletions_count", :count => total_deletions)) + files: t("layout.projects.commit_files_count", count: @stats.count), + additions: t("layout.projects.commit_additions_count", count: total_additions), + deletions: t("layout.projects.commit_deletions_count", count: total_deletions)) .both -begin =render_diff_stats @stats -@project.repo.diff(@commit1.id, @commit.id).each_with_index do |commit_diff, diff_counter| - commit_id = commit_diff.deleted_file ? @common_ancestor.id : @commit.id .file - %a{:name => "diff-#{diff_counter}"} + %a{name: "diff-#{diff_counter}"} .top .l= h(commit_diff.a_path.rtruncate 120) - if commit_diff.b_path.present? .r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path) .clear -if commit_diff.diff.present? && !(@project.repo.tree(commit_id) / commit_diff.b_path).binary? - .diff_data=render_diff(commit_diff, :diff_counter => diff_counter) + .diff_data=render_diff(commit_diff, diff_counter: diff_counter) - rescue Grit::Git::GitTimeout %p= t 'layout.git.repositories.commit_diff_too_big' diff --git a/app/views/projects/git/commits/index.html.haml b/app/views/projects/git/commits/index.html.haml index e8221fb1e..2bb27b3ff 100644 --- a/app/views/projects/git/commits/index.html.haml +++ b/app/views/projects/git/commits/index.html.haml @@ -1,6 +1,6 @@ --set_meta_tags :title => [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"] +-set_meta_tags title: [title_object(@project), "#{t '.title'} #{t('at') if @branch} #{@branch.try :name}"] = render 'submenu' -= render 'repo_block', :project => @project += render 'repo_block', project: @project -= render :partial => 'commits', :object => @commits += render partial: 'commits', object: @commits = render 'paginate' if @path.blank? diff --git a/app/views/projects/git/commits/show.html.haml b/app/views/projects/git/commits/show.html.haml index 70a7e3efe..72845a432 100644 --- a/app/views/projects/git/commits/show.html.haml +++ b/app/views/projects/git/commits/show.html.haml @@ -1,17 +1,17 @@ --set_meta_tags :title => [title_object(@project), shortest_hash_id(@commit.id), @commit.message] +-set_meta_tags title: [title_object(@project), shortest_hash_id(@commit.id), @commit.message] = render 'submenu' -= render 'about_block', :project => @project += render 'about_block', project: @project %h3= t("layout.projects.last_commit") -- GitPresenters::CommitAsMessagePresenter.present(@commit, :project => @project) do |presenter| - = render :partial => 'shared/feed_message', :locals => {:presenter => presenter, :item_no => 1} +- GitPresenters::CommitAsMessagePresenter.present(@commit, project: @project) do |presenter| + = render partial: 'shared/feed_message', locals: {presenter: presenter, item_no: 1} .both #repo-wrapper = render 'show' - -comments = @comments.select {|c| c.data.blank? } # dont work @comments.where(:data => nil) - = render "projects/comments/list", :list => comments, :project => @project, :commentable => @commit - = render "projects/comments/add", :project => @project, :commentable => @commit if current_user + -comments = @comments.select {|c| c.data.blank? } # dont work @comments.where(data: nil) + = render "projects/comments/list", list: comments, project: @project, commentable: @commit + = render "projects/comments/add", project: @project, commentable: @commit if current_user =hidden_field_tag :preview_url, project_md_preview_path(@project) diff --git a/app/views/projects/git/trees/_show.html.haml b/app/views/projects/git/trees/_show.html.haml index 88e88fe1f..029cd7fa3 100644 --- a/app/views/projects/git/trees/_show.html.haml +++ b/app/views/projects/git/trees/_show.html.haml @@ -4,7 +4,7 @@ = render 'fork' .both -%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} +%table#myTable.tablesorter.project{cellpadding: "0", cellspacing: "0"} %thead %tr %th.th1= t("layout.projects.filename") @@ -27,9 +27,9 @@ .pic= image_tag 'folder-submodule.png' .name - if url = submodule_url(node, @treeish) - = link_to(node.name, url, :class => 'files-see') + = link_to(node.name, url, class: 'files-see') = '@' - = link_to(node.id[0..6], "#{url}/tree/#{node.id}", :class => 'files-see') + = link_to(node.id[0..6], "#{url}/tree/#{node.id}", class: 'files-see') - else = "#{node.name} @ #{node.id[0..6]}" - else @@ -38,10 +38,10 @@ - pic = 'folder.png' - path = tree_path *options .pic= image_tag pic || 'code.png' - .name= link_to(node.name, path || blob_path(*options), :class => 'files-see') + .name= link_to(node.name, path || blob_path(*options), class: 'files-see') - if commit - = datetime_moment(commit.committed_date || commit.authored_date, :tag => :td) + = datetime_moment(commit.committed_date || commit.authored_date, tag: :td) %td= commit.short_message %td= (commit.committer || commit.author).name - else diff --git a/app/views/projects/git/trees/branches.html.haml b/app/views/projects/git/trees/branches.html.haml index 304ce7515..5be9d2e9c 100644 --- a/app/views/projects/git/trees/branches.html.haml +++ b/app/views/projects/git/trees/branches.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => "#{title_object @project}" +-set_meta_tags title: "#{title_object @project}" = render 'submenu' -= render 'repo_block', :project => @project += render 'repo_block', project: @project %div{'ng-controller' => 'ProjectBranchesController', 'ng-init' => "init('#{@project.owner.uname}', '#{@project.name}','#{@branch.try(:name)}')"} @@ -23,16 +23,16 @@ %ul.actions - if can?(:write, @project) %li{'ng-hide' => 'branch.ref == current_ref || branch.ui_container'} - %a{:href => '', 'ng-click' => 'destroy(branch)'} + %a{href: '', 'ng-click' => 'destroy(branch)'} = t('layout.projects.delete_branch') %li{'ng-hide' => 'branch.ui_container'} - %a{:href => '', 'ng-click' => 'branch.ui_container = true'} + %a{href: '', 'ng-click' => 'branch.ui_container = true'} = t('layout.projects.new_branch') %li{'ng-show' => 'branch.ui_container'} %form{'ng-submit' => 'create(branch)'} %input{'ng-model' => 'branch.new_ref'} - %input{:type => 'submit', :value =>t('layout.create')} - %a{:href => '', 'ng-click' => 'branch.ui_container = false'} + %input{type: 'submit', value:t('layout.create')} + %a{href: '', 'ng-click' => 'branch.ui_container = false'} = t('layout.cancel') %li{'ng-hide' => 'branch.ref == current_ref || branch.ui_container'} %a{'ng-href' => '{{branch.diff_path(project, current_ref)}}' } diff --git a/app/views/projects/git/trees/empty.html.haml b/app/views/projects/git/trees/empty.html.haml index 8469a6bfe..9418d28df 100644 --- a/app/views/projects/git/trees/empty.html.haml +++ b/app/views/projects/git/trees/empty.html.haml @@ -1,11 +1,11 @@ --set_meta_tags :title => title_object(@project) +-set_meta_tags title: title_object(@project) = render 'submenu' -= render 'repo_block', :project => @project -= render 'about_block', :project => @project += render 'repo_block', project: @project += render 'about_block', project: @project - if @project.parent_id.present? || @project.srpm.exists? - + .both #repo-wrapper @@ -13,7 +13,7 @@ .files .l= render 'whereami' .both - %table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"} + %table#myTable.tablesorter.project{cellpadding: "0", cellspacing: "0"} %thead %tr %th.th1= t("layout.projects.filename") @@ -22,7 +22,7 @@ %th.th4= t("layout.projects.author") %tbody %tr - %td.centered{:colspan => 4} + %td.centered{colspan: 4} %h3= I18n.t("layout.git.repositories.empty") - else @@ -35,7 +35,7 @@ = "git config --global user.email #{current_user.email}" %br/ git config --global http.postBuffer 524288000 - + %h3= t("layout.projects.create_repository") %p %code @@ -52,7 +52,7 @@ git commit -m 'description message' %br/ git push -u origin master - + %h3= t("layout.projects.existing_git_repo") %p %code diff --git a/app/views/projects/git/trees/show.html.haml b/app/views/projects/git/trees/show.html.haml index f1dccbe2f..2810df171 100644 --- a/app/views/projects/git/trees/show.html.haml +++ b/app/views/projects/git/trees/show.html.haml @@ -1,2 +1,2 @@ --set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" -= render :partial => "show", :layout => 'layout' +-set_meta_tags title: "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}" += render partial: "show", layout: 'layout' diff --git a/app/views/projects/git/trees/tags.html.haml b/app/views/projects/git/trees/tags.html.haml index f8a074c12..888c0150d 100644 --- a/app/views/projects/git/trees/tags.html.haml +++ b/app/views/projects/git/trees/tags.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => "#{title_object @project}" +-set_meta_tags title: "#{title_object @project}" = render 'submenu' -= render 'repo_block', :project => @project += render 'repo_block', project: @project %div{'ng-controller' => 'ProjectTagsController', 'ng-init' => "init('#{@project.owner.uname}', '#{@project.name}')"} @@ -21,7 +21,7 @@ = t('layout.projects.browse_code') - %w(zip tar.gz).each do |type| %a.detail-link{'ng-href' => "{{tag.archive_path(project, '#{type}')}}" } - = t('layout.projects.source_code', :type => type) + = t('layout.projects.source_code', type: type) %p.name %b {{tag.ref}} .date {{tag.object.authored_date * 1000 | date:'yyyy.MM.dd'}} diff --git a/app/views/projects/hooks/edit.html.haml b/app/views/projects/hooks/edit.html.haml index 230d0334a..ec574a922 100644 --- a/app/views/projects/hooks/edit.html.haml +++ b/app/views/projects/hooks/edit.html.haml @@ -1,13 +1,13 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.hooks')] +-set_meta_tags title: [title_object(@project), t('layout.projects.hooks')] = render 'submenu' = render 'sidebar' %h1= t("layout.hooks.services.#{@hook.name}") -= form_for @hook, :url => project_hook_path(@project, @hook), :method => :put, :html => { :class => :form } do |f| += form_for @hook, url: project_hook_path(@project, @hook), method: :put, html: { class: :form } do |f| = render 'form' .actions - = f.submit t('layout.update'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.update'), data: {'disable-with' => t('layout.processing')} %br = render "projects/hooks/docs/#{@hook.name}" \ No newline at end of file diff --git a/app/views/projects/hooks/index.html.haml b/app/views/projects/hooks/index.html.haml index ba4df47c1..de1edf8ce 100644 --- a/app/views/projects/hooks/index.html.haml +++ b/app/views/projects/hooks/index.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.hooks')] +-set_meta_tags title: [title_object(@project), t('layout.projects.hooks')] = render 'submenu' = render 'sidebar' %h1= t('layout.projects.hooks') -%table#datatable.tablesorter{:cellpadding => "0", :cellspacing => "0"} +%table#datatable.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.th1= t('attributes.name') @@ -13,8 +13,8 @@ - Hook::NAMES.each do |name| %tr %td - = link_to project_hooks_path(@project, :name => name) do + = link_to project_hooks_path(@project, name: name) do = t("layout.hooks.services.#{name}") - = "(#{@hooks.where(:name => name).count})" + = "(#{@hooks.where(name: name).count})" %td.right - = link_to t('layout.create'), new_project_hook_path(@project, :hook => {:name => name}), :class => 'button' + = link_to t('layout.create'), new_project_hook_path(@project, hook: {name: name}), class: 'button' diff --git a/app/views/projects/hooks/new.html.haml b/app/views/projects/hooks/new.html.haml index 80751cd5f..8da9e9f72 100644 --- a/app/views/projects/hooks/new.html.haml +++ b/app/views/projects/hooks/new.html.haml @@ -1,13 +1,13 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.hooks')] +-set_meta_tags title: [title_object(@project), t('layout.projects.hooks')] = render 'submenu' = render 'sidebar' %h1= t("layout.hooks.services.#{@hook.name}") -= form_for @hook, :url => project_hooks_path(@project), :method => :post, :html => { :class => :form } do |f| += form_for @hook, url: project_hooks_path(@project), method: :post, html: { class: :form } do |f| = render 'form' .actions - = f.submit t('layout.create'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.create'), data: {'disable-with' => t('layout.processing')} %br = render "projects/hooks/docs/#{@hook.name}" \ No newline at end of file diff --git a/app/views/projects/hooks/show.html.haml b/app/views/projects/hooks/show.html.haml index 25b57f9f5..e4c534ad1 100644 --- a/app/views/projects/hooks/show.html.haml +++ b/app/views/projects/hooks/show.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.hooks')] +-set_meta_tags title: [title_object(@project), t('layout.projects.hooks')] = render 'submenu' = render 'sidebar' %h1= t("layout.hooks.services.#{@name}") -= link_to t('layout.create'), new_project_hook_path(@project, :hook => {:name => @name}), :class => 'button' += link_to t('layout.create'), new_project_hook_path(@project, hook: {name: @name}), class: 'button' .booth %br @@ -21,6 +21,6 @@ .leftlist .rightlist - = link_to t('layout.edit'), edit_project_hook_path(@project, hook), :class => 'button' - = link_to t('layout.delete'), project_hook_path(@project, hook), :method => :delete, :confirm => t('layout.confirm'), :class => 'button' + = link_to t('layout.edit'), edit_project_hook_path(@project, hook), class: 'button' + = link_to t('layout.delete'), project_hook_path(@project, hook), method: :delete, confirm: t('layout.confirm'), class: 'button' .hr diff --git a/app/views/projects/issues/_assigned_popup.html.haml b/app/views/projects/issues/_assigned_popup.html.haml index 51d06bf7a..9fa344d30 100644 --- a/app/views/projects/issues/_assigned_popup.html.haml +++ b/app/views/projects/issues/_assigned_popup.html.haml @@ -3,12 +3,12 @@ .title= t('layout.issues.assign_someone') %span.icon-remove-circle .search-container - #search_user_path{:path => search_collaborators_project_issues_path(@project)} + #search_user_path{path: search_collaborators_project_issues_path(@project)} = tracker_search_field(:search_user, t('layout.issues.search_user')) - unless [:new, :create].include?(action_name.to_sym) - = form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f| - = hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]' + = form_for :issue, url: [@project, @issue], method: :put, html: { class: 'edit_assignee issue'} do |f| + = hidden_field_tag "user-default_assignee", nil, name: 'issue[assignee_id]' .list = render 'projects/issues/search_collaborators' \ No newline at end of file diff --git a/app/views/projects/issues/_colors_chooser.html.haml b/app/views/projects/issues/_colors_chooser.html.haml index 97eee6499..89aae19d2 100644 --- a/app/views/projects/issues/_colors_chooser.html.haml +++ b/app/views/projects/issues/_colors_chooser.html.haml @@ -1,6 +1,6 @@ -current_color ||= '0054a6' .colors - ['0054a6', '00a651', 'ed1c24', 'e65c00', '9e005d', '464646', '8c6239'].each do |color| - .color{:style => "background: ##{color};"} - #choose1.choose{:value => color, :class => current_color == color ? 'selected' : ''} + .color{style: "background: ##{color};"} + #choose1.choose{value: color, class: current_color == color ? 'selected' : ''} .both diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml index 871b4d272..fa3213b86 100644 --- a/app/views/projects/issues/_form.html.haml +++ b/app/views/projects/issues/_form.html.haml @@ -1,8 +1,8 @@ -=render 'title_body', :f => f, :id => 'new' +=render 'title_body', f: f, id: 'new' - if can?(:write, @project) .leftlist= t('activerecord.attributes.issue.assignee') + ':' #assigned-container.rightlist - =render 'user_container', :user => @issue.assignee + =render 'user_container', user: @issue.assignee .both .leftlist= t('layout.issues.labels') + ':' .rightlist @@ -11,5 +11,5 @@ .both .leftlist .rightlist - = submit_tag t(@issue.new_record? ? 'layout.create' : 'layout.update'), :data => {'disable-with' => t('layout.processing')} + = submit_tag t(@issue.new_record? ? 'layout.create' : 'layout.update'), data: {'disable-with' => t('layout.processing')} .both diff --git a/app/views/projects/issues/_header.html.haml b/app/views/projects/issues/_header.html.haml index b6895a9b3..89b5de82d 100644 --- a/app/views/projects/issues/_header.html.haml +++ b/app/views/projects/issues/_header.html.haml @@ -1,26 +1,26 @@ .activity .top .image - =image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user + =image_tag(avatar_url(@issue.user, :medium), alt: 'avatar') if @issue.user .created - = datetime_moment @issue.created_at, :tag => :span + = datetime_moment @issue.created_at, tag: :span - if @issue.user - %span= t('layout.by') + %span= t('layout.by') %span.name=link_to(@issue.user.fullname, user_path(@issue.user)) .text.issue_title %h3.issue_title=@issue.title .both #assigned-container.assigned-header - =render 'projects/issues/user_container', :user => @issue.assignee + =render 'projects/issues/user_container', user: @issue.assignee =render 'projects/issues/assigned_popup' .both .fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body .both %br - if can? :update, @issue - =link_to t('layout.edit'), '#', :id => 'edit_issue_content', :class => 'button' - =form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_form issue', :style => 'display:none;' } do |f| - =render 'projects/issues/title_body', :f => f, :id => 'update' - =f.submit t('layout.update'), :id => 'update_issue_content' - =link_to t('layout.issues.cancel_button'), '#', :id => 'cancel_edit_issue_content', :class => 'button' + =link_to t('layout.edit'), '#', id: 'edit_issue_content', class: 'button' + =form_for :issue, url: [@project, @issue], method: :put, html: { class: 'edit_form issue', style: 'display:none;' } do |f| + =render 'projects/issues/title_body', f: f, id: 'update' + =f.submit t('layout.update'), id: 'update_issue_content' + =link_to t('layout.issues.cancel_button'), '#', id: 'cancel_edit_issue_content', class: 'button' %br diff --git a/app/views/projects/issues/_index_sidebar.html.haml b/app/views/projects/issues/_index_sidebar.html.haml index 154ee8ba1..2568a9e5e 100644 --- a/app/views/projects/issues/_index_sidebar.html.haml +++ b/app/views/projects/issues/_index_sidebar.html.haml @@ -1,22 +1,22 @@ -content_for :sidebar do - if current_user - =form_tag project_issues_path(@project), :id => 'filter_issues', :method => :get do + =form_tag project_issues_path(@project), id: 'filter_issues', method: :get do .bordered %table %tr - %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {id: 'myradio1', class: 'niceRadio', name: 'filter'} %td.width135=t('layout.issues.all') %td.width30.right=@project.issues.without_pull_requests.not_closed_or_merged.count %tr - %td=radio_button_tag :myradio, 'assigned', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td=radio_button_tag :myradio, 'assigned', @is_assigned_to_me, {id: 'myradio1', class: 'niceRadio', name: 'filter'} %td=t('layout.issues.assigned') - %td.width30.right=@project.issues.without_pull_requests.where(:assignee_id => current_user.id).not_closed_or_merged.count - =form_tag project_issues_path(@project), :id => 'search_issue', :class => 'ajax_search_form', :method => :get do + %td.width30.right=@project.issues.without_pull_requests.where(assignee_id: current_user.id).not_closed_or_merged.count + =form_tag project_issues_path(@project), id: 'search_issue', class: 'ajax_search_form', method: :get do .bordered.bpadding20 - search = params[:search_issue].present? ? params[:search_issue] : t('layout.issues.search') =tracker_search_field(:search_issue, search) - if can? :new, @project.issues.new .bordered.nopadding %h3.bmargin10=t('layout.issues.new') - = link_to t("layout.add"), new_project_issue_path(@project), :class => 'button' + = link_to t("layout.add"), new_project_issue_path(@project), class: 'button' =render 'labels' diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index cb7cdc363..c82a08bb0 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -1,11 +1,11 @@ - path = polymorphic_path [@project || issue.project, issue.pull_request ? issue.pull_request : issue] -%tr#row1{:name => "row", :class => issue.labels.map(&:name).compact} +%tr#row1{name: "row", class: issue.labels.map(&:name).compact} %td.td0 - %span{:style => "display: none;"}=issue.serial_id + %span{style: "display: none;"}=issue.serial_id %td.td1=issue.serial_id %td - %a{:href => path} + %a{href: path} %div.issue_title -prefix = @project ? '' : "#{issue.project.name}: " ="#{prefix} #{issue.title}".html_safe @@ -16,12 +16,12 @@ -issue.labels.each do |label| .left.nomargin .label.selected.tracker.left - .labeltext.selected{:style => "background: ##{label.color};"}=label.name - %td.td3{:class => (issue.pull_request ? 'td3-pull' : '')} + .labeltext.selected{style: "background: ##{label.color};"}=label.name + %td.td3{class: (issue.pull_request ? 'td3-pull' : '')} - if issue.pull_request - %a{:href => path} + %a{href: path} .code # - = link_to image_tag(avatar_url(issue.assignee), :alt => 'avatar', :class => 'avatar'), user_path(issue.assignee) if issue.assignee - %a.answers{:href => "#{path}#block-list"} - = image_tag 'answers.png', :class => 'pic' - .count=issue.comments.where(:automatic => false).count + = link_to image_tag(avatar_url(issue.assignee), alt: 'avatar', class: 'avatar'), user_path(issue.assignee) if issue.assignee + %a.answers{href: "#{path}#block-list"} + = image_tag 'answers.png', class: 'pic' + .count=issue.comments.where(automatic: false).count diff --git a/app/views/projects/issues/_issues_table.html.haml b/app/views/projects/issues/_issues_table.html.haml index 1942c4f3f..25b9f0622 100644 --- a/app/views/projects/issues/_issues_table.html.haml +++ b/app/views/projects/issues/_issues_table.html.haml @@ -1,21 +1,21 @@ #description-top.issues-filter .project-tabnav %ul.tabnav-tabs - %li.list-browser-filter-tabs.open{:class => ('selected' if @status == :open)} + %li.list-browser-filter-tabs.open{class: ('selected' if @status == :open)} %a= "#{t('layout.issues.statuses.open')} (#{@opened_issues})" - %li.list-browser-filter-tabs.closed{:class => ('selected' if @status != :open)} + %li.list-browser-filter-tabs.closed{class: ('selected' if @status != :open)} %a= "#{t('layout.issues.statuses.closed')} (#{@closed_issues})" - %li.list-browser-sorts.updated{:class => ("selected #{@direction}" if @sort == :updated)} + %li.list-browser-sorts.updated{class: ("selected #{@direction}" if @sort == :updated)} - if @sort == :updated - %i{:class => (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')} + %i{class: (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')} %a= t('layout.issues.sort.updated') - %li.list-browser-sorts.created{:class => ("selected #{@direction}" if @sort == :created)} + %li.list-browser-sorts.created{class: ("selected #{@direction}" if @sort == :created)} - if @sort == :created - %i{:class => (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')} + %i{class: (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')} %a= t('layout.issues.sort.submitted') #table1.issues-table - %table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"} + %table#myTable.tablesorter.tracker{cellpadding: "0", cellspacing: "0"} %tbody - = render :partial => 'projects/issues/issue', :collection => issues + = render partial: 'projects/issues/issue', collection: issues = will_paginate issues diff --git a/app/views/projects/issues/_labels.html.haml b/app/views/projects/issues/_labels.html.haml index fec7aba5f..c114f7205 100644 --- a/app/views/projects/issues/_labels.html.haml +++ b/app/views/projects/issues/_labels.html.haml @@ -1,44 +1,44 @@ .block %h3=t('layout.issues.labels') #labels-stock - =form_tag project_issues_path(@project), :id => 'filter_labels', :method => :get do + =form_tag project_issues_path(@project), id: 'filter_labels', method: :get do - @project.labels.each_with_index do |label, index| =render 'projects/shared/filter_label', - :id => label.name.parameterize, - :selected => @labels.include?(label.name), - :extra_classes => 'div-tracker-labels', - :color => label.color, - :check_box_name => 'labels', - :check_box_value => label.name, - :name => label.name, - :count => Labeling.joins(:label).where(:labels => {:name => label.name, :project_id => @project.id}).count + id: label.name.parameterize, + selected: @labels.include?(label.name), + extra_classes: 'div-tracker-labels', + color: label.color, + check_box_name: 'labels', + check_box_value: label.name, + name: label.name, + count: Labeling.joins(:label).where(labels: {name: label.name, project_id: @project.id}).count - if can? :write, @project - %a#manage-labels.button.tmargin10{:href => "#labels-stock"}=t('layout.issues.label_manage') - #labels-edit{:style => "display: none;"} + %a#manage-labels.button.tmargin10{href: "#labels-stock"}=t('layout.issues.label_manage') + #labels-edit{style: "display: none;"} - @project.labels.each_with_index do |label, index| - .label.edit{:id => "label-#{index}"} - .labeltext.edit{:style => "background: ##{label.color};"} - .text=link_to(label.name, project_issues_update_label_path(@project, label.id), :class => 'edit_label') - .delete{:id => "delete#{index}"} - %a{:href => project_issues_delete_label_path(@project, label.id), :class => 'delete_label'}= image_tag 'x-label.png' + .label.edit{id: "label-#{index}"} + .labeltext.edit{style: "background: ##{label.color};"} + .text=link_to(label.name, project_issues_update_label_path(@project, label.id), class: 'edit_label') + .delete{id: "delete#{index}"} + %a{href: project_issues_delete_label_path(@project, label.id), class: 'delete_label'}= image_tag 'x-label.png' .both - .edit_label_form{:style => 'display:none'} - =form_tag project_issues_update_label_path(@project, label.id), :id => 'update_label', :method => :post do - %input.gray{:name => 'name', :type => "text", :value => label.name} - =render 'colors_chooser', :current_color => label.color + .edit_label_form{style: 'display:none'} + =form_tag project_issues_update_label_path(@project, label.id), id: 'update_label', method: :post do + %input.gray{name: 'name', type: "text", value: label.name} + =render 'colors_chooser', current_color: label.color .lefter - %a{:href => "#custom_color-#{label.name}", :id => "custom_color-#{label.name}", :class => 'custom_color'}=t('layout.issues.label_custom_color') - =text_field_tag :color, label.color, :id => 'label_color', :class => 'gray', :style => 'display:none', :maxlength => 6 + %a{href: "#custom_color-#{label.name}", id: "custom_color-#{label.name}", class: 'custom_color'}=t('layout.issues.label_custom_color') + =text_field_tag :color, label.color, id: 'label_color', class: 'gray', style: 'display:none', maxlength: 6 .righter - =link_to t('layout.update'), project_issues_update_label_path(@project, label.id), :id => 'update_label', :class => 'button' + =link_to t('layout.update'), project_issues_update_label_path(@project, label.id), id: 'update_label', class: 'button' .both - =form_tag create_label_project_issues_path(@project), :id => 'new_label', :method => :post do + =form_tag create_label_project_issues_path(@project), id: 'new_label', method: :post do =tracker_search_field(:name, t('layout.issues.new_label')) =render 'colors_chooser' .lefter - %a{:href => "#custom_color", :id => 'custom_color', :class => 'custom_color'}=t('layout.issues.label_custom_color') - =text_field_tag :color, '0054a6', :id => 'label_color', :class => 'gray', :style => 'display:none', :maxlength => 6 + %a{href: "#custom_color", id: 'custom_color', class: 'custom_color'}=t('layout.issues.label_custom_color') + =text_field_tag :color, '0054a6', id: 'label_color', class: 'gray', style: 'display:none', maxlength: 6 .righter - =link_to t('layout.add'), create_label_project_issues_path(@project), :id => 'add_label', :class => 'button' + =link_to t('layout.add'), create_label_project_issues_path(@project), id: 'add_label', class: 'button' .both diff --git a/app/views/projects/issues/_manage_sidebar.html.haml b/app/views/projects/issues/_manage_sidebar.html.haml index 1ba6fa829..c79b581aa 100644 --- a/app/views/projects/issues/_manage_sidebar.html.haml +++ b/app/views/projects/issues/_manage_sidebar.html.haml @@ -3,32 +3,32 @@ .bordered.nopadding %h3=t('activerecord.attributes.issue.status') - can_manage = can?(:update, @issue) - #switcher.issue_status{:class => "#{@issue.closed? ? 'switcher-off' : 'switcher'} #{can_manage ? "switch_issue_status" : ''}"} + #switcher.issue_status{class: "#{@issue.closed? ? 'switcher-off' : 'switcher'} #{can_manage ? "switch_issue_status" : ''}"} .swleft=t('layout.issues.status.open') .swright=t('layout.issues.status.closed') - if can_manage - =form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do - =hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]" + =form_tag [@project, @issue], id: 'update_issue_status', method: :put do + =hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', name: "issue[status]" .block %h3=t('layout.issues.labels') - if can?(:write, @project) .current_labels - (@project.labels || []).each do |label| - is_issue_label = @issue.labels.include? label - .label{:id => "flag#{label.id}", :class => @issue.persisted? ? 'nopointer' : 'add_label'} - .flag{:style => "background: ##{label.color}; #{is_issue_label ? 'display:none;' : ''}"} - .labeltext{:class => is_issue_label ? 'selected' : '', :style => is_issue_label ? "background: ##{label.color}" : ''}=label.name - .both=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]" - =form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_labels issue'} do |f| + .label{id: "flag#{label.id}", class: @issue.persisted? ? 'nopointer' : 'add_label'} + .flag{style: "background: ##{label.color}; #{is_issue_label ? 'display:none;' : ''}"} + .labeltext{class: is_issue_label ? 'selected' : '', style: is_issue_label ? "background: ##{label.color}" : ''}=label.name + .both=hidden_field_tag "flag#{label.id}", label.id, name: "issue[labelings_attributes][#{label.id}][label_id]" + =form_for :issue, url: [@project, @issue], method: :put, html: { class: 'edit_labels issue'} do |f| .manage_labels =hidden_field_tag "update_labels", true - @issue.labels.each do |label| - =hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]" + =hidden_field_tag "flag#{label.id}", label.id, name: "issue[labelings_attributes][#{label.id}][label_id]" - else - (@issue.labels || []).each do |label| .label.nopointer - .labeltext.selected{:style => "background: ##{label.color};"}=label.name + .labeltext.selected{style: "background: ##{label.color};"}=label.name .both - if can?(:write, @project) && @issue.persisted? - =link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_labels") - =link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_labels", :style => 'display:none') + =link_to(t('layout.issues.label_manage'), '#', class: "button tmargin10 manage_labels") + =link_to(t('layout.issues.done'), '#', class: "button tmargin10 update_labels", style: 'display:none') diff --git a/app/views/projects/issues/_search_collaborators.html.haml b/app/views/projects/issues/_search_collaborators.html.haml index 81463a782..bb038c1d2 100644 --- a/app/views/projects/issues/_search_collaborators.html.haml +++ b/app/views/projects/issues/_search_collaborators.html.haml @@ -3,19 +3,19 @@ = t('layout.issues.clear_assignee') .container %span= t('layout.issues.no_one_is_assigned') - = hidden_field_tag "user-nil", nil, :name => "issue[assignee_id]" + = hidden_field_tag "user-nil", nil, name: "issue[assignee_id]" - users = (@users || []) - users.each_with_index do |user, index| - .people.selected{:id => "user-#{index}", :class => 'add_assignee'} - .avatar= image_tag(avatar_url(user), :alt => 'avatar') + .people.selected{id: "user-#{index}", class: 'add_assignee'} + .avatar= image_tag(avatar_url(user), alt: 'avatar') .name= user.fullname .container .image - = image_tag(avatar_url(user, :micro), :alt => 'avatar') + = image_tag(avatar_url(user, :micro), alt: 'avatar') %span.name= link_to(user.fullname, user_path(user)) %span= t('layout.issues.is_assigned') - = hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]" + = hidden_field_tag "user-#{index}", user.id, name: "issue[assignee_id]" .both - if users.empty? .nothing= t('layout.issues.nothing_to_show') \ No newline at end of file diff --git a/app/views/projects/issues/_status.html.haml b/app/views/projects/issues/_status.html.haml index 1bf7b4602..c0f17bdc1 100644 --- a/app/views/projects/issues/_status.html.haml +++ b/app/views/projects/issues/_status.html.haml @@ -1,9 +1,9 @@ #closed_issue_text - if @issue.status == 'closed' && @issue.closed_at && @issue.closed_by - #closed-comment.comment-closed{:style => 'display: block;'} + #closed-comment.comment-closed{style: 'display: block;'} .state=t('layout.issues.status.closed') .text - .avatar= image_tag(avatar_url(@issue.closer), :alt => 'avatar') - .name="#{@issue.closer.fullname} #{datetime_moment(@issue.closed_at, :tag => :span)}".html_safe + .avatar= image_tag(avatar_url(@issue.closer), alt: 'avatar') + .name="#{@issue.closer.fullname} #{datetime_moment(@issue.closed_at, tag: :span)}".html_safe .both %br/ diff --git a/app/views/projects/issues/_title_body.html.haml b/app/views/projects/issues/_title_body.html.haml index 7f35fe7d6..d9178fc51 100644 --- a/app/views/projects/issues/_title_body.html.haml +++ b/app/views/projects/issues/_title_body.html.haml @@ -1,8 +1,8 @@ #open-comment.comment.view %h3.tmargin0= t 'activerecord.attributes.issue.title' - .wrapper= f.text_area :title, :cols => 80, :rows => 1 + .wrapper= f.text_area :title, cols: 80, rows: 1 #open-comment.comment.view =render 'projects/comments/button_md_help' %h3.tmargin0= t 'activerecord.attributes.issue.body' - =render 'projects/comments/body', :f => f, :id => id + =render 'projects/comments/body', f: f, id: id .both diff --git a/app/views/projects/issues/_user_container.html.haml b/app/views/projects/issues/_user_container.html.haml index 21c1ca3a6..b5a25d053 100644 --- a/app/views/projects/issues/_user_container.html.haml +++ b/app/views/projects/issues/_user_container.html.haml @@ -1,7 +1,7 @@ .user-container - if user .image - =image_tag(avatar_url(user, :micro), :alt => 'avatar') + =image_tag(avatar_url(user, :micro), alt: 'avatar') %span.name= link_to(user.fullname, user_path(user)) %span= t('layout.issues.is_assigned') - else diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 7b116f361..4edd71a10 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,5 +1,5 @@ --set_meta_tags :title => [title_object(@project), t('.title')] +-set_meta_tags title: [title_object(@project), t('.title')] -render 'submenu' -render 'index_sidebar' -= render 'issues_table', :issues => @issues += render 'issues_table', issues: @issues diff --git a/app/views/projects/issues/new.html.haml b/app/views/projects/issues/new.html.haml index 2c5519fa0..2612efe68 100644 --- a/app/views/projects/issues/new.html.haml +++ b/app/views/projects/issues/new.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => [title_object(@project), t('layout.issues.create_header')] +-set_meta_tags title: [title_object(@project), t('layout.issues.create_header')] -render 'submenu' -render 'manage_sidebar' %h3.bpadding10= t("layout.issues.create_header") =render 'projects/issues/assigned_popup' -= form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue new' } do |f| - = render "form", :f => f += form_for :issue, url: project_issues_path(@project), html: { class: 'form issue new' } do |f| + = render "form", f: f =hidden_field_tag :preview_url, project_md_preview_path(@project) = render "projects/comments/markdown_help" \ No newline at end of file diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 6d8b4d06e..b87de0b5f 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@project), @issue.title] +-set_meta_tags title: [title_object(@project), @issue.title] -render 'submenu' -render 'manage_sidebar' -content_for :right_nopadding do @@ -6,9 +6,9 @@ =render 'header' =render 'status' -= render "projects/comments/list", :list => @issue.comments, :project => @project, :commentable => @issue += render "projects/comments/list", list: @issue.comments, project: @project, commentable: @issue %br -= render "projects/comments/add", :project => @project, :commentable => @issue if current_user += render "projects/comments/add", project: @project, commentable: @issue if current_user =hidden_field_tag :preview_url, project_md_preview_path(@project) diff --git a/app/views/projects/projects/_filters.html.haml b/app/views/projects/projects/_filters.html.haml index 6b578a3b1..7af8dc74d 100644 --- a/app/views/projects/projects/_filters.html.haml +++ b/app/views/projects/projects/_filters.html.haml @@ -1,15 +1,15 @@ -content_for :sidebar do - if current_user - =form_tag projects_path, :id => 'filter_projects', :method => :get do + =form_tag projects_path, id: 'filter_projects', method: :get do .bordered.bpadding20 =tracker_search_field(:search, t('layout.find_project')) - if can?(:create, Project) .bordered.bpadding20 - = link_to t('layout.projects.new'), new_project_path, :class => 'button' + = link_to t('layout.projects.new'), new_project_path, class: 'button' - if can?(:mass_import, Project) .both %br - = link_to t('layout.projects.mass_import'), mass_import_projects_path, :class => 'button' + = link_to t('layout.projects.mass_import'), mass_import_projects_path, class: 'button' .bordered.bpadding20 %h3=t('layout.relations.filters') - options_for_filters(@all_projects, @groups, @owners).each do |options| diff --git a/app/views/projects/projects/_form.html.haml b/app/views/projects/projects/_form.html.haml index af92b3e1b..22f864135 100644 --- a/app/views/projects/projects/_form.html.haml +++ b/app/views/projects/projects/_form.html.haml @@ -1,18 +1,18 @@ - act = controller.action_name.to_sym %div{'ng-controller' => 'ProjectFromController'} .leftlist= f.label :name - .rightlist= f.text_field :name, :class => 'text_field' + .rightlist= f.text_field :name, class: 'text_field' .both .leftlist= f.label :description - .rightlist= f.text_area :description, :class => 'text_field', :cols => 80 + .rightlist= f.text_area :description, class: 'text_field', cols: 80 .both - if [:new, :create].include? act - = render 'owner', :f => f + = render 'owner', f: f .leftlist= f.label :visibility .rightlist - Project::VISIBILITIES.each do |visibility| - = f.radio_button :visibility, visibility, :class => 'niceRadio' + = f.radio_button :visibility, visibility, class: 'niceRadio' - if visibility == 'open' = image_tag("unlock.png") - else @@ -42,10 +42,10 @@ = f.select :default_branch, options_from_collection_for_select( @project.repo.branches, :name, :name, @project.default_branch), - :class => 'sel80', :id => 'branch_selector' + class: 'sel80', id: 'branch_selector' .both #maintainer_form{'ng-show' => 'project.is_package'} - = f.hidden_field :maintainer_id, :value => @project.maintainer_id + = f.hidden_field :maintainer_id, value: @project.maintainer_id .leftlist = f.label :maintainer .rightlist @@ -53,15 +53,15 @@ -# list of potential maintainers? = autocomplete_field_tag :maintainer_name, @project.maintainer.fullname, autocomplete_maintainers_path(@project.owner, @project), - :id_element => '#project_maintainer_id', - :placeholder => @project.maintainer.fullname + id_element: '#project_maintainer_id', + placeholder: @project.maintainer.fullname - if [:new, :create].include? act .leftlist= f.label :srpm - .rightlist= f.file_field :srpm, :class => 'file_field' + .rightlist= f.file_field :srpm, class: 'file_field' .both .leftlist \  - .rightlist= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')} + .rightlist= submit_tag t('layout.save'), class: 'button', data: {'disable-with' => t('layout.saving')} .both :javascript diff --git a/app/views/projects/projects/_owner.html.haml b/app/views/projects/projects/_owner.html.haml index 3d1d19653..94d9dce4e 100644 --- a/app/views/projects/projects/_owner.html.haml +++ b/app/views/projects/projects/_owner.html.haml @@ -2,9 +2,9 @@ .rightlist = label_tag t("activerecord.attributes.project.who_owns.me") - if Group.can_own_project(current_user).count > 0 - = radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} ) + = radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {checked: 'checked'} : {} ) = label_tag t("activerecord.attributes.project.who_owns.group") - = radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} ) + = radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {checked: 'checked'} : {} ) -# TODO: Make our own select_box helper with new design, blackjack and bitches! = select_tag :owner_id, options_from_collection_for_select( Group.can_own_project(current_user), :id, :name ) - else diff --git a/app/views/projects/projects/_project.html.haml b/app/views/projects/projects/_project.html.haml index a59667f52..f7433fb9e 100644 --- a/app/views/projects/projects/_project.html.haml +++ b/app/views/projects/projects/_project.html.haml @@ -1,4 +1,4 @@ -%tr{:id => "Row#{project_counter}"} +%tr{id: "Row#{project_counter}"} %td = link_to project do .table-sort-left= image_tag visibility_icon(project.visibility) @@ -7,9 +7,9 @@ - alone_member = alone_member? project %td - c = participant_class(alone_member, project) - %span{:class => c, :title => t("layout.relations.#{c}")} + %span{class: c, title: t("layout.relations.#{c}")} = 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 + = link_to remove_user_project_path(project), method: :delete, confirm: t("layout.confirm") do %span.delete   diff --git a/app/views/projects/projects/edit.html.haml b/app/views/projects/projects/edit.html.haml index 5cdc5af03..e801bc2ce 100644 --- a/app/views/projects/projects/edit.html.haml +++ b/app/views/projects/projects/edit.html.haml @@ -1,12 +1,12 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.edit')] +-set_meta_tags title: [title_object(@project), t('layout.projects.edit')] = render 'submenu' = render 'sidebar' -= form_for @project, :html => { :class => :form, :multipart => true } do |f| - = render "form", :f => f += form_for @project, html: { class: :form, multipart: true } do |f| + = render "form", f: f .hr .leftside= t("layout.projects.delete_warning") -.rightside= link_to t("layout.delete"), project_path(@project), :method => :delete, :confirm => t("layout.projects.confirm_delete"), :class => 'button' if can? :destroy, @project +.rightside= link_to t("layout.delete"), project_path(@project), method: :delete, confirm: t("layout.projects.confirm_delete"), class: 'button' if can? :destroy, @project .both diff --git a/app/views/projects/projects/index.html.haml b/app/views/projects/projects/index.html.haml index 920b10daa..f6bf486bf 100644 --- a/app/views/projects/projects/index.html.haml +++ b/app/views/projects/projects/index.html.haml @@ -1,31 +1,22 @@ --set_meta_tags :title => t('layout.projects.list_header') +-set_meta_tags title: t('layout.projects.list_header') -render 'filters' .toolbar -%w(user_owner group_owner user group).each do |el| - %span{:class => el}=t "layout.relations.#{el}" + %span{class: el}=t "layout.relations.#{el}" .both -- columns = [{:type => 'html'}, - {:type => 'html', :sortable => false, :searchable => false}, - {:type => nil, :sortable => false, :searchable => false, :class => 'rights'}, - {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}] --#= raw datatable(columns, {:sort_by => "[0, 'asc']", :search_label => t("layout.search_by_name"), :processing => t("layout.processing"), --# :pagination_labels => {:previous => t("datatables.previous_label"), :next => t("datatables.next_label")}, --# :empty_label => t("datatables.empty_label"), --# :info_label => t("datatables.info_label"), --# :info_empty_label => t("datatables.info_empty_label"), --# :filtered_label => t("datatables.filtered_label"), --# :table_dom_id => 'datatable', --# :auto_width => 'false', --# :sdom => 'rtip'}) +- columns = [{type: 'html'}, + {type: 'html', sortable: false, searchable: false}, + {type: nil, sortable: false, searchable: false, class: 'rights'}, + {type: nil, sortable: false, searchable: false, class: 'buttons'}] -%table#datatable.tablesorter{:cellpadding => "0", :cellspacing => "0"} +%table#datatable.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th.th1= t("activerecord.attributes.project.name") %th.th2= t("activerecord.attributes.project.description") %th.th3= t("layout.projects.role") %th.th4= t("layout.projects.remove_user") - %tbody= render :partial => 'projects/projects/project', :collection => @projects + %tbody= render partial: 'projects/projects/project', collection: @projects :javascript $(document).ready(function() { @@ -85,7 +76,7 @@ "aaSorting": [[ 0, 'asc' ]], "sDom": 'rtip', "bServerSide": true, - "sAjaxSource": "#{ projects_path :format => :json }", + "sAjaxSource": "#{ projects_path format: :json }", "iDeferLoading": #{ @projects.count }, "aoColumns": [ #{ format_columns_for_datatable(columns) } diff --git a/app/views/projects/projects/index.json.jbuilder b/app/views/projects/projects/index.json.jbuilder index 2678557ab..f2cc8c559 100644 --- a/app/views/projects/projects/index.json.jbuilder +++ b/app/views/projects/projects/index.json.jbuilder @@ -16,6 +16,6 @@ end json.aaData do |aadata| aadata.array!(@projects[:projects]) do |json, proj| - json.partial! 'project', :project => proj + json.partial! 'project', project: proj end end diff --git a/app/views/projects/projects/mass_import.html.haml b/app/views/projects/projects/mass_import.html.haml index 796ca274a..cdcc0a04d 100644 --- a/app/views/projects/projects/mass_import.html.haml +++ b/app/views/projects/projects/mass_import.html.haml @@ -1,5 +1,5 @@ %h3.bpadding10= title t("layout.projects.mass_import") -= form_for @project, :url => run_mass_import_projects_path, :html => { :class => :form } do |f| += form_for @project, url: run_mass_import_projects_path, html: { class: :form } do |f| = f.hidden_field :mass_import .leftlist= f.label :url .rightlist= f.text_field :url @@ -10,12 +10,12 @@ .leftlist= f.label :add_to_repository_id .rightlist= f.select :add_to_repository_id, repositories_grouped_by_platform .both - = render 'owner', :f => f + = render 'owner', f: f .leftlist= f.label :visibility .rightlist - Project::VISIBILITIES.each do |visibility| - = f.radio_button :visibility, visibility, :class => 'niceRadio' + = f.radio_button :visibility, visibility, class: 'niceRadio' - if visibility == 'open' = image_tag("unlock.png") - else @@ -24,4 +24,4 @@ .both .hr .button_block - = f.submit t('layout.add'), :data => {'disable-with' => t('layout.saving')} \ No newline at end of file + = f.submit t('layout.add'), data: {'disable-with' => t('layout.saving')} \ No newline at end of file diff --git a/app/views/projects/projects/new.html.haml b/app/views/projects/projects/new.html.haml index 68a1a0c6f..81a8b1579 100644 --- a/app/views/projects/projects/new.html.haml +++ b/app/views/projects/projects/new.html.haml @@ -1,4 +1,4 @@ %h3.bpadding10= title t("layout.projects.new") -= form_for @project, :html => { :class => :form, :multipart => true } do |f| - = render "form", :f => f += form_for @project, html: { class: :form, multipart: true } do |f| + = render "form", f: f diff --git a/app/views/projects/projects/refs_list.html.haml b/app/views/projects/projects/refs_list.html.haml index 43ea5f649..5d9670a0d 100644 --- a/app/views/projects/projects/refs_list.html.haml +++ b/app/views/projects/projects/refs_list.html.haml @@ -1 +1 @@ -=render 'projects/pull_requests/ref_select', :kind => 'to', :project => @project, :current => @selected +=render 'projects/pull_requests/ref_select', kind: 'to', project: @project, current: @selected diff --git a/app/views/projects/projects/sections.html.haml b/app/views/projects/projects/sections.html.haml index 7289ecfb9..e8a6e0f0c 100644 --- a/app/views/projects/projects/sections.html.haml +++ b/app/views/projects/projects/sections.html.haml @@ -1,23 +1,23 @@ --set_meta_tags :title => [title_object(@project), t('layout.projects.sections')] +-set_meta_tags title: [title_object(@project), t('layout.projects.sections')] = render 'submenu' = render 'sidebar' -= form_for @project, :url => sections_project_path(@project), :method => :post, :html => { :class => :form, :multipart => true } do |f| += form_for @project, url: sections_project_path(@project), method: :post, html: { class: :form, multipart: true } do |f| .leftside.w25 - %span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_issues + %span.niceCheck-main{onclick: "changeCheck(this)"}= f.check_box :has_issues .leftside.w420 = t("activerecord.attributes.project.has_issues") %br - %span{:style => "font-size: 11px;"}= t("layout.projects.has_issue_description") + %span{style: "font-size: 11px;"}= t("layout.projects.has_issue_description") .both .leftside.w25 - %span.niceCheck-main{:onclick => "changeCheck(this)"}= f.check_box :has_wiki, :class => 'niceCheck-main' + %span.niceCheck-main{onclick: "changeCheck(this)"}= f.check_box :has_wiki, class: 'niceCheck-main' .leftside.w420 = t("activerecord.attributes.project.has_wiki") %br - %span{:style => "font-size: 11px;"}= t("layout.projects.has_wiki_description") + %span{style: "font-size: 11px;"}= t("layout.projects.has_wiki_description") .both - .padd25= submit_tag t('layout.save'), :class => 'button', :data => {'disable-with' => t('layout.saving')} + .padd25= submit_tag t('layout.save'), class: 'button', data: {'disable-with' => t('layout.saving')} .both :javascript diff --git a/app/views/projects/pull_requests/_activity.html.haml b/app/views/projects/pull_requests/_activity.html.haml index 7141c49db..e79b72dd7 100644 --- a/app/views/projects/pull_requests/_activity.html.haml +++ b/app/views/projects/pull_requests/_activity.html.haml @@ -3,26 +3,26 @@ - diff_counter = 0 -merge_activity(@comments, @commits).each do |item| # -if item.is_a? Comment - =render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present? + =render 'projects/git/commits/commits_small', commits: commits_queue if commits_queue.present? -commits_queue.clear -unless item.created_from_commit_hash - = render 'projects/comments/comment', :comment => item, :data => {:project => @project, :commentable => @commentable} + = render 'projects/comments/comment', comment: item, data: {project: @project, commentable: @commentable} -else - - GitPresenters::CommitAsMessagePresenter.present(nil, :comment => item) do |presenter| - = render 'shared/feed_message', :presenter => presenter, :item_no => "-#{item.id}" + - GitPresenters::CommitAsMessagePresenter.present(nil, comment: item) do |presenter| + = render 'shared/feed_message', presenter: presenter, item_no: "-#{item.id}" -elsif item.is_a? Grit::Commit -commits_queue << item -elsif item.is_a? Array - =render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present? + =render 'projects/git/commits/commits_small', commits: commits_queue if commits_queue.present? -commits_queue.clear -unless item[1].first.data[:actual] -exp_id = "expand-comment#{item[1].first.id}" .activity =t '.show_outdated_diff' - %span.data-expander.collapsed{:id => exp_id}   - .hidden{:id => "content-#{exp_id}"} - =render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter + %span.data-expander.collapsed{id: exp_id}   + .hidden{id: "content-#{exp_id}"} + =render 'projects/pull_requests/discussion_comments', item: item, diff_counter: diff_counter -else - =render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter + =render 'projects/pull_requests/discussion_comments', item: item, diff_counter: diff_counter - diff_counter += 1 -=render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present? +=render 'projects/git/commits/commits_small', commits: commits_queue if commits_queue.present? diff --git a/app/views/projects/pull_requests/_diff_commits_tabs.html.haml b/app/views/projects/pull_requests/_diff_commits_tabs.html.haml index 117b84635..6cc922c31 100644 --- a/app/views/projects/pull_requests/_diff_commits_tabs.html.haml +++ b/app/views/projects/pull_requests/_diff_commits_tabs.html.haml @@ -3,13 +3,13 @@ -total_additions = @stats.inject(0) {|sum, n| sum + n.additions} -total_deletions = @stats.inject(0) {|sum, n| sum + n.deletions} %h5= t("layout.projects.diff_show_header", - :files => t("layout.projects.commit_files_count", :count => @stats.count), - :additions => t("layout.projects.commit_additions_count", :count => total_additions), - :deletions => t("layout.projects.commit_deletions_count", :count => total_deletions)) + files: t("layout.projects.commit_files_count", count: @stats.count), + additions: t("layout.projects.commit_additions_count", count: total_additions), + deletions: t("layout.projects.commit_deletions_count", count: total_deletions)) .both -begin = render_diff_stats(@stats) - = render :partial => 'pull_diff', :collection => @pull.diff + = render partial: 'pull_diff', collection: @pull.diff - rescue => ex -if ex.try(:message) == 'Grit::Git::GitTimeout' %p= t 'layout.git.repositories.commit_diff_too_big' @@ -17,5 +17,5 @@ -raise ex #commits.tab-pane - if @total_commits > @commits.count - %div= t("projects.pull_requests.is_big", :count => @commits.count) - = render :partial => 'projects/git/commits/commits', :object => @commits + %div= t("projects.pull_requests.is_big", count: @commits.count) + = render partial: 'projects/git/commits/commits', object: @commits diff --git a/app/views/projects/pull_requests/_discussion_comments.html.haml b/app/views/projects/pull_requests/_discussion_comments.html.haml index c35d879d0..d067425e2 100644 --- a/app/views/projects/pull_requests/_discussion_comments.html.haml +++ b/app/views/projects/pull_requests/_discussion_comments.html.haml @@ -5,11 +5,11 @@ -if comment.actual_inline_comment? @pull.diff .r=link_to t("layout.pull_requests.view_full_changes"), "#{project_commentable_path(@project, @commentable)}##{comment_anchor(comment)}", - :class => 'link_to_full_changes' + class: 'link_to_full_changes' -else .r =t'projects.pull_requests.outdated_diff' =image_tag 'x.png' .clear - .diff_data=render_diff(comment.inline_diff, :diff_counter => diff_counter, :comments => item[1], :filepath => comment.data[:path], :diff_prefix => 'discussion') + .diff_data=render_diff(comment.inline_diff, diff_counter: diff_counter, comments: item[1], filepath: comment.data[:path], diff_prefix: 'discussion') diff --git a/app/views/projects/pull_requests/_index_sidebar.html.haml b/app/views/projects/pull_requests/_index_sidebar.html.haml index df07380c7..2dc0b7c73 100644 --- a/app/views/projects/pull_requests/_index_sidebar.html.haml +++ b/app/views/projects/pull_requests/_index_sidebar.html.haml @@ -1,17 +1,17 @@ -content_for :sidebar do - if current_user - =form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do + =form_tag project_pull_requests_path(@project), id: 'filter_issues', method: :get do .bordered %table %tr - %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {id: 'myradio1', class: 'niceRadio', name: 'filter'} %td.width135=t("layout.pull_requests.all") %td.width30.right=@project.issues.joins(:pull_request).not_closed_or_merged.count %tr - %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'} + %td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {id: 'myradio1', class: 'niceRadio', name: 'filter'} %td=t("layout.pull_requests.to_me") - %td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).not_closed_or_merged.count - =form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do + %td.width30.right=@project.issues.joins(:pull_request).where(assignee_id: current_user.id).not_closed_or_merged.count + =form_tag project_pull_requests_path(@project), id: 'filter_pull_requests', method: :get, class: 'ajax_search_form' do .bordered.bpadding20 - search = params[:search_pull_request].present? ? params[:search_pull_request] : t('layout.pull_requests.search') =tracker_search_field(:search_pull_request, search) diff --git a/app/views/projects/pull_requests/_nav_tabs.html.haml b/app/views/projects/pull_requests/_nav_tabs.html.haml index 5d244eb0c..699879a04 100644 --- a/app/views/projects/pull_requests/_nav_tabs.html.haml +++ b/app/views/projects/pull_requests/_nav_tabs.html.haml @@ -1,14 +1,14 @@ %ul.nav.nav-tabs#pull_tabs %li - %a{"data-toggle" => "tab", :href => "#discussion"}=t 'pull_requests.tabs.discussion' + %a{"data-toggle" => "tab", href: "#discussion"}=t 'pull_requests.tabs.discussion' -if @stats %li - %a{"data-toggle" => "tab", :href => "#diff"}="#{t'pull_requests.tabs.diff'} (#{@stats.count})" + %a{"data-toggle" => "tab", href: "#diff"}="#{t'pull_requests.tabs.diff'} (#{@stats.count})" -if @commits %li - commits_message = @commits.count.to_s - commits_message << '+' if @total_commits > @commits.count - %a{"data-toggle" => "tab", :href => "#commits"}="#{t'pull_requests.tabs.commits'} (#{commits_message})" + %a{"data-toggle" => "tab", href: "#commits"}="#{t'pull_requests.tabs.commits'} (#{commits_message})" :javascript $(document).ready(function() { diff --git a/app/views/projects/pull_requests/_pull_diff.html.haml b/app/views/projects/pull_requests/_pull_diff.html.haml index baf8b9ece..440cf4de7 100644 --- a/app/views/projects/pull_requests/_pull_diff.html.haml +++ b/app/views/projects/pull_requests/_pull_diff.html.haml @@ -1,9 +1,9 @@ - commit_id = pull_diff.deleted_file ? @pull.to_commit.id : @pull.from_commit.id .file - %a{:name => "diff-#{pull_diff_counter}"} + %a{name: "diff-#{pull_diff_counter}"} .top .l= h(pull_diff.renamed_file ? "#{pull_diff.a_path.rtruncate 60}=>#{pull_diff.b_path.rtruncate 60}" : pull_diff.b_path.rtruncate(120)) .r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, pull_diff.b_path) .clear -if pull_diff.diff.present? && !(@pull.repo.tree(commit_id) / pull_diff.b_path).binary? - .diff_data=render_diff(pull_diff, :diff_counter => pull_diff_counter, :comments => @comments) + .diff_data=render_diff(pull_diff, diff_counter: pull_diff_counter, comments: @comments) diff --git a/app/views/projects/pull_requests/_ref_select.html.haml b/app/views/projects/pull_requests/_ref_select.html.haml index 8a979ecf8..762d1e5bd 100644 --- a/app/views/projects/pull_requests/_ref_select.html.haml +++ b/app/views/projects/pull_requests/_ref_select.html.haml @@ -1,3 +1,3 @@ -ref="#{kind}_ref" -.l=select_tag ref, ref_selector_options(project, current), :id => ref, :class => 'sel80', :name => "pull_request[#{ref}]" +.l=select_tag ref, ref_selector_options(project, current), id: ref, class: 'sel80', name: "pull_request[#{ref}]" diff --git a/app/views/projects/pull_requests/_status.html.haml b/app/views/projects/pull_requests/_status.html.haml index 84fbeb1d1..265a70fda 100644 --- a/app/views/projects/pull_requests/_status.html.haml +++ b/app/views/projects/pull_requests/_status.html.haml @@ -1,5 +1,5 @@ - if can?(:merge, @pull) - %a.button{:href => '', 'ng-click' => 'merge()', 'ng-show' => "pull.status == 'ready'"} + %a.button{href: '', 'ng-click' => 'merge()', 'ng-show' => "pull.status == 'ready'"} = t 'projects.pull_requests.ready' .both @@ -8,29 +8,29 @@ = t "projects.pull_requests.blocked" .alert{'ng-show' => "pull.status == 'merged'"} = t("projects.pull_requests.merged", - :user => '{{pull.merged_by.uname}}', - :to_ref => show_ref(@pull, 'to'), - :from_ref => show_ref(@pull, 'from'), - :time => '{{merged_at}}').html_safe + user: '{{pull.merged_by.uname}}', + to_ref: show_ref(@pull, 'to'), + from_ref: show_ref(@pull, 'from'), + time: '{{merged_at}}').html_safe .alert{'ng-show' => "pull.status == 'closed'"} = t("projects.pull_requests.closed", - :user => '{{pull.closed_by.uname}}', - :time => '{{closed_at}}') + user: '{{pull.closed_by.uname}}', + time: '{{closed_at}}') .both - if !@pull.cross_pull? && can?(:write, @project) %div{'ng-init' => "getBranch('#{@pull.from_ref}')", 'ng-show' => "pull.status == 'closed' || pull.status == 'merged'"} - %a.button{:href => '', 'ng-click' => 'deleteBranch()', 'ng-show' => "branch && branch.object.sha == pull.from_ref.sha"} + %a.button{href: '', 'ng-click' => 'deleteBranch()', 'ng-show' => "branch && branch.object.sha == pull.from_ref.sha"} = t('layout.projects.delete_branch') - %a.button{:href => '', 'ng-click' => 'restoreBranch()', 'ng-hide' => "branch"} + %a.button{href: '', 'ng-click' => 'restoreBranch()', 'ng-hide' => "branch"} = t('layout.projects.restore_branch') .both -if can? :update, @pull %br - %a.button{:href => '', 'ng-click' => 'reopen()', 'ng-show' => "pull.status == 'closed'"} + %a.button{href: '', 'ng-click' => 'reopen()', 'ng-show' => "pull.status == 'closed'"} = t '.reopen' - %a.button{:href => '', 'ng-click' => 'close()', 'ng-show' => "pull.status == 'ready' || pull.status == 'open' || pull.status == 'blocked'"} + %a.button{href: '', 'ng-click' => 'close()', 'ng-show' => "pull.status == 'ready' || pull.status == 'open' || pull.status == 'blocked'"} = t '.close' \ No newline at end of file diff --git a/app/views/projects/pull_requests/index.html.haml b/app/views/projects/pull_requests/index.html.haml index 5aa20c682..8fddad218 100644 --- a/app/views/projects/pull_requests/index.html.haml +++ b/app/views/projects/pull_requests/index.html.haml @@ -1,6 +1,6 @@ -ar = 'activerecord.attributes.pull_requests' --set_meta_tags :title => [title_object(@project), t('.title')] +-set_meta_tags title: [title_object(@project), t('.title')] -render 'submenu' -render 'index_sidebar' -= render 'projects/issues/issues_table', :issues => @issues_with_pull_request += render 'projects/issues/issues_table', issues: @issues_with_pull_request diff --git a/app/views/projects/pull_requests/new.html.haml b/app/views/projects/pull_requests/new.html.haml index 96f559cec..bfc50f31f 100644 --- a/app/views/projects/pull_requests/new.html.haml +++ b/app/views/projects/pull_requests/new.html.haml @@ -1,6 +1,6 @@ -ar = 'activerecord.attributes.pull_requests' --set_meta_tags :title => [title_object(@project), t('.title')] -= render :partial => 'submenu' +-set_meta_tags title: [title_object(@project), t('.title')] += render partial: 'submenu' %h3.bpadding10=pull_header @pull #repo-wrapper =render 'nav_tabs' @@ -8,38 +8,38 @@ #discussion.tab-pane.active =hidden_field_tag :update_action, new_project_pull_request_path =render 'projects/issues/assigned_popup' - =form_for @pull, :url => (@pull.already? ? new_project_pull_request_path : project_pull_requests_path), :html => {:class => 'well well-large', :method => (@pull.already? ? :get : :post)} do |f| + =form_for @pull, url: (@pull.already? ? new_project_pull_request_path : project_pull_requests_path), html: {class: 'well well-large', method: (@pull.already? ? :get : :post)} do |f| - .leftlist=f.label :from_project, t("#{ar}.from_project"), :class => :label + .leftlist=f.label :from_project, t("#{ar}.from_project"), class: :label %div - .l=text_field_tag :from_project, @pull.from_project.name_with_owner, :readonly => :readonly, :style => 'background-color: #DDD;' - =render 'ref_select', :kind => 'from', :project => @pull.from_project, :current => @pull.from_ref + .l=text_field_tag :from_project, @pull.from_project.name_with_owner, readonly: :readonly, style: 'background-color: #DDD;' + =render 'ref_select', kind: 'from', project: @pull.from_project, current: @pull.from_ref .both - .leftlist=f.label :to_project, t("#{ar}.to_project"), :class => :label + .leftlist=f.label :to_project, t("#{ar}.to_project"), class: :label %div - .l=f.autocomplete_field :to_project, autocomplete_to_project_project_pull_requests_path, :value => @pull.to_project.name_with_owner, :id_element => 'pull_request_to_project_id', :name => 'to_project' - =render 'ref_select', :kind => 'to', :project => @pull.to_project, :current => @pull.to_ref + .l=f.autocomplete_field :to_project, autocomplete_to_project_project_pull_requests_path, value: @pull.to_project.name_with_owner, id_element: 'pull_request_to_project_id', name: 'to_project' + =render 'ref_select', kind: 'to', project: @pull.to_project, current: @pull.to_ref .both .leftlist.big-list - .rightlist=f.submit t('.update'), :class => 'btn btn-primary', :style => @pull.already? ? '' : 'display: none;', :id => 'update_pull', :data => {'disable-with' => t('layout.processing')} + .rightlist=f.submit t('.update'), class: 'btn btn-primary', style: @pull.already? ? '' : 'display: none;', id: 'update_pull', data: {'disable-with' => t('layout.processing')} .both -unless @pull.already? =f.fields_for :issue do |issue| - =render 'projects/issues/title_body', :f => issue, :id => 'new' - .leftlist.big-list=f.label :title, t('activerecord.attributes.issue.status'), :class => :label + =render 'projects/issues/title_body', f: issue, id: 'new' + .leftlist.big-list=f.label :title, t('activerecord.attributes.issue.status'), class: :label .rightlist .flash - %div{:class => @pull.ready? ? 'notice' : 'alert'} + %div{class: @pull.ready? ? 'notice' : 'alert'} =pull_status @pull .both - if can?(:write, @pull.to_project) .leftlist.big-list= t('activerecord.attributes.issue.assignee') + ':' #assigned-container.rightlist - =render 'projects/issues/user_container', :user => @pull.assignee + =render 'projects/issues/user_container', user: @pull.assignee .both .leftlist.big-list .rightlist - =f.submit t('.submit'), :class => 'btn btn-primary', :id => 'create_pull', :data => {'disable-with' => t('layout.processing')} unless @pull.already? + =f.submit t('.submit'), class: 'btn btn-primary', id: 'create_pull', data: {'disable-with' => t('layout.processing')} unless @pull.already? .both =render 'diff_commits_tabs' if !@pull.already? && @stats != nil diff --git a/app/views/projects/pull_requests/show.html.haml b/app/views/projects/pull_requests/show.html.haml index 9e653b0c3..11a8807b0 100644 --- a/app/views/projects/pull_requests/show.html.haml +++ b/app/views/projects/pull_requests/show.html.haml @@ -1,12 +1,12 @@ -ar = 'activerecord.attributes.pull_requests' --set_meta_tags :title => [title_object(@project), t('.title', :name => @pull.title.truncate(40), :user => @pull.user.try(:uname))] -= render :partial => 'submenu' +-set_meta_tags title: [title_object(@project), t('.title', name: @pull.title.truncate(40), user: @pull.user.try(:uname))] += render partial: 'submenu' %div{'ng-controller' => 'PullRequestController', 'ng-init' => "init('#{@project.owner.uname}', '#{@project.name}', '#{@pull.serial_id}')"} %h3.bpadding10 - PullRequest::STATUSES.each do |status| - = pull_status_label status, {'ng-show' => "pull.status == '#{status}'", :style => 'display: none;'} + = pull_status_label status, {'ng-show' => "pull.status == '#{status}'", style: 'display: none;'} = pull_header @pull #repo-wrapper =render 'nav_tabs' @@ -15,7 +15,7 @@ =render 'projects/issues/header' =render 'activity' %br - =render "projects/comments/add", :project => @project, :commentable => @issue if current_user + =render "projects/comments/add", project: @project, commentable: @issue if current_user .pull_status =render 'status' =render 'diff_commits_tabs' unless @pull.already? diff --git a/app/views/projects/shared/_filter_label.html.haml b/app/views/projects/shared/_filter_label.html.haml index 14fa61277..5b919dcf7 100644 --- a/app/views/projects/shared/_filter_label.html.haml +++ b/app/views/projects/shared/_filter_label.html.haml @@ -1,10 +1,10 @@ - extra_classes ||= '' -.div-filter-labels{:id => "label-#{id}", :class => extra_classes, :style => selected ? "background-color:##{color};color:#FFF" : ''} +.div-filter-labels{id: "label-#{id}", class: extra_classes, style: selected ? "background-color:##{color};color:#FFF" : ''} .div-label-left .label - .flag{:id => "flag-#{id}", :style => "background-color: ##{color};"} + .flag{id: "flag-#{id}", style: "background-color: ##{color};"} .labeltext=name - =check_box_tag "#{check_box_name}[]", check_box_value, selected, :style => 'display:none' + =check_box_tag "#{check_box_name}[]", check_box_value, selected, style: 'display:none' .both .div-label-right=count .both diff --git a/app/views/projects/wiki/_compare.html.haml b/app/views/projects/wiki/_compare.html.haml index 3496a8f33..c4fbb40cb 100644 --- a/app/views/projects/wiki/_compare.html.haml +++ b/app/views/projects/wiki/_compare.html.haml @@ -1,14 +1,14 @@ - revert_button = capture do - = link_to t("wiki.revert_page#{action_name == 'revert' ? '' : 's'}"), '#', :class => "gollum-revert-button button width100" + = link_to t("wiki.revert_page#{action_name == 'revert' ? '' : 's'}"), '#', class: "gollum-revert-button button width100" - if action_name != 'revert' - = form_tag revert_path(@project, @versions.first[0..6], (@versions.size == 1) ? 'prev' : @versions.last[0..6], @name), :name => "gollum-revert", :id => "gollum-revert-form" do + = form_tag revert_path(@project, @versions.first[0..6], (@versions.size == 1) ? 'prev' : @versions.last[0..6], @name), name: "gollum-revert", id: "gollum-revert-form" do = revert_button if can? :write, @project %br %br - = render :partial => 'diff_data', :collection => @diffs, :as => :diff + = render partial: 'diff_data', collection: @diffs, as: :diff .spacer %br diff --git a/app/views/projects/wiki/_diff_data.html.haml b/app/views/projects/wiki/_diff_data.html.haml index 952b6ea45..468b47a3c 100644 --- a/app/views/projects/wiki/_diff_data.html.haml +++ b/app/views/projects/wiki/_diff_data.html.haml @@ -1,7 +1,7 @@ .file - %a{:name => "diff-#{diff_counter}"} + %a{name: "diff-#{diff_counter}"} .top .l= h((diff.deleted_file ? diff.a_path : diff.b_path).rtruncate 100) .clear - .diff_data.highlight= render_diff(diff, :diff_counter => diff_counter, :in_wiki => true) + .diff_data.highlight= render_diff(diff, diff_counter: diff_counter, in_wiki: true) diff --git a/app/views/projects/wiki/_editor.html.haml b/app/views/projects/wiki/_editor.html.haml index 1869eaf58..ec8c818b2 100644 --- a/app/views/projects/wiki/_editor.html.haml +++ b/app/views/projects/wiki/_editor.html.haml @@ -1,43 +1,37 @@ -#gollum-editor{:class => "#{@new ? 'create' : 'edit'}", :'data-escaped-name' => escaped_name} - = form_tag editor_path(@project, @name), :name => 'gollum-editor', :method => @new ? :post : :put do +#gollum-editor{class: "#{@new ? 'create' : 'edit'}", :'data-escaped-name' => escaped_name} + = form_tag editor_path(@project, @name), name: 'gollum-editor', method: @new ? :post : :put do %fieldset#gollum-editor-fields - if @new #gollum-editor-title-field.singleline - = label_tag :page, t("wiki.page_title"), :class => 'jaws' - = text_field_tag :page, @name, :id => "gollum-editor-page-title" + = label_tag :page, t("wiki.page_title"), class: 'jaws' + = text_field_tag :page, @name, id: "gollum-editor-page-title" - else - = hidden_field_tag :page, @name, :id => "gollum-editor-page-title" + = hidden_field_tag :page, @name, id: "gollum-editor-page-title" = render 'editor_toolbar' - = text_area_tag :content, @content, :id => "gollum-editor-body", :'data-markup-lang' => format + = text_area_tag :content, @content, id: "gollum-editor-body", :'data-markup-lang' => format - if has_footer? #gollum-editor-edit-footer.collapsed - = link_to "#", :class => "button" do + = link_to "#", class: "button" do %span= t("wiki.expand_collapse") %h4= t("wiki.footer") = text_area_tag :footer, footer.text_data - if has_sidebar? #gollum-editor-edit-sidebar.collapsed - = link_to "#", :class => "button" do + = link_to "#", class: "button" do %span= t("wiki.expand_collapse") %h4= t("wiki.sidebar") = text_area_tag :sidebar, sidebar.text_data #gollum-editor-edit-summary.singleline - = label_tag :message, t("wiki.edit_commit_message"), :class => "jaws" - = text_field_tag :message, t("wiki.commit_message_placeholder"), :id => "gollum-editor-message-field" + = label_tag :message, t("wiki.edit_commit_message"), class: "jaws" + = text_field_tag :message, t("wiki.commit_message_placeholder"), id: "gollum-editor-message-field" %span.jaws %br - = submit_tag t('wiki.save_button'), :id => 'gollum-editor-submit', :title => t('wiki.save_changes'), :data => {'disable-with' => t('layout.saving')} - = link_to t("wiki.preview"), "javascript:void(0)", :id => "gollum-editor-preview", :class => "minibutton", :title => t("wiki.preview_title"), :'data-url' => preview_project_wiki_index_path(@project) - -/ - content_for :javascripts do -/ = javascript_include_tag 'gollum/editor/gollum.editor.js' -/ -/ - content_for :stylesheets do -/ = stylesheet_link_tag 'gollum/editor.css' + = submit_tag t('wiki.save_button'), id: 'gollum-editor-submit', title: t('wiki.save_changes'), data: {'disable-with' => t('layout.saving')} + = link_to t("wiki.preview"), "javascript:void(0)", id: "gollum-editor-preview", class: "minibutton", title: t("wiki.preview_title"), :'data-url' => preview_project_wiki_index_path(@project) diff --git a/app/views/projects/wiki/_editor_toolbar.html.haml b/app/views/projects/wiki/_editor_toolbar.html.haml index f3d60d8d8..48ba6d1d1 100644 --- a/app/views/projects/wiki/_editor_toolbar.html.haml +++ b/app/views/projects/wiki/_editor_toolbar.html.haml @@ -1,51 +1,51 @@ #gollum-editor-function-bar #gollum-editor-function-buttons - = link_to "#", :id => "function-bold", :class => "function-button", :title => t("wiki.editor.bold") do + = link_to "#", id: "function-bold", class: "function-button", title: t("wiki.editor.bold") do %span= t("wiki.editor.bold") - = link_to "#", :id => "function-italic", :class => "function-button", :title => t("wiki.editor.italic") do + = link_to "#", id: "function-italic", class: "function-button", title: t("wiki.editor.italic") do %span= t("wiki.editor.italic") - = link_to "#", :id => "function-code", :class => "function-button", :title => t("wiki.editor.code") do + = link_to "#", id: "function-code", class: "function-button", title: t("wiki.editor.code") do %span= t("wiki.editor.code") %span.function-divider   - = link_to "#", :id => "function-ul", :class => "function-button", :title => t("wiki.editor.unordered_list") do + = link_to "#", id: "function-ul", class: "function-button", title: t("wiki.editor.unordered_list") do %span= t("wiki.editor.unordered_list") - = link_to "#", :id => "function-ol", :class => "function-button", :title => t("wiki.editor.ordered_list") do + = link_to "#", id: "function-ol", class: "function-button", title: t("wiki.editor.ordered_list") do %span= t("wiki.editor.ordered_list") - = link_to "#", :id => "function-blockquote", :class => "function-button", :title => t("wiki.editor.blockquote") do + = link_to "#", id: "function-blockquote", class: "function-button", title: t("wiki.editor.blockquote") do %span= t("wiki.editor.blockquote") - = link_to "#", :id => "function-hr", :class => "function-button", :title => t("wiki.editor.horizontal_rule") do + = link_to "#", id: "function-hr", class: "function-button", title: t("wiki.editor.horizontal_rule") do %span= t("wiki.editor.horizontal_rule") %span.function-divider   - = link_to "#", :id => "function-h1", :class => "function-button", :title => t("wiki.editor.h1") do + = link_to "#", id: "function-h1", class: "function-button", title: t("wiki.editor.h1") do %span= t("wiki.editor.h1") - = link_to "#", :id => "function-h2", :class => "function-button", :title => t("wiki.editor.h2") do + = link_to "#", id: "function-h2", class: "function-button", title: t("wiki.editor.h2") do %span= t("wiki.editor.h2") - = link_to "#", :id => "function-h3", :class => "function-button", :title => t("wiki.editor.h3") do + = link_to "#", id: "function-h3", class: "function-button", title: t("wiki.editor.h3") do %span= t("wiki.editor.h3") %span.function-divider   - = link_to "#", :id => "function-link", :class => "function-button", :title => t("wiki.editor.link") do + = link_to "#", id: "function-link", class: "function-button", title: t("wiki.editor.link") do %span= t("wiki.editor.link") - = link_to "#", :id => "function-image", :class => "function-button", :title => t("wiki.editor.image") do + = link_to "#", id: "function-image", class: "function-button", title: t("wiki.editor.image") do %span= t("wiki.editor.image") %span.function-divider   - = link_to "#", :id => "function-help", :class => "function-button", :title => t("wiki.editor.help") do + = link_to "#", id: "function-help", class: "function-button", title: t("wiki.editor.help") do %span= t("wiki.editor.help") #gollum-editor-format-selector - = select_tag :format, options_for_select(wiki_formats, format), :id => "wiki_format" + = select_tag :format, options_for_select(wiki_formats, format), id: "wiki_format" = label_tag :format, t("wiki.editor.format") #gollum-editor-help.jaws %ul#gollum-editor-help-parent - %li= link_to "help_1", "javascript:void(0);", :class => "selected" + %li= link_to "help_1", "javascript:void(0);", class: "selected" %li= link_to "help_1", "javascript:void(0);" %li= link_to "help_1", "javascript:void(0);" %ul#gollum-editor-help-list diff --git a/app/views/projects/wiki/_git_access.html.haml b/app/views/projects/wiki/_git_access.html.haml index fa0e5fbcb..412711528 100644 --- a/app/views/projects/wiki/_git_access.html.haml +++ b/app/views/projects/wiki/_git_access.html.haml @@ -1,6 +1,6 @@ .name = link_to t("wiki.clones.http"), git_repo_url(@project.wiki_repo_name), :'data-permissions' => (can? :write, @project) ? 'Read+Write' : 'Read' - #url-field{:style => 'display: inline'} + #url-field{style: 'display: inline'} .role :javascript diff --git a/app/views/projects/wiki/_history.html.haml b/app/views/projects/wiki/_history.html.haml index 6b7c91127..e518bfd96 100644 --- a/app/views/projects/wiki/_history.html.haml +++ b/app/views/projects/wiki/_history.html.haml @@ -1,25 +1,25 @@ -= form_tag compare_path(@project, @name), :name => "compare-versions", :id => "version-form" do - %table.wiki{:cellpadding => "0", :cellspacing => "0"} += form_tag compare_path(@project, @name), name: "compare-versions", id: "version-form" do + %table.wiki{cellpadding: "0", cellspacing: "0"} - @versions.each do |v| %tr.history %td.td1 - %span#niceCheckbox1.niceCheck-main{:onclick => "changeCheck(this)"} - / = check_box_tag "versions[]", v.id, :html => {:class => 'history_cbx'} - %input{:type => 'checkbox', :id => 'versions_', :name => 'versions[]', :value => v.id, :class => 'history_cbx'} + %span#niceCheckbox1.niceCheck-main{onclick: "changeCheck(this)"} + / = check_box_tag "versions[]", v.id, html: {class: 'history_cbx'} + %input{type: 'checkbox', id: 'versions_', name: 'versions[]', value: v.id, class: 'history_cbx'} %td.td2 - - user = User.where(:email => v.author.email).first + - user = User.where(email: v.author.email).first .avatar = link_to user_path_by_user(user) do - = image_tag avatar_url_by_email(v.author.email), :alt => "avatar: #{v.author.name}", :class => 'mini-gravatar' + = 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.fullname : v.author.name .both %td.td3 - = datetime_moment v.committed_date, :tag => :span, :class => 'wiki-gray' + = datetime_moment v.committed_date, tag: :span, class: 'wiki-gray' = v.message - if @name - = raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), :title => t("wiki.view_commit")}]" + = raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), title: t("wiki.view_commit")}]" - else = "[#{v.id[0..6]}]" diff --git a/app/views/projects/wiki/_navigation.html.haml b/app/views/projects/wiki/_navigation.html.haml index aa2d542a0..fa9cbb046 100644 --- a/app/views/projects/wiki/_navigation.html.haml +++ b/app/views/projects/wiki/_navigation.html.haml @@ -3,11 +3,11 @@ .left= @project.name %nav %ul - %li{:class => ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''} + %li{class: ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''} = link_to t("wiki.home"), project_wiki_index_path(@project) - %li{:class => (act == :pages) ? 'active' : ''} + %li{class: (act == :pages) ? 'active' : ''} = link_to t("wiki.pages"), pages_project_wiki_index_path(@project) - %li{:class => (act == :wiki_history or act == :compare_wiki) ? 'active' : ''} + %li{class: (act == :wiki_history or act == :compare_wiki) ? 'active' : ''} = link_to t("wiki.wiki_history"), history_project_wiki_index_path(@project) - %li{:class => (act == :git) ? 'active' : ''} + %li{class: (act == :git) ? 'active' : ''} = link_to t("wiki.git_access"), git_project_wiki_index_path(@project) \ No newline at end of file diff --git a/app/views/projects/wiki/_page.html.haml b/app/views/projects/wiki/_page.html.haml index e759c99ff..e1e8432c0 100644 --- a/app/views/projects/wiki/_page.html.haml +++ b/app/views/projects/wiki/_page.html.haml @@ -1,19 +1,19 @@ #wiki-content - .wrap{:class => "#{has_footer? ? 'has-footer' : ''} #{has_sidebar? ? 'has-rightbar' : ''}"} - #wiki-body{:class => "gollum-#{format}-content"} + .wrap{class: "#{has_footer? ? 'has-footer' : ''} #{has_sidebar? ? 'has-rightbar' : ''}"} + #wiki-body{class: "gollum-#{format}-content"} #template= raw @content - if has_sidebar? - #wiki-rightbar{:class => "gollum-#{sidebar_format}-content"}= raw sidebar_content + #wiki-rightbar{class: "gollum-#{sidebar_format}-content"}= raw sidebar_content - if has_footer? - #wiki-footer{:class => "gollum-#{footer_format}-content"} + #wiki-footer{class: "gollum-#{footer_format}-content"} #footer-content= raw footer_content .both #gollum-footer %p#last-edit = t("wiki.last_edited_by") - %b= user_link_by_user User.where(:email => author_email).first - = datetime_moment date, :tag => :span + %b= user_link_by_user User.where(email: author_email).first + = datetime_moment date, tag: :span - unless action_name == 'preview' or cannot? :write, @project %p#delete-link - = link_to project_wiki_path(@project, escaped_name), :method => :delete, :confirm => t("layout.confirm") do + = link_to project_wiki_path(@project, escaped_name), method: :delete, confirm: t("layout.confirm") do %span= t("wiki.delete_page") \ No newline at end of file diff --git a/app/views/projects/wiki/_results.html.haml b/app/views/projects/wiki/_results.html.haml index 9cd93b013..8d399640a 100644 --- a/app/views/projects/wiki/_results.html.haml +++ b/app/views/projects/wiki/_results.html.haml @@ -12,10 +12,6 @@ - @st_ref = capture do %strong= @ref || @query - if action_name == 'search' - = raw t("wiki.no_results_for_search", :query => @st_ref) + = raw t("wiki.no_results_for_search", query: @st_ref) - else - = raw t("wiki.no_pages_in", :ref => @st_ref) - -/ #footer -/ %ul.actions -/ %li.minibutton= link_to t("wiki.back_to_top"), '#wiki' \ No newline at end of file + = raw t("wiki.no_pages_in", ref: @st_ref) diff --git a/app/views/projects/wiki/_searchbar.html.haml b/app/views/projects/wiki/_searchbar.html.haml index 8ba3d22a1..71085d943 100644 --- a/app/views/projects/wiki/_searchbar.html.haml +++ b/app/views/projects/wiki/_searchbar.html.haml @@ -1,7 +1,7 @@ #gollum-searchbar - = form_tag search_project_wiki_index_path(@project), :method => :get, :id => "gollum-search-form" do + = form_tag search_project_wiki_index_path(@project), method: :get, id: "gollum-search-form" do #gollum-searchbar-fauxtext - = text_field_tag :q, t("wiki.search_and_hellip"), :id => "search-query", :autocomplete => "on" - = link_to "#", :id => "search-submit", :title => t("wiki.search_popup") do + = text_field_tag :q, t("wiki.search_and_hellip"), id: "search-query", autocomplete: "on" + = link_to "#", id: "search-submit", title: t("wiki.search_popup") do %span= t("wiki.search") .both diff --git a/app/views/projects/wiki/_sidebar.html.haml b/app/views/projects/wiki/_sidebar.html.haml index b8768c8b3..9284e635f 100644 --- a/app/views/projects/wiki/_sidebar.html.haml +++ b/app/views/projects/wiki/_sidebar.html.haml @@ -2,13 +2,13 @@ %aside .admin-preferences %ul - %li{:class => ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''} + %li{class: ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''} = link_to t("wiki.home"), project_wiki_index_path(@project) - %li{:class => (act == :pages) ? 'active' : ''} + %li{class: (act == :pages) ? 'active' : ''} = link_to t("wiki.pages"), pages_project_wiki_index_path(@project) - %li{:class => (act == :wiki_history or act == :compare_wiki) ? 'active' : ''} + %li{class: (act == :wiki_history or act == :compare_wiki) ? 'active' : ''} = link_to t("wiki.wiki_history"), history_project_wiki_index_path(@project) - %li{:class => (act == :git) ? 'active' : ''} + %li{class: (act == :git) ? 'active' : ''} = link_to t("wiki.git_access"), git_project_wiki_index_path(@project) %br = render 'searchbar' \ No newline at end of file diff --git a/app/views/projects/wiki/compare.html.haml b/app/views/projects/wiki/compare.html.haml index 7ca80e462..b4f14d8e8 100644 --- a/app/views/projects/wiki/compare.html.haml +++ b/app/views/projects/wiki/compare.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@project), t('.title')] +-set_meta_tags title: [title_object(@project), t('.title')] = render 'gollum_includes' / = render 'project_short' = render 'submenu' @@ -15,7 +15,7 @@ .r - if can? :read, @project - = link_to t("wiki.back_to_history"), @name ? history_project_wiki_path(@project, escaped_name) : history_project_wiki_index_path(@project), :class => 'button width100' + = link_to t("wiki.back_to_history"), @name ? history_project_wiki_path(@project, escaped_name) : history_project_wiki_index_path(@project), class: 'button width100' #wiki-content= render "compare" diff --git a/app/views/projects/wiki/edit.html.haml b/app/views/projects/wiki/edit.html.haml index a82ee519a..0d91b949d 100644 --- a/app/views/projects/wiki/edit.html.haml +++ b/app/views/projects/wiki/edit.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@project), "#{t('wiki.editing_page')} #{@page.name}"] +-set_meta_tags title: [title_object(@project), "#{t('wiki.editing_page')} #{@page.name}"] = render 'gollum_includes' / = render 'project_short' = render 'submenu' @@ -7,8 +7,8 @@ = t("wiki.editing_page") %strong= @page.name - if can? :read, @project - .r= link_to t("wiki.view_page"), view_path(@project, escaped_name), :class => 'action-view-page button' - .r= link_to t("wiki.page_history"), history_project_wiki_path(@project, escaped_name), :class => 'aciton-view-history button' + .r= link_to t("wiki.view_page"), view_path(@project, escaped_name), class: 'action-view-page button' + .r= link_to t("wiki.page_history"), history_project_wiki_path(@project, escaped_name), class: 'aciton-view-history button' .both #wiki-content= render "editor" diff --git a/app/views/projects/wiki/git.html.haml b/app/views/projects/wiki/git.html.haml index 2cfc33ad2..00e90f2c3 100644 --- a/app/views/projects/wiki/git.html.haml +++ b/app/views/projects/wiki/git.html.haml @@ -1,4 +1,4 @@ --set_meta_tags :title => [title_object(@project), t('wiki.git_access')] +-set_meta_tags title: [title_object(@project), t('wiki.git_access')] / = render 'gollum_includes' / = render 'project_short' = render 'submenu' diff --git a/app/views/projects/wiki/history.html.haml b/app/views/projects/wiki/history.html.haml index 25e517594..45416fd58 100644 --- a/app/views/projects/wiki/history.html.haml +++ b/app/views/projects/wiki/history.html.haml @@ -1,9 +1,8 @@ --set_meta_tags :title => [title_object(@project), t('wiki.wiki_history')] -/ = render 'gollum_includes' -/ = render 'project_short' +-set_meta_tags title: [title_object(@project), t('wiki.wiki_history')] + = render 'submenu' -.r= link_to t("wiki.compare_revisions"), "javascript:void(0);", :class => "action-compare-revision button width100" +.r= link_to t("wiki.compare_revisions"), "javascript:void(0);", class: "action-compare-revision button width100" .both = render 'history' .both diff --git a/app/views/projects/wiki/pages.html.haml b/app/views/projects/wiki/pages.html.haml index fff37180c..c9a34910c 100644 --- a/app/views/projects/wiki/pages.html.haml +++ b/app/views/projects/wiki/pages.html.haml @@ -1,10 +1,9 @@ --set_meta_tags :title => [title_object(@project), t('wiki.pages')] -/ = render 'gollum_includes' -/ = render 'project_short' +-set_meta_tags title: [title_object(@project), t('wiki.pages')] + = render 'submenu' - if can? :write, @project - .r= link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), :id => 'minibutton-new-page', :class => 'button width100' + .r= link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), id: 'minibutton-new-page', class: 'button width100' .both = render "results" diff --git a/app/views/projects/wiki/search.html.haml b/app/views/projects/wiki/search.html.haml index 8a34a77ee..e04929948 100644 --- a/app/views/projects/wiki/search.html.haml +++ b/app/views/projects/wiki/search.html.haml @@ -1,14 +1,13 @@ --set_meta_tags :title => [title_object(@project), @query, t('wiki.searching.title')] -/ = render 'gollum_includes' -/ = render 'project_short' +-set_meta_tags title: [title_object(@project), @query, t('wiki.searching.title')] + = render 'submenu' - @st_query = capture do %strong= @query -%h1.title= raw t("wiki.search_results_for", :query => @st_query) +%h1.title= raw t("wiki.search_results_for", query: @st_query) %ul.actions - if can? :read, @project - %li.minibutton= link_to t("wiki.home"), project_wiki_index_path(@project), :class => 'action-edit-page' + %li.minibutton= link_to t("wiki.home"), project_wiki_index_path(@project), class: 'action-edit-page' = render "results" diff --git a/app/views/projects/wiki/show.html.haml b/app/views/projects/wiki/show.html.haml index cff28ba8d..8ace7e971 100644 --- a/app/views/projects/wiki/show.html.haml +++ b/app/views/projects/wiki/show.html.haml @@ -1,6 +1,5 @@ --set_meta_tags :title => [title_object(@project), @page.name] -/ = render 'gollum_includes' -/ = render 'project_short' +-set_meta_tags title: [title_object(@project), @page.name] + = render 'submenu' .left %h3 @@ -8,13 +7,13 @@ = "(#{t("wiki.preview")})" if action_name == 'preview' - unless action_name == 'preview' .r - = link_to t("wiki.page_history"), history_project_wiki_path(@project, escaped_name), :class => 'button' + = link_to t("wiki.page_history"), history_project_wiki_path(@project, escaped_name), class: 'button' .r - if @editable - = link_to t("wiki.edit_page"), edit_project_wiki_path(@project, escaped_name), :class => 'button' + = link_to t("wiki.edit_page"), edit_project_wiki_path(@project, escaped_name), class: 'button' .r - if can? :write, @project - = link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), :id => 'minibutton-new-page', :class => 'button' + = link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), id: 'minibutton-new-page', class: 'button' .both / = render 'searchbar' = render "page" diff --git a/app/views/search/_form.html.haml b/app/views/search/_form.html.haml index eb315bc85..fad76ff29 100644 --- a/app/views/search/_form.html.haml +++ b/app/views/search/_form.html.haml @@ -1,4 +1,4 @@ .search - = form_tag search_index_path, :method => 'get' do + = form_tag search_index_path, method: 'get' do .pic - .field= text_field_tag 'query', @query, :placeholder => t("layout.search.header") \ No newline at end of file + .field= text_field_tag 'query', @query, placeholder: t("layout.search.header") \ No newline at end of file diff --git a/app/views/search/_form_advanced.html.haml b/app/views/search/_form_advanced.html.haml index 7615e109e..8951f0cfc 100644 --- a/app/views/search/_form_advanced.html.haml +++ b/app/views/search/_form_advanced.html.haml @@ -1,5 +1,5 @@ -= form_tag search_index_path, :method => 'get' do - .leftside= text_field_tag 'query', @query, :placeholder => t("layout.search.header"), :class => 'exsearch' - .lineForm.leftside.rmargin10= select_tag 'type', options_for_select(t('layout.search.types').invert, @type), :class => 'sel80 cusel', :id => 'selSearch' - .leftside= submit_tag t('layout.search.header'), :class => 'button width100', :data => {'disable-with' => t('layout.processing')} += form_tag search_index_path, method: 'get' do + .leftside= text_field_tag 'query', @query, placeholder: t("layout.search.header"), class: 'exsearch' + .lineForm.leftside.rmargin10= select_tag 'type', options_for_select(t('layout.search.types').invert, @type), class: 'sel80 cusel', id: 'selSearch' + .leftside= submit_tag t('layout.search.header'), class: 'button width100', data: {'disable-with' => t('layout.processing')} .both \ No newline at end of file diff --git a/app/views/search/_table.html.haml b/app/views/search/_table.html.haml index 048bc6209..90197f916 100644 --- a/app/views/search/_table.html.haml +++ b/app/views/search/_table.html.haml @@ -1,5 +1,5 @@ - collection = instance_variable_get("@#{type}") -%table.tablesorter.bmargin5{:cellpadding => "0", :cellspacing => "0"} +%table.tablesorter.bmargin5{cellpadding: "0", cellspacing: "0"} %thead %tr %th #{t "layout.#{type}.list_header"} (#{collection.count}) @@ -7,4 +7,4 @@ - collection.each do |c| %tr %td= render type.singularize, type.singularize.to_sym => c -= link_to t('layout.search.all'), search_index_path(:query => @query, :type => type) if collection.present? \ No newline at end of file += link_to t('layout.search.all'), search_index_path(query: @query, type: type) if collection.present? \ No newline at end of file diff --git a/app/views/search/index.html.haml b/app/views/search/index.html.haml index bec080a11..74e4b3cb3 100644 --- a/app/views/search/index.html.haml +++ b/app/views/search/index.html.haml @@ -2,16 +2,16 @@ = render 'form_advanced' - if @type == 'all' #all - = render 'table', :type => 'projects' + = render 'table', type: 'projects' .both .left.width400.rmargin55 - = render 'table', :type => 'users' - = render 'table', :type => 'groups' + = render 'table', type: 'users' + = render 'table', type: 'groups' .left.width400 - = render 'table', :type => 'platforms' + = render 'table', type: 'platforms' - else - collection = instance_variable_get("@#{@type}") - .tmargin10{:id => @type}= render :collection => collection, :partial => @type.to_s.underscore.singularize + .tmargin10{id: @type}= render collection: collection, partial: @type.to_s.underscore.singularize %br = will_paginate collection .both diff --git a/app/views/shared/_angularjs_will_paginate.html.haml b/app/views/shared/_angularjs_will_paginate.html.haml index d2193cce9..7abd8628c 100644 --- a/app/views/shared/_angularjs_will_paginate.html.haml +++ b/app/views/shared/_angularjs_will_paginate.html.haml @@ -1,14 +1,14 @@ #will_paginate{'ng-show' => 'pages'} .pagination %div{'ng-class' => "{'disabled': !page.active}", 'ng-repeat' => 'page in pages', 'ng-switch' => 'page.type'} - %a{'ng-switch-when' => 'previous_page', 'ng-click' => 'goToPage(page.number)', :href => ''} + %a{'ng-switch-when' => 'previous_page', 'ng-click' => 'goToPage(page.number)', href: ''} = t('datatables.previous_label') - %a{'ng-switch-when' => 'first', :href => ''} + %a{'ng-switch-when' => 'first', href: ''} {{page.number}} - %a{'ng-switch-when' => 'page', 'ng-click' => 'goToPage(page.number)', :href => ''} + %a{'ng-switch-when' => 'page', 'ng-click' => 'goToPage(page.number)', href: ''} {{page.number}} - %a{'ng-switch-when' => 'more', 'ng-click' => 'goToPage(page.number)', :href => ''} … - %a{'ng-switch-when' => 'last', 'ng-click' => 'goToPage(page.number)', :href => ''} + %a{'ng-switch-when' => 'more', 'ng-click' => 'goToPage(page.number)', href: ''} … + %a{'ng-switch-when' => 'last', 'ng-click' => 'goToPage(page.number)', href: ''} {{page.number}} - %a{'ng-switch-when' => 'next_page', 'ng-click' => 'goToPage(page.number)', :href => ''} + %a{'ng-switch-when' => 'next_page', 'ng-click' => 'goToPage(page.number)', href: ''} = t('datatables.next_label') \ No newline at end of file diff --git a/app/views/shared/_autocomplete_form.html.haml b/app/views/shared/_autocomplete_form.html.haml index cef3191bc..af98b0ee2 100644 --- a/app/views/shared/_autocomplete_form.html.haml +++ b/app/views/shared/_autocomplete_form.html.haml @@ -9,23 +9,23 @@ - default_values ||= [] - subject_class = subject.class.name.underscore -.autocomplete-form{:subject_class => subject_class, :field => field, :path => autocomplete_path, :class => field} +.autocomplete-form{subject_class: subject_class, field: field, path: autocomplete_path, class: field} %h3= t("activerecord.attributes.build_list.#{field}") %span.icon-question-sign - if !(params[:show] == 'inline' && params[:build_list_id].present?) - .dialog{:title => t("activerecord.attributes.build_list.#{field}"), :id => "#{field}_dialog"} + .dialog{title: t("activerecord.attributes.build_list.#{field}"), id: "#{field}_dialog"} = render "shared/autocomplete_docs/#{field}" .both - = autocomplete_field_tag field, nil, "#{autocomplete_path}?#{{:platform_id => subject.save_to_platform.try(:id)}.to_param}", :placeholder => placeholder, :class => 'autocomplete', :update_elements => {:id => "##{field}_field", :path => "##{field}_field_path", :label => "##{field}_field_label"} - = hidden_field_tag field, nil, :id => "#{field}_field" - = hidden_field_tag field, nil, :id => "#{field}_field_path" - = hidden_field_tag field, nil, :id => "#{field}_field_label" - = submit_tag t('layout.add'), :class => 'button add' + = autocomplete_field_tag field, nil, "#{autocomplete_path}?#{{platform_id: subject.save_to_platform.try(:id)}.to_param}", placeholder: placeholder, class: 'autocomplete', update_elements: {id: "##{field}_field", path: "##{field}_field_path", label: "##{field}_field_label"} + = hidden_field_tag field, nil, id: "#{field}_field" + = hidden_field_tag field, nil, id: "#{field}_field_path" + = hidden_field_tag field, nil, id: "#{field}_field_label" + = submit_tag t('layout.add'), class: 'button add' - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %tbody - field_name = "#{subject_class}[#{field}][]" - - field_class.where(:id => params[:build_list].try(:[], field) ).each do |extra| + - field_class.where(id: params[:build_list].try(:[], field) ).each do |extra| %tr - if extra.is_a?(BuildList) %td= link_to "#{extra.id} (#{extra.project.name} - #{extra.arch.name})", extra @@ -36,9 +36,9 @@ = hidden_field_tag field_name, extra.id %span.delete   .default-values - - field_class.where(:id => default_values).each do |extra| + - field_class.where(id: default_values).each do |extra| .hidden{:label => "#{extra.platform.name}/#{extra.name}", :path => url_for([extra.platform, extra]), - :name => field_name, :value => extra.id} + :name => field_name, value: extra.id} diff --git a/app/views/shared/_avatar_form.html.haml b/app/views/shared/_avatar_form.html.haml index 9729a6b9b..5831c0230 100644 --- a/app/views/shared/_avatar_form.html.haml +++ b/app/views/shared/_avatar_form.html.haml @@ -1,9 +1,9 @@ -.leftlist= f.label :avatar, t("layout.avatars.avatar_with_size", :max => number_to_human_size(Avatar::MAX_AVATAR_SIZE)) +.leftlist= f.label :avatar, t("layout.avatars.avatar_with_size", max: number_to_human_size(Avatar::MAX_AVATAR_SIZE)) .rightlist= image_tag(avatar_url(subject, :medium)) .leftlist .rightlist .check - %span#niceCheckbox1.niceCheck-main= check_box_tag "delete_avatar", 1, false, :class => 'niceCheckbox1' + %span#niceCheckbox1.niceCheck-main= check_box_tag "delete_avatar", 1, false, class: 'niceCheckbox1' .forcheck= t('layout.avatars.delete_avatar') .both = f.file_field :avatar diff --git a/app/views/shared/_build_results.html.haml b/app/views/shared/_build_results.html.haml index 7d68edc0d..6d859dc9b 100644 --- a/app/views/shared/_build_results.html.haml +++ b/app/views/shared/_build_results.html.haml @@ -1,6 +1,6 @@ %h3= subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results') %h4.nomargin{'ng-hide' => 'subject.results'}= t('layout.no_') -%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0", 'ng-show' => 'subject.results'} +%table.tablesorter.width565{cellpadding: "0", cellspacing: "0", 'ng-show' => 'subject.results'} %thead %tr %th= t("activerecord.attributes.product_build_list/results.file_name") diff --git a/app/views/shared/_feed_message.html.haml b/app/views/shared/_feed_message.html.haml index c498b07a2..2d14d40fe 100644 --- a/app/views/shared/_feed_message.html.haml +++ b/app/views/shared/_feed_message.html.haml @@ -1,28 +1,28 @@ -if !presenter.is_reference_to_issue || can?(:show, presenter.reference_project) - .activity{:id => presenter.comment_id? ? presenter.comment_anchor : ''} + .activity{id: presenter.comment_id? ? presenter.comment_anchor : ''} .top - if presenter.buttons? %span.buttons= raw presenter.buttons.join(' | ').html_safe .image - %img{:alt => "avatar", :src => presenter.image} + %img{alt: "avatar", src: presenter.image} .text -#.imaged move up a line. %span.name= presenter.header .both - = datetime_moment presenter.date, :tag => :span, :class => :date + = datetime_moment presenter.date, tag: :span, class: :date .both - if presenter.caption? %span.subject= presenter.caption - if presenter.expandable? and presenter.content? - %span.data-expander.collapsed{:id => "expand#{item_no}"}   + %span.data-expander.collapsed{id: "expand#{item_no}"}   .both .both - if presenter.content? %div =presenter.issue_referenced_state if presenter.issue_referenced_state? - .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'} + .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) .both diff --git a/app/views/shared/_log.html.haml b/app/views/shared/_log.html.haml index 30bc027ec..fcd3bf514 100644 --- a/app/views/shared/_log.html.haml +++ b/app/views/shared/_log.html.haml @@ -7,11 +7,11 @@ - download_log_url ||= false .hr -%a{:name => 'log'} +%a{name: 'log'} .log-wrapper .log-header .text-wrap - = link_to({:anchor => :log}, {:id => 'log_anchor'}) do + = link_to({anchor: :log}, {id: 'log_anchor'}) do %h3= t("layout.build_lists.log.build_log") %span .both @@ -23,15 +23,15 @@ = label_tag :word_wrap do = check_box_tag :word_wrap = t("layout.word_wrap") - %td.last{ :class => build_started ? nil : :hidden } + %td.last{ class: build_started ? nil : :hidden } = label_tag :autoreload do = check_box_tag :autoreload, true, build_started = t("layout.build_lists.log.autoreload") = select_tag :reload_interval, log_reload_time_options .both - #output.cm-s-default.log{ :readonly => :readonly, - :data => { :url => get_log_path, :log_type => :build } } + #output.cm-s-default.log{ readonly: :readonly, + data: { url: get_log_path, log_type: :build } } %pre#code .both .both diff --git a/app/views/shared/_members_table.html.haml b/app/views/shared/_members_table.html.haml index 816287a83..13939a297 100644 --- a/app/views/shared/_members_table.html.haml +++ b/app/views/shared/_members_table.html.haml @@ -1,5 +1,5 @@ -= form_tag remove_members_path, :id => 'members_form', :method => :post do - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} += form_tag remove_members_path, id: 'members_form', method: :post do + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr - if can? :remove_members, editable_object @@ -12,10 +12,10 @@ = t("layout.remove") %tbody - members.each_with_index do |user, num| - %tr{:id => "admin-table-members-row#{num}", :class => cycle(:odd, :even)} + %tr{id: "admin-table-members-row#{num}", class: cycle(:odd, :even)} - if can? :remove_members, editable_object %td - %span.niceCheck-main{:id => "niceCheckbox#{num}", :style => "background-position: 0px 0px; "} + %span.niceCheck-main{id: "niceCheckbox#{num}", style: "background-position: 0px 0px; "} = check_box_tag "user_remove[#{user.id}][]" %td .img @@ -23,17 +23,17 @@ .forimg= link_to user.fullname, user_path(user) - if can? :remove_member, editable_object %td.buttons - = link_to "#{remove_member_path}?member_id=#{user.id}", :method => :delete, :confirm => t("layout.confirm") do + = link_to "#{remove_member_path}?member_id=#{user.id}", method: :delete, confirm: t("layout.confirm") do %span.delete   - if can? :remove_members, editable_object - = submit_tag t("layout.delete"), :class => 'button', :data => {'disable-with' => t('layout.processing')} + = submit_tag t("layout.delete"), class: 'button', data: {'disable-with' => t('layout.processing')} .both - if can? :add_member, editable_object .hr.top = form_tag add_member_path do .admin-search - = autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_autocompletes_path, :id_element => '#member_id_field' - = hidden_field_tag 'member_id', nil, :id => 'member_id_field' - = submit_tag t('layout.add'), :class => 'button', :data => {'disable-with' => t('layout.processing')} + = autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_autocompletes_path, id_element: '#member_id_field' + = hidden_field_tag 'member_id', nil, id: 'member_id_field' + = submit_tag t('layout.add'), class: 'button', data: {'disable-with' => t('layout.processing')} .both diff --git a/app/views/shared/_profile.html.haml b/app/views/shared/_profile.html.haml index 51a229d0d..08ca0d24e 100644 --- a/app/views/shared/_profile.html.haml +++ b/app/views/shared/_profile.html.haml @@ -11,10 +11,10 @@ = hidden_field_tag :profile_path, @profile_path .row .span3.profile - .avatar= image_tag avatar_url(user || group, :big), :alt => (user || group).uname + .avatar= image_tag avatar_url(user || group, :big), alt: (user || group).uname .base_info - %h3{:title => uname}= title short_message(uname, 16) - %p{:title => user.try(:name)} + %h3{title: uname}= title short_message(uname, 16) + %p{title: user.try(:name)} - if user = short_message(user.name, 28) = link_to image_tag('gears.png'), edit_url if edit_url.present? @@ -23,32 +23,32 @@ %p.info.first - message = "#{t 'activerecord.attributes.user.email'}: " = message - = mail_to user.email, short_message(user.email, max_length - message.length), :encode => 'javascript', :title => user.email + = mail_to user.email, short_message(user.email, max_length - message.length), encode: 'javascript', title: user.email %p.info - message = "#{t 'activerecord.attributes.user.site'}: " = message - = link_to short_message(user.site, max_length - message.length), user.site, :title => user.site - %p.info{:title => user.company}= short_message("#{t 'activerecord.attributes.user.company'}: #{user.company}", max_length) - %p.info{:title => user.location}= short_message("#{t 'activerecord.attributes.user.location'}: #{user.location}", max_length) + = link_to short_message(user.site, max_length - message.length), user.site, title: user.site + %p.info{title: user.company}= short_message("#{t 'activerecord.attributes.user.company'}: #{user.company}", max_length) + %p.info{title: user.location}= short_message("#{t 'activerecord.attributes.user.location'}: #{user.location}", max_length) .span6 - %h3{:style => 'margin-top: 0;'}= desc_title + %h3{style: 'margin-top: 0;'}= desc_title = desc -%hr.profile_line{:color => 'dfe8ef', :size => '3'} +%hr.profile_line{color: 'dfe8ef', size: '3'} .row-fluid.profile-content .span12.content %nav %ul %li - = link_to t('layout.projects.list_header'), '#', :class => 'projects active' + = link_to t('layout.projects.list_header'), '#', class: 'projects active' .span12.sub-menu %nav %ul - %li= link_to t('layout.projects.public'), '#', :class => "public-projects #{!@hidden ? 'active' : ''}" - %li= link_to t('layout.projects.private'), '#', :class => "private-projects #{@hidden ? 'active' : ''}" + %li= link_to t('layout.projects.public'), '#', class: "public-projects #{!@hidden ? 'active' : ''}" + %li= link_to t('layout.projects.private'), '#', class: "private-projects #{@hidden ? 'active' : ''}" .search .pic - .field= text_field_tag :query_projects, @query, :placeholder => t('layout.find_project') + .field= text_field_tag :query_projects, @query, placeholder: t('layout.find_project') .both - .profile-table= render 'shared/profile_projects', :projects => projects + .profile-table= render 'shared/profile_projects', projects: projects diff --git a/app/views/shared/_profile_projects.html.haml b/app/views/shared/_profile_projects.html.haml index c832cadab..28fc4a63e 100644 --- a/app/views/shared/_profile_projects.html.haml +++ b/app/views/shared/_profile_projects.html.haml @@ -2,16 +2,16 @@ %table %tbody - pr_groups[0].each_with_index do |project, ind| - %tr{:class => ind.odd? ? 'odd' : 'even'} + %tr{class: ind.odd? ? 'odd' : 'even'} - [project, pr_groups[1][ind]].each do |project| %th - if project.present? - .project-link= link_to short_message(project.name, 60), project, :title => project.name + .project-link= link_to short_message(project.name, 60), project, title: project.name .both .row-fluid - = datetime_moment project.updated_at, :class => :span3 + = datetime_moment project.updated_at, class: :span3 - commits_count = project.total_commits_count .span3= "#{commits_count > 10000 ? '10000+' : commits_count} #{commits_pluralize(commits_count)}" %br -%div{:style => 'margin: 10px;'}= will_paginate projects +%div{style: 'margin: 10px;'}= will_paginate projects diff --git a/app/views/shared/_urpmi_list.html.haml b/app/views/shared/_urpmi_list.html.haml index 085ba0a1b..e4e281b30 100644 --- a/app/views/shared/_urpmi_list.html.haml +++ b/app/views/shared/_urpmi_list.html.haml @@ -1,9 +1,9 @@ .group %span Данные для подключения: - .group{:style => 'padding-left: 10px'} + .group{style: 'padding-left: 10px'} - urpmi_commands.each do |platform, commands| #{platform}: - .group{:style => 'padding-left: 20px'} + .group{style: 'padding-left: 20px'} - commands.each do |command| %span= command %br diff --git a/app/views/user_mailer/_footer.html.haml b/app/views/user_mailer/_footer.html.haml index b4d481d03..9ba884932 100644 --- a/app/views/user_mailer/_footer.html.haml +++ b/app/views/user_mailer/_footer.html.haml @@ -1,7 +1,7 @@ %hr - %p{:style => "font-size:small;color:#666"} + %p{style: "font-size:small;color:#666"} = t("notifications.footers.notifiers") = link_to t("notifications.footers.notification_center"), notifiers_settings_url - %p{:style => "font-size:small;color:#666"} + %p{style: "font-size:small;color:#666"} = t("notifications.footers.support_team") diff --git a/app/views/user_mailer/git_delete_branch_notification.html.haml b/app/views/user_mailer/git_delete_branch_notification.html.haml index 31b46c01f..e9e6faf7f 100644 --- a/app/views/user_mailer/git_delete_branch_notification.html.haml +++ b/app/views/user_mailer/git_delete_branch_notification.html.haml @@ -1,8 +1,8 @@ -- user = User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) +- user = User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) %p - _user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email, true) : nil - = t('notifications.bodies.delete_branch', :branch_name => branch_name, :user_link => _user_link).html_safe - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) + = t('notifications.bodies.delete_branch', branch_name: branch_name, user_link: _user_link).html_safe + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) = render 'footer' \ No newline at end of file diff --git a/app/views/user_mailer/git_new_push_notification.html.haml b/app/views/user_mailer/git_new_push_notification.html.haml index 62d24ec8f..169b86676 100644 --- a/app/views/user_mailer/git_new_push_notification.html.haml +++ b/app/views/user_mailer/git_new_push_notification.html.haml @@ -1,11 +1,9 @@ -- user = User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) - +- user = User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) %p - _user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email, true) : nil - = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => _user_link}) - = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) - + = raw t("notifications.bodies.#{change_type}_branch", {branch_name: branch_name, user_link: _user_link}) + = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) %p - last_commits.each do |commit| @@ -14,7 +12,7 @@ %br - if defined? other_commits %br - =link_to t('notifications.bodies.more_commits', :count => other_commits_count, :commits => commits_pluralize(other_commits_count)), - diff_url(project_owner, project_name, :diff => other_commits) + =link_to t('notifications.bodies.more_commits', count: other_commits_count, commits: commits_pluralize(other_commits_count)), + diff_url(project_owner, project_name, diff: other_commits) = render 'footer' \ No newline at end of file diff --git a/app/views/user_mailer/invite_approve_notification.en.haml b/app/views/user_mailer/invite_approve_notification.en.haml index 31cad87d7..7753b1228 100644 --- a/app/views/user_mailer/invite_approve_notification.en.haml +++ b/app/views/user_mailer/invite_approve_notification.en.haml @@ -2,6 +2,6 @@ %p You have been invited to project ABF. Please click on the following - = link_to 'link for registration', new_user_registration_url(:invitation_token => @register_request.token) + = link_to 'link for registration', new_user_registration_url(invitation_token: @register_request.token) %p== Support team «ROSA ABF» diff --git a/app/views/user_mailer/invite_approve_notification.ru.haml b/app/views/user_mailer/invite_approve_notification.ru.haml index 4b1b0b118..5e1f3dd57 100644 --- a/app/views/user_mailer/invite_approve_notification.ru.haml +++ b/app/views/user_mailer/invite_approve_notification.ru.haml @@ -2,6 +2,6 @@ %p Вы приглашены в проект ABF. Пожалуйста, перейдите по - = link_to 'ссылке для регистрации', new_user_registration_url(:invitation_token => @register_request.token) + = link_to 'ссылке для регистрации', new_user_registration_url(invitation_token: @register_request.token) %p== Команда поддержки «ROSA ABF» diff --git a/app/views/users/base/_form.html.haml b/app/views/users/base/_form.html.haml index c4cccf559..594c859c7 100644 --- a/app/views/users/base/_form.html.haml +++ b/app/views/users/base/_form.html.haml @@ -1,6 +1,6 @@ - if current_user.admin? - .leftlist= f.label :role, t("activerecord.attributes.user.role"), :class => :label - .rightlist= f.select :role, User::ROLES, {}, {:name => 'role'} + .leftlist= f.label :role, t("activerecord.attributes.user.role"), class: :label + .rightlist= f.select :role, User::ROLES, {}, {name: 'role'} - if @user.new_record? .leftlist= f.label :uname, t("activerecord.attributes.user.uname") .rightlist= f.text_field :uname @@ -28,7 +28,7 @@ .leftlist= f.label :location, t("activerecord.attributes.user.location") .rightlist= f.text_field :location .both -= render 'shared/avatar_form', :subject => @user, :f => f += render 'shared/avatar_form', subject: @user, f: f .leftlist= f.label :professional_experience, t("activerecord.attributes.user.professional_experience") .rightlist= f.text_area :professional_experience .both @@ -37,5 +37,5 @@ .both .leftlist \  -.rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} +.rightlist= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} .both diff --git a/app/views/users/base/_sidebar.html.haml b/app/views/users/base/_sidebar.html.haml index 9557e5435..3bb25e6d8 100644 --- a/app/views/users/base/_sidebar.html.haml +++ b/app/views/users/base/_sidebar.html.haml @@ -1,7 +1,7 @@ %aside .admin-preferences %ul - %li{:class => action_name == 'profile' ? 'active' : nil}= link_to t('layout.users.profile'), profile_settings_path - %li{:class => action_name == 'private' ? 'active' : nil}= link_to t('layout.users.user_private_settings'), private_settings_path - %li{:class => action_name == 'notifiers' ? 'active' : nil}= link_to t('layout.users.settings_notifier'), notifiers_settings_path - %li{:class => controller_name == 'ssh_keys' ? 'active' : nil}= link_to t('ssh_keys'), ssh_keys_path \ No newline at end of file + %li{class: action_name == 'profile' ? 'active' : nil}= link_to t('layout.users.profile'), profile_settings_path + %li{class: action_name == 'private' ? 'active' : nil}= link_to t('layout.users.user_private_settings'), private_settings_path + %li{class: action_name == 'notifiers' ? 'active' : nil}= link_to t('layout.users.settings_notifier'), notifiers_settings_path + %li{class: controller_name == 'ssh_keys' ? 'active' : nil}= link_to t('ssh_keys'), ssh_keys_path \ No newline at end of file diff --git a/app/views/users/profile/show.html.haml b/app/views/users/profile/show.html.haml index 914a2d558..7c6db271b 100644 --- a/app/views/users/profile/show.html.haml +++ b/app/views/users/profile/show.html.haml @@ -1,10 +1,10 @@ --set_meta_tags :title => title_object(@user) +-set_meta_tags title: title_object(@user) - edit_url = can?(:edit, @user) ? (current_user == @user ? profile_settings_path : edit_admin_user_path(@user)) : nil -= render 'shared/profile', :uname => @user.uname, - :name => @user.name, - :user => @user, - :search_path => user_path, - :projects => @projects, - :edit_url => edit_url \ No newline at end of file += render 'shared/profile', uname: @user.uname, + name: @user.name, + user: @user, + search_path: user_path, + projects: @projects, + edit_url: edit_url \ No newline at end of file diff --git a/app/views/users/register_requests/invite.html.haml b/app/views/users/register_requests/invite.html.haml index 9a947155f..ef0ef7ac1 100644 --- a/app/views/users/register_requests/invite.html.haml +++ b/app/views/users/register_requests/invite.html.haml @@ -1,13 +1,13 @@ -content_for :nav do %nav -if I18n.locale == :ru - %a{:href => "#{new_register_request_path}.en"} + %a{href: "#{new_register_request_path}.en"} %p English %br>/ version -elsif I18n.locale == :en - %a{:href => "#{new_register_request_path}.ru"} + %a{href: "#{new_register_request_path}.ru"} %p Русская %br>/ @@ -16,29 +16,29 @@ .left %p =raw t 'invites.description' - %div{:style => "clear: both;"} + %div{style: "clear: both;"} .right %h3=t 'invites.want' - %form#new_register_request{"accept-charset" => "UTF-8", :action => "/register_requests", :method => "post", :name => "invite_form"} + %form#new_register_request{"accept-charset" => "UTF-8", action: "/register_requests", method: "post", name: "invite_form"} .signup-left=t 'invites.name' .signup-right - %input#email.registartion-input-signup{:name => "register_request[name]", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input-signup';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value=='#{t 'invites.login_email'}'){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();", :type => "text"}/ - %div{:style => "clear: both;"} + %input#email.registartion-input-signup{name: "register_request[name]", onClick: "this.className='registartion-input-focus';disError(this);", onblur: "if(this.value==''){this.value='';this.className='registartion-input-signup';}else{this.className='registartion-input-no-focus';};buttonCheck();", onfocus: "if(this.value=='#{t 'invites.login_email'}'){this.value='';this.className='registartion-input-focus';};", onkeydown: "buttonCheck();", type: "text"}/ + %div{style: "clear: both;"} .signup-left=t 'invites.email' .signup-right - %input#email.registartion-input-signup{:name => "register_request[email]", :onClick => "this.className='registartion-input-focus';disError(this);", :onblur => "if(this.value==''){this.value='';this.className='registartion-input-signup';}else{this.className='registartion-input-no-focus';};buttonCheck();", :onfocus => "if(this.value=='#{t 'invites.login_email'}'){this.value='';this.className='registartion-input-focus';};", :onkeydown => "buttonCheck();", :type => "text"}/ - %div{:style => "clear: both;"} + %input#email.registartion-input-signup{name: "register_request[email]", onClick: "this.className='registartion-input-focus';disError(this);", onblur: "if(this.value==''){this.value='';this.className='registartion-input-signup';}else{this.className='registartion-input-no-focus';};buttonCheck();", onfocus: "if(this.value=='#{t 'invites.login_email'}'){this.value='';this.className='registartion-input-focus';};", onkeydown: "buttonCheck();", type: "text"}/ + %div{style: "clear: both;"} .signup-left=raw t 'invites.interest' .signup-right - %select.registartion-input-signup{:name => "register_request[interest]"} + %select.registartion-input-signup{name: "register_request[interest]"} -t('invites.interests').each do |base, title| %option=title - %div{:style => "clear: both;"} + %div{style: "clear: both;"} .signup-left=t 'invites.comments' .signup-right - %textarea.registartion-input-signup{:name => "register_request[more]", :rows => "3"} - %div{:style => "clear: both;"} + %textarea.registartion-input-signup{name: "register_request[more]", rows: "3"} + %div{style: "clear: both;"} =hidden_field_tag :format, I18n.locale .button - %input.button{:type => "submit", :value => t('invites.send')} -%div{:style => "clear: both;"} + %input.button{type: "submit", value: t('invites.send')} +%div{style: "clear: both;"} diff --git a/app/views/users/register_requests/new.html.haml b/app/views/users/register_requests/new.html.haml index d69448ed3..c2d385d0b 100644 --- a/app/views/users/register_requests/new.html.haml +++ b/app/views/users/register_requests/new.html.haml @@ -4,16 +4,16 @@ - if flash.present? .flash - flash.each do |key, value| - .message{ :title => key.to_s.humanize, :class => (key == :alert ? "error" : key) } + .message{ title: key.to_s.humanize, class: (key == :alert ? "error" : key) } %p= value - - form_for(@register_request, :html => { :class => "form login" }) do |f| + - form_for(@register_request, html: { class: "form login" }) do |f| .group.wat-cf - .left= f.label :name, :class => "label right" - .right= f.text_field :name, :class => "text_field" + .left= f.label :name, class: "label right" + .right= f.text_field :name, class: "text_field" .group.wat-cf - .left= f.label :email, :class => "label right" - .right= f.text_field :email, :class => "text_field" + .left= f.label :email, class: "label right" + .right= f.text_field :email, class: "text_field" .group.navform.wat-cf .right - %button.button{:type => "submit"}= t("layout.register_request.get_token_button") + %button.button{type: "submit"}= t("layout.register_request.get_token_button") %span.text_button_padding \ No newline at end of file diff --git a/app/views/users/register_requests/thanks.html.haml b/app/views/users/register_requests/thanks.html.haml index bfd406e14..83ef60466 100644 --- a/app/views/users/register_requests/thanks.html.haml +++ b/app/views/users/register_requests/thanks.html.haml @@ -1,3 +1,3 @@ .all %p - %span{:style => "font-size: 28px;"}=raw t 'invites.thanks' + %span{style: "font-size: 28px;"}=raw t 'invites.thanks' diff --git a/app/views/users/settings/notifiers.html.haml b/app/views/users/settings/notifiers.html.haml index 78bb398c6..2f5eb3196 100644 --- a/app/views/users/settings/notifiers.html.haml +++ b/app/views/users/settings/notifiers.html.haml @@ -1,27 +1,27 @@ --set_meta_tags :title => t('layout.users.settings_notifier') +-set_meta_tags title: t('layout.users.settings_notifier') %p - = t("layout.settings.notifiers.notice_header", :email => @user.email) + = t("layout.settings.notifiers.notice_header", email: @user.email) %br = link_to t("layout.settings.notifiers.change_email_link"), profile_settings_path %br %br -= form_for @user.notifier, :url => notifiers_settings_path, :html => {:class => :form} do |f| - = render 'notifier', :f => f, :field => :can_notify += form_for @user.notifier, url: notifiers_settings_path, html: {class: :form} do |f| + = render 'notifier', f: f, field: :can_notify %h3= t("layout.settings.notifiers.code_header") - [:update_code, :new_comment_commit_owner, :new_comment_commit_repo_owner, :new_comment_commit_commentor].each do |field| - = render 'notifier', :f => f, :field => field + = render 'notifier', f: f, field: field %h3= t("layout.settings.notifiers.tracker_header") - [:new_comment, :new_comment_reply, :new_issue, :issue_assign].each do |field| - = render 'notifier', :f => f, :field => field + = render 'notifier', f: f, field: field %h3= t("layout.settings.notifiers.build_list_header") - [:new_build, :new_associated_build].each do |field| - = render 'notifier', :f => f, :field => field + = render 'notifier', f: f, field: field %br .leftside.w25 \  - .leftside.w420= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + .leftside.w420= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} .both :javascript diff --git a/app/views/users/settings/private.html.haml b/app/views/users/settings/private.html.haml index 2eb30eeb3..08d284411 100644 --- a/app/views/users/settings/private.html.haml +++ b/app/views/users/settings/private.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => t('layout.users.settings') +-set_meta_tags title: t('layout.users.settings') %h3.fix.bpadding10= t('layout.users.private_settings_header') -= form_for @user, :url => private_settings_path, :html => {:class => :form} do |f| += form_for @user, url: private_settings_path, html: {class: :form} do |f| .leftlist= f.label :current_password .rightlist= f.password_field :current_password .both @@ -13,16 +13,16 @@ .both .leftlist \  - .rightlist= submit_tag t('layout.save'), :data => {'disable-with' => t('layout.saving')} + .rightlist= submit_tag t('layout.save'), data: {'disable-with' => t('layout.saving')} .both %br -= form_for @user, :url => reset_auth_token_settings_path, :html => {:class => :form} do |f| += form_for @user, url: reset_auth_token_settings_path, html: {class: :form} do |f| .leftlist= f.label :authentication_token .rightlist= @user.authentication_token .both .leftlist - .rightlist= submit_tag t('layout.users.reset_token'), :data => {'disable-with' => t('layout.saving')} + .rightlist= submit_tag t('layout.users.reset_token'), data: {'disable-with' => t('layout.saving')} .both :javascript diff --git a/app/views/users/settings/profile.html.haml b/app/views/users/settings/profile.html.haml index d09263464..a4d06bd42 100644 --- a/app/views/users/settings/profile.html.haml +++ b/app/views/users/settings/profile.html.haml @@ -1,8 +1,8 @@ --set_meta_tags :title => t('.title') +-set_meta_tags title: t('.title') %h3.fix.bpadding10= @user.uname -= form_for @user, :url => profile_settings_path, :html => {:class => :form} do |f| - = render 'form', :f => f += form_for @user, url: profile_settings_path, html: {class: :form} do |f| + = render 'form', f: f .notify %p= t('layout.users.public_data_edit_warning') diff --git a/app/views/users/ssh_keys/index.html.haml b/app/views/users/ssh_keys/index.html.haml index e1764966f..e26e114c0 100644 --- a/app/views/users/ssh_keys/index.html.haml +++ b/app/views/users/ssh_keys/index.html.haml @@ -1,26 +1,26 @@ -= form_tag ssh_keys_path, :id => 'ssh_keys_form' do += form_tag ssh_keys_path, id: 'ssh_keys_form' do = hidden_field_tag "_method", "post" - %table.tablesorter{:cellpadding => "0", :cellspacing => "0"} + %table.tablesorter{cellpadding: "0", cellspacing: "0"} %thead %tr %th= title t('ssh_keys') - %th{:colspan => "2"}= t 'layout.delete' + %th{colspan: "2"}= t 'layout.delete' %tbody - @ssh_keys.each do |key| %tr %td="#{key.name} (#{key.fingerprint})" - %td= link_to image_tag('x.png'), ssh_key_path(key), :method => :delete, :confirm => t('layout.confirm') + %td= link_to image_tag('x.png'), ssh_key_path(key), method: :delete, confirm: t('layout.confirm') .both %h3.fix.bpadding10= t 'add_key' -= form_for SshKey.new, :url => ssh_keys_path, :html => {:class => :form} do |f| += form_for SshKey.new, url: ssh_keys_path, html: {class: :form} do |f| .leftlist= f.label :name, t('activerecord.attributes.ssh_key.name') .rightlist= f.text_field :name .both .leftlist= f.label :key, t('activerecord.attributes.ssh_key.key') .rightlist= f.text_area :key %br - = f.submit t('layout.add'), :data => {'disable-with' => t('layout.processing')} + = f.submit t('layout.add'), data: {'disable-with' => t('layout.processing')} - content_for :sidebar, render('sidebar') diff --git a/config/application.rb b/config/application.rb index 77751f953..e59074d7e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -7,7 +7,7 @@ require './lib/api_defender' # you've limited to :test, :development, or :production. if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require *Rails.groups(:assets => %w(development test)) + Bundler.require *Rails.groups(assets: %w(development test)) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end diff --git a/config/deploy/production.rb.sample b/config/deploy/production.rb.sample index 12b2038d4..220eff3c2 100644 --- a/config/deploy/production.rb.sample +++ b/config/deploy/production.rb.sample @@ -7,4 +7,4 @@ set :domain, "0.0.0.0" role :app, domain role :web, domain -role :db, domain, :primary => true \ No newline at end of file +role :db, domain, primary: true \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index c75da8c27..ad34b8834 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -36,8 +36,8 @@ Rosa::Application.configure do #config.action_mailer.raise_delivery_errors = true #config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp # :letter_opener - config.action_mailer.smtp_settings = { :host => "localhost", :port => 1025 } - config.action_mailer.default_url_options = { :host => 'localhost:3000' } + config.action_mailer.smtp_settings = { host: "localhost", port: 1025 } + config.action_mailer.default_url_options = { host: 'localhost:3000' } # Print deprecation notices to the Rails logger config.active_support.deprecation = :log diff --git a/config/environments/production.rb b/config/environments/production.rb index 03bf1daf2..0d300816e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -37,7 +37,7 @@ Rosa::Application.configure do # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => 'abf.io' } + config.action_mailer.default_url_options = { host: 'abf.io' } config.delivery_method = :sendmail # Enable threaded mode diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 4b915da80..a3af4306c 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -36,7 +36,7 @@ Rosa::Application.configure do # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => 'abf.rosalinux.ru' } + config.action_mailer.default_url_options = { host: 'abf.rosalinux.ru' } config.delivery_method = :sendmail # Enable threaded mode diff --git a/config/environments/test.rb b/config/environments/test.rb index 67ee98018..b899ccdcd 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -24,7 +24,7 @@ Rosa::Application.configure do # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - config.action_mailer.default_url_options = { :host => 'localhost:3000' } + config.action_mailer.default_url_options = { host: 'localhost:3000' } # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, diff --git a/config/initializers/logentries.rb b/config/initializers/logentries.rb index a7d195dda..2c9ba46c9 100644 --- a/config/initializers/logentries.rb +++ b/config/initializers/logentries.rb @@ -2,7 +2,7 @@ # key = APP_CONFIG['keys']['logentries_key'] # if Rails.env.development? -# Rails.logger = Le.new key, :debug => true +# Rails.logger = Le.new key, debug: true # else # Rails.logger = Le.new key # end \ No newline at end of file diff --git a/config/initializers/logglier.rb b/config/initializers/logglier.rb index 67bda1aaa..f0a9eaa34 100644 --- a/config/initializers/logglier.rb +++ b/config/initializers/logglier.rb @@ -1,5 +1,5 @@ # require 'logglier' # if Rails.env.production? -# Rails.logger = Logglier.new("https://logs-01.loggly.com/inputs/#{APP_CONFIG['keys']['logglier_key']}/tag/ruby/", :threaded => true) +# Rails.logger = Logglier.new("https://logs-01.loggly.com/inputs/#{APP_CONFIG['keys']['logglier_key']}/tag/ruby/", threaded: true) # end \ No newline at end of file diff --git a/config/initializers/notifications.rb b/config/initializers/notifications.rb index c46429587..6dfbd470e 100644 --- a/config/initializers/notifications.rb +++ b/config/initializers/notifications.rb @@ -1,22 +1,22 @@ -Warden::Manager.after_authentication do |user,auth,opts| # after_set_user, :except => fetch - ActiveSupport::Notifications.instrument("event_log.observer", :eventable => user) +Warden::Manager.after_authentication do |user,auth,opts| # after_set_user, except: fetch + ActiveSupport::Notifications.instrument("event_log.observer", eventable: user) end Warden::Manager.before_failure do |env, opts| # raise env.inspect - ActiveSupport::Notifications.instrument "event_log.observer", :kind => 'error', - :message => (env['action_dispatch.request.request_parameters']['user'].delete_if{|k,v| k == 'password'}.inspect rescue nil) + ActiveSupport::Notifications.instrument "event_log.observer", kind: 'error', + message: (env['action_dispatch.request.request_parameters']['user'].delete_if{|k,v| k == 'password'}.inspect rescue nil) end Warden::Manager.before_logout do |user,auth,opts| - ActiveSupport::Notifications.instrument("event_log.observer", :eventable => user) + ActiveSupport::Notifications.instrument("event_log.observer", eventable: user) end ActiveSupport::Notifications.subscribe "event_log.observer" do |name, start, finish, id, payload| if c = EventLog.current_controller eventable = payload[:eventable] message = payload[:message].presence; message ||= eventable.event_log_message if eventable.respond_to?(:event_log_message) - EventLog.create_with_current_controller :kind => (payload[:kind].presence || 'info'), :message => message, - :eventable => eventable, :eventable_name => payload[:eventable_name].presence + EventLog.create_with_current_controller kind: (payload[:kind].presence || 'info'), message: message, + eventable: eventable, eventable_name: payload[:eventable_name].presence end end diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 8f345debb..c384dd3bb 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Rosa::Application.config.session_store :cookie_store, :key => '_rosa_session' +Rosa::Application.config.session_store :cookie_store, key: '_rosa_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information diff --git a/config/initializers/setup.rb b/config/initializers/setup.rb index 42884a73a..99d659a73 100644 --- a/config/initializers/setup.rb +++ b/config/initializers/setup.rb @@ -3,9 +3,9 @@ require 'modules' require 'plugins' # Setup Smart HTTP GRack -config = {:project_root => File.join(APP_CONFIG['git_path'], 'git_projects'), :git_path => 'git', :upload_pack => true, :receive_pack => true} +config = {project_root: File.join(APP_CONFIG['git_path'], 'git_projects'), git_path: 'git', upload_pack: true, receive_pack: true} # Rosa::Application.config.middleware.insert_before 0, ::Grack::Handler, config Rosa::Application.config.middleware.insert_after ::Rails::Rack::Logger, ::Grack::Handler, config Rosa::Application.config.middleware.insert_before ::Grack::Handler, ::Grack::Auth -Rosa::Application.config.action_mailer.default_url_options = { :host => APP_CONFIG['action_mailer_host'] } if APP_CONFIG['action_mailer_host'] +Rosa::Application.config.action_mailer.default_url_options = { host: APP_CONFIG['action_mailer_host'] } if APP_CONFIG['action_mailer_host'] diff --git a/config/routes.rb b/config/routes.rb index 246b36a5a..232c12382 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rosa::Application.routes.draw do - resource :contact, :only => [:new, :create, :sended] do + resource :contact, only: [:new, :create, :sended] do get '/' => 'contacts#new' get :sended end @@ -7,16 +7,16 @@ Rosa::Application.routes.draw do devise_scope :users do get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' end - devise_for :users, :controllers => {:omniauth_callbacks => 'users/omniauth_callbacks'}, :skip => [:registrations] do - get 'users/sign_up' => 'users/registrations#new', :as => :new_user_registration - post 'users' => 'users/registrations#create', :as => :user_registration + devise_for :users, controllers: {omniauth_callbacks: 'users/omniauth_callbacks'}, skip: [:registrations] do + get 'users/sign_up' => 'users/registrations#new', as: :new_user_registration + post 'users' => 'users/registrations#create', as: :user_registration end namespace :api do namespace :v1 do - resources :advisories, :only => [:index, :show, :create, :update] - resources :search, :only => [:index] - resources :build_lists, :only => [:index, :create, :show] do + resources :advisories, only: [:index, :show, :create, :update] + resources :search, only: [:index] + resources :build_lists, only: [:index, :create, :show] do member { put :publish put :reject_publish @@ -25,8 +25,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: [:index, :show, :update, :destroy, :create] do collection { get :platforms_for_build get :allowed @@ -38,9 +38,9 @@ Rosa::Application.routes.draw do post :clone put :clear } - resources :maintainers, :only => [ :index ] + resources :maintainers, only: [ :index ] end - resources :repositories, :only => [:show, :update, :destroy] do + resources :repositories, only: [:show, :update, :destroy] do member { get :projects get :key_pair @@ -54,7 +54,7 @@ Rosa::Application.routes.draw do delete :remove_repo_lock_file } end - resources :projects, :only => [:index, :show, :update, :create, :destroy] do + resources :projects, only: [:index, :show, :update, :create, :destroy] do collection { get :get_id } member { post :fork @@ -64,9 +64,9 @@ Rosa::Application.routes.draw do delete :remove_member put :update_member } - resources :build_lists, :only => :index - resources :issues, :only => [:index, :create, :show, :update] - resources :pull_requests, :only => [:index, :create, :show, :update] do + resources :build_lists, only: :index + resources :issues, only: [:index, :create, :show, :update] + resources :pull_requests, only: [:index, :create, :show, :update] do member { get :commits get :files @@ -74,9 +74,9 @@ Rosa::Application.routes.draw do } end end - resources :users, :only => [:show] + resources :users, only: [:show] get 'user' => 'users#show_current_user' - resource :user, :only => [:update] do + resource :user, only: [:update] do member { get :notifiers put :notifiers @@ -84,7 +84,7 @@ Rosa::Application.routes.draw do get '/pull_requests' => 'pull_requests#user_index' } end - resources :groups, :only => [:index, :show, :update, :create, :destroy] do + resources :groups, only: [:index, :show, :update, :create, :destroy] do member { get :members put :add_member @@ -94,11 +94,11 @@ Rosa::Application.routes.draw do get '/pull_requests' => 'pull_requests#group_index' } end - resources :products, :only => [:show, :update, :create, :destroy] do - resources :product_build_lists, :only => :index + resources :products, only: [:show, :update, :create, :destroy] do + resources :product_build_lists, only: :index end - resources :product_build_lists, :only => [:index, :show, :destroy, :create, :update] do - put :cancel, :on => :member + resources :product_build_lists, only: [:index, :show, :destroy, :create, :update] do + put :cancel, on: :member end resources :jobs do @@ -111,30 +111,30 @@ Rosa::Application.routes.draw do end end - #resources :ssh_keys, :only => [:index, :create, :destroy] + #resources :ssh_keys, only: [:index, :create, :destroy] get 'issues' => 'issues#all_index' get 'pull_requests' => 'pull_requests#all_index' end end - resources :search, :only => [:index] + resources :search, only: [:index] - get '/forbidden' => 'pages#forbidden', :as => 'forbidden' - get '/terms-of-service' => 'pages#tos', :as => 'tos' - get '/tour/:id' => 'pages#tour_inside', :as => 'tour_inside', :id => /projects|sources|builds/ + get '/forbidden' => 'pages#forbidden', as: 'forbidden' + get '/terms-of-service' => 'pages#tos', as: 'tos' + get '/tour/:id' => 'pages#tour_inside', as: 'tour_inside', id: /projects|sources|builds/ #match '/invite.html' => redirect('/register_requests/new') - get '/activity_feeds.:format' => 'home#activity', :as => 'atom_activity_feeds', :format => /atom/ + get '/activity_feeds.:format' => 'home#activity', as: 'atom_activity_feeds', format: /atom/ get '/issues' => 'home#issues' get '/pull_requests' => 'home#pull_requests' if APP_CONFIG['anonymous_access'] authenticated do - root :to => 'home#activity' + root to: 'home#activity' end - root :to => 'home#root' + root to: 'home#root' else - root :to => 'home#activity' + root to: 'home#activity' end namespace :admin do @@ -143,29 +143,29 @@ Rosa::Application.routes.draw do get :list get :system end - put :reset_auth_token, :on => :member + put :reset_auth_token, on: :member end - resources :register_requests, :only => [:index] do - put :update, :on => :collection + 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 + 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 + resources :advisories, only: [:index, :show, :search] do + get :search, on: :collection end - scope :module => 'platforms' do - resources :platforms, :constraints => {:id => Platform::NAME_PATTERN} do - resources :private_users, :except => [:show, :destroy, :update] + scope module: 'platforms' do + resources :platforms, constraints: {id: Platform::NAME_PATTERN} do + resources :private_users, except: [:show, :destroy, :update] member do put :regenerate_metadata put :clear @@ -179,14 +179,14 @@ Rosa::Application.routes.draw do get :advisories end - resources :contents, :only => [:index] - match '/contents/*path' => 'contents#index', :format => false + resources :contents, only: [:index] + match '/contents/*path' => 'contents#index', format: false - resources :mass_builds, :only => [:create, :new, :index] do + resources :mass_builds, only: [:create, :new, :index] do member do post :cancel post :publish - get '/:kind.:format' => "mass_builds#get_list", :as => :get_list, :kind => /failed_builds_list|missed_projects_list|projects_list/ + get '/:kind.:format' => "mass_builds#get_list", as: :get_list, kind: /failed_builds_list|missed_projects_list|projects_list/ end end @@ -204,14 +204,14 @@ Rosa::Application.routes.draw do put :sync_lock_file end end - resources :key_pairs, :only => [:create, :index, :destroy] - resources :tokens, :only => [:create, :index, :show, :new] do + resources :key_pairs, only: [:create, :index, :destroy] + resources :tokens, only: [:create, :index, :show, :new] do member do post :withdraw end end resources :products do - resources :product_build_lists, :only => [:create, :destroy, :new, :show, :update] do + resources :product_build_lists, only: [:create, :destroy, :new, :show, :update] do member { get :log put :cancel @@ -219,14 +219,14 @@ Rosa::Application.routes.draw do end collection { get :autocomplete_project } end - resources :maintainers, :only => [:index] + resources :maintainers, only: [:index] end match '/private/:platform_name/*file_path' => 'privates#show' - resources :product_build_lists, :only => [:index, :show] + resources :product_build_lists, only: [:index, :show] end - resources :autocompletes, :only => [] do + resources :autocompletes, only: [] do collection do get :autocomplete_user_uname get :autocomplete_group_uname @@ -235,12 +235,12 @@ Rosa::Application.routes.draw do end end - scope :module => 'users' do - get '/settings/ssh_keys' => 'ssh_keys#index', :as => :ssh_keys + scope module: 'users' do + get '/settings/ssh_keys' => 'ssh_keys#index', as: :ssh_keys post '/settings/ssh_keys' => 'ssh_keys#create' - delete '/settings/ssh_keys/:id' => 'ssh_keys#destroy', :as => :ssh_key + delete '/settings/ssh_keys/:id' => 'ssh_keys#destroy', as: :ssh_key - resources :settings, :only => [] do + resources :settings, only: [] do collection do get :profile put :profile @@ -251,19 +251,19 @@ Rosa::Application.routes.draw do put :reset_auth_token end end - resources :register_requests, :only => [:new, :create], :format => /ru|en/ #view support only two languages + resources :register_requests, only: [:new, :create], format: /ru|en/ #view support only two languages get '/allowed' => 'users#allowed' get '/check' => 'users#check' get '/discover' => 'users#discover' end - scope :module => 'groups' do - get '/groups/new' => 'profile#new' # need to force next route exclude :id => 'new' - get '/groups/:id' => redirect("/%{id}"), :as => :profile_group # override default group show route - resources :groups, :controller => 'profile' do - delete :remove_user, :on => :member - resources :members, :only => [:index] do + scope module: 'groups' do + get '/groups/new' => 'profile#new' # need to force next route exclude id: 'new' + get '/groups/:id' => redirect("/%{id}"), as: :profile_group # override default group show route + resources :groups, controller: 'profile' do + delete :remove_user, on: :member + resources :members, only: [:index] do collection do post :add post :update @@ -273,8 +273,8 @@ Rosa::Application.routes.draw do end end - scope :module => 'projects' do - resources :build_lists, :only => [:index, :show] do + scope module: 'projects' do + resources :build_lists, only: [:index, :show] do member do put :cancel put :create_container @@ -285,22 +285,22 @@ Rosa::Application.routes.draw do end end - resources :projects, :only => [:index, :new, :create] do + resources :projects, only: [:index, :new, :create] do collection do post :run_mass_import get :mass_import end end - scope ':owner_name/:project_name', :constraints => {:project_name => Project::NAME_REGEXP} do # project - scope :as => 'project' do + scope ':owner_name/:project_name', constraints: {project_name: Project::NAME_REGEXP} do # project + scope as: 'project' do resources :wiki do collection do - match '_history' => 'wiki#wiki_history', :as => :history, :via => :get - match '_access' => 'wiki#git', :as => :git, :via => :get - match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', :as => :revert, :via => [:get, :post] - match '_compare' => 'wiki#compare_wiki', :as => :compare, :via => :post - #match '_compare/:versions' => 'wiki#compare_wiki', :versions => /.*/, :as => :compare_versions, :via => :get - match '_compare/:versions' => 'wiki#compare_wiki', :versions => /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, :as => :compare_versions, :via => :get + match '_history' => 'wiki#wiki_history', as: :history, via: :get + match '_access' => 'wiki#git', as: :git, via: :get + match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', as: :revert, via: [:get, :post] + match '_compare' => 'wiki#compare_wiki', as: :compare, via: :post + #match '_compare/:versions' => 'wiki#compare_wiki', versions: /.*/, as: :compare_versions, via: :get + match '_compare/:versions' => 'wiki#compare_wiki', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get post :preview get :search get :pages @@ -308,90 +308,90 @@ Rosa::Application.routes.draw do member do get :history get :edit - match 'revert/:sha1/:sha2' => 'wiki#revert', :as => :revert_page, :via => [:get, :post] - match ':ref' => 'wiki#show', :as => :versioned, :via => :get + match 'revert/:sha1/:sha2' => 'wiki#revert', as: :revert_page, via: [:get, :post] + match ':ref' => 'wiki#show', as: :versioned, via: :get post :compare - #match 'compare/*versions' => 'wiki#compare', :as => :compare_versions, :via => :get - match 'compare/:versions' => 'wiki#compare', :versions => /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, :as => :compare_versions, :via => :get + #match 'compare/*versions' => 'wiki#compare', as: :compare_versions, via: :get + match 'compare/:versions' => 'wiki#compare', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get end end - resources :issues, :except => [:destroy, :edit] do - resources :comments, :only => [:edit, :create, :update, :destroy] - resources :subscribes, :only => [:create, :destroy] + resources :issues, except: [:destroy, :edit] do + resources :comments, only: [:edit, :create, :update, :destroy] + resources :subscribes, only: [:create, :destroy] collection do post :create_label get :search_collaborators end end - post "/labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label - post "/labels/:label_id/update" => "issues#update_label", :as => :issues_update_label + post "/labels/:label_id" => "issues#destroy_label", as: :issues_delete_label + post "/labels/:label_id/update" => "issues#update_label", as: :issues_update_label - resources :build_lists, :only => [:index, :new, :create] do - get :list, :on => :collection + resources :build_lists, only: [:index, :new, :create] do + get :list, on: :collection end resources :collaborators do - get :find, :on => :collection + get :find, on: :collection end - resources :hooks, :except => :show - resources :pull_requests, :except => :destroy do - get :autocomplete_to_project, :on => :collection - put :merge, :on => :member + resources :hooks, except: :show + resources :pull_requests, except: :destroy do + get :autocomplete_to_project, on: :collection + put :merge, on: :member end - post '/preview' => 'projects#preview', :as => 'md_preview' - post 'refs_list' => 'projects#refs_list', :as => 'refs_list' - get '/pull_requests/:issue_id/add_line_comments(.:format)' => "comments#new_line", :as => :new_line_pull_comment + post '/preview' => 'projects#preview', as: 'md_preview' + post 'refs_list' => 'projects#refs_list', as: 'refs_list' + get '/pull_requests/:issue_id/add_line_comments(.:format)' => "comments#new_line", as: :new_line_pull_comment end # Resource - get '/autocomplete_maintainers' => 'projects#autocomplete_maintainers', :as => :autocomplete_maintainers - get '/modify' => 'projects#edit', :as => :edit_project + get '/autocomplete_maintainers' => 'projects#autocomplete_maintainers', as: :autocomplete_maintainers + get '/modify' => 'projects#edit', as: :edit_project put '/' => 'projects#update' delete '/' => 'projects#destroy' # Member - post '/fork' => 'projects#fork', :as => :fork_project - get '/possible_forks' => 'projects#possible_forks', :as => :possible_forks_project - get '/sections' => 'projects#sections', :as => :sections_project + post '/fork' => 'projects#fork', as: :fork_project + get '/possible_forks' => 'projects#possible_forks', as: :possible_forks_project + get '/sections' => 'projects#sections', as: :sections_project post '/sections' => 'projects#sections' - delete '/remove_user' => 'projects#remove_user', :as => :remove_user_project - constraints :treeish => /.+/ do + delete '/remove_user' => 'projects#remove_user', as: :remove_user_project + constraints treeish: /.+/ do constraints Rosa::Constraints::Treeish do # Tree - get '/' => "git/trees#show", :as => :project - get '/tree/:treeish(/*path)' => "git/trees#show", :as => :tree, :format => false + get '/' => "git/trees#show", as: :project + get '/tree/:treeish(/*path)' => "git/trees#show", as: :tree, format: false # Tags - get '/tags' => "git/trees#tags", :as => :tags + get '/tags' => "git/trees#tags", as: :tags # Branches - get '/branches' => "git/trees#branches", :as => :branches - get '/branches/:treeish' => "git/trees#branches", :as => :branch - delete '/branches/:treeish' => "git/trees#destroy", :as => :branch - put '/branches/:treeish' => "git/trees#restore_branch", :as => :branch - post '/branches' => "git/trees#create", :as => :branches + get '/branches' => "git/trees#branches", as: :branches + get '/branches/:treeish' => "git/trees#branches", as: :branch + delete '/branches/:treeish' => "git/trees#destroy", as: :branch + put '/branches/:treeish' => "git/trees#restore_branch", as: :branch + post '/branches' => "git/trees#create", as: :branches # Commits - get '/commits/:treeish(/*path)' => "git/commits#index", :as => :commits, :format => false - get '/commit/:id(.:format)' => "git/commits#show", :as => :commit + get '/commits/:treeish(/*path)' => "git/commits#index", as: :commits, format: false + get '/commit/:id(.:format)' => "git/commits#show", as: :commit # 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 + 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 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 + get '/commit/:commit_id/add_line_comments(.:format)' => "comments#new_line", as: :new_line_commit_comment # Commit subscribes - post '/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit - delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit + post '/commit/:commit_id/subscribe' => "commit_subscribes#create", as: :subscribe_commit + delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", as: :unsubscribe_commit # Editing files - get '/edit/:treeish/*path' => "git/blobs#edit", :as => :edit_blob, :format => false - put '/edit/:treeish/*path' => "git/blobs#update", :format => false + get '/edit/:treeish/*path' => "git/blobs#edit", as: :edit_blob, format: false + put '/edit/:treeish/*path' => "git/blobs#update", format: false # Blobs - get '/blob/:treeish/*path' => "git/blobs#show", :as => :blob, :format => false + get '/blob/:treeish/*path' => "git/blobs#show", as: :blob, format: false # Blame - get '/blame/:treeish/*path' => "git/blobs#blame", :as => :blame, :format => false + get '/blame/:treeish/*path' => "git/blobs#blame", as: :blame, format: false # Raw - get '/raw/:treeish/*path' => "git/blobs#raw", :as => :raw, :format => false + get '/raw/:treeish/*path' => "git/blobs#raw", as: :raw, format: false # Archive - get '/archive/:treeish.:format' => "git/trees#archive", :as => :archive, :format => /zip|tar\.gz/ + get '/archive/:treeish.:format' => "git/trees#archive", as: :archive, format: /zip|tar\.gz/ # Git diff - get '/diff/:diff' => "git/commits#diff", :as => :diff, :format => false, :diff => /.*/ + get '/diff/:diff' => "git/commits#diff", as: :diff, format: false, diff: /.*/ end end end @@ -399,15 +399,15 @@ Rosa::Application.routes.draw do scope ':uname' do # project owner profile constraints Rosa::Constraints::Owner.new(User) do - get '/' => 'users/profile#show', :as => :user + get '/' => 'users/profile#show', as: :user end constraints Rosa::Constraints::Owner.new(Group, true) do - get '/' => 'groups/profile#show', :as => :group + get '/' => 'groups/profile#show', as: :group end end # As of Rails 3.0.1, using rescue_from in your ApplicationController to # recover from a routing error is broken! # see: https://rails.lighthouseapp.com/projects/8994/tickets/4444-can-no-longer-rescue_from-actioncontrollerroutingerror - match '*a', :to => 'application#render_404' + match '*a', to: 'application#render_404' end diff --git a/config/schedule.rb b/config/schedule.rb index 20dbff353..508f63318 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -1,48 +1,48 @@ -#every 1.day, :at => '0:05 am' do +#every 1.day, at: '0:05 am' do # runner "Download.rotate_nginx_log" #end # -#every 1.day, :at => '0:10 am' do +#every 1.day, at: '0:10 am' do # runner "Download.parse_and_remove_nginx_log" #end -every :day, :at => '4:10 am' do - rake "product_build_list:clear:outdated", :output => 'log/product_build_list_clear.log' +every :day, at: '4:10 am' do + rake "product_build_list:clear:outdated", output: 'log/product_build_list_clear.log' end -every :day, :at => '4:00 am' do - rake "import:sync:all", :output => 'log/sync.log' +every :day, at: '4:00 am' do + rake "import:sync:all", output: 'log/sync.log' end -every :day, :at => '3:50 am' do - rake "buildlist:clear:outdated", :output => 'log/build_list_clear.log' +every :day, at: '3:50 am' do + rake "buildlist:clear:outdated", output: 'log/build_list_clear.log' end -every :day, :at => '3:30 am' do - rake "pull_requests:clear", :output => 'log/pull_requests_clear.log' +every :day, at: '3:30 am' do + rake "pull_requests:clear", output: 'log/pull_requests_clear.log' end -every :day, :at => '3:00 am' do - rake "activity_feeds:clear", :output => 'log/activity_feeds.log' +every :day, at: '3:00 am' do + rake "activity_feeds:clear", output: 'log/activity_feeds.log' end every 3.minute do - runner 'AbfWorker::BuildListsPublishTaskManager.new.run', :output => 'log/task_manager.log' + runner 'AbfWorker::BuildListsPublishTaskManager.new.run', output: 'log/task_manager.log' end every 1.minute do runner 'RpmBuildNode.cleanup!' end -every :day, :at => '4am' do - runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log' - runner 'Product.autostart_iso_builds_once_a_day', :output => 'log/autostart_iso_builds.log' +every :day, at: '4am' do + runner 'Product.autostart_iso_builds_once_a_12_hours', output: 'log/autostart_iso_builds.log' + runner 'Product.autostart_iso_builds_once_a_day', output: 'log/autostart_iso_builds.log' end -every :day, :at => '4pm' do - runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log' +every :day, at: '4pm' do + runner 'Product.autostart_iso_builds_once_a_12_hours', output: 'log/autostart_iso_builds.log' end -every :sunday, :at => '4am' do - runner 'Product.autostart_iso_builds_once_a_week', :output => 'log/autostart_iso_builds.log' +every :sunday, at: '4am' do + runner 'Product.autostart_iso_builds_once_a_week', output: 'log/autostart_iso_builds.log' end \ No newline at end of file diff --git a/config/unicorn.rb b/config/unicorn.rb index ed8692c0f..123d51510 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -7,8 +7,8 @@ worker_processes 8 working_directory File.join(base_path, 'current') # available in 0.94.0+ # listen File.join(base_path, 'tmp', 'pids', 'unicorn.sock') -# listen "/tmp/.sock", :backlog => 64 -# listen 8080, :tcp_nopush => true +# listen "/tmp/.sock", backlog: 64 +# listen 8080, tcp_nopush: true # nuke workers after 30 seconds instead of 60 seconds (the default) timeout 600 @@ -42,7 +42,7 @@ before_fork do |server, worker| # What is does is prevent the master process from holding # the database connection defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! - + # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and # immediately start loading up a new version of itself (loaded with a new # version of our app). When this new Unicorn is completely loaded @@ -52,7 +52,7 @@ before_fork do |server, worker| # we send it a QUIT. # # Using this method we get 0 downtime deploys. - + if File.exists?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) diff --git a/db/migrate/20110309144736_devise_create_users.rb b/db/migrate/20110309144736_devise_create_users.rb index 34555b0a3..e189f0fa2 100644 --- a/db/migrate/20110309144736_devise_create_users.rb +++ b/db/migrate/20110309144736_devise_create_users.rb @@ -4,8 +4,8 @@ class DeviseCreateUsers < ActiveRecord::Migration t.string :name ## Database authenticatable - t.string :email, :null => false, :default => "" - t.string :encrypted_password, :null => false, :default => "" + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t.datetime :reset_password_sent_at @@ -14,8 +14,8 @@ class DeviseCreateUsers < ActiveRecord::Migration t.timestamps end - add_index :users, :email, :unique => true - add_index :users, :reset_password_token, :unique => true + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true end def self.down diff --git a/db/migrate/20110311154011_create_repositories.rb b/db/migrate/20110311154011_create_repositories.rb index 1396f8c30..a3963dca4 100644 --- a/db/migrate/20110311154011_create_repositories.rb +++ b/db/migrate/20110311154011_create_repositories.rb @@ -1,8 +1,8 @@ class CreateRepositories < ActiveRecord::Migration def self.up create_table :repositories do |t| - t.string :name, :null => false - t.integer :platform_id, :null => false + t.string :name, null: false + t.integer :platform_id, null: false t.timestamps end diff --git a/db/migrate/20110311154044_remove_platform_id_from_projects.rb b/db/migrate/20110311154044_remove_platform_id_from_projects.rb index 7ec739f02..153f63ff0 100644 --- a/db/migrate/20110311154044_remove_platform_id_from_projects.rb +++ b/db/migrate/20110311154044_remove_platform_id_from_projects.rb @@ -4,6 +4,6 @@ class RemovePlatformIdFromProjects < ActiveRecord::Migration end def self.down - add_column :projects, :platform_id, :integer, :null => false + add_column :projects, :platform_id, :integer, null: false end end diff --git a/db/migrate/20110311154136_add_repository_id_to_projects.rb b/db/migrate/20110311154136_add_repository_id_to_projects.rb index c2099a9f5..7540166a5 100644 --- a/db/migrate/20110311154136_add_repository_id_to_projects.rb +++ b/db/migrate/20110311154136_add_repository_id_to_projects.rb @@ -1,6 +1,6 @@ class AddRepositoryIdToProjects < ActiveRecord::Migration def self.up - add_column :projects, :repository_id, :integer, :null => false + add_column :projects, :repository_id, :integer, null: false end def self.down diff --git a/db/migrate/20110311154929_add_unixname_to_repositories.rb b/db/migrate/20110311154929_add_unixname_to_repositories.rb index b3907bc14..56ab48ff5 100644 --- a/db/migrate/20110311154929_add_unixname_to_repositories.rb +++ b/db/migrate/20110311154929_add_unixname_to_repositories.rb @@ -1,6 +1,6 @@ class AddUnixnameToRepositories < ActiveRecord::Migration def self.up - add_column :repositories, :unixname, :string, :null => false + add_column :repositories, :unixname, :string, null: false end def self.down diff --git a/db/migrate/20110312133121_create_containers.rb b/db/migrate/20110312133121_create_containers.rb index e5a2fbf87..a3ca2af40 100644 --- a/db/migrate/20110312133121_create_containers.rb +++ b/db/migrate/20110312133121_create_containers.rb @@ -1,9 +1,9 @@ class CreateContainers < ActiveRecord::Migration def self.up create_table :containers do |t| - t.string :name, :null => false - t.integer :project_id, :null => false - t.integer :owner_id, :null => false + t.string :name, null: false + t.integer :project_id, null: false + t.integer :owner_id, null: false t.timestamps end diff --git a/db/migrate/20110312133559_create_arches.rb b/db/migrate/20110312133559_create_arches.rb index 98a064628..2f24af470 100644 --- a/db/migrate/20110312133559_create_arches.rb +++ b/db/migrate/20110312133559_create_arches.rb @@ -1,12 +1,12 @@ class CreateArches < ActiveRecord::Migration def self.up create_table :arches do |t| - t.string :name, :null => false + t.string :name, null: false t.timestamps end - add_index :arches, :name, :unique => true + add_index :arches, :name, unique: true end def self.down diff --git a/db/migrate/20110312133948_create_rpms.rb b/db/migrate/20110312133948_create_rpms.rb index 8feaa5221..176b55c2e 100644 --- a/db/migrate/20110312133948_create_rpms.rb +++ b/db/migrate/20110312133948_create_rpms.rb @@ -1,13 +1,13 @@ class CreateRpms < ActiveRecord::Migration def self.up create_table :rpms do |t| - t.string :name, :null => false - t.integer :arch_id, :null => false - t.integer :project_id, :null => false + t.string :name, null: false + t.integer :arch_id, null: false + t.integer :project_id, null: false t.timestamps end - + add_index :rpms, :project_id add_index :rpms, [:project_id, :arch_id] end diff --git a/db/migrate/20110317130503_add_released_to_platforms.rb b/db/migrate/20110317130503_add_released_to_platforms.rb index bc8346d7e..e5cd3e07e 100644 --- a/db/migrate/20110317130503_add_released_to_platforms.rb +++ b/db/migrate/20110317130503_add_released_to_platforms.rb @@ -1,6 +1,6 @@ class AddReleasedToPlatforms < ActiveRecord::Migration def self.up - add_column :platforms, :released, :boolean, :default => false + add_column :platforms, :released, :boolean, default: false end def self.down diff --git a/db/migrate/20110405161609_create_build_lists.rb b/db/migrate/20110405161609_create_build_lists.rb index 0f90611da..c434f9c2c 100644 --- a/db/migrate/20110405161609_create_build_lists.rb +++ b/db/migrate/20110405161609_create_build_lists.rb @@ -1,6 +1,6 @@ class CreateBuildLists < ActiveRecord::Migration def self.up - create_table :build_lists, :force => true do |t| + create_table :build_lists, force: true do |t| t.integer :bs_id t.string :container_path t.integer :status @@ -14,7 +14,7 @@ class CreateBuildLists < ActiveRecord::Migration t.timestamps end - add_index :build_lists, :bs_id, :unique => true + add_index :build_lists, :bs_id, unique: true add_index :build_lists, :project_id add_index :build_lists, :arch_id end diff --git a/db/migrate/20110407144147_add_is_circle_to_build_lists.rb b/db/migrate/20110407144147_add_is_circle_to_build_lists.rb index 016190164..3b97663d0 100644 --- a/db/migrate/20110407144147_add_is_circle_to_build_lists.rb +++ b/db/migrate/20110407144147_add_is_circle_to_build_lists.rb @@ -1,6 +1,6 @@ class AddIsCircleToBuildLists < ActiveRecord::Migration def self.up - add_column :build_lists, :is_circle, :boolean, :default => false + add_column :build_lists, :is_circle, :boolean, default: false end def self.down diff --git a/db/migrate/20110408123808_create_build_list_items.rb b/db/migrate/20110408123808_create_build_list_items.rb index db9538fef..637c07fd7 100644 --- a/db/migrate/20110408123808_create_build_list_items.rb +++ b/db/migrate/20110408123808_create_build_list_items.rb @@ -1,6 +1,6 @@ class CreateBuildListItems < ActiveRecord::Migration def self.up - create_table :build_list_items, :force => true do |t| + create_table :build_list_items, force: true do |t| t.string :name t.integer :level t.integer :status diff --git a/db/migrate/20110411082826_create_products.rb b/db/migrate/20110411082826_create_products.rb index 64a50e87b..13ed3dac9 100644 --- a/db/migrate/20110411082826_create_products.rb +++ b/db/migrate/20110411082826_create_products.rb @@ -1,9 +1,9 @@ class CreateProducts < ActiveRecord::Migration def self.up create_table :products do |t| - t.string :name, :null => false - t.integer :platform_id, :null => false - t.integer :build_status, :default => 2, :null => false ### NOTE :default => 2 comes from Product::NEVER_BUILT status which we unable to use here + t.string :name, null: false + t.integer :platform_id, null: false + t.integer :build_status, default: 2, null: false ### NOTE default: 2 comes from Product::NEVER_BUILT status which we unable to use here t.string :build_path t.timestamps diff --git a/db/migrate/20110411160955_create_delayed_jobs.rb b/db/migrate/20110411160955_create_delayed_jobs.rb index e2d4b85c4..84b3ba651 100644 --- a/db/migrate/20110411160955_create_delayed_jobs.rb +++ b/db/migrate/20110411160955_create_delayed_jobs.rb @@ -1,8 +1,8 @@ class CreateDelayedJobs < ActiveRecord::Migration def self.up - create_table :delayed_jobs, :force => true do |table| - table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue - table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually. + create_table :delayed_jobs, force: true do |table| + table.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue + table.integer :attempts, default: 0 # Provides for retries, but still fail eventually. table.text :handler # YAML-encoded string of the object that will do work table.text :last_error # reason for last failure (See Note below) table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. @@ -11,11 +11,11 @@ class CreateDelayedJobs < ActiveRecord::Migration table.string :locked_by # Who is working on this object (if locked) table.timestamps end - - add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' + + add_index :delayed_jobs, [:priority, :run_at], name: 'delayed_jobs_priority' end - + def self.down - drop_table :delayed_jobs + drop_table :delayed_jobs end end diff --git a/db/migrate/20110414145300_add_template_columns_to_products.rb b/db/migrate/20110414145300_add_template_columns_to_products.rb index f56229ce7..c15bea696 100644 --- a/db/migrate/20110414145300_add_template_columns_to_products.rb +++ b/db/migrate/20110414145300_add_template_columns_to_products.rb @@ -1,7 +1,7 @@ class AddTemplateColumnsToProducts < ActiveRecord::Migration def self.up - add_column :products, :is_template, :boolean, :default => false - add_column :products, :system_wide, :boolean, :default => false + add_column :products, :is_template, :boolean, default: false + add_column :products, :system_wide, :boolean, default: false end def self.down diff --git a/db/migrate/20110428140753_add_use_cron_to_products.rb b/db/migrate/20110428140753_add_use_cron_to_products.rb index db07c69fe..16e0c937e 100644 --- a/db/migrate/20110428140753_add_use_cron_to_products.rb +++ b/db/migrate/20110428140753_add_use_cron_to_products.rb @@ -1,6 +1,6 @@ class AddUseCronToProducts < ActiveRecord::Migration def self.up - add_column :products, :use_cron, :boolean, :default => false + add_column :products, :use_cron, :boolean, default: false end def self.down diff --git a/db/migrate/20111011182847_add_extra_fields_to_users.rb b/db/migrate/20111011182847_add_extra_fields_to_users.rb index 49fbbf1e5..ed73a3e0e 100644 --- a/db/migrate/20111011182847_add_extra_fields_to_users.rb +++ b/db/migrate/20111011182847_add_extra_fields_to_users.rb @@ -2,8 +2,8 @@ class AddExtraFieldsToUsers < ActiveRecord::Migration def self.up add_column :users, :nickname, :string add_column :users, :ssh_key, :text - add_index :users, :nickname, :unique => true - User.all.each {|u| User.where(:id => u.id).update_all(:nickname => u.email.split('@').first)} + add_index :users, :nickname, unique: true + User.all.each {|u| User.where(id: u.id).update_all(nickname: u.email.split('@').first)} end def self.down diff --git a/db/migrate/20111011200645_create_authentications.rb b/db/migrate/20111011200645_create_authentications.rb index 068a5c180..3829949c0 100644 --- a/db/migrate/20111011200645_create_authentications.rb +++ b/db/migrate/20111011200645_create_authentications.rb @@ -9,7 +9,7 @@ class CreateAuthentications < ActiveRecord::Migration end add_index :authentications, :user_id - add_index :authentications, [:provider, :uid], :unique => true + add_index :authentications, [:provider, :uid], unique: true end def self.down diff --git a/db/migrate/20111012065448_create_downloads.rb b/db/migrate/20111012065448_create_downloads.rb index 8eeb4f022..d3439d4b3 100644 --- a/db/migrate/20111012065448_create_downloads.rb +++ b/db/migrate/20111012065448_create_downloads.rb @@ -1,11 +1,11 @@ class CreateDownloads < ActiveRecord::Migration def self.up create_table :downloads do |t| - t.string :name, :null => false + t.string :name, null: false t.string :version t.string :distro t.string :platform - t.integer :counter, :default => 0 + t.integer :counter, default: 0 t.timestamps end diff --git a/db/migrate/20111012133633_create_event_logs.rb b/db/migrate/20111012133633_create_event_logs.rb index 93c18d296..2c81b40f9 100644 --- a/db/migrate/20111012133633_create_event_logs.rb +++ b/db/migrate/20111012133633_create_event_logs.rb @@ -3,7 +3,7 @@ class CreateEventLogs < ActiveRecord::Migration create_table :event_logs do |t| t.references :user t.string :user_name - t.references :object, :polymorphic => true + t.references :object, polymorphic: true t.string :object_name t.string :ip t.string :kind diff --git a/db/migrate/20111014150436_remove_repository_id_from_project.rb b/db/migrate/20111014150436_remove_repository_id_from_project.rb index bc85b3ae0..8c90be926 100644 --- a/db/migrate/20111014150436_remove_repository_id_from_project.rb +++ b/db/migrate/20111014150436_remove_repository_id_from_project.rb @@ -4,6 +4,6 @@ class RemoveRepositoryIdFromProject < ActiveRecord::Migration end def self.down - add_column :projects, :repository_id, :integer, :null => false + add_column :projects, :repository_id, :integer, null: false end end diff --git a/db/migrate/20111016220428_platform_restruct.rb b/db/migrate/20111016220428_platform_restruct.rb index 60d49c43d..b09299bca 100644 --- a/db/migrate/20111016220428_platform_restruct.rb +++ b/db/migrate/20111016220428_platform_restruct.rb @@ -1,9 +1,9 @@ class PlatformRestruct < ActiveRecord::Migration def self.up change_table :platforms do |t| - t.references :owner, :polymorphic => true - t.string :visibility, :default => 'open' - t.string :platform_type, :default => 'main' + t.references :owner, polymorphic: true + t.string :visibility, default: 'open' + t.string :platform_type, default: 'main' t.string :distrib_type end end diff --git a/db/migrate/20111016224709_project_restruct.rb b/db/migrate/20111016224709_project_restruct.rb index 89d190c12..0e265fd54 100644 --- a/db/migrate/20111016224709_project_restruct.rb +++ b/db/migrate/20111016224709_project_restruct.rb @@ -1,8 +1,8 @@ class ProjectRestruct < ActiveRecord::Migration def self.up change_table :projects do |t| - t.references :owner, :polymorphic => true - t.string :visibility, :default => 'open' + t.references :owner, polymorphic: true + t.string :visibility, default: 'open' end end diff --git a/db/migrate/20111016225240_repositories_restruct.rb b/db/migrate/20111016225240_repositories_restruct.rb index 21a3a5b60..fc2ac4677 100644 --- a/db/migrate/20111016225240_repositories_restruct.rb +++ b/db/migrate/20111016225240_repositories_restruct.rb @@ -1,8 +1,8 @@ class RepositoriesRestruct < ActiveRecord::Migration def self.up change_table :repositories do |t| - t.references :owner, :polymorphic => true - t.string :visibility, :default => 'open' + t.references :owner, polymorphic: true + t.string :visibility, default: 'open' end end diff --git a/db/migrate/20111017152936_create_categories.rb b/db/migrate/20111017152936_create_categories.rb index 438dc11f5..7449f7dcd 100644 --- a/db/migrate/20111017152936_create_categories.rb +++ b/db/migrate/20111017152936_create_categories.rb @@ -3,7 +3,7 @@ class CreateCategories < ActiveRecord::Migration create_table :categories do |t| t.string :name t.string :ancestry - t.integer :projects_count, :default => 0, :null => false + t.integer :projects_count, default: 0, null: false t.timestamps end diff --git a/db/migrate/20111021164945_delete_nickname_init_uname.rb b/db/migrate/20111021164945_delete_nickname_init_uname.rb index ca06f82a4..5c16e4e46 100644 --- a/db/migrate/20111021164945_delete_nickname_init_uname.rb +++ b/db/migrate/20111021164945_delete_nickname_init_uname.rb @@ -1,13 +1,13 @@ class DeleteNicknameInitUname < ActiveRecord::Migration def self.up remove_column :users, :nickname - add_index :users, :uname, :unique => true - User.all.each {|u| User.where(:id => u.id).update_all(:uname => u.email.split('@').first.gsub(/[^a-zA-Z0-9_]/, '_'))} + add_index :users, :uname, unique: true + User.all.each {|u| User.where(id: u.id).update_all(uname: u.email.split('@').first.gsub(/[^a-zA-Z0-9_]/, '_'))} end def self.down add_column :users, :nickname, :string remove_index :users, :uname - User.all.each {|u| User.where(:id => u.id).update_all(:nickname => u.email.split('@').first.gsub(/[^a-zA-Z0-9_]/, '_'))} + User.all.each {|u| User.where(id: u.id).update_all(nickname: u.email.split('@').first.gsub(/[^a-zA-Z0-9_]/, '_'))} end end diff --git a/db/migrate/20111022170400_create_rights.rb b/db/migrate/20111022170400_create_rights.rb index fea0cf008..3a477765d 100644 --- a/db/migrate/20111022170400_create_rights.rb +++ b/db/migrate/20111022170400_create_rights.rb @@ -1,9 +1,9 @@ class CreateRights < ActiveRecord::Migration def self.up create_table :rights do |t| - t.string :name, :null => false - t.string :controller, :null => false - t.string :action, :null => false + t.string :name, null: false + t.string :controller, null: false + t.string :action, null: false t.timestamps end diff --git a/db/migrate/20111026200223_add_default_to_roles.rb b/db/migrate/20111026200223_add_default_to_roles.rb index 79965786f..f82eb48bc 100644 --- a/db/migrate/20111026200223_add_default_to_roles.rb +++ b/db/migrate/20111026200223_add_default_to_roles.rb @@ -1,7 +1,7 @@ class AddDefaultToRoles < ActiveRecord::Migration def self.up - add_column :roles, :use_default, :boolean, :default => false - add_column :roles, :use_default_for_owner, :boolean, :default => false + add_column :roles, :use_default, :boolean, default: false + add_column :roles, :use_default_for_owner, :boolean, default: false end def self.down diff --git a/db/migrate/20111027230610_change_roles_on_and_to.rb b/db/migrate/20111027230610_change_roles_on_and_to.rb index 4012fa917..3d94068a2 100644 --- a/db/migrate/20111027230610_change_roles_on_and_to.rb +++ b/db/migrate/20111027230610_change_roles_on_and_to.rb @@ -1,7 +1,7 @@ class ChangeRolesOnAndTo < ActiveRecord::Migration def self.up - change_column :roles, :on, :string, :default => '' - change_column :roles, :to, :string, :default => '' + change_column :roles, :on, :string, default: '' + change_column :roles, :to, :string, default: '' end def self.down diff --git a/db/migrate/20111028070604_remove_visibility_from_repositories.rb b/db/migrate/20111028070604_remove_visibility_from_repositories.rb index f9512b8e8..57f17152f 100644 --- a/db/migrate/20111028070604_remove_visibility_from_repositories.rb +++ b/db/migrate/20111028070604_remove_visibility_from_repositories.rb @@ -4,6 +4,6 @@ class RemoveVisibilityFromRepositories < ActiveRecord::Migration end def self.down - add_column :repositories, :visibility, :string, :default => "open" + add_column :repositories, :visibility, :string, default: "open" end end diff --git a/db/migrate/20111107211538_create_product_build_lists.rb b/db/migrate/20111107211538_create_product_build_lists.rb index 350444d9f..389db118a 100644 --- a/db/migrate/20111107211538_create_product_build_lists.rb +++ b/db/migrate/20111107211538_create_product_build_lists.rb @@ -2,7 +2,7 @@ class CreateProductBuildLists < ActiveRecord::Migration def self.up create_table :product_build_lists do |t| t.references :product - t.integer :status, :null => false, :default => ProductBuildList::BUILD_STARTED + t.integer :status, null: false, default: ProductBuildList::BUILD_STARTED t.datetime :notified_at t.timestamps diff --git a/db/migrate/20111123160010_drop_acl_tables.rb b/db/migrate/20111123160010_drop_acl_tables.rb index c05feb666..2e4c6d70f 100644 --- a/db/migrate/20111123160010_drop_acl_tables.rb +++ b/db/migrate/20111123160010_drop_acl_tables.rb @@ -16,9 +16,9 @@ class DropAclTables < ActiveRecord::Migration t.timestamps end create_table :rights do |t| - t.string "name", :null => false - t.string "controller", :null => false - t.string "action", :null => false + t.string "name", null: false + t.string "controller", null: false + t.string "action", null: false t.timestamps end create_table :role_lines do |t| @@ -29,10 +29,10 @@ class DropAclTables < ActiveRecord::Migration create_table :roles do |t| t.string "name" t.text "can_see" - t.string "on", :default => "" - t.string "to", :default => "" - t.boolean "use_default", :default => false - t.boolean "use_default_for_owner", :default => false + t.string "on", default: "" + t.string "to", default: "" + t.boolean "use_default", default: false + t.boolean "use_default_for_owner", default: false t.timestamps end diff --git a/db/migrate/20111216134039_create_issues.rb b/db/migrate/20111216134039_create_issues.rb index 8d6a47315..2269daa1b 100644 --- a/db/migrate/20111216134039_create_issues.rb +++ b/db/migrate/20111216134039_create_issues.rb @@ -11,7 +11,7 @@ class CreateIssues < ActiveRecord::Migration t.timestamps end - add_index :issues, [:project_id, :serial_id], :unique => true + add_index :issues, [:project_id, :serial_id], unique: true end def self.down diff --git a/db/migrate/20111219073859_add_has_issues_to_projects.rb b/db/migrate/20111219073859_add_has_issues_to_projects.rb index f0ea1e42c..ee7bafc5f 100644 --- a/db/migrate/20111219073859_add_has_issues_to_projects.rb +++ b/db/migrate/20111219073859_add_has_issues_to_projects.rb @@ -1,6 +1,6 @@ class AddHasIssuesToProjects < ActiveRecord::Migration def self.up - add_column :projects, :has_issues, :boolean, :default => true + add_column :projects, :has_issues, :boolean, default: true end def self.down diff --git a/db/migrate/20111221120208_add_has_wiki_to_projects.rb b/db/migrate/20111221120208_add_has_wiki_to_projects.rb index 8e411afd1..68105d7e4 100644 --- a/db/migrate/20111221120208_add_has_wiki_to_projects.rb +++ b/db/migrate/20111221120208_add_has_wiki_to_projects.rb @@ -1,6 +1,6 @@ class AddHasWikiToProjects < ActiveRecord::Migration def self.up - add_column :projects, :has_wiki, :boolean, :default => false + add_column :projects, :has_wiki, :boolean, default: false end def self.down diff --git a/db/migrate/20111228182425_add_auto_publish_to_build_lists.rb b/db/migrate/20111228182425_add_auto_publish_to_build_lists.rb index a9cb7d3bd..6fa3975c5 100644 --- a/db/migrate/20111228182425_add_auto_publish_to_build_lists.rb +++ b/db/migrate/20111228182425_add_auto_publish_to_build_lists.rb @@ -1,6 +1,6 @@ class AddAutoPublishToBuildLists < ActiveRecord::Migration def self.up - add_column :build_lists, :auto_publish, :boolean, :default => true + add_column :build_lists, :auto_publish, :boolean, default: true end def self.down diff --git a/db/migrate/20120111072106_create_settings_notifiers.rb b/db/migrate/20120111072106_create_settings_notifiers.rb index b8517a9e9..80d904f65 100644 --- a/db/migrate/20120111072106_create_settings_notifiers.rb +++ b/db/migrate/20120111072106_create_settings_notifiers.rb @@ -1,13 +1,13 @@ class CreateSettingsNotifiers < ActiveRecord::Migration def self.up create_table :settings_notifiers do |t| - t.integer :user_id, :null => false + t.integer :user_id, null: false - t.boolean :can_notify, :default => true - t.boolean :new_comment, :default => true - t.boolean :new_comment_reply, :default => true - t.boolean :new_issue, :default => true - t.boolean :issue_assign, :default => true + t.boolean :can_notify, default: true + t.boolean :new_comment, default: true + t.boolean :new_comment_reply, default: true + t.boolean :new_issue, default: true + t.boolean :issue_assign, default: true t.timestamps end diff --git a/db/migrate/20120113121748_add_issue_status_default_value.rb b/db/migrate/20120113121748_add_issue_status_default_value.rb index bbc58f3cc..3196f7d42 100644 --- a/db/migrate/20120113121748_add_issue_status_default_value.rb +++ b/db/migrate/20120113121748_add_issue_status_default_value.rb @@ -1,9 +1,9 @@ class AddIssueStatusDefaultValue < ActiveRecord::Migration def self.up - change_column :issues, :status, :string, :default => 'open' + change_column :issues, :status, :string, default: 'open' end def self.down - change_column :issues, :status, :string, :null => true + change_column :issues, :status, :string, null: true end end diff --git a/db/migrate/20120117110723_add_language_to_users.rb b/db/migrate/20120117110723_add_language_to_users.rb index 4bf0cec48..e452842e2 100644 --- a/db/migrate/20120117110723_add_language_to_users.rb +++ b/db/migrate/20120117110723_add_language_to_users.rb @@ -1,6 +1,6 @@ class AddLanguageToUsers < ActiveRecord::Migration def self.up - add_column :users, :language, :string, :default => 'en' + add_column :users, :language, :string, default: 'en' end def self.down diff --git a/db/migrate/20120118173141_add_settings_to_settings_notifiers.rb b/db/migrate/20120118173141_add_settings_to_settings_notifiers.rb index 89877b871..410f0f049 100644 --- a/db/migrate/20120118173141_add_settings_to_settings_notifiers.rb +++ b/db/migrate/20120118173141_add_settings_to_settings_notifiers.rb @@ -1,8 +1,8 @@ class AddSettingsToSettingsNotifiers < ActiveRecord::Migration def self.up - add_column :settings_notifiers, :new_comment_commit_owner, :boolean, :default => true - add_column :settings_notifiers, :new_comment_commit_repo_owner, :boolean, :default => true - add_column :settings_notifiers, :new_comment_commit_commentor, :boolean, :default => true + add_column :settings_notifiers, :new_comment_commit_owner, :boolean, default: true + add_column :settings_notifiers, :new_comment_commit_repo_owner, :boolean, default: true + add_column :settings_notifiers, :new_comment_commit_commentor, :boolean, default: true end def self.down diff --git a/db/migrate/20120123120400_add_status_to_subscribe.rb b/db/migrate/20120123120400_add_status_to_subscribe.rb index 69f24e6f9..5a53e7cea 100644 --- a/db/migrate/20120123120400_add_status_to_subscribe.rb +++ b/db/migrate/20120123120400_add_status_to_subscribe.rb @@ -1,6 +1,6 @@ class AddStatusToSubscribe < ActiveRecord::Migration def self.up - add_column :subscribes, :status, :boolean, :default => true + add_column :subscribes, :status, :boolean, default: true end def self.down diff --git a/db/migrate/20120124065207_create_activity_feeds.rb b/db/migrate/20120124065207_create_activity_feeds.rb index d5b13fc3a..1411e7186 100644 --- a/db/migrate/20120124065207_create_activity_feeds.rb +++ b/db/migrate/20120124065207_create_activity_feeds.rb @@ -1,7 +1,7 @@ class CreateActivityFeeds < ActiveRecord::Migration def self.up create_table :activity_feeds do |t| - t.integer :user_id, :null => false + t.integer :user_id, null: false t.string :kind t.text :data diff --git a/db/migrate/20120126214421_add_projects_count_to_users.rb b/db/migrate/20120126214421_add_projects_count_to_users.rb index 7ec5c436c..1358a16c6 100644 --- a/db/migrate/20120126214421_add_projects_count_to_users.rb +++ b/db/migrate/20120126214421_add_projects_count_to_users.rb @@ -1,6 +1,6 @@ class AddProjectsCountToUsers < ActiveRecord::Migration def self.up - add_column :users, :own_projects_count, :integer, :default => 0, :null => false + add_column :users, :own_projects_count, :integer, default: 0, null: false User.reset_column_information User.all.each do |user| diff --git a/db/migrate/20120126214447_add_projects_count_to_groups.rb b/db/migrate/20120126214447_add_projects_count_to_groups.rb index ed65a68ef..94040e29c 100644 --- a/db/migrate/20120126214447_add_projects_count_to_groups.rb +++ b/db/migrate/20120126214447_add_projects_count_to_groups.rb @@ -1,6 +1,6 @@ class AddProjectsCountToGroups < ActiveRecord::Migration def self.up - add_column :groups, :own_projects_count, :integer, :default => 0, :null => false + add_column :groups, :own_projects_count, :integer, default: 0, null: false Group.reset_column_information Group.all.each do |group| diff --git a/db/migrate/20120127141211_add_confirmable_to_users.rb b/db/migrate/20120127141211_add_confirmable_to_users.rb index 58be2ee72..66162a3bb 100644 --- a/db/migrate/20120127141211_add_confirmable_to_users.rb +++ b/db/migrate/20120127141211_add_confirmable_to_users.rb @@ -3,7 +3,7 @@ class AddConfirmableToUsers < ActiveRecord::Migration add_column :users, :confirmation_token, :string add_column :users, :confirmed_at, :datetime add_column :users, :confirmation_sent_at, :datetime - add_index :users, :confirmation_token, :unique => true + add_index :users, :confirmation_token, unique: true end def self.down diff --git a/db/migrate/20120127234602_add_index_for_projects_name.rb b/db/migrate/20120127234602_add_index_for_projects_name.rb index c82a885b7..11bffca68 100644 --- a/db/migrate/20120127234602_add_index_for_projects_name.rb +++ b/db/migrate/20120127234602_add_index_for_projects_name.rb @@ -1,7 +1,7 @@ class AddIndexForProjectsName < ActiveRecord::Migration def self.up - add_index :projects, [:name, :owner_id, :owner_type], :unique => true, :case_sensitive => false - add_index :project_imports, :name, :unique => true, :case_sensitive => false + add_index :projects, [:name, :owner_id, :owner_type], unique: true, case_sensitive: false + add_index :project_imports, :name, unique: true, case_sensitive: false end def self.down diff --git a/db/migrate/20120131124517_add_platform_reference_to_project_imports.rb b/db/migrate/20120131124517_add_platform_reference_to_project_imports.rb index a54942edf..a0a528947 100644 --- a/db/migrate/20120131124517_add_platform_reference_to_project_imports.rb +++ b/db/migrate/20120131124517_add_platform_reference_to_project_imports.rb @@ -2,12 +2,12 @@ class AddPlatformReferenceToProjectImports < ActiveRecord::Migration def self.up add_column :project_imports, :platform_id, :integer remove_index :project_imports, :name - add_index :project_imports, [:name, :platform_id], :unique => true, :case_sensitive => false + add_index :project_imports, [:name, :platform_id], unique: true, case_sensitive: false end def self.down remove_index :project_imports, [:name, :platform_id] - add_index :project_imports, :name, :unique => true, :case_sensitive => false + add_index :project_imports, :name, unique: true, case_sensitive: false remove_column :project_imports, :platform_id end end diff --git a/db/migrate/20120206225130_change_commentable_id_to_decimal.rb b/db/migrate/20120206225130_change_commentable_id_to_decimal.rb index 799e1f8d9..83d38691b 100644 --- a/db/migrate/20120206225130_change_commentable_id_to_decimal.rb +++ b/db/migrate/20120206225130_change_commentable_id_to_decimal.rb @@ -1,6 +1,6 @@ class ChangeCommentableIdToDecimal < ActiveRecord::Migration def up - add_column :comments, :commentable_id_tmp, :decimal, :precision => 50, :scale => 0 + add_column :comments, :commentable_id_tmp, :decimal, precision: 50, scale: 0 Comment.reset_column_information Comment.all.each {|c| c.update_column :commentable_id_tmp, (c.commentable_type == 'Grit::Commit' ? c.commentable_id.hex : c.commentable_id.to_i)} remove_column :comments, :commentable_id diff --git a/db/migrate/20120209135822_create_register_requests.rb b/db/migrate/20120209135822_create_register_requests.rb index 6ae743fa7..a58d9f51a 100644 --- a/db/migrate/20120209135822_create_register_requests.rb +++ b/db/migrate/20120209135822_create_register_requests.rb @@ -4,13 +4,13 @@ class CreateRegisterRequests < ActiveRecord::Migration t.string :name t.string :email t.string :token - t.boolean :approved, :default => false - t.boolean :rejected, :default => false + t.boolean :approved, default: false + t.boolean :rejected, default: false t.timestamps end - add_index :register_requests, [:email], :unique => true, :case_sensitive => false - add_index :register_requests, [:token], :unique => true, :case_sensitive => false + add_index :register_requests, [:email], unique: true, case_sensitive: false + add_index :register_requests, [:token], unique: true, case_sensitive: false end def self.down diff --git a/db/migrate/20120214021626_change_subscribeable_id_to_decimal.rb b/db/migrate/20120214021626_change_subscribeable_id_to_decimal.rb index 177244e40..fe5351429 100644 --- a/db/migrate/20120214021626_change_subscribeable_id_to_decimal.rb +++ b/db/migrate/20120214021626_change_subscribeable_id_to_decimal.rb @@ -1,6 +1,6 @@ class ChangeSubscribeableIdToDecimal < ActiveRecord::Migration def up - add_column :subscribes, :subscribeable_id_tmp, :decimal, :precision => 50, :scale => 0 + add_column :subscribes, :subscribeable_id_tmp, :decimal, precision: 50, scale: 0 Subscribe.reset_column_information Subscribe.all.each {|c| c.update_column :subscribeable_id_tmp, (c.subscribeable_type == 'Grit::Commit' ? c.subscribeable_id.hex : c.subscribeable_id.to_i)} remove_column :subscribes, :subscribeable_id diff --git a/db/migrate/20120220131333_add_default_branch_to_projects.rb b/db/migrate/20120220131333_add_default_branch_to_projects.rb index 977441b11..b6d298c9e 100644 --- a/db/migrate/20120220131333_add_default_branch_to_projects.rb +++ b/db/migrate/20120220131333_add_default_branch_to_projects.rb @@ -1,6 +1,6 @@ class AddDefaultBranchToProjects < ActiveRecord::Migration def change - add_column :projects, :default_branch, :string, :default => 'master' + add_column :projects, :default_branch, :string, default: 'master' end end diff --git a/db/migrate/20120220175615_create_labels.rb b/db/migrate/20120220175615_create_labels.rb index b10b80ea7..a9d0a9f92 100644 --- a/db/migrate/20120220175615_create_labels.rb +++ b/db/migrate/20120220175615_create_labels.rb @@ -1,15 +1,15 @@ class CreateLabels < ActiveRecord::Migration def change create_table :labels do |t| - t.string :name, :null => false - t.string :color, :null => false + t.string :name, null: false + t.string :color, null: false t.references :project t.timestamps end create_table :labelings do |t| - t.references :label, :null => false + t.references :label, null: false t.references :issue t.timestamps diff --git a/db/migrate/20120220185458_remove_repositories_owner.rb b/db/migrate/20120220185458_remove_repositories_owner.rb index 88c85a855..4b940b5ad 100644 --- a/db/migrate/20120220185458_remove_repositories_owner.rb +++ b/db/migrate/20120220185458_remove_repositories_owner.rb @@ -2,7 +2,7 @@ class RemoveRepositoriesOwner < ActiveRecord::Migration def self.up remove_column :repositories, :owner_id remove_column :repositories, :owner_type - Relation.delete_all(:target_type => 'Repository') + Relation.delete_all(target_type: 'Repository') end def self.down diff --git a/db/migrate/20120224122738_add_is_rpm_to_projects.rb b/db/migrate/20120224122738_add_is_rpm_to_projects.rb index 1df769ab8..153978982 100644 --- a/db/migrate/20120224122738_add_is_rpm_to_projects.rb +++ b/db/migrate/20120224122738_add_is_rpm_to_projects.rb @@ -1,5 +1,5 @@ class AddIsRpmToProjects < ActiveRecord::Migration def change - add_column :projects, :is_rpm, :boolean, :default => true + add_column :projects, :is_rpm, :boolean, default: true end end diff --git a/db/migrate/20120229182356_add_default_values_to_is_rpm_for_projects.rb b/db/migrate/20120229182356_add_default_values_to_is_rpm_for_projects.rb index 4c223d2db..7c4df5cd9 100644 --- a/db/migrate/20120229182356_add_default_values_to_is_rpm_for_projects.rb +++ b/db/migrate/20120229182356_add_default_values_to_is_rpm_for_projects.rb @@ -1,5 +1,5 @@ class AddDefaultValuesToIsRpmForProjects < ActiveRecord::Migration def change - Project.update_all(:is_rpm => true) + Project.update_all(is_rpm: true) end end diff --git a/db/migrate/20120306212914_add_project_to_comment.rb b/db/migrate/20120306212914_add_project_to_comment.rb index 14e40abd9..82e7a85fa 100644 --- a/db/migrate/20120306212914_add_project_to_comment.rb +++ b/db/migrate/20120306212914_add_project_to_comment.rb @@ -2,8 +2,8 @@ class AddProjectToComment < ActiveRecord::Migration def up add_column :comments, :project_id, :integer Subscribe.reset_column_information - Comment.where(:commentable_type => 'Grit::Commit').destroy_all - Comment.where(:commentable_type => 'Issue').each do |comment| + Comment.where(commentable_type: 'Grit::Commit').destroy_all + Comment.where(commentable_type: 'Issue').each do |comment| comment.update_column(:project_id, comment.commentable.project.id) end end diff --git a/db/migrate/20120314223151_remove_is_template_from_products.rb b/db/migrate/20120314223151_remove_is_template_from_products.rb index b130c4f1a..069086ad6 100644 --- a/db/migrate/20120314223151_remove_is_template_from_products.rb +++ b/db/migrate/20120314223151_remove_is_template_from_products.rb @@ -4,6 +4,6 @@ class RemoveIsTemplateFromProducts < ActiveRecord::Migration end def down - add_column :products, "is_template", :boolean, :default => false + add_column :products, "is_template", :boolean, default: false end end diff --git a/db/migrate/20120320102912_add_build_list_priority.rb b/db/migrate/20120320102912_add_build_list_priority.rb index 48c650f19..9e33697d8 100644 --- a/db/migrate/20120320102912_add_build_list_priority.rb +++ b/db/migrate/20120320102912_add_build_list_priority.rb @@ -1,6 +1,6 @@ class AddBuildListPriority < ActiveRecord::Migration def self.up - add_column :build_lists, :priority, :integer, :null => false, :default => 0 + add_column :build_lists, :priority, :integer, null: false, default: 0 end def self.down diff --git a/db/migrate/20120321130436_add_devise_lockable.rb b/db/migrate/20120321130436_add_devise_lockable.rb index 0d242536d..7c77cdf86 100644 --- a/db/migrate/20120321130436_add_devise_lockable.rb +++ b/db/migrate/20120321130436_add_devise_lockable.rb @@ -1,8 +1,8 @@ class AddDeviseLockable < ActiveRecord::Migration def change - add_column :users, :failed_attempts, :integer, :default => 0 # Only if lock strategy is :failed_attempts + add_column :users, :failed_attempts, :integer, default: 0 # Only if lock strategy is :failed_attempts add_column :users, :unlock_token, :string # Only if unlock strategy is :email or :both add_column :users, :locked_at, :datetime - add_index :users, :unlock_token, :unique => true + add_index :users, :unlock_token, unique: true end end diff --git a/db/migrate/20120329181830_remove_auto_build_list.rb b/db/migrate/20120329181830_remove_auto_build_list.rb index 9fd5db61f..58f28c300 100644 --- a/db/migrate/20120329181830_remove_auto_build_list.rb +++ b/db/migrate/20120329181830_remove_auto_build_list.rb @@ -4,7 +4,7 @@ class RemoveAutoBuildList < ActiveRecord::Migration end def self.down - create_table :auto_build_lists, :force => true do |t| + create_table :auto_build_lists, force: true do |t| t.integer "project_id" t.integer "arch_id" t.integer "pl_id" diff --git a/db/migrate/20120329182602_delete_categories.rb b/db/migrate/20120329182602_delete_categories.rb index 21d2bb7da..1039cbd75 100644 --- a/db/migrate/20120329182602_delete_categories.rb +++ b/db/migrate/20120329182602_delete_categories.rb @@ -5,10 +5,10 @@ class DeleteCategories < ActiveRecord::Migration end def self.down - create_table :categories, :force => true do |t| + create_table :categories, force: true do |t| t.string "name" t.string "ancestry" - t.integer "projects_count", :default => 0, :null => false + t.integer "projects_count", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" end diff --git a/db/migrate/20120330201229_remove_containers_and_rpms.rb b/db/migrate/20120330201229_remove_containers_and_rpms.rb index ac1dca3b8..a3a1874d6 100644 --- a/db/migrate/20120330201229_remove_containers_and_rpms.rb +++ b/db/migrate/20120330201229_remove_containers_and_rpms.rb @@ -6,21 +6,21 @@ class RemoveContainersAndRpms < ActiveRecord::Migration def down create_table "containers" do |t| - t.string "name", :null => false - t.integer "project_id", :null => false - t.integer "owner_id", :null => false + t.string "name", null: false + t.integer "project_id", null: false + t.integer "owner_id", null: false t.datetime "created_at" t.datetime "updated_at" end create_table "rpms" do |t| - t.string "name", :null => false - t.integer "arch_id", :null => false - t.integer "project_id", :null => false + t.string "name", null: false + t.integer "arch_id", null: false + t.integer "project_id", null: false t.datetime "created_at" t.datetime "updated_at" end - add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id" - add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id" + add_index "rpms", ["project_id", "arch_id"], name: "index_rpms_on_project_id_and_arch_id" + add_index "rpms", ["project_id"], name: "index_rpms_on_project_id" end end diff --git a/db/migrate/20120331180541_customize_platform.rb b/db/migrate/20120331180541_customize_platform.rb index 013e15e26..ec66059f6 100644 --- a/db/migrate/20120331180541_customize_platform.rb +++ b/db/migrate/20120331180541_customize_platform.rb @@ -5,7 +5,7 @@ class CustomizePlatform < ActiveRecord::Migration change_column_null :platforms, :platform_type, false change_column_null :platforms, :released, false change_column_null :platforms, :visibility, false - add_index "platforms", ["name"], :unique => true, :case_sensitive => false + add_index "platforms", ["name"], unique: true, case_sensitive: false end def self.down @@ -15,5 +15,5 @@ class CustomizePlatform < ActiveRecord::Migration change_column_null :platforms, :released, true change_column_null :platforms, :visibility, true remove_index "platforms", ["name"] - end + end end diff --git a/db/migrate/20120403110931_clear_product.rb b/db/migrate/20120403110931_clear_product.rb index 2db0348ed..540046808 100644 --- a/db/migrate/20120403110931_clear_product.rb +++ b/db/migrate/20120403110931_clear_product.rb @@ -6,8 +6,8 @@ class ClearProduct < ActiveRecord::Migration end def self.down - add_column :products, :build_status, :integer, :default => 2, :null => false + add_column :products, :build_status, :integer, default: 2, null: false add_column :products, :build_path, :string - add_column :products, :system_wide, :boolean, :default => false + add_column :products, :system_wide, :boolean, default: false end end diff --git a/db/migrate/20120404134602_modify_default_queue.rb b/db/migrate/20120404134602_modify_default_queue.rb index e8aebf214..41437871f 100644 --- a/db/migrate/20120404134602_modify_default_queue.rb +++ b/db/migrate/20120404134602_modify_default_queue.rb @@ -1,11 +1,11 @@ class ModifyDefaultQueue < ActiveRecord::Migration def up - change_column :delayed_jobs, :queue, :string, :default => 'default' + change_column :delayed_jobs, :queue, :string, default: 'default' execute "UPDATE delayed_jobs SET queue = 'default'" end def down - change_column :delayed_jobs, :queue, :string, :default => nil + change_column :delayed_jobs, :queue, :string, default: nil execute "UPDATE delayed_jobs SET queue = null" end end diff --git a/db/migrate/20120412173938_create_pull_requests.rb b/db/migrate/20120412173938_create_pull_requests.rb index 618ccef61..7f2ae0a68 100644 --- a/db/migrate/20120412173938_create_pull_requests.rb +++ b/db/migrate/20120412173938_create_pull_requests.rb @@ -1,11 +1,11 @@ class CreatePullRequests < ActiveRecord::Migration def change create_table :pull_requests do |t| - t.integer :issue_id, :null => false - t.integer :base_project_id, :null => false - t.integer :head_project_id, :null => false - t.string :base_ref, :null => false - t.string :head_ref, :null => false + t.integer :issue_id, null: false + t.integer :base_project_id, null: false + t.integer :head_project_id, null: false + t.string :base_ref, null: false + t.string :head_ref, null: false end end end diff --git a/db/migrate/20120413102757_build_average_time.rb b/db/migrate/20120413102757_build_average_time.rb index 07bff36e5..35232ebec 100644 --- a/db/migrate/20120413102757_build_average_time.rb +++ b/db/migrate/20120413102757_build_average_time.rb @@ -1,9 +1,9 @@ class BuildAverageTime < ActiveRecord::Migration def change - add_column :projects, :average_build_time, :integer, :null => false, :default => 0 - add_column :projects, :build_count, :integer, :null => false, :default => 0 + add_column :projects, :average_build_time, :integer, null: false, default: 0 + add_column :projects, :build_count, :integer, null: false, default: 0 end - ActivityFeed.where(:kind => 'build_list_notification').destroy_all + ActivityFeed.where(kind: 'build_list_notification').destroy_all end diff --git a/db/migrate/20120417133722_remove_downloads.rb b/db/migrate/20120417133722_remove_downloads.rb index 40c07f4d9..bf1c761c7 100644 --- a/db/migrate/20120417133722_remove_downloads.rb +++ b/db/migrate/20120417133722_remove_downloads.rb @@ -4,12 +4,12 @@ class RemoveDownloads < ActiveRecord::Migration end def down - create_table "downloads", :force => true do |t| - t.string "name", :null => false + create_table "downloads", force: true do |t| + t.string "name", null: false t.string "version" t.string "distro" t.string "platform" - t.integer "counter", :default => 0 + t.integer "counter", default: 0 t.datetime "created_at" t.datetime "updated_at" end diff --git a/db/migrate/20120428053303_create_advisories.rb b/db/migrate/20120428053303_create_advisories.rb index e1a6ee8fc..8886e2aea 100644 --- a/db/migrate/20120428053303_create_advisories.rb +++ b/db/migrate/20120428053303_create_advisories.rb @@ -3,13 +3,13 @@ class CreateAdvisories < ActiveRecord::Migration create_table :advisories do |t| t.string :advisory_id t.integer :project_id - t.text :description, :default => '' - t.text :references, :default => '' - t.text :update_type, :default => '' + t.text :description, default: '' + t.text :references, default: '' + t.text :update_type, default: '' t.timestamps end - add_index :advisories, :advisory_id, :unique => true + add_index :advisories, :advisory_id, unique: true add_index :advisories, :project_id add_index :advisories, :update_type end diff --git a/db/migrate/20120428054604_create_advisories_platforms.rb b/db/migrate/20120428054604_create_advisories_platforms.rb index aded3af7b..c7c1d01c8 100644 --- a/db/migrate/20120428054604_create_advisories_platforms.rb +++ b/db/migrate/20120428054604_create_advisories_platforms.rb @@ -1,18 +1,18 @@ class CreateAdvisoriesPlatforms < ActiveRecord::Migration def up - create_table :advisories_platforms, :id => false do |t| + create_table :advisories_platforms, id: false do |t| t.integer :advisory_id t.integer :platform_id end add_index :advisories_platforms, :advisory_id add_index :advisories_platforms, :platform_id - add_index :advisories_platforms, [:advisory_id, :platform_id], :name => :advisory_platform_index, :unique => true + add_index :advisories_platforms, [:advisory_id, :platform_id], name: :advisory_platform_index, unique: true end def down - remove_index :advisories_platforms, :column => :advisory_id - remove_index :advisories_platforms, :column => :platform_id - remove_index :advisories_platforms, :name => :advisory_platform_index + remove_index :advisories_platforms, column: :advisory_id + remove_index :advisories_platforms, column: :platform_id + remove_index :advisories_platforms, name: :advisory_platform_index drop_table :advisories_platforms end end diff --git a/db/migrate/20120505101650_add_build_priority_to_users.rb b/db/migrate/20120505101650_add_build_priority_to_users.rb index 45e2efae3..d3cfcc7da 100644 --- a/db/migrate/20120505101650_add_build_priority_to_users.rb +++ b/db/migrate/20120505101650_add_build_priority_to_users.rb @@ -1,7 +1,7 @@ class AddBuildPriorityToUsers < ActiveRecord::Migration def up - add_column :users, :build_priority, :integer, :default => 50 - User.update_all :build_priority => 50 + add_column :users, :build_priority, :integer, default: 50 + User.update_all build_priority: 50 end def down diff --git a/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb index 1d56f3d15..bc3ba80e3 100644 --- a/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb +++ b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb @@ -1,11 +1,11 @@ class RenameIsRpmToIsPackageInProjects < ActiveRecord::Migration def up rename_column :projects, :is_rpm, :is_package - change_column :projects, :is_package, :boolean, :default => true, :null => false + change_column :projects, :is_package, :boolean, default: true, null: false end def down rename_column :projects, :is_package, :is_rpm - change_column :projects, :is_package, :boolean, :default => true + change_column :projects, :is_package, :boolean, default: true end end diff --git a/db/migrate/20120524132504_set_mass_build_user_id_to_first_if_nil.rb b/db/migrate/20120524132504_set_mass_build_user_id_to_first_if_nil.rb index d4c053170..c0228c810 100644 --- a/db/migrate/20120524132504_set_mass_build_user_id_to_first_if_nil.rb +++ b/db/migrate/20120524132504_set_mass_build_user_id_to_first_if_nil.rb @@ -1,6 +1,6 @@ class SetMassBuildUserIdToFirstIfNil < ActiveRecord::Migration def up - MassBuild.update_all(:user_id => nil, :user_id => 1) + MassBuild.update_all(user_id: nil, user_id: 1) end def down diff --git a/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb b/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb index d9e595b7f..5de29b2db 100644 --- a/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb +++ b/db/migrate/20120529130537_add_default_false_to_auto_publish_of_mass_builds.rb @@ -1,5 +1,5 @@ class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration def change - change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false + change_column :mass_builds, :auto_publish, :boolean, default: false, null: false end end diff --git a/db/migrate/20120607153342_add_many_projects_to_advisories.rb b/db/migrate/20120607153342_add_many_projects_to_advisories.rb index 80ed9ad62..22229fe19 100644 --- a/db/migrate/20120607153342_add_many_projects_to_advisories.rb +++ b/db/migrate/20120607153342_add_many_projects_to_advisories.rb @@ -1,12 +1,12 @@ class AddManyProjectsToAdvisories < ActiveRecord::Migration def up - create_table :advisories_projects, :id => false do |t| + create_table :advisories_projects, id: false do |t| t.integer :advisory_id t.integer :project_id end add_index :advisories_projects, :advisory_id add_index :advisories_projects, :project_id - add_index :advisories_projects, [:advisory_id, :project_id], :name => :advisory_project_index, :unique => true + add_index :advisories_projects, [:advisory_id, :project_id], name: :advisory_project_index, unique: true Advisory.find_in_batches do |b| b.each do |advisory| @@ -32,9 +32,9 @@ class AddManyProjectsToAdvisories < ActiveRecord::Migration end end - remove_index :advisories_projects, :column => :advisory_id - remove_index :advisories_projects, :column => :project_id - remove_index :advisories_projects, :name => :advisory_project_index + remove_index :advisories_projects, column: :advisory_id + remove_index :advisories_projects, column: :project_id + remove_index :advisories_projects, name: :advisory_project_index drop_table :advisories_projects end end diff --git a/db/migrate/20120609163454_drop_delayed_jobs.rb b/db/migrate/20120609163454_drop_delayed_jobs.rb index c1113565e..f22e0ca0b 100644 --- a/db/migrate/20120609163454_drop_delayed_jobs.rb +++ b/db/migrate/20120609163454_drop_delayed_jobs.rb @@ -5,8 +5,8 @@ class DropDelayedJobs < ActiveRecord::Migration def down create_table :delayed_jobs do |t| - t.integer "priority", :default => 0 - t.integer "attempts", :default => 0 + t.integer "priority", default: 0 + t.integer "attempts", default: 0 t.text "handler" t.text "last_error" t.datetime "run_at" @@ -15,8 +15,8 @@ class DropDelayedJobs < ActiveRecord::Migration t.string "locked_by" t.datetime "created_at" t.datetime "updated_at" - t.string "queue", :default => "default" + t.string "queue", default: "default" end - add_index :delayed_jobs, ["priority", "run_at"], :name => "delayed_jobs_priority" + add_index :delayed_jobs, ["priority", "run_at"], name: "delayed_jobs_priority" end end diff --git a/db/migrate/20120622092725_add_counters_to_mass_builds.rb b/db/migrate/20120622092725_add_counters_to_mass_builds.rb index 5b0ed2e73..504e33eed 100644 --- a/db/migrate/20120622092725_add_counters_to_mass_builds.rb +++ b/db/migrate/20120622092725_add_counters_to_mass_builds.rb @@ -1,10 +1,10 @@ class AddCountersToMassBuilds < ActiveRecord::Migration def change - add_column :mass_builds, :build_lists_count, :integer, :default => 0 - add_column :mass_builds, :build_published_count, :integer, :default => 0 - add_column :mass_builds, :build_pending_count, :integer, :default => 0 - add_column :mass_builds, :build_started_count, :integer, :default => 0 - add_column :mass_builds, :build_publish_count, :integer, :default => 0 - add_column :mass_builds, :build_error_count, :integer, :default => 0 + add_column :mass_builds, :build_lists_count, :integer, default: 0 + add_column :mass_builds, :build_published_count, :integer, default: 0 + add_column :mass_builds, :build_pending_count, :integer, default: 0 + add_column :mass_builds, :build_started_count, :integer, default: 0 + add_column :mass_builds, :build_publish_count, :integer, default: 0 + add_column :mass_builds, :build_error_count, :integer, default: 0 end end diff --git a/db/migrate/20120629134216_add_stop_build_to_mass_builds.rb b/db/migrate/20120629134216_add_stop_build_to_mass_builds.rb index 1e92dbc34..980fd166f 100644 --- a/db/migrate/20120629134216_add_stop_build_to_mass_builds.rb +++ b/db/migrate/20120629134216_add_stop_build_to_mass_builds.rb @@ -1,5 +1,5 @@ class AddStopBuildToMassBuilds < ActiveRecord::Migration def change - add_column :mass_builds, :stop_build, :boolean, :null => false, :default => false + add_column :mass_builds, :stop_build, :boolean, null: false, default: false end end diff --git a/db/migrate/20120703101719_add_null_false_to_mass_builds_counters.rb b/db/migrate/20120703101719_add_null_false_to_mass_builds_counters.rb index 6ae37a904..31738850d 100644 --- a/db/migrate/20120703101719_add_null_false_to_mass_builds_counters.rb +++ b/db/migrate/20120703101719_add_null_false_to_mass_builds_counters.rb @@ -1,10 +1,10 @@ class AddNullFalseToMassBuildsCounters < ActiveRecord::Migration def change - change_column :mass_builds, :build_lists_count, :integer, :default => 0, :null => false - change_column :mass_builds, :build_published_count, :integer, :default => 0, :null => false - change_column :mass_builds, :build_pending_count, :integer, :default => 0, :null => false - change_column :mass_builds, :build_started_count, :integer, :default => 0, :null => false - change_column :mass_builds, :build_publish_count, :integer, :default => 0, :null => false - change_column :mass_builds, :build_error_count, :integer, :default => 0, :null => false + change_column :mass_builds, :build_lists_count, :integer, default: 0, null: false + change_column :mass_builds, :build_published_count, :integer, default: 0, null: false + change_column :mass_builds, :build_pending_count, :integer, default: 0, null: false + change_column :mass_builds, :build_started_count, :integer, default: 0, null: false + change_column :mass_builds, :build_publish_count, :integer, default: 0, null: false + change_column :mass_builds, :build_error_count, :integer, default: 0, null: false end end diff --git a/db/migrate/20120719045806_create_flash_notifies.rb b/db/migrate/20120719045806_create_flash_notifies.rb index 2a9f16a29..9477cd851 100644 --- a/db/migrate/20120719045806_create_flash_notifies.rb +++ b/db/migrate/20120719045806_create_flash_notifies.rb @@ -1,10 +1,10 @@ class CreateFlashNotifies < ActiveRecord::Migration def change create_table :flash_notifies do |t| - t.text :body_ru, :null => false - t.text :body_en, :null => false - t.string :status, :null => false - t.boolean :published, :null => false, :default => true + t.text :body_ru, null: false + t.text :body_en, null: false + t.string :status, null: false + t.boolean :published, null: false, default: true t.timestamps end end diff --git a/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb b/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb index 87baab1d8..2791c9a8c 100644 --- a/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb +++ b/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb @@ -2,7 +2,7 @@ class AddSaveToRepositoryToBuildLists < ActiveRecord::Migration def self.up add_column :build_lists, :save_to_repository_id, :integer - BuildList.scoped.includes(:project => :repositories, :save_to_platform => :repositories).find_in_batches do |batch| + BuildList.scoped.includes(project: :repositories, save_to_platform: :repositories).find_in_batches do |batch| batch.each do |bl| begin project = bl.project diff --git a/db/migrate/20120730214052_disable_null_value_for_key_pairs.rb b/db/migrate/20120730214052_disable_null_value_for_key_pairs.rb index e1d71ec52..3dceb28e8 100644 --- a/db/migrate/20120730214052_disable_null_value_for_key_pairs.rb +++ b/db/migrate/20120730214052_disable_null_value_for_key_pairs.rb @@ -1,16 +1,16 @@ class DisableNullValueForKeyPairs < ActiveRecord::Migration def up change_column_null :key_pairs, :repository_id, false - change_column_null :key_pairs, :user_id, false - change_column_null :key_pairs, :key_id, false + change_column_null :key_pairs, :user_id, false + change_column_null :key_pairs, :key_id, false change_column_null :key_pairs, :public, false - add_index :key_pairs, :repository_id, :unique => true + add_index :key_pairs, :repository_id, unique: true end def down change_column_null :key_pairs, :repository_id, true - change_column_null :key_pairs, :user_id, true - change_column_null :key_pairs, :key_id, true + change_column_null :key_pairs, :user_id, true + change_column_null :key_pairs, :key_id, true change_column_null :key_pairs, :public, true remove_index :key_pairs, :repository_id end diff --git a/db/migrate/20120822210712_add_actual_to_build_list_packages.rb b/db/migrate/20120822210712_add_actual_to_build_list_packages.rb index 847eed97e..47778e3ed 100644 --- a/db/migrate/20120822210712_add_actual_to_build_list_packages.rb +++ b/db/migrate/20120822210712_add_actual_to_build_list_packages.rb @@ -1,14 +1,14 @@ class AddActualToBuildListPackages < ActiveRecord::Migration def self.up - add_column :build_list_packages, :actual, :boolean, :default => false + add_column :build_list_packages, :actual, :boolean, default: false add_index :build_list_packages, [:actual, :platform_id] add_index :build_lists, [:project_id, :save_to_repository_id, :build_for_platform_id, :arch_id], - :name => :maintainer_search_index + name: :maintainer_search_index end def self.down remove_index :build_list_packages, [:actual, :platform_id] remove_column :build_list_packages, :actual - remove_index :build_lists, :name => :maintainer_search_index + remove_index :build_lists, name: :maintainer_search_index end end diff --git a/db/migrate/20120906115648_add_publish_without_qa_to_repositories.rb b/db/migrate/20120906115648_add_publish_without_qa_to_repositories.rb index c3f83e01e..cc7a1b13c 100644 --- a/db/migrate/20120906115648_add_publish_without_qa_to_repositories.rb +++ b/db/migrate/20120906115648_add_publish_without_qa_to_repositories.rb @@ -1,7 +1,7 @@ class AddPublishWithoutQaToRepositories < ActiveRecord::Migration class Platform < ActiveRecord::Base - has_many :repositories, :dependent => :destroy + has_many :repositories, dependent: :destroy end class Repository < ActiveRecord::Base @@ -9,9 +9,9 @@ class AddPublishWithoutQaToRepositories < ActiveRecord::Migration end def up - add_column :repositories, :publish_without_qa, :boolean, :default => true - Platform.where(:released => true).each{|p| p.repositories.update_all(:publish_without_qa => false)} - Platform.where(:released => false).each{|p| p.repositories.update_all(:publish_without_qa => true)} + add_column :repositories, :publish_without_qa, :boolean, default: true + Platform.where(released: true).each{|p| p.repositories.update_all(publish_without_qa: false)} + Platform.where(released: false).each{|p| p.repositories.update_all(publish_without_qa: true)} end def down diff --git a/db/migrate/20120914160741_add_build_list_notifications_to_settings_notifier.rb b/db/migrate/20120914160741_add_build_list_notifications_to_settings_notifier.rb index e94e14128..3123cd274 100644 --- a/db/migrate/20120914160741_add_build_list_notifications_to_settings_notifier.rb +++ b/db/migrate/20120914160741_add_build_list_notifications_to_settings_notifier.rb @@ -1,6 +1,6 @@ class AddBuildListNotificationsToSettingsNotifier < ActiveRecord::Migration def change - add_column :settings_notifiers, :new_build, :boolean, :default => true - add_column :settings_notifiers, :new_associated_build, :boolean, :default => true + add_column :settings_notifiers, :new_build, :boolean, default: true + add_column :settings_notifiers, :new_associated_build, :boolean, default: true end end diff --git a/db/migrate/20121206143724_add_list_to_mass_build.rb b/db/migrate/20121206143724_add_list_to_mass_build.rb index 3bca325e6..a08177cda 100644 --- a/db/migrate/20121206143724_add_list_to_mass_build.rb +++ b/db/migrate/20121206143724_add_list_to_mass_build.rb @@ -1,7 +1,7 @@ class AddListToMassBuild < ActiveRecord::Migration def change add_column :mass_builds, :projects_list, :text - add_column :mass_builds, :missed_projects_count, :integer, :default => 0, :null => false + add_column :mass_builds, :missed_projects_count, :integer, default: 0, null: false add_column :mass_builds, :missed_projects_list, :text end end diff --git a/db/migrate/20121211132948_add_indexes.rb b/db/migrate/20121211132948_add_indexes.rb index 8357e4b19..32a4707ef 100644 --- a/db/migrate/20121211132948_add_indexes.rb +++ b/db/migrate/20121211132948_add_indexes.rb @@ -1,6 +1,6 @@ class AddIndexes < ActiveRecord::Migration def change - add_index :project_to_repositories, [:repository_id, :project_id], :unique => true + add_index :project_to_repositories, [:repository_id, :project_id], unique: true add_index :repositories, :platform_id end end diff --git a/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb b/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb index 0e35c4726..514a8f6ea 100644 --- a/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb +++ b/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb @@ -4,14 +4,14 @@ class AddEncryptedSecretToKeyPairs < ActiveRecord::Migration rename_index :key_pairs_backup, 'index_key_pairs_on_repository_id', 'index_key_pairs_backup_on_repository_id' create_table :key_pairs do |t| - t.text :public, :null => false - t.text :encrypted_secret, :null => false - t.string :key_id, :null => false - t.references :user, :null => false - t.references :repository, :null => false + t.text :public, null: false + t.text :encrypted_secret, null: false + t.string :key_id, null: false + t.references :user, null: false + t.references :repository, null: false t.timestamps end - add_index :key_pairs, :repository_id, :unique => true + add_index :key_pairs, :repository_id, unique: true end def down diff --git a/db/migrate/20121224125838_remove_build_requires_from_build_list.rb b/db/migrate/20121224125838_remove_build_requires_from_build_list.rb index bcfe3c6a1..512dbf729 100644 --- a/db/migrate/20121224125838_remove_build_requires_from_build_list.rb +++ b/db/migrate/20121224125838_remove_build_requires_from_build_list.rb @@ -4,6 +4,6 @@ class RemoveBuildRequiresFromBuildList < ActiveRecord::Migration end def down - add_column :build_lists, :build_requires, :boolean, :default => false + add_column :build_lists, :build_requires, :boolean, default: false end end diff --git a/db/migrate/20121225103309_add_new_core_to_mass_build.rb b/db/migrate/20121225103309_add_new_core_to_mass_build.rb index 0d04e5df0..af782941b 100644 --- a/db/migrate/20121225103309_add_new_core_to_mass_build.rb +++ b/db/migrate/20121225103309_add_new_core_to_mass_build.rb @@ -1,5 +1,5 @@ class AddNewCoreToMassBuild < ActiveRecord::Migration def change - add_column :mass_builds, :new_core, :boolean, :default => false + add_column :mass_builds, :new_core, :boolean, default: false end end diff --git a/db/migrate/20130119125710_set_default_value_for_new_core.rb b/db/migrate/20130119125710_set_default_value_for_new_core.rb index 9d92a9376..18d9d6d9b 100644 --- a/db/migrate/20130119125710_set_default_value_for_new_core.rb +++ b/db/migrate/20130119125710_set_default_value_for_new_core.rb @@ -1,9 +1,9 @@ class SetDefaultValueForNewCore < ActiveRecord::Migration def up - change_column :build_lists, :new_core, :boolean, :default => true + change_column :build_lists, :new_core, :boolean, default: true end def down - change_column :build_lists, :new_core, :boolean, :default => nil + change_column :build_lists, :new_core, :boolean, default: nil end end diff --git a/db/migrate/20130128123151_add_container_status_to_build_list.rb b/db/migrate/20130128123151_add_container_status_to_build_list.rb index 054b40b39..a63349194 100644 --- a/db/migrate/20130128123151_add_container_status_to_build_list.rb +++ b/db/migrate/20130128123151_add_container_status_to_build_list.rb @@ -6,7 +6,7 @@ class AddContainerStatusToBuildList < ActiveRecord::Migration def up add_column :build_lists, :container_status, :integer remove_column :build_lists, :container_path - BuildList.where(:container_status => nil).update_all(:container_status => BuildList::WAITING_FOR_RESPONSE) + BuildList.where(container_status: nil).update_all(container_status: BuildList::WAITING_FOR_RESPONSE) end def down diff --git a/db/migrate/20130129145833_add_counters_to_mass_build.rb b/db/migrate/20130129145833_add_counters_to_mass_build.rb index f67ca4214..2a623445f 100644 --- a/db/migrate/20130129145833_add_counters_to_mass_build.rb +++ b/db/migrate/20130129145833_add_counters_to_mass_build.rb @@ -1,13 +1,13 @@ class AddCountersToMassBuild < ActiveRecord::Migration def up - add_column :mass_builds, :success_count, :integer, :default => 0, :null => false - add_column :mass_builds, :build_canceled_count, :integer, :default => 0, :null => false - change_column :mass_builds, :new_core, :boolean, :default => true + add_column :mass_builds, :success_count, :integer, default: 0, null: false + add_column :mass_builds, :build_canceled_count, :integer, default: 0, null: false + change_column :mass_builds, :new_core, :boolean, default: true end def down remove_column :mass_builds, :success_count remove_column :mass_builds, :build_canceled_count - change_column :mass_builds, :new_core, :boolean, :default => false + change_column :mass_builds, :new_core, :boolean, default: false end end diff --git a/db/migrate/20130201094007_add_use_personal_repository_to_build_list.rb b/db/migrate/20130201094007_add_use_personal_repository_to_build_list.rb index ae24ae61e..e25d64f8f 100644 --- a/db/migrate/20130201094007_add_use_personal_repository_to_build_list.rb +++ b/db/migrate/20130201094007_add_use_personal_repository_to_build_list.rb @@ -1,5 +1,5 @@ class AddUsePersonalRepositoryToBuildList < ActiveRecord::Migration def change - add_column :build_lists, :use_save_to_repository, :boolean, :default => true + add_column :build_lists, :use_save_to_repository, :boolean, default: true end end diff --git a/db/migrate/20130207101148_add_publishi686_into_x8664_to_project.rb b/db/migrate/20130207101148_add_publishi686_into_x8664_to_project.rb index 3f27f757f..5098c8547 100644 --- a/db/migrate/20130207101148_add_publishi686_into_x8664_to_project.rb +++ b/db/migrate/20130207101148_add_publishi686_into_x8664_to_project.rb @@ -1,5 +1,5 @@ class AddPublishi686IntoX8664ToProject < ActiveRecord::Migration def change - add_column :projects, :publish_i686_into_x86_64, :boolean, :default => false + add_column :projects, :publish_i686_into_x86_64, :boolean, default: false end end diff --git a/db/migrate/20130218135847_add_extra_repositories_and_containers_to_build_list.rb b/db/migrate/20130218135847_add_extra_repositories_and_containers_to_build_list.rb index f68eadf9e..0e823faed 100644 --- a/db/migrate/20130218135847_add_extra_repositories_and_containers_to_build_list.rb +++ b/db/migrate/20130218135847_add_extra_repositories_and_containers_to_build_list.rb @@ -1,6 +1,6 @@ class AddExtraRepositoriesAndContainersToBuildList < ActiveRecord::Migration def change - add_column :build_lists, :auto_create_container, :boolean, :default => false + add_column :build_lists, :auto_create_container, :boolean, default: false add_column :build_lists, :extra_repositories, :text add_column :build_lists, :extra_containers, :text end diff --git a/db/migrate/20130227102900_create_ssh_keys.rb b/db/migrate/20130227102900_create_ssh_keys.rb index 7e652627f..13292451a 100644 --- a/db/migrate/20130227102900_create_ssh_keys.rb +++ b/db/migrate/20130227102900_create_ssh_keys.rb @@ -2,14 +2,14 @@ class CreateSshKeys < ActiveRecord::Migration def change create_table :ssh_keys do |t| t.string :name - t.text :key, :null => false - t.string :fingerprint, :null => false - t.integer :user_id, :null => false + t.text :key, null: false + t.string :fingerprint, null: false + t.integer :user_id, null: false t.timestamps end - add_index :ssh_keys, :fingerprint, :unique => true + add_index :ssh_keys, :fingerprint, unique: true add_index :ssh_keys, :user_id end end diff --git a/db/migrate/20130319172358_add_automatic_to_comments.rb b/db/migrate/20130319172358_add_automatic_to_comments.rb index a3f2d24bc..b83336105 100644 --- a/db/migrate/20130319172358_add_automatic_to_comments.rb +++ b/db/migrate/20130319172358_add_automatic_to_comments.rb @@ -1,6 +1,6 @@ class AddAutomaticToComments < ActiveRecord::Migration def change - add_column :comments, :automatic, :boolean, :default => false + add_column :comments, :automatic, :boolean, default: false add_index :comments, :commentable_type add_index :comments, :automatic diff --git a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb index e60b17fe5..efdba85f6 100644 --- a/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb +++ b/db/migrate/20130322132919_autostart_iso_build_on_regular_basis.rb @@ -1,7 +1,7 @@ class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration def change - add_column :products, :autostart_status, :integer, :default => nil - add_column :product_build_lists, :not_delete, :boolean, :default => false - add_column :product_build_lists, :autostarted, :boolean, :default => false + add_column :products, :autostart_status, :integer, default: nil + add_column :product_build_lists, :not_delete, :boolean, default: false + add_column :product_build_lists, :autostarted, :boolean, default: false end end diff --git a/db/migrate/20130326165628_add_add_info_to_comments.rb b/db/migrate/20130326165628_add_add_info_to_comments.rb index 5a88f8414..ca1a34041 100644 --- a/db/migrate/20130326165628_add_add_info_to_comments.rb +++ b/db/migrate/20130326165628_add_add_info_to_comments.rb @@ -1,6 +1,6 @@ class AddAddInfoToComments < ActiveRecord::Migration def change - add_column :comments, :created_from_commit_hash, :decimal, :precision => 50, :scale => 0 + add_column :comments, :created_from_commit_hash, :decimal, precision: 50, scale: 0 add_column :comments, :created_from_issue_id, :integer add_index :comments, :created_from_issue_id diff --git a/db/migrate/20130403202853_add_name_with_owner_to_project.rb b/db/migrate/20130403202853_add_name_with_owner_to_project.rb index 7f7cd58f2..32fbf94b0 100644 --- a/db/migrate/20130403202853_add_name_with_owner_to_project.rb +++ b/db/migrate/20130403202853_add_name_with_owner_to_project.rb @@ -13,7 +13,7 @@ class AddNameWithOwnerToProject < ActiveRecord::Migration FROM groups as owners WHERE projects.owner_type = 'Group' AND projects.owner_id = owners.id SQL - change_column :projects, :owner_uname, :string, :null => false + change_column :projects, :owner_uname, :string, null: false end def down diff --git a/db/migrate/20130527181351_drop_use_save_to_repository_from_build_lists.rb b/db/migrate/20130527181351_drop_use_save_to_repository_from_build_lists.rb index 8207562ad..3a1867756 100644 --- a/db/migrate/20130527181351_drop_use_save_to_repository_from_build_lists.rb +++ b/db/migrate/20130527181351_drop_use_save_to_repository_from_build_lists.rb @@ -4,6 +4,6 @@ class DropUseSaveToRepositoryFromBuildLists < ActiveRecord::Migration end def down - add_column :build_lists, :use_save_to_repository, :boolean, :default => true + add_column :build_lists, :use_save_to_repository, :boolean, default: true end end diff --git a/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb b/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb index 68abdc439..7cddde1cc 100644 --- a/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb +++ b/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb @@ -5,8 +5,8 @@ class AddExtraReposAndBuildListsToMassBuild < ActiveRecord::Migration def up add_column :mass_builds, :save_to_platform_id, :integer MassBuild.update_all('save_to_platform_id = platform_id') - change_column :mass_builds, :save_to_platform_id, :integer, :null => false - change_column :mass_builds, :platform_id, :integer, :null => false + change_column :mass_builds, :save_to_platform_id, :integer, null: false + change_column :mass_builds, :platform_id, :integer, null: false rename_column :mass_builds, :platform_id, :build_for_platform_id add_column :mass_builds, :extra_repositories, :text add_column :mass_builds, :extra_build_lists, :text diff --git a/db/migrate/20130624095928_create_tokens.rb b/db/migrate/20130624095928_create_tokens.rb index a3bde8ba5..52a9e0ee2 100644 --- a/db/migrate/20130624095928_create_tokens.rb +++ b/db/migrate/20130624095928_create_tokens.rb @@ -2,17 +2,17 @@ class CreateTokens < ActiveRecord::Migration def change create_table :tokens do |t| - t.integer :subject_id, :null => false - t.string :subject_type, :null => false - t.integer :creator_id, :null => false + t.integer :subject_id, null: false + t.string :subject_type, null: false + t.integer :creator_id, null: false t.integer :updater_id - t.string :status, :default => 'active' + t.string :status, default: 'active' t.text :description - t.string :authentication_token, :null => false + t.string :authentication_token, null: false t.timestamps end - add_index :tokens, :authentication_token, :unique => true + add_index :tokens, :authentication_token, unique: true add_index :tokens, [:subject_id, :subject_type] end diff --git a/db/migrate/20130701121313_drop_bs_id_from_build_lists.rb b/db/migrate/20130701121313_drop_bs_id_from_build_lists.rb index d5db043d5..373a1442c 100644 --- a/db/migrate/20130701121313_drop_bs_id_from_build_lists.rb +++ b/db/migrate/20130701121313_drop_bs_id_from_build_lists.rb @@ -10,7 +10,7 @@ class DropBsIdFromBuildLists < ActiveRecord::Migration def down add_column :build_lists, :bs_id, :integer - add_index :build_lists, :bs_id, :unique => true + add_index :build_lists, :bs_id, unique: true BuildList.update_all('bs_id = id') end diff --git a/db/migrate/20130724105821_create_platform_arch_settings.rb b/db/migrate/20130724105821_create_platform_arch_settings.rb index d83af5364..fcae2484b 100644 --- a/db/migrate/20130724105821_create_platform_arch_settings.rb +++ b/db/migrate/20130724105821_create_platform_arch_settings.rb @@ -2,15 +2,15 @@ class CreatePlatformArchSettings < ActiveRecord::Migration def up create_table :platform_arch_settings do |t| - t.integer :platform_id, :null => false - t.integer :arch_id, :null => false - t.integer :time_living, :null => false + t.integer :platform_id, null: false + t.integer :arch_id, null: false + t.integer :time_living, null: false t.boolean :default t.timestamps end - add_index :platform_arch_settings, [:platform_id, :arch_id], :unique => true + add_index :platform_arch_settings, [:platform_id, :arch_id], unique: true - arch_ids = Arch.where(:name => %w(i586 x86_64)).pluck(:id) + arch_ids = Arch.where(name: %w(i586 x86_64)).pluck(:id) Platform.main.each do |platform| arch_ids.each do |arch_id| platform.platform_arch_settings.create( diff --git a/db/migrate/20130731120901_create_project_statistics.rb b/db/migrate/20130731120901_create_project_statistics.rb index 3d7103210..67f61cbfa 100644 --- a/db/migrate/20130731120901_create_project_statistics.rb +++ b/db/migrate/20130731120901_create_project_statistics.rb @@ -1,13 +1,13 @@ class CreateProjectStatistics < ActiveRecord::Migration def change create_table :project_statistics do |t| - t.integer :average_build_time, :null => false, :default => 0 - t.integer :build_count, :null => false, :default => 0 - t.integer :arch_id, :null => false - t.integer :project_id, :null => false + t.integer :average_build_time, null: false, default: 0 + t.integer :build_count, null: false, default: 0 + t.integer :arch_id, null: false + t.integer :project_id, null: false t.timestamps end - add_index :project_statistics, [:project_id, :arch_id], :unique => true + add_index :project_statistics, [:project_id, :arch_id], unique: true end end diff --git a/db/migrate/20130731130518_drop_average_build_time_and_build_count_from_project.rb b/db/migrate/20130731130518_drop_average_build_time_and_build_count_from_project.rb index 723d331aa..b74820792 100644 --- a/db/migrate/20130731130518_drop_average_build_time_and_build_count_from_project.rb +++ b/db/migrate/20130731130518_drop_average_build_time_and_build_count_from_project.rb @@ -5,7 +5,7 @@ class DropAverageBuildTimeAndBuildCountFromProject < ActiveRecord::Migration end def down - add_column :projects, :average_build_time, :integer, :null => false, :default => 0 - add_column :projects, :build_count, :integer, :null => false, :default => 0 + add_column :projects, :average_build_time, :integer, null: false, default: 0 + add_column :projects, :build_count, :integer, null: false, default: 0 end end diff --git a/db/migrate/20130820195938_add_sound_notifications_to_user.rb b/db/migrate/20130820195938_add_sound_notifications_to_user.rb index a7b32696c..d6aff49b6 100644 --- a/db/migrate/20130820195938_add_sound_notifications_to_user.rb +++ b/db/migrate/20130820195938_add_sound_notifications_to_user.rb @@ -1,5 +1,5 @@ class AddSoundNotificationsToUser < ActiveRecord::Migration def change - add_column :users, :sound_notifications, :boolean, :default => true + add_column :users, :sound_notifications, :boolean, default: true end end diff --git a/db/migrate/20130822154741_create_repository_statuses.rb b/db/migrate/20130822154741_create_repository_statuses.rb index 3687c9532..59eda7f48 100644 --- a/db/migrate/20130822154741_create_repository_statuses.rb +++ b/db/migrate/20130822154741_create_repository_statuses.rb @@ -1,14 +1,14 @@ class CreateRepositoryStatuses < ActiveRecord::Migration def change create_table :repository_statuses do |t| - t.integer :repository_id, :null => false - t.integer :platform_id, :null => false - t.integer :status, :default => 0 + t.integer :repository_id, null: false + t.integer :platform_id, null: false + t.integer :status, default: 0 t.datetime :last_regenerated_at t.integer :last_regenerated_status t.timestamps end - add_index :repository_statuses, [:repository_id, :platform_id], :unique => true + add_index :repository_statuses, [:repository_id, :platform_id], unique: true end end diff --git a/db/migrate/20130822160501_add_status_to_platform.rb b/db/migrate/20130822160501_add_status_to_platform.rb index 674858e73..1e99209d1 100644 --- a/db/migrate/20130822160501_add_status_to_platform.rb +++ b/db/migrate/20130822160501_add_status_to_platform.rb @@ -1,6 +1,6 @@ class AddStatusToPlatform < ActiveRecord::Migration def change - add_column :platforms, :status, :integer, :default => 0 + add_column :platforms, :status, :integer, default: 0 add_column :platforms, :last_regenerated_at, :datetime add_column :platforms, :last_regenerated_status, :integer end diff --git a/db/migrate/20130918164616_add_increase_release_tag_to_mass_build.rb b/db/migrate/20130918164616_add_increase_release_tag_to_mass_build.rb index f1197eaf3..09c11ad95 100644 --- a/db/migrate/20130918164616_add_increase_release_tag_to_mass_build.rb +++ b/db/migrate/20130918164616_add_increase_release_tag_to_mass_build.rb @@ -1,5 +1,5 @@ class AddIncreaseReleaseTagToMassBuild < ActiveRecord::Migration def change - add_column :mass_builds, :increase_release_tag, :boolean, :default => false, :null => false + add_column :mass_builds, :increase_release_tag, :boolean, default: false, null: false end end diff --git a/db/migrate/20131022082357_remove_default_status_from_platform.rb b/db/migrate/20131022082357_remove_default_status_from_platform.rb index 0fd2822ec..4f26feb7e 100644 --- a/db/migrate/20131022082357_remove_default_status_from_platform.rb +++ b/db/migrate/20131022082357_remove_default_status_from_platform.rb @@ -1,5 +1,5 @@ class RemoveDefaultStatusFromPlatform < ActiveRecord::Migration def change - change_column :platforms, :status, :integer, :default => nil + change_column :platforms, :status, :integer, default: nil end end diff --git a/db/migrate/20131022082416_remove_default_status_from_product_build_list.rb b/db/migrate/20131022082416_remove_default_status_from_product_build_list.rb index 8846e5a2e..ae740cb6e 100644 --- a/db/migrate/20131022082416_remove_default_status_from_product_build_list.rb +++ b/db/migrate/20131022082416_remove_default_status_from_product_build_list.rb @@ -1,5 +1,5 @@ class RemoveDefaultStatusFromProductBuildList < ActiveRecord::Migration def change - change_column :product_build_lists, :status, :integer, :default => nil + change_column :product_build_lists, :status, :integer, default: nil end end diff --git a/db/migrate/20131126154305_add_new_commit_to_settings_notifier.rb b/db/migrate/20131126154305_add_new_commit_to_settings_notifier.rb index cb4b49f6f..07e9fe2d8 100644 --- a/db/migrate/20131126154305_add_new_commit_to_settings_notifier.rb +++ b/db/migrate/20131126154305_add_new_commit_to_settings_notifier.rb @@ -1,5 +1,5 @@ class AddNewCommitToSettingsNotifier < ActiveRecord::Migration def change - add_column :settings_notifiers, :update_code, :boolean, :default => false + add_column :settings_notifiers, :update_code, :boolean, default: false end end diff --git a/db/migrate/20140113205657_add_synchronize_publication_to_repository.rb b/db/migrate/20140113205657_add_synchronize_publication_to_repository.rb index ddf57995f..9adbce1e4 100644 --- a/db/migrate/20140113205657_add_synchronize_publication_to_repository.rb +++ b/db/migrate/20140113205657_add_synchronize_publication_to_repository.rb @@ -1,5 +1,5 @@ class AddSynchronizePublicationToRepository < ActiveRecord::Migration def change - add_column :repositories, :synchronizing_publications, :boolean, :default => false, :null => false + add_column :repositories, :synchronizing_publications, :boolean, default: false, null: false end end diff --git a/db/migrate/20140113215223_add_architecture_dependent_to_project.rb b/db/migrate/20140113215223_add_architecture_dependent_to_project.rb index b1fd34e95..292c880ab 100644 --- a/db/migrate/20140113215223_add_architecture_dependent_to_project.rb +++ b/db/migrate/20140113215223_add_architecture_dependent_to_project.rb @@ -1,5 +1,5 @@ class AddArchitectureDependentToProject < ActiveRecord::Migration def change - add_column :projects, :architecture_dependent, :boolean, :default => false, :null => false + add_column :projects, :architecture_dependent, :boolean, default: false, null: false end end diff --git a/lib/abf_worker/base_observer.rb b/lib/abf_worker/base_observer.rb index cc217648f..62159c520 100644 --- a/lib/abf_worker/base_observer.rb +++ b/lib/abf_worker/base_observer.rb @@ -32,7 +32,7 @@ module AbfWorker def sort_results_and_save(results, item = subject) item.results = results.sort_by{ |r| r['file_name'] } - item.save(:validate => false) + item.save(validate: false) end end diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index 08cdd8636..de32ebe54 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -72,7 +72,7 @@ module AbfWorker end def packages_structure - structure = {:sources => [], :binaries => {}} + structure = {sources: [], binaries: {}} Arch.pluck(:name).each{ |name| structure[:binaries][name.to_sym] = [] } structure end @@ -105,23 +105,23 @@ module AbfWorker 'publish_worker', 'class' => 'AbfWorker::PublishWorker', 'args' => [{ - :id => build_list.id, - :cmd_params => cmd_params, - :main_script => 'build.sh', - :rollback_script => 'rollback.sh', - :platform => { - :platform_path => platform_path, - :type => distrib_type, - :name => build_list.build_for_platform.name, - :arch => build_list.arch.name + id: build_list.id, + cmd_params: cmd_params, + main_script: 'build.sh', + rollback_script: 'rollback.sh', + platform: { + platform_path: platform_path, + type: distrib_type, + name: build_list.build_for_platform.name, + arch: build_list.arch.name }, - :repository => {:id => build_list.save_to_repository_id}, - :time_living => 9600, # 160 min - :packages => packages, - :old_packages => packages_structure, - :build_list_ids => [build_list.id], - :projects_for_cleanup => [], - :extra => {:create_container => true} + repository: {id: build_list.save_to_repository_id}, + time_living: 9600, # 160 min + packages: packages, + old_packages: packages_structure, + build_list_ids: [build_list.id], + projects_for_cleanup: [], + extra: {create_container: true} }] ) end @@ -130,11 +130,11 @@ module AbfWorker build_lists_for_cleanup = [] status = testing ? BuildList::BUILD_PUBLISHED_INTO_TESTING : BuildList::BUILD_PUBLISHED Arch.pluck(:id).each do |arch_id| - bl = BuildList.where(:project_id => project_id). - where(:new_core => true, :status => status). - where(:save_to_repository_id => repository_id). - where(:build_for_platform_id => platform_id). - where(:arch_id => arch_id). + bl = BuildList.where(project_id: project_id). + where(new_core: true, status: status). + where(save_to_repository_id: repository_id). + where(build_for_platform_id: platform_id). + where(arch_id: arch_id). order(:updated_at).first build_lists_for_cleanup << bl if bl end @@ -151,7 +151,7 @@ module AbfWorker def fill_packages(bl, results_map, field = :sha1) results_map[:sources] |= bl.packages.by_package_type('source').pluck(field).compact if field != :sha1 - + binaries = bl.packages.by_package_type('binary').pluck(field).compact arch = bl.arch.name.to_sym results_map[:binaries][arch] |= binaries @@ -168,7 +168,7 @@ module AbfWorker def create_tasks_for_resign_repositories RepositoryStatus.platform_ready .for_resign - .includes(:repository => :platform) + .includes(repository: :platform) .readonly(false) .each do |repository_status| r = repository_status.repository @@ -186,19 +186,19 @@ module AbfWorker 'publish_worker_default', 'class' => "AbfWorker::PublishWorkerDefault", 'args' => [{ - :id => r.id, - :cmd_params => cmd_params, - :main_script => 'resign.sh', - :platform => { - :platform_path => "#{r.platform.path}/repository", - :type => distrib_type, - :name => r.platform.name, - :arch => 'x86_64' + id: r.id, + cmd_params: cmd_params, + main_script: 'resign.sh', + platform: { + platform_path: "#{r.platform.path}/repository", + type: distrib_type, + name: r.platform.name, + arch: 'x86_64' }, - :repository => {:id => r.id}, - :skip_feedback => true, - :time_living => 9600, # 160 min - :extra => {:repository_status_id => repository_status.id, :resign => true} + repository: {id: r.id}, + skip_feedback: true, + time_living: 9600, # 160 min + extra: {repository_status_id: repository_status.id, resign: true} }] ) if repository_status.start_resign end @@ -207,13 +207,13 @@ module AbfWorker def create_tasks_for_build_rpms(testing = false) available_repos = BuildList. select('MIN(updated_at) as min_updated_at, save_to_repository_id, build_for_platform_id'). - where(:new_core => true, :status => (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)). + where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)). group(:save_to_repository_id, :build_for_platform_id). order(:min_updated_at). limit(@workers_count * 2) # because some repos may be locked locked_rep = RepositoryStatus.not_ready.joins(:platform). - where(:platforms => {:platform_type => 'main'}).pluck(:repository_id) + where(platforms: {platform_type: 'main'}).pluck(:repository_id) available_repos = available_repos.where('save_to_repository_id NOT IN (?)', locked_rep) unless locked_rep.empty? for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).map do |key| @@ -232,10 +232,10 @@ module AbfWorker counter = 1 available_repos = available_repos.map{ |bl| [bl.save_to_repository_id, bl.build_for_platform_id] } | for_cleanup | for_cleanup_from_testing available_repos.each do |save_to_repository_id, build_for_platform_id| - next if RepositoryStatus.not_ready.where(:repository_id => save_to_repository_id, :platform_id => build_for_platform_id).exists? + next if RepositoryStatus.not_ready.where(repository_id: save_to_repository_id, platform_id: build_for_platform_id).exists? break if counter > @workers_count counter += 1 if create_rpm_build_task(save_to_repository_id, build_for_platform_id, testing) - end + end end def create_rpm_build_task(save_to_repository_id, build_for_platform_id, testing) @@ -247,15 +247,15 @@ module AbfWorker # We should not to publish new builds into repository # if project of builds has been removed from repository. BuildList.where( - :project_id => projects_for_cleanup.map{ |k| k.split('-')[testing ? 1 : 0] }.uniq, - :save_to_repository_id => save_to_repository_id, - :status => [BuildList::BUILD_PUBLISH, BuildList::BUILD_PUBLISH_INTO_TESTING] - ).update_all(:status => BuildList::FAILED_PUBLISH) + project_id: projects_for_cleanup.map{ |k| k.split('-')[testing ? 1 : 0] }.uniq, + save_to_repository_id: save_to_repository_id, + status: [BuildList::BUILD_PUBLISH, BuildList::BUILD_PUBLISH_INTO_TESTING] + ).update_all(status: BuildList::FAILED_PUBLISH) build_lists = BuildList. - where(:new_core => true, :status => (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)). - where(:save_to_repository_id => save_to_repository_id). - where(:build_for_platform_id => build_for_platform_id). + where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)). + where(save_to_repository_id: save_to_repository_id). + where(build_for_platform_id: build_for_platform_id). order(:updated_at) locked_ids = @redis.lrange(LOCKED_BUILD_LISTS, 0, -1) build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty? @@ -276,7 +276,7 @@ module AbfWorker if testing build_lists_for_cleanup_from_testing = @redis.smembers("#{BUILD_LISTS_FOR_CLEANUP_FROM_TESTING}-#{save_to_repository_id}-#{build_for_platform_id}") - BuildList.where(:id => build_lists_for_cleanup_from_testing).each do |b| + BuildList.where(id: build_lists_for_cleanup_from_testing).each do |b| self.class.fill_packages(b, old_packages, :fullname) end if build_lists_for_cleanup_from_testing.present? end @@ -291,7 +291,7 @@ module AbfWorker repository_status = save_to_repository.repository_statuses.find_or_create_by_platform_id(build_for_platform_id) return false unless repository_status.publish - + save_to_platform = save_to_repository.platform build_for_platform = Platform.find build_for_platform_id platform_path = "#{save_to_platform.path}/repository" @@ -313,21 +313,21 @@ module AbfWorker }.map{ |k, v| "#{k}=#{v}" }.join(' ') options = { - :id => (bl ? bl.id : Time.now.to_i), - :cmd_params => cmd_params, - :main_script => 'build.sh', - :rollback_script => 'rollback.sh', - :platform => { - :platform_path => platform_path, - :type => distrib_type, - :name => build_for_platform.name, - :arch => (bl ? bl.arch.name : 'x86_64') + id: (bl ? bl.id : Time.now.to_i), + cmd_params: cmd_params, + main_script: 'build.sh', + rollback_script: 'rollback.sh', + platform: { + platform_path: platform_path, + type: distrib_type, + name: build_for_platform.name, + arch: (bl ? bl.arch.name : 'x86_64') }, - :repository => {:id => save_to_repository_id}, - :time_living => 9600, # 160 min - :extra => { - :repository_status_id => repository_status.id, - :build_lists_for_cleanup_from_testing => build_lists_for_cleanup_from_testing + repository: {id: save_to_repository_id}, + time_living: 9600, # 160 min + extra: { + repository_status_id: repository_status.id, + build_lists_for_cleanup_from_testing: build_lists_for_cleanup_from_testing } } @@ -353,10 +353,10 @@ module AbfWorker worker_queue, 'class' => worker_class, 'args' => [options.merge({ - :packages => packages, - :old_packages => old_packages, - :build_list_ids => build_list_ids, - :projects_for_cleanup => projects_for_cleanup + packages: packages, + old_packages: old_packages, + build_list_ids: build_list_ids, + projects_for_cleanup: projects_for_cleanup })] ) @@ -379,7 +379,7 @@ module AbfWorker def create_tasks_for_regenerate_metadata_for_software_center Platform.main.waiting_for_regeneration.each do |platform| repos = platform.repositories - statuses = RepositoryStatus.where(:platform_id => platform.id) + statuses = RepositoryStatus.where(platform_id: platform.id) next if repos.find{ |r| r.repo_lock_file_exists? } next if statuses.present? && statuses.map{ |s| s.ready? || s.can_start_regeneration? || s.can_start_resign? }.uniq != [true] @@ -397,17 +397,17 @@ module AbfWorker 'publish_worker_default', 'class' => 'AbfWorker::PublishWorkerDefault', 'args' => [{ - :id => Time.now.to_i, - :cmd_params => cmd_params, - :main_script => 'regenerate_platform_metadata.sh', - :platform => { - :platform_path => "#{platform.path}/repository", - :type => platform.distrib_type, - :name => platform.name, - :arch => 'x86_64' + id: Time.now.to_i, + cmd_params: cmd_params, + main_script: 'regenerate_platform_metadata.sh', + platform: { + platform_path: "#{platform.path}/repository", + type: platform.distrib_type, + name: platform.name, + arch: 'x86_64' }, - :time_living => 9600, # 160 min - :extra => {:platform_id => platform.id, :regenerate_platform => true} + time_living: 9600, # 160 min + extra: {platform_id: platform.id, regenerate_platform: true} }] ) if platform.start_regeneration @@ -417,7 +417,7 @@ module AbfWorker def create_tasks_for_repository_regenerate_metadata RepositoryStatus.platform_ready .for_regeneration - .includes(:repository => :platform) + .includes(repository: :platform) .readonly(false) .each do |repository_status| rep = repository_status.repository @@ -444,18 +444,18 @@ module AbfWorker 'publish_worker_default', 'class' => 'AbfWorker::PublishWorkerDefault', 'args' => [{ - :id => Time.now.to_i, - :cmd_params => cmd_params, - :main_script => 'build.sh', - :rollback_script => 'rollback.sh', - :platform => { - :platform_path => platform_path, - :type => build_for_platform.distrib_type, - :name => build_for_platform.name, - :arch => 'x86_64' + id: Time.now.to_i, + cmd_params: cmd_params, + main_script: 'build.sh', + rollback_script: 'rollback.sh', + platform: { + platform_path: platform_path, + type: build_for_platform.distrib_type, + name: build_for_platform.name, + arch: 'x86_64' }, - :time_living => 9600, # 160 min - :extra => {:repository_status_id => repository_status.id, :regenerate => true} + time_living: 9600, # 160 min + extra: {repository_status_id: repository_status.id, regenerate: true} }] ) if repository_status.start_regeneration end diff --git a/lib/abf_worker/model_helper.rb b/lib/abf_worker/model_helper.rb index 9aa000095..5ee7b8193 100644 --- a/lib/abf_worker/model_helper.rb +++ b/lib/abf_worker/model_helper.rb @@ -10,8 +10,8 @@ module AbfWorker::ModelHelper module ClassMethods def log_server @log_server ||= Redis.new( - :host => APP_CONFIG['abf_worker']['log_server']['host'], - :port => APP_CONFIG['abf_worker']['log_server']['port'] + host: APP_CONFIG['abf_worker']['log_server']['host'], + port: APP_CONFIG['abf_worker']['log_server']['port'] ) end end diff --git a/lib/abf_worker/publish_observer.rb b/lib/abf_worker/publish_observer.rb index f12d9e7f1..f70489981 100644 --- a/lib/abf_worker/publish_observer.rb +++ b/lib/abf_worker/publish_observer.rb @@ -2,7 +2,6 @@ module AbfWorker class PublishObserver < AbfWorker::BaseObserver @queue = :publish_observer - def self.perform(options) new(options, BuildList).perform end @@ -10,9 +9,9 @@ module AbfWorker def perform return if status == STARTED # do nothing when publication started extra = options['extra'] - repository_status = RepositoryStatus.where(:id => extra['repository_status_id']).first + repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first begin - + if extra['regenerate'] || extra['regenerate_platform'] log_sha1 = (options['results'].try(:first) || {}).fetch('sha1', nil) end @@ -22,7 +21,7 @@ module AbfWorker repository_status.last_regenerated_status = status repository_status.last_regenerated_log_sha1 = log_sha1 elsif extra['regenerate_platform'] # Regenerate metadata for Software Center - if platform = Platform.where(:id => extra['platform_id']).first + if platform = Platform.where(id: extra['platform_id']).first platform.last_regenerated_at = Time.now.utc platform.last_regenerated_status = status platform.last_regenerated_log_sha1 = log_sha1 @@ -55,8 +54,8 @@ module AbfWorker protected def update_rpm_builds - build_lists = BuildList.where(:id => options['build_list_ids']) - build_lists.each do |build_list| + build_lists = BuildList.where(id: options['build_list_ids']) + build_lists.each do |build_list| update_results build_list case status when COMPLETED diff --git a/lib/abf_worker/rpm_worker_observer.rb b/lib/abf_worker/rpm_worker_observer.rb index 3e9201f1c..6615e733e 100644 --- a/lib/abf_worker/rpm_worker_observer.rb +++ b/lib/abf_worker/rpm_worker_observer.rb @@ -24,18 +24,18 @@ module AbfWorker subject.now_publish if subject.can_auto_publish? when FAILED subject.build_error - item.update_attributes({:status => BuildList::BUILD_ERROR}) + item.update_attributes({status: BuildList::BUILD_ERROR}) when STARTED subject.start_build when CANCELED subject.build_canceled - item.update_attributes({:status => BuildList::BUILD_CANCELED}) + item.update_attributes({status: BuildList::BUILD_CANCELED}) when TESTS_FAILED subject.tests_failed end if [TESTS_FAILED, COMPLETED].include?(status) - item.update_attributes({:status => BuildList::SUCCESS}) + item.update_attributes({status: BuildList::SUCCESS}) subject.publish_container if subject.auto_create_container? end end @@ -44,10 +44,10 @@ module AbfWorker def find_or_create_item subject.items.first || subject.items.create({ - :version => subject.commit_hash, - :name => subject.project.name, - :status => BuildList::BUILD_STARTED, - :level => 0 + version: subject.commit_hash, + name: subject.project.name, + status: BuildList::BUILD_STARTED, + level: 0 }) end diff --git a/lib/abf_worker/status_inspector.rb b/lib/abf_worker/status_inspector.rb index 54e10fcad..8edadee12 100644 --- a/lib/abf_worker/status_inspector.rb +++ b/lib/abf_worker/status_inspector.rb @@ -3,7 +3,7 @@ module AbfWorker class << self def projects_status - Rails.cache.fetch([AbfWorker::StatusInspector, :projects_status], :expires_in => 10.seconds) do + Rails.cache.fetch([AbfWorker::StatusInspector, :projects_status], expires_in: 10.seconds) do result = get_status(:rpm, :publish) { |w, worker| w.to_s =~ /#{worker}_worker_default/ } nodes = RpmBuildNode.total_statistics result[:rpm][:workers] += nodes[:systems] @@ -38,14 +38,13 @@ module AbfWorker redis, key = Resque.redis, "queue:#{worker}_worker" default_tasks, tasks = redis.llen("#{key}_default"), redis.llen(key) { - :workers => workers.count, - :build_tasks => workers.select{ |w| w.working? }.count, - :default_tasks => default_tasks, - :low_tasks => tasks, - :tasks => (default_tasks + tasks) + workers: workers.count, + build_tasks: workers.select{ |w| w.working? }.count, + default_tasks: default_tasks, + low_tasks: tasks, + tasks: (default_tasks + tasks) } end - end end -end \ No newline at end of file +end diff --git a/lib/api_defender.rb b/lib/api_defender.rb index de24917d2..053dd6c23 100644 --- a/lib/api_defender.rb +++ b/lib/api_defender.rb @@ -7,9 +7,9 @@ class ApiDefender < Rack::Throttle::Hourly def initialize(app) options = { - :cache => Redis.new(:thread_safe => true), - :key_prefix => :throttle, - :max => 2000 # only 2000 request per hour + cache: Redis.new(thread_safe: true), + key_prefix: :throttle, + max: 2000 # only 2000 request per hour } @app, @options = app, options end diff --git a/lib/ext/angularjs_link_renderer.rb b/lib/ext/angularjs_link_renderer.rb index d7b508800..c766a5b51 100644 --- a/lib/ext/angularjs_link_renderer.rb +++ b/lib/ext/angularjs_link_renderer.rb @@ -4,7 +4,6 @@ class Array end end - class AngularjsLinkRenderer < WillPaginate::ActionView::LinkRenderer def to_html @@ -14,30 +13,29 @@ class AngularjsLinkRenderer < WillPaginate::ActionView::LinkRenderer end protected - - def page_number(page) - unless page == current_page - {:active => true, :number => page, :type => :page} - else - {:active => false, :number => page, :type => :first} - end + + def page_number(page) + unless page == current_page + {active: true, number: page, type: :page} + else + {active: false, number: page, type: :first} end - - def gap - nil + end + + def gap + nil + end + + def next_page + num = @collection.current_page < @collection.total_pages && @collection.current_page + 1 + previous_or_next_page(num, @options[:next_label], :next_page) + end + + def previous_or_next_page(page, text, classname) + if page + {active: true, number: page, type: classname} + else + {active: false, number: page, type: classname} end - - def next_page - num = @collection.current_page < @collection.total_pages && @collection.current_page + 1 - previous_or_next_page(num, @options[:next_label], :next_page) - end - - def previous_or_next_page(page, text, classname) - if page - {:active => true, :number => page, :type => classname} - else - {:active => false, :number => page, :type => classname} - end - end - + end end diff --git a/lib/ext/core/string.rb b/lib/ext/core/string.rb index 535edf1c4..b22e3dee6 100644 --- a/lib/ext/core/string.rb +++ b/lib/ext/core/string.rb @@ -6,7 +6,7 @@ class String if ascii_only? # no need to encode if ascii force_encoding(default_encoding) else # should encode - options = {:invalid => :replace, :undef => :replace, :replace => ''} + options = {invalid: :replace, undef: :replace, replace: ''} if (detected = detect_encoding) && detected[:encoding] force_encoding(detected[:encoding]).encode!(default_encoding, detected[:encoding], options) end diff --git a/lib/ext/git/grit.rb b/lib/ext/git/grit.rb index 6df6c1e03..ca23f9aa0 100644 --- a/lib/ext/git/grit.rb +++ b/lib/ext/git/grit.rb @@ -107,7 +107,7 @@ module Grit end def diff(a, b, *paths) - diff = self.git.native('diff', {:M => true}, "#{a}...#{b}", '--', *paths) + diff = self.git.native('diff', {M: true}, "#{a}...#{b}", '--', *paths) if diff =~ /diff --git a/ diff = diff.sub(/.*?(diff --git a)/m, '\1') @@ -127,7 +127,7 @@ module Grit def diff_stats(a,b) stats = [] Dir.chdir(path) do - lines = self.git.native(:diff, {:numstat => true, :M => true}, "#{a}...#{b}").split("\n") + lines = self.git.native(:diff, {numstat: true, M: true}, "#{a}...#{b}").split("\n") while !lines.empty? files = [] while lines.first =~ /^([-\d]+)\s+([-\d]+)\s+(.+)/ diff --git a/lib/ext/preregistration.rb b/lib/ext/preregistration.rb index 661984341..42c683436 100644 --- a/lib/ext/preregistration.rb +++ b/lib/ext/preregistration.rb @@ -10,7 +10,7 @@ module Preregistration def new_with_token if params['invitation_token'] - req = RegisterRequest.approved.where(:token => params['invitation_token'].strip).first + req = RegisterRequest.approved.where(token: params['invitation_token'].strip).first redirect_to new_register_request_path and return unless req resource = build_resource({}) @@ -26,7 +26,7 @@ module Preregistration def create_with_token redirect_to new_register_request_path and return unless params['invitation_token'] - req = RegisterRequest.approved.where(:token => params['invitation_token'].strip).first + req = RegisterRequest.approved.where(token: params['invitation_token'].strip).first build_resource @@ -38,11 +38,11 @@ module Preregistration if resource.active_for_authentication? set_flash_message :notice, :signed_up if is_navigational_format? sign_in(resource_name, resource) - respond_with resource, :location => after_sign_up_path_for(resource) + respond_with resource, location: after_sign_up_path_for(resource) else - set_flash_message :notice, :inactive_signed_up, :reason => inactive_reason(resource) if is_navigational_format? + set_flash_message :notice, :inactive_signed_up, reason: inactive_reason(resource) if is_navigational_format? expire_session_data_after_sign_in! - respond_with resource, :location => after_inactive_sign_up_path_for(resource) + respond_with resource, location: after_inactive_sign_up_path_for(resource) end else clean_up_passwords(resource) diff --git a/lib/ext/rails/reserved_name_validator.rb b/lib/ext/rails/reserved_name_validator.rb index cfc1a1a5e..49776fc56 100644 --- a/lib/ext/rails/reserved_name_validator.rb +++ b/lib/ext/rails/reserved_name_validator.rb @@ -32,7 +32,7 @@ class ReservedNameValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if reserved_names.include?(value.to_s.downcase) - record.errors.add(attribute, :exclusion, options.merge(:value => value)) + record.errors.add(attribute, :exclusion, options.merge(value: value)) end end end diff --git a/lib/modules/models/commit_and_version.rb b/lib/modules/models/commit_and_version.rb index f9776b9e2..d34863e11 100644 --- a/lib/modules/models/commit_and_version.rb +++ b/lib/modules/models/commit_and_version.rb @@ -7,7 +7,7 @@ module Modules validate lambda { if project && (commit_hash.blank? || project.repo.commit(commit_hash).blank?) - errors.add :commit_hash, I18n.t('flash.build_list.wrong_commit_hash', :commit_hash => commit_hash) + errors.add :commit_hash, I18n.t('flash.build_list.wrong_commit_hash', commit_hash: commit_hash) end } diff --git a/lib/modules/models/file_store_clean.rb b/lib/modules/models/file_store_clean.rb index 86412c92e..68b1ae2c3 100644 --- a/lib/modules/models/file_store_clean.rb +++ b/lib/modules/models/file_store_clean.rb @@ -8,7 +8,7 @@ module Modules destroy_files_from_file_store if Rails.env.production? super end - later :destroy, :queue => :clone_build + later :destroy, queue: :clone_build def sha1_of_file_store_files raise NotImplementedError, "You should implement this method" @@ -33,12 +33,12 @@ module Modules def later_destroy_files_from_file_store(args) destroy_files_from_file_store(args) end - later :later_destroy_files_from_file_store, :queue => :clone_build + later :later_destroy_files_from_file_store, queue: :clone_build end def self.file_exist_on_file_store?(sha1) begin - resp = JSON(RestClient.get "#{APP_CONFIG['file_store_url']}/api/v1/file_stores.json", :params => {:hash => sha1}) + resp = JSON(RestClient.get "#{APP_CONFIG['file_store_url']}/api/v1/file_stores.json", params: {hash: sha1}) rescue # Dont care about it resp = [] end diff --git a/lib/modules/models/git.rb b/lib/modules/models/git.rb index 240442631..664fa34c9 100644 --- a/lib/modules/models/git.rb +++ b/lib/modules/models/git.rb @@ -7,20 +7,20 @@ module Modules extend ActiveSupport::Concern included do - validates_attachment_size :srpm, :less_than => 500.megabytes - validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type') + validates_attachment_size :srpm, less_than: 500.megabytes + validates_attachment_content_type :srpm, content_type: ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], message: I18n.t('layout.invalid_content_type') has_attached_file :srpm # attr_accessible :srpm after_create :create_git_repo - after_commit(:on => :create) {|p| p.fork_git_repo unless p.is_root?} # later with resque - after_commit(:on => :create) {|p| p.import_attached_srpm if p.srpm?} # later with resque # should be after create_git_repo + after_commit(on: :create) {|p| p.fork_git_repo unless p.is_root?} # later with resque + after_commit(on: :create) {|p| p.import_attached_srpm if p.srpm?} # later with resque # should be after create_git_repo after_destroy :destroy_git_repo # after_rollback lambda { destroy_git_repo rescue true if new_record? } - later :import_attached_srpm, :queue => :fork_import - later :fork_git_repo, :queue => :fork_import + later :import_attached_srpm, queue: :fork_import + later :fork_git_repo, queue: :fork_import end def repo @@ -37,7 +37,7 @@ module Modules def create_branch(new_ref, from_ref, user) return false if new_ref.blank? || from_ref.blank? || !(from_commit = repo.commit(from_ref)) - status, out, err = repo.git.native(:branch, {:process_info => true}, new_ref, from_commit.id) + status, out, err = repo.git.native(:branch, {process_info: true}, new_ref, from_commit.id) if status == 0 Resque.enqueue(GitHook, owner.uname, name, from_commit.id, GitHook::ZERO, "refs/heads/#{new_ref}", 'commit', "user-#{user.id}", nil) return true @@ -75,7 +75,7 @@ module Modules system "sudo chown -R rosa:rosa #{repo.path}" #FIXME Permission denied - /mnt/gitstore/git_projects/... index.add(path, data) - if sha1 = index.commit(message, :parents => [parent], :actor => actor, :last_tree => parent.tree.id, :head => head) + if sha1 = index.commit(message, parents: [parent], actor: actor, last_tree: parent.tree.id, head: head) Resque.enqueue(GitHook, owner.uname, name, sha1, sha1, "refs/heads/#{head}", 'commit', "user-#{options[:actor].id}", message) end sha1 @@ -103,7 +103,7 @@ module Modules [ node, node_path, - repo.log(treeish, node_path, :max_count => 1).first + repo.log(treeish, node_path, max_count: 1).first ] end end @@ -144,7 +144,7 @@ module Modules end def fork_git_repo - dummy = Grit::Repo.new(path) rescue parent.repo.fork_bare(path, :shared => false) + dummy = Grit::Repo.new(path) rescue parent.repo.fork_bare(path, shared: false) write_hook end @@ -212,31 +212,31 @@ module Modules end end if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? - next if owner.projects.exists?(:name => name) + next if owner.projects.exists?(name: name) description = `rpm -q --qf '[%{Description}]' -p #{srpm_file}`.scrub('') project = owner.projects.build( - :name => name, - :description => description, - :visibility => visibility, - :is_package => false # See: Hook for #attach_to_personal_repository + name: name, + description: description, + visibility: visibility, + is_package: false # See: Hook for #attach_to_personal_repository ) project.owner = owner if project.save repository.projects << project rescue nil - project.update_attributes(:is_package => true) + project.update_attributes(is_package: true) project.import_srpm srpm_file, platform.name end end rescue => e f.close if defined?(f) - Airbrake.notify_or_ignore(e, :link => link.to_s, :url => url, :owner => owner) + Airbrake.notify_or_ignore(e, link: link.to_s, url: url, owner: owner) ensure File.delete srpm_file if srpm_file end end rescue => e - Airbrake.notify_or_ignore(e, :url => url, :owner => owner) + Airbrake.notify_or_ignore(e, url: url, owner: owner) ensure FileUtils.remove_entry_secure dir if dir end diff --git a/lib/modules/models/markdown.rb b/lib/modules/models/markdown.rb index 6edc9f182..4483fcb64 100644 --- a/lib/modules/models/markdown.rb +++ b/lib/modules/models/markdown.rb @@ -183,7 +183,7 @@ module Modules def reference_commit(identifier) if commit = @project.repo.commit(identifier) link_to shortest_hash_id(commit.id), commit_path(@project, commit.id) - title = GitPresenters::CommitAsMessagePresenter.present(commit, :project => @project) do |presenter| + title = GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter| link_to(identifier, commit_path(@project, commit), html_options.merge(title: presenter.caption, class: "gfm gfm-commit #{html_options[:class]}")) end end diff --git a/lib/modules/models/owner.rb b/lib/modules/models/owner.rb index fc451c4ff..953fa39d6 100644 --- a/lib/modules/models/owner.rb +++ b/lib/modules/models/owner.rb @@ -4,8 +4,8 @@ module Modules extend ActiveSupport::Concern included do - validates :owner, :presence => true - after_create lambda { relations.create :actor_id => owner.id, :actor_type => owner.class.to_s, :role => 'admin' } + validates :owner, presence: true + after_create lambda { relations.create actor_id: owner.id, actor_type: owner.class.to_s, role: 'admin' } end end diff --git a/lib/modules/models/personal_repository.rb b/lib/modules/models/personal_repository.rb index ce79e1090..2a4ba43fd 100644 --- a/lib/modules/models/personal_repository.rb +++ b/lib/modules/models/personal_repository.rb @@ -4,7 +4,7 @@ module Modules extend ActiveSupport::Concern included do - after_create :create_personal_repository, :unless => :system? + after_create :create_personal_repository, unless: :system? end def create_personal_repository diff --git a/lib/modules/models/time_living.rb b/lib/modules/models/time_living.rb index 0dd79d45c..d0ac003a4 100644 --- a/lib/modules/models/time_living.rb +++ b/lib/modules/models/time_living.rb @@ -5,9 +5,9 @@ module Modules included do - validates :time_living, :numericality => { - :only_integer => true - }, :presence => true + validates :time_living, numericality: { + only_integer: true + }, presence: true validate lambda { # MIN_TIME_LIVING <= time_living <= MAX_TIME_LIVING or @@ -17,8 +17,8 @@ module Modules max = self.class.const_defined?(:MAX_TIME_LIVING) ? self.class::MAX_TIME_LIVING : 43200 if min > time_living.to_i || time_living.to_i > max errors.add :time_living, I18n.t('flash.time_living.numericality_error', - :min => (min / 60), - :max => (max / 60) + min: (min / 60), + max: (max / 60) ) end } diff --git a/lib/modules/models/url_helper.rb b/lib/modules/models/url_helper.rb index 7dac3d65d..c374899c3 100644 --- a/lib/modules/models/url_helper.rb +++ b/lib/modules/models/url_helper.rb @@ -2,6 +2,6 @@ module Modules::Models::UrlHelper def default_url_options host ||= EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] protocol ||= APP_CONFIG['mailer_https_url'] ? 'https' : 'http' rescue 'http' - {:host => host, :protocol => protocol} + {host: host, protocol: protocol} end end diff --git a/lib/modules/models/wiki.rb b/lib/modules/models/wiki.rb index acd14f259..033df0881 100644 --- a/lib/modules/models/wiki.rb +++ b/lib/modules/models/wiki.rb @@ -21,9 +21,9 @@ module Modules def create_wiki if has_wiki && !FileTest.exist?(wiki_path) Grit::Repo.init_bare(wiki_path) - wiki = Gollum::Wiki.new(wiki_path, {:base_path => Rails.application.routes.url_helpers.project_wiki_index_path(owner, self)}) + wiki = Gollum::Wiki.new(wiki_path, {base_path: Rails.application.routes.url_helpers.project_wiki_index_path(owner, self)}) wiki.write_page('Home', :markdown, I18n.t("wiki.seed.welcome_content"), - {:name => owner.name, :email => owner.email, :message => 'Initial commit'}) + {name: owner.name, email: owner.email, message: 'Initial commit'}) end end diff --git a/lib/modules/observers/activity_feed/build_list.rb b/lib/modules/observers/activity_feed/build_list.rb index af25b3137..b2230357f 100644 --- a/lib/modules/observers/activity_feed/build_list.rb +++ b/lib/modules/observers/activity_feed/build_list.rb @@ -22,18 +22,18 @@ module Modules::Observers::ActivityFeed::BuildList updater = publisher || user (project.admins | [publisher].compact).each do |recipient| ActivityFeed.create( - :user => recipient, - :kind => 'build_list_notification', - :data => { - :build_list_id => id, - :status => status, - :updated_at => updated_at, - :project_id => project_id, - :project_name => project.name, - :project_owner => project.owner.uname, - :user_name => updater.name, - :user_email => updater.email, - :user_id => updater.id + user: recipient, + kind: 'build_list_notification', + data: { + build_list_id: id, + status: status, + updated_at: updated_at, + project_id: project_id, + project_name: project.name, + project_owner: project.owner.uname, + user_name: updater.name, + user_email: updater.email, + user_id: updater.id } ) end diff --git a/lib/modules/observers/activity_feed/comment.rb b/lib/modules/observers/activity_feed/comment.rb index db133c37e..162e38a98 100644 --- a/lib/modules/observers/activity_feed/comment.rb +++ b/lib/modules/observers/activity_feed/comment.rb @@ -2,7 +2,7 @@ module Modules::Observers::ActivityFeed::Comment extend ActiveSupport::Concern included do - after_commit :new_comment_notifications, :on => :create + after_commit :new_comment_notifications, on: :create # dont remove outdated issues link after_update -> { Comment.create_link_on_issues_from_item(self) } end @@ -16,25 +16,25 @@ module Modules::Observers::ActivityFeed::Comment if user_id != subscribe.user_id UserMailer.new_comment_notification(self, subscribe.user).deliver if can_notify_on_new_comment?(subscribe) ActivityFeed.create( - :user => subscribe.user, - :kind => 'new_comment_notification', - :data => { - :user_name => user.name, - :user_email => user.email, - :user_id => user_id, - :comment_body => body, - :issue_title => commentable.title, - :issue_serial_id => commentable.serial_id, - :project_id => commentable.project.id, - :comment_id => id, - :project_name => project.name, - :project_owner => project.owner.uname + user: subscribe.user, + kind: 'new_comment_notification', + data: { + user_name: user.name, + user_email: user.email, + user_id: user_id, + comment_body: body, + issue_title: commentable.title, + issue_serial_id: commentable.serial_id, + project_id: commentable.project.id, + comment_id: id, + project_name: project.name, + project_owner: project.owner.uname } ) end end elsif commit_comment? - Subscribe.comment_subscribes(self).where(:status => true).each do |subscribe| + Subscribe.comment_subscribes(self).where(status: true).each do |subscribe| next if own_comment?(subscribe.user) if subscribe.user.notifier.can_notify and ( (subscribe.project.owner?(subscribe.user) && subscribe.user.notifier.new_comment_commit_repo_owner) or @@ -43,19 +43,19 @@ module Modules::Observers::ActivityFeed::Comment UserMailer.new_comment_notification(self, subscribe.user).deliver end ActivityFeed.create( - :user => subscribe.user, - :kind => 'new_comment_commit_notification', - :data => { - :user_name => user.name, - :user_email => user.email, - :user_id => user_id, - :comment_body => body, - :commit_message => commentable.message, - :commit_id => commentable.id, - :project_id => project.id, - :comment_id => id, - :project_name => project.name, - :project_owner => project.owner.uname} + user: subscribe.user, + kind: 'new_comment_commit_notification', + data: { + user_name: user.name, + user_email: user.email, + user_id: user_id, + comment_body: body, + commit_message: commentable.message, + commit_id: commentable.id, + project_id: project.id, + comment_id: id, + project_name: project.name, + project_owner: project.owner.uname} ) end end @@ -65,5 +65,4 @@ module Modules::Observers::ActivityFeed::Comment def can_notify_on_new_comment?(subscribe) User.find(subscribe.user).notifier.new_comment && User.find(subscribe.user).notifier.can_notify end - -end \ No newline at end of file +end diff --git a/lib/modules/observers/activity_feed/git.rb b/lib/modules/observers/activity_feed/git.rb index e1967d0b3..77edff99e 100644 --- a/lib/modules/observers/activity_feed/git.rb +++ b/lib/modules/observers/activity_feed/git.rb @@ -13,8 +13,8 @@ module Modules::Observers::ActivityFeed::Git if change_type == 'delete' kind = 'git_delete_branch_notification' - options = {:project_id => record.project.id, :project_name => record.project.name, :branch_name => branch_name, - :change_type => change_type, :project_owner => record.project.owner.uname} + options = {project_id: record.project.id, project_name: record.project.name, branch_name: branch_name, + change_type: change_type, project_owner: record.project.owner.uname} else if record.message # online update last_commits, commits = [[record.newrev, record.message]], [] @@ -26,22 +26,22 @@ module Modules::Observers::ActivityFeed::Git end kind = 'git_new_push_notification' - options = {:project_id => record.project.id, :project_name => record.project.name, :last_commits => last_commits, - :branch_name => branch_name, :change_type => change_type, :project_owner => record.project.owner.uname} + options = {project_id: record.project.id, project_name: record.project.name, last_commits: last_commits, + branch_name: branch_name, change_type: change_type, project_owner: record.project.owner.uname} if commits.count > 3 commits = commits[0...-3] - options.merge!({:other_commits_count => commits.count, :other_commits => "#{commits[0].sha[0..9]}...#{commits[-1].sha[0..9]}"}) + options.merge!({other_commits_count: commits.count, other_commits: "#{commits[0].sha[0..9]}...#{commits[-1].sha[0..9]}"}) end Comment.create_link_on_issues_from_item(record, all_commits) if all_commits.count > 0 end - options.merge!({:user_id => record.user.id, :user_name => record.user.name, :user_email => record.user.email}) if record.user + options.merge!({user_id: record.user.id, user_name: record.user.name, user_email: record.user.email}) if record.user record.project.admins.each do |recipient| next if record.user && record.user.id == recipient.id ActivityFeed.create!( - :user => recipient, - :kind => kind, - :data => options + user: recipient, + kind: kind, + data: options ) if recipient.notifier.can_notify && recipient.notifier.update_code UserMailer.send(kind, recipient, options).deliver @@ -54,14 +54,12 @@ module Modules::Observers::ActivityFeed::Git project.admins.each do |recipient| ActivityFeed.create!( - :user => recipient, - :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 => record[:commit_sha], :project_owner => project.owner.uname} + user: recipient, + 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: record[:commit_sha], project_owner: project.owner.uname} ) end end - end - -end \ No newline at end of file +end diff --git a/lib/modules/observers/activity_feed/issue.rb b/lib/modules/observers/activity_feed/issue.rb index 81f72522a..cb62545ab 100644 --- a/lib/modules/observers/activity_feed/issue.rb +++ b/lib/modules/observers/activity_feed/issue.rb @@ -2,13 +2,13 @@ module Modules::Observers::ActivityFeed::Issue extend ActiveSupport::Concern included do - after_commit :new_issue_notifications, :on => :create + after_commit :new_issue_notifications, on: :create - after_commit :send_assign_notifications, :on => :create, :if => Proc.new { |i| i.assignee } - after_commit -> { send_assign_notifications(:update) }, :on => :update + after_commit :send_assign_notifications, on: :create, if: Proc.new { |i| i.assignee } + after_commit -> { send_assign_notifications(:update) }, on: :update - after_commit :send_hooks, :on => :create - after_commit -> { send_hooks(:update) }, :on => :update, :if => Proc.new { |i| i.previous_changes['status'].present? } + after_commit :send_hooks, on: :create + after_commit -> { send_hooks(:update) }, on: :update, if: Proc.new { |i| i.previous_changes['status'].present? } end private @@ -20,17 +20,17 @@ module Modules::Observers::ActivityFeed::Issue UserMailer.new_issue_notification(self, recipient).deliver end ActivityFeed.create( - :user => recipient, - :kind => 'new_issue_notification', - :data => { - :user_name => user.name, - :user_email => user.email, - :user_id => user_id, - :issue_serial_id => serial_id, - :issue_title => title, - :project_id => project.id, - :project_name => project.name, - :project_owner => project.owner.uname + user: recipient, + kind: 'new_issue_notification', + data: { + user_name: user.name, + user_email: user.email, + user_id: user_id, + issue_serial_id: serial_id, + issue_title: title, + project_id: project.id, + project_name: project.name, + project_owner: project.owner.uname } ) end @@ -43,16 +43,16 @@ module Modules::Observers::ActivityFeed::Issue UserMailer.issue_assign_notification(self, assignee).deliver end ActivityFeed.create( - :user => assignee, - :kind => 'issue_assign_notification', - :data => { - :user_name => assignee.name, - :user_email => assignee.email, - :issue_serial_id => serial_id, - :issue_title => title, - :project_id => project.id, - :project_name => project.name, - :project_owner => project.owner.uname + user: assignee, + kind: 'issue_assign_notification', + data: { + user_name: assignee.name, + user_email: assignee.email, + issue_serial_id: serial_id, + issue_title: title, + project_id: project.id, + project_name: project.name, + project_owner: project.owner.uname } ) end diff --git a/lib/modules/observers/activity_feed/user.rb b/lib/modules/observers/activity_feed/user.rb index 45a01a718..1b7ac6e48 100644 --- a/lib/modules/observers/activity_feed/user.rb +++ b/lib/modules/observers/activity_feed/user.rb @@ -2,16 +2,16 @@ module Modules::Observers::ActivityFeed::User extend ActiveSupport::Concern included do - after_commit :new_user_notification, :on => :create + after_commit :new_user_notification, on: :create end private def new_user_notification ActivityFeed.create( - :user => self, - :kind => 'new_user_notification', - :data => {:user_name => self.user_appeal, :user_email => self.email} + user: self, + kind: 'new_user_notification', + data: {user_name: self.user_appeal, user_email: self.email} ) end diff --git a/lib/plugins/rails_datatables/README.md b/lib/plugins/rails_datatables/README.md index 0106b7206..8ff329ad3 100644 --- a/lib/plugins/rails_datatables/README.md +++ b/lib/plugins/rails_datatables/README.md @@ -55,7 +55,7 @@ Activate using <%= datatable() %>, passing in the columns, how to filter them (s :no_records_message - Message to display if no records are found, whether on load or after searching :auto_width - Automatically adjust the width of the columns. Defaults to true. :row_callback - a function to run on each row in the table. Inserted in to "'fnRowCallback': function( nRow, aData, iDisplayIndex ) { }". See [documentation for fnRowCallback](http://www.datatables.net/usage/callbacks) for more information. - + #### Column Options :class - string, the class to assign to the table cell. Default is none. @@ -64,18 +64,18 @@ Activate using <%= datatable() %>, passing in the columns, how to filter them (s :searchable - boolean, allow this column to be searched, for non-Ajax tables. Default is true. #### AJAX Options - + When you're working with large datasets it's not reasonable to load everything on page load. Use an :ajax_source to load just the records that are being displayed, do custom searching (DB, Solr, etc). :ajax_source - string, for large datasets, use an ajax source to load each page on its own. For smaller datasets, just load the whole set and let datatable do the sorting -Add a datatable method on your controller to return JSON -* Return the objects to be displayed -* Return the total number of objects +Add a datatable method on your controller to return JSON +* Return the objects to be displayed +* Return the total number of objects * Add a method to handle sorting - DataTables returns the column that is being sorted (0 - n), so you need to know which column is which and sort on it. - + ### AJAX Example - + #### Datatable view example - datatable.html.erb {"sEcho": <%= params[:sEcho] || -1 %>, @@ -99,12 +99,12 @@ Add a datatable method on your controller to return JSON end private - + def current_objects(params={}) current_page = (params[:iDisplayStart].to_i/params[:iDisplayLength].to_i rescue 0)+1 - @current_objects = Object.paginate :page => current_page, - :include => [:user], - :order => "#{datatable_columns(params[:iSortCol_0])} #{params[:sSortDir_0] || "DESC"}", + @current_objects = Object.paginate :page => current_page, + :include => [:user], + :order => "#{datatable_columns(params[:iSortCol_0])} #{params[:sSortDir_0] || "DESC"}", :conditions => conditions, :per_page => params[:iDisplayLength] end @@ -129,7 +129,7 @@ Add a datatable method on your controller to return JSON conditions << "(objects.description ILIKE '%#{params[:sSearch]}%' OR users.name ILIKE '%#{params[:sSearch]}%')" if(params[:sSearch]) return conditions.join(" AND ") end - + ### Note There is a more functionality offered by DataTables than this plugin currently provides. We add to it as we find need for other features. If there's a feature of DataTables that you'd like to see, fork this repo and add it so we can all benefit. diff --git a/lib/plugins/related_models/base.rb b/lib/plugins/related_models/base.rb index b8a2d83b3..c00c2e077 100644 --- a/lib/plugins/related_models/base.rb +++ b/lib/plugins/related_models/base.rb @@ -9,7 +9,7 @@ module RelatedModels helper_method :parent_url, :parent_path - self.class_attribute :parents_symbols, :resources_configuration, :instance_writer => false + self.class_attribute :parents_symbols, :resources_configuration, instance_writer: false self.parents_symbols ||= [] self.resources_configuration ||= {} diff --git a/lib/recipes/nginx.rb b/lib/recipes/nginx.rb index 9af0cbceb..e70d4ecbe 100644 --- a/lib/recipes/nginx.rb +++ b/lib/recipes/nginx.rb @@ -5,7 +5,7 @@ Capistrano::Configuration.instance(:must_exist).load do set(:nginx_config_path) { "/etc/nginx/conf.d/#{fetch :application}.conf" } desc "Generate Nginx configuration" - task :generate_configuration, :roles => :web, :except => { :no_release => true } do + task :generate_configuration, roles: :web, except: { no_release: true } do config = %Q{ upstream #{application}_backend { # server 127.0.0.1:#{unicorn_port rescue 8080}; @@ -48,22 +48,22 @@ server { end desc "Start nginx web server" - task :start, :roles => :web, :except => { :no_release => true } do + task :start, roles: :web, except: { no_release: true } do sudo "#{fetch :nginx_init_path} start" end desc "Stop nginx web server" - task :stop, :roles => :web, :except => { :no_release => true } do + task :stop, roles: :web, except: { no_release: true } do sudo "#{fetch :nginx_init_path} stop" end desc "Restart nginx web server" - task :restart, :roles => :web, :except => { :no_release => true } do + task :restart, roles: :web, except: { no_release: true } do sudo "#{fetch :nginx_init_path} restart" end desc "Resload nginx web server" - task :reload, :roles => :web, :except => { :no_release => true } do + task :reload, roles: :web, except: { no_release: true } do sudo "#{fetch :nginx_init_path} reload" end end diff --git a/lib/recipes/unicorn.rb b/lib/recipes/unicorn.rb index 7f5474489..d7b9fcb80 100644 --- a/lib/recipes/unicorn.rb +++ b/lib/recipes/unicorn.rb @@ -4,19 +4,19 @@ Capistrano::Configuration.instance(:must_exist).load do set(:unicorn_pid) { "#{fetch :shared_path}/pids/unicorn.pid" } # set :unicorn_port, 8080 - task :start, :roles => :app, :except => { :no_release => true } do + task :start, roles: :app, except: { no_release: true } do run "cd #{fetch :current_path} && #{try_sudo} #{unicorn_binary} -l /tmp/#{fetch :application}_unicorn.sock -E #{rails_env} -c config/unicorn.rb -D" # -p #{unicorn_port} end - task :stop, :roles => :app, :except => { :no_release => true } do + task :stop, roles: :app, except: { no_release: true } do run "#{try_sudo} kill `cat #{unicorn_pid}`" rescue warn 'deploy:stop FAILED' end - task :graceful_stop, :roles => :app, :except => { :no_release => true } do + task :graceful_stop, roles: :app, except: { no_release: true } do run "#{try_sudo} kill -QUIT `cat #{unicorn_pid}`" rescue warn 'deploy:graceful_stop FAILED' end - task :reload, :roles => :app, :except => { :no_release => true } do + task :reload, roles: :app, except: { no_release: true } do run "#{try_sudo} kill -USR2 `cat #{unicorn_pid}`" rescue warn 'deploy:reload FAILED' end - task :restart, :roles => :app, :except => { :no_release => true } do + task :restart, roles: :app, except: { no_release: true } do reload #stop #start # blue pill will do it? diff --git a/lib/tasks/activity_feeds.rake b/lib/tasks/activity_feeds.rake index 89e08b357..7a091dde1 100644 --- a/lib/tasks/activity_feeds.rake +++ b/lib/tasks/activity_feeds.rake @@ -1,6 +1,6 @@ namespace :activity_feeds do desc 'Remove outdated activity feeds' - task :clear => :environment do + task clear: :environment do say "Removing outdated Activity Feed" User.all.each do |user| outdated = ActivityFeed.outdated diff --git a/lib/tasks/add_branch.rake b/lib/tasks/add_branch.rake index c8055d8c4..95be01962 100644 --- a/lib/tasks/add_branch.rake +++ b/lib/tasks/add_branch.rake @@ -13,7 +13,7 @@ namespace :add_branch do end desc "Add branch for group projects" - task :group => :environment do + task group: :environment do src_branch = ENV['SRC_BRANCH'] dst_branch = ENV['DST_BRANCH'] group = ENV['GROUP'] @@ -22,13 +22,13 @@ namespace :add_branch do next if p.repo.branches.map(&:name).include?(dst_branch) next if p.repo.branches.map(&:name).exclude?(src_branch) say "===== Process #{p.name} project" - Rake::Task['add_branch:fork_branch'].execute(:path => p.path, :src_branch => src_branch, :dst_branch => dst_branch) + Rake::Task['add_branch:fork_branch'].execute(path: p.path, src_branch: src_branch, dst_branch: dst_branch) end say 'DONE' end desc "Add branch for platform projects" - task :platform => :environment do + task platform: :environment do src_branch = ENV['SRC_BRANCH'] || 'import_mandriva2011' dst_branch = ENV['DST_BRANCH'] || 'rosa2012lts' say "START add branch #{dst_branch} from #{src_branch}" @@ -37,14 +37,14 @@ namespace :add_branch do r.projects.find_each do |p| next if p.repo.branches.map(&:name).include?(dst_branch) say "===== Process #{p.name} project" - Rake::Task['add_branch:fork_branch'].execute(:path => p.path, :src_branch => src_branch, :dst_branch => dst_branch) + Rake::Task['add_branch:fork_branch'].execute(path: p.path, src_branch: src_branch, dst_branch: dst_branch) end end say 'DONE' end desc "Add branch for owner projects by list" - task :list => :environment do + task list: :environment do source = ENV['SOURCE'] || 'https://dl.dropbox.com/u/984976/texlive.txt' owner = User.find_by_uname(ENV['OWNER']) || Group.find_by_uname!(ENV['OWNER'] || 'import') platform = Platform.find_by_name!(ENV['PLATFORM'] || 'rosa2012.1') @@ -56,7 +56,7 @@ namespace :add_branch do name.chomp!; name.strip! print "Fork branch for '#{name}'... " if p = Project.find_by_owner_and_name(owner.uname, name) - # Rake::Task['add_branch:fork_branch'].execute(:path => p.path, :src_branch => src_branch, :dst_branch => dst_branch) + # Rake::Task['add_branch:fork_branch'].execute(path: p.path, src_branch: src_branch, dst_branch: dst_branch) system "bundle exec rake add_branch:fork_branch[#{p.path},#{src_branch},#{dst_branch}] -s RAILS_ENV=#{Rails.env} > /dev/null 2>&1" print 'Ok!' repo.projects << p rescue print ' Add to repo failed!' diff --git a/lib/tasks/buildlist.rake b/lib/tasks/buildlist.rake index 8409ba6dd..b97983786 100644 --- a/lib/tasks/buildlist.rake +++ b/lib/tasks/buildlist.rake @@ -3,11 +3,11 @@ namespace :buildlist do namespace :clear do desc 'Remove outdated BuildLists and MassBuilds' - task :outdated => :environment do + task outdated: :environment do say "[#{Time.zone.now}] Removing outdated BuildLists" say "[#{Time.zone.now}] There are #{BuildList.outdated.count} outdated BuildLists" counter = 0 - BuildList.outdated.order(:id).find_in_batches(:batch_size => 100) do |build_lists| + BuildList.outdated.order(:id).find_in_batches(batch_size: 100) do |build_lists| build_lists.each do |bl| bl.destroy && (counter += 1) if bl.id != bl.last_published.first.try(:id) end @@ -29,7 +29,7 @@ namespace :buildlist do namespace :packages do # TODO Maybe do it in migration, because it's just a single query? desc 'Actualize packages for all platforms' - task :actualize => :environment do + task actualize: :environment do say "Updating packages" packages = BuildList::Package.joins( %q{ @@ -49,7 +49,7 @@ namespace :buildlist do AND j_pt = package_type AND j_plid = platform_id AND j_ca = created_at - } ).update_all(:actual => true) + } ).update_all(actual: true) say "'Actual' setted to #{packages} packages" end end diff --git a/lib/tasks/change_git_head.rake b/lib/tasks/change_git_head.rake index 9ed2e5695..a99ba190f 100644 --- a/lib/tasks/change_git_head.rake +++ b/lib/tasks/change_git_head.rake @@ -1,7 +1,7 @@ namespace :project do desc 'Change HEAD at projects where default branch is not master' - task :git_change_head => :environment do + task git_change_head: :environment do projects = Project.where("default_branch <> 'master'") say "Find #{projects.count} project(s) without master HEAD" say "Start working..." diff --git a/lib/tasks/fix_orphan_pulls.rake b/lib/tasks/fix_orphan_pulls.rake index 54b4d41a5..ba6f6adb9 100644 --- a/lib/tasks/fix_orphan_pulls.rake +++ b/lib/tasks/fix_orphan_pulls.rake @@ -1,6 +1,6 @@ namespace :project do desc 'Fix pull requests where was delete the "from project"' - task :fix_orphan_pulls => :environment do + task fix_orphan_pulls: :environment do projects = Project.where('ancestry IS NOT NULL') say "Pull requests total count is #{PullRequest.count}" PullRequest.all.each_with_index do |pull, ind| @@ -9,7 +9,7 @@ namespace :project do print ' updating...' pull.from_project_name = pull.from_project.name pull.from_project_owner_uname = pull.from_project.owner.uname - say pull.save(:validate => false) ? 'success' : 'fail!' + say pull.save(validate: false) ? 'success' : 'fail!' else print ' its orphan! updating...' parent_path = File.join(APP_CONFIG['git_path'], 'pull_requests', pull.to_project.owner.uname, pull.to_project.name) @@ -17,7 +17,7 @@ namespace :project do # Get an owner and project name from the pull dir elements = Dir["#{pull.id}-*"].first.split '-' rescue [] pull.from_project_owner_uname, pull.from_project_name = elements[1], elements[2] - say pull.save(:validate => false) ? 'success' : 'fail!' + say pull.save(validate: false) ? 'success' : 'fail!' end end end diff --git a/lib/tasks/git_detach_from_parent.rake b/lib/tasks/git_detach_from_parent.rake index 737208c87..b8ebc8d60 100644 --- a/lib/tasks/git_detach_from_parent.rake +++ b/lib/tasks/git_detach_from_parent.rake @@ -1,6 +1,6 @@ namespace :project do desc 'Break the dependency of a repository cloned with --shared on its source repository' - task :git_detach_from_parent => :environment do + task git_detach_from_parent: :environment do projects = Project.where('ancestry IS NOT NULL') say "Total count of the forked projects is #{projects.count}" projects.each_with_index do |project, ind| diff --git a/lib/tasks/hook.rake b/lib/tasks/hook.rake index e979fd0e5..0cb214e79 100644 --- a/lib/tasks/hook.rake +++ b/lib/tasks/hook.rake @@ -1,10 +1,10 @@ namespace :hook do desc "Inserting hook to all repos" - task :install => :environment do + task install: :environment do hook = "/home/#{APP_CONFIG['shell_user']}/gitlab-shell/hooks/post-receive" say "Install process.." count, projects = 0, Project.scoped - projects = projects.where(:id => ENV['PROJECT_ID']) if ENV['PROJECT_ID'] + projects = projects.where(id: ENV['PROJECT_ID']) if ENV['PROJECT_ID'] projects.each do |project| next unless Dir.exist? project.path hook_file = File.join(project.path, 'hooks', 'post-receive') @@ -22,10 +22,10 @@ namespace :hook do end desc "remove git hook from all repos" - task :remove => :environment do + task remove: :environment do say "process.." count, projects = 0, Project.scoped - projects = projects.where(:id => ENV['PROJECT_ID']) if ENV['PROJECT_ID'] + projects = projects.where(id: ENV['PROJECT_ID']) if ENV['PROJECT_ID'] projects.each do |project| FileUtils.rm_rf File.join(project.path, 'hooks', 'post-receive') count = count + 1 diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 4bf23528d..ecd2265ec 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -3,7 +3,7 @@ require 'open-uri' namespace :import do desc "Load projects" - task :projects => :environment do + task projects: :environment do source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/package_list.txt' #owner = User.find_by_uname(ENV['OWNER_UNAME']) || Group.find_by_uname(ENV['OWNER_UNAME']) || User.first owner = Group.find_by_uname("npp_team") @@ -28,7 +28,7 @@ namespace :import do # 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 CLEAR=true HIDDEN=true > log/srpm_naulinux.log & desc 'Import SRPMs as projects' - task :srpm => :environment do + 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' @@ -49,7 +49,7 @@ namespace :import do else # check if project already added if project = repo.projects.find_by_name(name) || repo.projects.by_name(name).first # fallback to speedup print "Found project '#{project.name_with_owner}' in '#{platform.name}/#{repo.name}'." - elsif scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class) and + elsif scoped = Project.where(owner_id: owner.id, owner_type: owner.class) and project = scoped.find_by_name(name) || scoped.by_name(name).first begin repo.projects << project rescue nil @@ -60,12 +60,12 @@ namespace :import do end else description = `rpm -q --qf '[%{Description}]' -p #{srpm_file}`.scrub('') - project = Project.create!(:name => name, :description => description) {|p| p.owner = owner} + project = Project.create!(name: name, description: description) {|p| p.owner = owner} repo.projects << project rescue nil print "Create project #{project.name_with_owner} in #{platform.name}/#{repo.name} OK." end end - project.update_attributes(:visibility => 'hidden') if hidden + project.update_attributes(visibility: 'hidden') if hidden project.import_srpm(srpm_file, platform.name) print " Code import complete!" else @@ -78,7 +78,7 @@ namespace :import do namespace :sync do desc "Sync all repos" - task :all => :environment do + task all: :environment do # system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=main") # system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=contrib") # system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=non-free") @@ -89,10 +89,10 @@ namespace :import do system("bundle exec rake import:sync:run SOURCE=rsync://rh-mirror.redhat.com/redhat/linux/enterprise/6Server/en/os/SRPMS/ DESTINATION=#{File.join(APP_CONFIG['root_path'], 'rh-mirror.redhat.com', 'redhat', 'linux', 'enterprise', '6Server', 'en', 'os', 'SRPMS')} PLATFORM=server_personal REPOSITORY=main OWNER=server BRANCH=import") end - task :run => [:rsync, :parse] + task run: [:rsync, :parse] desc "Rsync with mirror.yandex.ru" - task :rsync => :environment do + task rsync: :environment do release = ENV['RELEASE'] || 'official/2011' repository = ENV['REPOSITORY'] || 'main' source = ENV['SOURCE'] || "rsync://mirror.yandex.ru/mandriva/#{release}/SRPMS/#{repository}/" @@ -107,7 +107,7 @@ namespace :import do end desc "Parse repository for changes" - task :parse => :environment do + task parse: :environment do release = ENV['RELEASE'] || 'official/2011' platform = Platform.find_by_name(ENV['PLATFORM'] || "mandriva2011") repository = platform.repositories.find_by_name(ENV['REPOSITORY'] || 'main') @@ -120,7 +120,7 @@ namespace :import do print "Processing '#{srpm_file}'... " if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? and version = `rpm -q --qf '[%{Version}-%{Release}]' -p #{srpm_file}` and $?.success? and version.present? - project_import = ProjectImport.find_by_name_and_platform_id(name, platform.id) || ProjectImport.by_name(name).where(:platform_id => platform.id).first || ProjectImport.new(:name => name, :platform_id => platform.id) + project_import = ProjectImport.find_by_name_and_platform_id(name, platform.id) || ProjectImport.by_name(name).where(platform_id: platform.id).first || ProjectImport.new(name: name, platform_id: platform.id) if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime unless project = project_import.project if platform.personal? # search project through owner # used for testhat @@ -129,13 +129,13 @@ namespace :import do else # search project through repository if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup print "Found project #{project.name_with_owner} in #{platform.name}/#{repository.name}. " - elsif scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class) and + elsif scoped = Project.where(owner_id: owner.id, owner_type: owner.class) and project = scoped.find_by_name(name) || scoped.by_name(name).first repository.projects << project print "Add project #{project.name_with_owner} to #{platform.name}/#{repository.name}. " else description = `rpm -q --qf '[%{Description}]' -p #{srpm_file}`.scrub('') - project = Project.create!(:name => name, :description => description) {|p| p.owner = owner} + project = Project.create!(name: name, description: description) {|p| p.owner = owner} repository.projects << project print "Create project #{project.name_with_owner} at #{platform.name}/#{repository.name}. " end diff --git a/lib/tasks/migrate_from_mount_to_symlink.rake b/lib/tasks/migrate_from_mount_to_symlink.rake index a7e1dfeec..98de5a833 100644 --- a/lib/tasks/migrate_from_mount_to_symlink.rake +++ b/lib/tasks/migrate_from_mount_to_symlink.rake @@ -1,7 +1,7 @@ namespace :downloads do desc "Migrate from mount to symlinks" - task :migrate => :environment do + task migrate: :environment do Platform.opened.each do |pl| system("sudo mv #{pl.symlink_path}/*.lst #{pl.path}") system("sudo umount #{pl.symlink_path}") diff --git a/lib/tasks/migrate_repos_task.rake b/lib/tasks/migrate_repos_task.rake index b5a64cef3..08d4ae5e4 100644 --- a/lib/tasks/migrate_repos_task.rake +++ b/lib/tasks/migrate_repos_task.rake @@ -1,7 +1,7 @@ namespace :repositories do desc "Migrate repositories from fs" - task :migrate => :environment do + task migrate: :environment do repo_dirs = Dir["/root/mandriva_main_git/*.git"] total = repo_dirs.length @@ -18,7 +18,7 @@ namespace :repositories do next end - project = main.projects.create(:name => project_name, :name => project_name) + project = main.projects.create(name: project_name, name: project_name) puts "Executing: 'rm -rf #{project.path}'" `rm -rf #{project.path}` diff --git a/lib/tasks/new_core.rake b/lib/tasks/new_core.rake index a38753d2c..56952652a 100644 --- a/lib/tasks/new_core.rake +++ b/lib/tasks/new_core.rake @@ -1,19 +1,19 @@ namespace :new_core do desc 'Extracts all rpms from BuildList container and updates BuildList::Package#sha1 field' - task :update_packages => :environment do + task update_packages: :environment do say "[#{Time.zone.now}] Starting to extract rpms..." token = User.find_by_uname('rosa_system').authentication_token - BuildList.where(:new_core => true). - where(:status => [ + BuildList.where(new_core: true). + where(status: [ BuildList::SUCCESS, BuildList::FAILED_PUBLISH, BuildList::BUILD_PUBLISHED, BuildList::BUILD_PUBLISH ]). order(:id). - find_in_batches(:batch_size => 100) do | build_lists | + find_in_batches(batch_size: 100) do | build_lists | build_lists.each do | bl | puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}" @@ -42,7 +42,7 @@ namespace :new_core do fullname = File.basename rpm_file package = bl.packages.by_package_type(package_type).find{ |p| p.fullname == fullname } next unless package - + package.sha1 = Digest::SHA1.file(rpm_file).hexdigest if %x[ curl #{APP_CONFIG['file_store_url']}/api/v1/file_stores.json?hash=#{package.sha1} ] == '[]' system "curl --user #{token}: -POST -F 'file_store[file]=@#{rpm_file}' #{APP_CONFIG['file_store_url']}/api/v1/upload" diff --git a/lib/tasks/product_build_list.rake b/lib/tasks/product_build_list.rake index 892f7e343..5cba505e3 100644 --- a/lib/tasks/product_build_list.rake +++ b/lib/tasks/product_build_list.rake @@ -3,7 +3,7 @@ namespace :product_build_list do namespace :clear do desc 'Remove outdated ProductBuildLists' - task :outdated => :environment do + task outdated: :environment do say "[#{Time.zone.now}] Removing outdated ProductBuildLists" say "[#{Time.zone.now}] There are #{ProductBuildList.outdated.count} outdated ProductBuildLists" ProductBuildList.outdated.destroy_all diff --git a/lib/tasks/projects.rake b/lib/tasks/projects.rake index 973123b73..5214007c4 100644 --- a/lib/tasks/projects.rake +++ b/lib/tasks/projects.rake @@ -2,7 +2,7 @@ namespace :project do namespace :maintainer do desc 'Set maintainer to owner (or to owners owner if owner is a group) to projects' - task :set_to_owner => :environment do + task set_to_owner: :environment do projects = Project.scoped count = projects.count say "Setting maintainer to all projects (#{count})" @@ -23,13 +23,13 @@ namespace :project do say "100% done" end end - task :maintainer => 'maintainer:set_to_owner' + task maintainer: 'maintainer:set_to_owner' end namespace :projects do desc 'Add projects from one platform repository to another' - task :copy_to_repo => :environment do + task copy_to_repo: :environment do source_platform = Platform.find_by_name!(ENV['SRC_PLATFORM']) dest_platform = Platform.find_by_name!(ENV['DST_PLATFORM']) source_repo = source_platform.repositories.find_by_name!(ENV['SRC_REPO']) diff --git a/lib/tasks/pull_requests.rake b/lib/tasks/pull_requests.rake index 010012a19..5885f1551 100644 --- a/lib/tasks/pull_requests.rake +++ b/lib/tasks/pull_requests.rake @@ -1,7 +1,7 @@ namespace :pull_requests do desc 'Remove temporary git repos for pull requests' - task :clear => :environment do + task clear: :environment do Dir.chdir(File.join(APP_CONFIG['git_path'], 'temp_pull_requests')) do say "Removing repos older one day:" say `find -mindepth 3 -maxdepth 3 -type d -mtime +0` diff --git a/lib/tasks/remove_branch.rake b/lib/tasks/remove_branch.rake index 89281d5a1..90752fc10 100644 --- a/lib/tasks/remove_branch.rake +++ b/lib/tasks/remove_branch.rake @@ -1,6 +1,6 @@ namespace :remove_branch do desc "Remove branch for group projects" - task :group => :environment do + task group: :environment do branch = ENV['BRANCH'] group = ENV['GROUP'] say "START remove branch #{branch} from #{group} group" diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index 5cc0e31e0..13c8f72f5 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -1,6 +1,6 @@ namespace :resque do desc 'Stop all Resque workers' - task :stop_workers => :environment do + task stop_workers: :environment do pids = [] Resque.workers.each do |worker| pids << worker.to_s.split(/:/).second diff --git a/lib/tasks/sudo_test.rake b/lib/tasks/sudo_test.rake index 9f3791971..ff5577baa 100644 --- a/lib/tasks/sudo_test.rake +++ b/lib/tasks/sudo_test.rake @@ -1,6 +1,6 @@ namespace :sudo_test do desc "Test sudo from web" - task :projects => :environment do + task projects: :environment do system "sudo touch /root/sudo_#{Time.now.to_i}.txt" - end + end end \ No newline at end of file diff --git a/spec/controllers/admin/flash_notifies_controller_spec.rb b/spec/controllers/admin/flash_notifies_controller_spec.rb index ad7494fda..73aa69a9d 100644 --- a/spec/controllers/admin/flash_notifies_controller_spec.rb +++ b/spec/controllers/admin/flash_notifies_controller_spec.rb @@ -6,11 +6,11 @@ describe Admin::FlashNotifiesController do @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: { + body_ru: "Hello! I`m ru body", + body_en: "Hello! I`m en body", + status: "error", + published: true } } @@ -18,9 +18,9 @@ describe Admin::FlashNotifiesController do @flash_notify2 = FactoryGirl.create(:flash_notify) @update_params = { - :id => @flash_notify, - :flash_notify => { - :body_ru => "updated!" + id: @flash_notify, + flash_notify: { + body_ru: "updated!" } } end @@ -28,7 +28,7 @@ describe Admin::FlashNotifiesController do 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 + get action, id: @flash_notify response.should redirect_to(new_user_session_path) end end @@ -38,7 +38,7 @@ describe Admin::FlashNotifiesController do end it 'should not change objects count on destroy' do - lambda { delete :destroy, :id => @flash_notify }.should change{ FlashNotify.count }.by(0) + lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(0) end it 'should not change flash notify body on update' do @@ -61,7 +61,7 @@ describe Admin::FlashNotifiesController do [:index, :new, :edit].each do |action| it "should be able to perform #{action} action" do - get action, :id => @flash_notify + get action, id: @flash_notify response.should render_template(action) end end @@ -76,12 +76,12 @@ describe Admin::FlashNotifiesController do end it 'should be able to perform destroy action' do - delete :destroy, :id => @flash_notify + 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) + lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(-1) end it 'should be able to perform update action' do @@ -103,7 +103,7 @@ describe Admin::FlashNotifiesController 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 + get action, id: @flash_notify response.should redirect_to(forbidden_path) end end @@ -113,7 +113,7 @@ describe Admin::FlashNotifiesController do end it 'should not change objects count on destroy' do - lambda { delete :destroy, :id => @flash_notify }.should change{ FlashNotify.count }.by(0) + lambda { delete :destroy, id: @flash_notify }.should change{ FlashNotify.count }.by(0) end it 'should not change flash notify body on update' do diff --git a/spec/controllers/api/v1/advisories_controller_spec.rb b/spec/controllers/api/v1/advisories_controller_spec.rb index dcc24b12e..b8e04f84a 100644 --- a/spec/controllers/api/v1/advisories_controller_spec.rb +++ b/spec/controllers/api/v1/advisories_controller_spec.rb @@ -2,44 +2,44 @@ require 'spec_helper' shared_examples_for 'api advisories user with show rights' do it 'should be able to perform show action' do - get :show, :id => @advisory.advisory_id, :format => :json + get :show, id: @advisory.advisory_id, format: :json response.should be_success end it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should be_success end end shared_examples_for 'api advisories user with admin rights' do context 'api advisories user with create rights' do - let(:params) { {:build_list_id => @build_list.id, :advisory => {:description => 'test'}} } + let(:params) { {build_list_id: @build_list.id, advisory: {description: 'test'}} } it 'should be able to perform create action' do - post :create, params, :format => :json + post :create, params, format: :json response.should be_success end it 'ensures that advisory has been created' do - lambda { post :create, params, :format => :json }.should change{ Advisory.count }.by(1) + lambda { post :create, params, format: :json }.should change{ Advisory.count }.by(1) end it 'ensures that build_list has been associated with advisory' do - post :create, params, :format => :json + post :create, params, format: :json @build_list.reload @build_list.advisory.should_not be_nil end end context 'api advisories user with update rights' do - let(:params) { {:id => @advisory.advisory_id, :build_list_id => @build_list.id} } + let(:params) { {id: @advisory.advisory_id, build_list_id: @build_list.id} } it 'should be able to perform update action' do - put :update, params, :format => :json + put :update, params, format: :json response.should be_success end it 'ensures that advisory has not been created' do - lambda { put :update, params, :format => :json }.should_not change{ Advisory.count } + lambda { put :update, params, format: :json }.should_not change{ Advisory.count } end it 'ensures that build_list has been associated with advisory' do - put :update, params, :format => :json + put :update, params, format: :json @build_list.reload @build_list.advisory.should_not be_nil end @@ -48,32 +48,32 @@ end shared_examples_for 'api advisories user without admin rights' do context 'api advisories user without create rights' do - let(:params) { {:build_list_id => @build_list.id, :advisory => {:description => 'test'}} } + let(:params) { {build_list_id: @build_list.id, advisory: {description: 'test'}} } it 'should not be able to perform create action' do - post :create, params, :format => :json + post :create, params, format: :json response.should_not be_success end it 'ensures that advisory has not been created' do - lambda { post :create, params, :format => :json }.should_not change{ Advisory.count } + lambda { post :create, params, format: :json }.should_not change{ Advisory.count } end it 'ensures that build_list has not been associated with advisory' do - post :create, params, :format => :json + post :create, params, format: :json @build_list.reload @build_list.advisory.should be_nil end end context 'api advisories user without update rights' do - let(:params) { {:id => @advisory.advisory_id, :build_list_id => @build_list.id} } + let(:params) { {id: @advisory.advisory_id, build_list_id: @build_list.id} } it 'should not be able to perform update action' do - put :update, params, :format => :json + put :update, params, format: :json response.should_not be_success end it 'ensures that advisory has not been created' do - lambda { put :update, params, :format => :json }.should_not change{ Advisory.count } + lambda { put :update, params, format: :json }.should_not change{ Advisory.count } end it 'ensures that build_list has not been associated with advisory' do - put :update, params, :format => :json + put :update, params, format: :json @build_list.reload @build_list.advisory.should be_nil end @@ -93,18 +93,18 @@ describe Api::V1::AdvisoriesController do end context 'for guest' do - + if APP_CONFIG['anonymous_access'] it_should_behave_like 'api advisories user with show rights' end it 'should not be able to perform show action', :anonymous_access => false do - get :show, :id => @advisory.advisory_id, :format => :json + get :show, id: @advisory.advisory_id, format: :json response.should_not be_success end it 'should not be able to perform index action', :anonymous_access => false do - get :index, :format => :json + get :index, format: :json response.should_not be_success end it_should_behave_like 'api advisories user without admin rights' @@ -132,7 +132,7 @@ describe Api::V1::AdvisoriesController do context 'for user who has access to update build_list' do before do @user = FactoryGirl.create(:user) - @build_list.save_to_platform.relations.create(:role => 'admin', :actor => @user) + @build_list.save_to_platform.relations.create(role: 'admin', actor: @user) http_login(@user) end diff --git a/spec/controllers/api/v1/arches_controller_spec.rb b/spec/controllers/api/v1/arches_controller_spec.rb index 125fb64f7..98eeae90a 100644 --- a/spec/controllers/api/v1/arches_controller_spec.rb +++ b/spec/controllers/api/v1/arches_controller_spec.rb @@ -6,12 +6,12 @@ describe Api::V1::ArchesController do context 'for guest' do it "should be able to perform index action", :anonymous_access => true do - get :index, :format => :json + get :index, format: :json should render_template(:index) end it 'should be able to perform get_id action', :anonymous_access => false do - get :index, :format => :json + get :index, format: :json response.status.should == 401 end end @@ -23,7 +23,7 @@ describe Api::V1::ArchesController do end it "should be able to perform index action" do - get :index, :format => :json + get :index, format: :json should render_template(:index) end end diff --git a/spec/controllers/api/v1/build_lists_controller_spec.rb b/spec/controllers/api/v1/build_lists_controller_spec.rb index 47e0dca86..12c63adc7 100644 --- a/spec/controllers/api/v1/build_lists_controller_spec.rb +++ b/spec/controllers/api/v1/build_lists_controller_spec.rb @@ -7,7 +7,7 @@ shared_examples_for 'show build list via api' do end it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should render_template("api/v1/build_lists/index") end end @@ -19,14 +19,14 @@ shared_examples_for 'not show build list via api' do end pending 'should not be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.body.should == {"message" => "Access violation to this page!"}.to_json end end shared_examples_for 'create build list via api' do before { - #@project.update_attributes({:repositories => @platform.repositories}) + #@project.update_attributes({repositories: @platform.repositories}) #test_git_commit(@project) } @@ -53,13 +53,13 @@ shared_examples_for 'create build list via api' do end it 'should not create without existing commit hash in project' do - lambda{ post :create, @create_params.deep_merge(:build_list => {:commit_hash => 'wrong'})}.should change{@project.build_lists.count}.by(0) + lambda{ post :create, @create_params.deep_merge(build_list: {commit_hash: 'wrong'})}.should change{@project.build_lists.count}.by(0) end end shared_examples_for 'not create build list via api' do before { - #@project.update_attributes({:repositories => @platform.repositories}) + #@project.update_attributes({repositories: @platform.repositories}) #test_git_commit(@project) } @@ -84,7 +84,7 @@ shared_examples_for 'validation error via build list api' do |message| end it "should return correct json error message" do - response.body.should == { :build_list => {:id => nil, :message => message} }.to_json + response.body.should == { build_list: {id: nil, message: message} }.to_json end end @@ -110,20 +110,20 @@ describe Api::V1::BuildListsController do @user = FactoryGirl.create(:user) @owner_user = @project.owner @member_user = FactoryGirl.create(:user) - @project.relations.create(:role => 'reader', :actor => @member_user) - @build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it?? + @project.relations.create(role: 'reader', actor: @member_user) + @build_list.save_to_platform.relations.create(role: 'admin', actor: @owner_user) # Why it's really need it?? # Create and show params: - @create_params = {:build_list => @build_list.attributes.symbolize_keys.merge(:qwerty=>'!')} # wrong parameter - @create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platform_id => @platform.id, :format => :json) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + @create_params = {build_list: @build_list.attributes.symbolize_keys.merge(:qwerty=>'!')} # wrong parameter + @create_params = @create_params.merge(arches: [@params[:arch_id]], build_for_platform_id: @platform.id, format: :json) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) http_login(@user) end context "do cancel" do def do_cancel - put :cancel, :id => @build_list, :format => :json + put :cancel, id: @build_list, format: :json end context 'if user is project owner' do @@ -136,7 +136,7 @@ describe Api::V1::BuildListsController do end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.cancel_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.cancel_success')} }.to_json end it 'should return 200 response code' do @@ -180,7 +180,7 @@ describe Api::V1::BuildListsController do context "do create_container" do def do_create_container - put :create_container, :id => @build_list, :format => :json + put :create_container, id: @build_list, format: :json end before { stub_redis } @@ -195,7 +195,7 @@ describe Api::V1::BuildListsController do do_create_container end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.create_container_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.create_container_success')} }.to_json end it 'should return 200 response code' do @@ -239,7 +239,7 @@ describe Api::V1::BuildListsController do context 'do publish_into_testing' do def do_publish_into_testing - put :publish_into_testing, :id => @build_list, :format => :json + put :publish_into_testing, id: @build_list, format: :json end context 'if user is project && platform owner' do @@ -253,7 +253,7 @@ describe Api::V1::BuildListsController do do_publish_into_testing end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.publish_success')} }.to_json end it 'should return 200 response code' do @@ -272,7 +272,7 @@ describe Api::V1::BuildListsController do end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.publish_success')} }.to_json end it 'should return 200 response code' do @@ -340,7 +340,7 @@ describe Api::V1::BuildListsController do context "do publish" do def do_publish - put :publish, :id => @build_list, :format => :json + put :publish, id: @build_list, format: :json end context 'if user is project && platform owner' do @@ -354,7 +354,7 @@ describe Api::V1::BuildListsController do do_publish end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.publish_success')} }.to_json end it 'should return 200 response code' do @@ -373,7 +373,7 @@ describe Api::V1::BuildListsController do end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.publish_success')} }.to_json end it 'should return 200 response code' do @@ -455,12 +455,12 @@ describe Api::V1::BuildListsController do context "do reject_publish" do before(:each) do - any_instance_of(BuildList, :current_duration => 100) + any_instance_of(BuildList, current_duration: 100) @build_list.save_to_repository.update_column(:publish_without_qa, false) end def do_reject_publish - put :reject_publish, :id => @build_list, :format => :json + put :reject_publish, id: @build_list, format: :json end context 'if user is project owner' do @@ -473,7 +473,7 @@ describe Api::V1::BuildListsController do context "if it has :success status" do it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.reject_publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.reject_publish_success')} }.to_json end it 'should return 200 response code' do @@ -521,7 +521,7 @@ describe Api::V1::BuildListsController do @another_user = FactoryGirl.create(:user) @build_list.update_column(:status, BuildList::SUCCESS) @build_list.save_to_repository.update_column(:publish_without_qa, true) - @build_list.project.collaborators.create(:actor_type => 'User', :actor_id => @another_user.id, :role => 'reader') + @build_list.project.collaborators.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader') http_login(@another_user) do_reject_publish end @@ -541,13 +541,13 @@ describe Api::V1::BuildListsController do @another_user = FactoryGirl.create(:user) @build_list.update_column(:status, BuildList::SUCCESS) @build_list.save_to_repository.update_column(:publish_without_qa, true) - @build_list.project.relations.create!(:actor_type => 'User', :actor_id => @another_user.id, :role => 'writer') + @build_list.project.relations.create!(actor_type: 'User', actor_id: @another_user.id, role: 'writer') http_login(@another_user) do_reject_publish end it "should return correct json message" do - response.body.should == { :build_list => {:id => @build_list.id, :message => I18n.t('layout.build_lists.reject_publish_success')} }.to_json + response.body.should == { build_list: {id: @build_list.id, message: I18n.t('layout.build_lists.reject_publish_success')} }.to_json end it 'should return 200 response code' do @@ -571,7 +571,7 @@ describe Api::V1::BuildListsController do before do repository = FactoryGirl.create(:repository) repository.platform.change_visibility - Platform.where(:id => @platform.id).update_all(:platform_type => 'personal') + Platform.where(id: @platform.id).update_all(platform_type: 'personal') @create_params[:build_list].merge!({ :include_repos => [repository.id], :build_for_platform_id => repository.platform_id @@ -624,18 +624,18 @@ describe Api::V1::BuildListsController do @member_user = FactoryGirl.create(:user) # Create and show params: - @create_params = {:build_list => @build_list.attributes.symbolize_keys} - @create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platform_id => @platform.id, :format => :json) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + @create_params = {build_list: @build_list.attributes.symbolize_keys} + @create_params = @create_params.merge(arches: [@params[:arch_id]], build_for_platform_id: @platform.id, format: :json) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) # Groups: - @owner_group = FactoryGirl.create(:group, :owner => @owner_user) + @owner_group = FactoryGirl.create(:group, owner: @owner_user) @member_group = FactoryGirl.create(:group) - @member_group.actors.create :role => 'reader', :actor_id => @member_user.id, :actor_type => 'User' + @member_group.actors.create role: 'reader', actor_id: @member_user.id, actor_type: 'User' @group = FactoryGirl.create(:group) @user = FactoryGirl.create(:user) - @group.actors.create :role => 'reader', :actor_id => @user.id, :actor_type => 'User' + @group.actors.create role: 'reader', actor_id: @user.id, actor_type: 'User' old_path = @project.path @project.owner = @owner_group @@ -643,10 +643,10 @@ describe Api::V1::BuildListsController do # Move GIT repo into new folder system "mkdir -p #{@project.path} && mv -f #{old_path}/* #{@project.path}/" - @project.relations.create :role => 'reader', :actor_id => @member_group.id, :actor_type => 'Group' - @project.relations.create :role => 'admin', :actor_id => @owner_group.id, :actor_type => 'Group' - @build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_group) # Why it's really need it?? - @build_list.save_to_platform.relations.create(:role => 'reader', :actor => @member_group) # Why it's really need it?? + @project.relations.create role: 'reader', actor_id: @member_group.id, actor_type: 'Group' + @project.relations.create role: 'admin', actor_id: @owner_group.id, actor_type: 'Group' + @build_list.save_to_platform.relations.create(role: 'admin', actor: @owner_group) # Why it's really need it?? + @build_list.save_to_platform.relations.create(role: 'reader', actor: @member_group) # Why it's really need it?? http_login(@user) end @@ -699,29 +699,29 @@ describe Api::V1::BuildListsController do @build_list2 = FactoryGirl.create(:build_list) @build_list2.project.update_column(:visibility, 'hidden') - project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user) - @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project) + project = FactoryGirl.create(:project_with_commit, visibility: 'hidden', owner: @user) + @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, project: project) @build_list4 = FactoryGirl.create(:build_list) @build_list4.project.update_column(:visibility, 'hidden') - @build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User' + @build_list4.project.relations.create! role: 'reader', actor_id: @user.id, actor_type: 'User' @filter_build_list1 = FactoryGirl.create(:build_list) @filter_build_list2 = FactoryGirl.create(:build_list) @filter_build_list3 = FactoryGirl.create(:build_list) - @filter_build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1.day), - :project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform, - :arch => @build_list3.arch) + @filter_build_list4 = FactoryGirl.create(:build_list, updated_at: (Time.now - 1.day), + project: @build_list3.project, save_to_platform: @build_list3.save_to_platform, + arch: @build_list3.arch) end context 'for guest' do - it 'should be able to perform index action', :anonymous_access => true do - get :index, :format => :json + it 'should be able to perform index action', anonymous_access: true do + get :index, format: :json response.should be_success end - it 'should not be able to perform index action', :anonymous_access => false do - get :index, :format => :json + it 'should not be able to perform index action', anonymous_access: false do + get :index, format: :json response.status.should == 401 end end @@ -732,12 +732,12 @@ describe Api::V1::BuildListsController do } it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should be_success end it 'should show only accessible build_lists' do - get :index, :filter => {:ownership => 'index'}, :format => :json + get :index, filter: {ownership: 'index'}, format: :json assigns(:build_lists).should include(@build_list1) assigns(:build_lists).should_not include(@build_list2) assigns(:build_lists).should include(@build_list3) @@ -752,24 +752,24 @@ describe Api::V1::BuildListsController do end it 'should filter by id' do - get :index, :filter => {:id => @filter_build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json + get :index, filter: {id: @filter_build_list1.id, project_name: 'fdsfdf', any_other_field: 'do not matter'}, format: :json assigns[:build_lists].should include(@filter_build_list1) assigns[:build_lists].should_not include(@filter_build_list2) assigns[:build_lists].should_not include(@filter_build_list3) end it 'should filter by project_name' do - get :index, :filter => {:project_name => @filter_build_list2.project.name, :ownership => 'index'}, :format => :json + get :index, filter: {project_name: @filter_build_list2.project.name, ownership: 'index'}, format: :json assigns[:build_lists].should_not include(@filter_build_list1) assigns[:build_lists].should include(@filter_build_list2) assigns[:build_lists].should_not include(@filter_build_list3) end it 'should filter by project_name and start_date' do - get :index, :filter => {:project_name => @filter_build_list3.project.name, :ownership => 'index', + get :index, filter: {project_name: @filter_build_list3.project.name, ownership: 'index', :"updated_at_start(1i)" => @filter_build_list3.updated_at.year.to_s, :"updated_at_start(2i)" => @filter_build_list3.updated_at.month.to_s, - :"updated_at_start(3i)" => @filter_build_list3.updated_at.day.to_s}, :format => :json + :"updated_at_start(3i)" => @filter_build_list3.updated_at.day.to_s}, format: :json assigns[:build_lists].should_not include(@filter_build_list1) assigns[:build_lists].should_not include(@filter_build_list2) assigns[:build_lists].should include(@filter_build_list3) @@ -787,11 +787,11 @@ describe Api::V1::BuildListsController do stub_symlink_methods @owner_user = @project.owner @member_user = FactoryGirl.create(:user) - @project.relations.create(:role => 'reader', :actor => @member_user) - @build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it?? + @project.relations.create(role: 'reader', actor: @member_user) + @build_list.save_to_platform.relations.create(role: 'admin', actor: @owner_user) # Why it's really need it?? # Show params: - @show_params = {:id => @build_list.id, :format => :json} + @show_params = {id: @build_list.id, format: :json} end context 'for open project' do @@ -836,32 +836,32 @@ describe Api::V1::BuildListsController do context "for group" do before(:each) do @platform = FactoryGirl.create(:platform_with_repos) - @build_list = FactoryGirl.create(:build_list, :save_to_platform => @platform) + @build_list = FactoryGirl.create(:build_list, save_to_platform: @platform) @project = @build_list.project @params = @build_list.attributes.symbolize_keys stub_symlink_methods @owner_user = @project.owner#FactoryGirl.create(:user) @member_user = FactoryGirl.create(:user) - #@project.relations.create(:role => 'reader', :actor => @member_user) + #@project.relations.create(role: 'reader', actor: @member_user) # Show params: - @show_params = {:id => @build_list.id, :format => :json} + @show_params = {id: @build_list.id, format: :json} # Groups: - @owner_group = FactoryGirl.create(:group, :owner => @owner_user) + @owner_group = FactoryGirl.create(:group, owner: @owner_user) @member_group = FactoryGirl.create(:group) - @member_group.actors.create :role => 'reader', :actor_id => @member_user.id, :actor_type => 'User' + @member_group.actors.create role: 'reader', actor_id: @member_user.id, actor_type: 'User' @group = FactoryGirl.create(:group) - @group.actors.create :role => 'reader', :actor_id => @user.id, :actor_type => 'User' + @group.actors.create role: 'reader', actor_id: @user.id, actor_type: 'User' - #@project = FactoryGirl.create(:project, :owner => @owner_group, :repositories => @platform.repositories) + #@project = FactoryGirl.create(:project, owner: @owner_group, repositories: @platform.repositories) #@project.owner = @owner_group #@project.save - @project.relations.create :role => 'reader', :actor_id => @member_group.id, :actor_type => 'Group' - #@build_list.save_to_platform.relations.create(:role => 'reader', :actor => @member_group) # Why it's really need it?? - #@build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_group) # Why it's really need it?? + @project.relations.create role: 'reader', actor_id: @member_group.id, actor_type: 'Group' + #@build_list.save_to_platform.relations.create(role: 'reader', actor: @member_group) # Why it's really need it?? + #@build_list.save_to_platform.relations.create(role: 'admin', actor: @owner_group) # Why it's really need it?? end context 'for open project' do diff --git a/spec/controllers/api/v1/groups_controller_spec.rb b/spec/controllers/api/v1/groups_controller_spec.rb index 342d022b6..d7a2f9e2c 100644 --- a/spec/controllers/api/v1/groups_controller_spec.rb +++ b/spec/controllers/api/v1/groups_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' shared_examples_for 'api group user with reader rights' do it 'should be able to perform members action' do - get :members, :id => @group.id, :format => :json + get :members, id: @group.id, format: :json response.should be_success end it_should_behave_like 'api group user with show rights' @@ -10,19 +10,19 @@ end shared_examples_for 'api group user with show rights' do it 'should be able to perform show action' do - get :show, :id => @group.id, :format => :json + get :show, id: @group.id, format: :json response.should be_success end it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should be_success end end shared_examples_for 'api group user without reader rights' do it 'should not be able to perform members action' do - get :members, :id => @group.id, :format => :json + get :members, id: @group.id, format: :json response.should_not be_success end end @@ -31,7 +31,7 @@ shared_examples_for 'api group user with admin rights' do context 'api group user with update rights' do before do - put :update, {:group => {:description => 'new description'}, :id => @group.id}, :format => :json + put :update, {group: {description: 'new description'}, id: @group.id}, format: :json end it 'should be able to perform update action' do @@ -46,7 +46,7 @@ shared_examples_for 'api group user with admin rights' do context 'api group user with add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :id => @group.id}, :format => :json + put :add_member, {member_id: member.id, id: @group.id}, format: :json end it 'should be able to perform add_member action' do @@ -61,7 +61,7 @@ shared_examples_for 'api group user with admin rights' do let(:member) { FactoryGirl.create(:user) } before do @group.add_member(member) - delete :remove_member, {:member_id => member.id, :id => @group.id}, :format => :json + delete :remove_member, {member_id: member.id, id: @group.id}, format: :json end it 'should be able to perform remove_member action' do @@ -76,14 +76,14 @@ shared_examples_for 'api group user with admin rights' do let(:member) { FactoryGirl.create(:user) } before do @group.add_member(member) - put :update_member, {:member_id => member.id, :role => 'reader', :id => @group.id}, :format => :json + put :update_member, {member_id: member.id, role: 'reader', id: @group.id}, format: :json end it 'should be able to perform update_member action' do response.should be_success end it 'ensures that member role has been updated in group' do - @group.actors.where(:actor_id => member, :actor_type => 'User').first. + @group.actors.where(actor_id: member, actor_type: 'User').first. role.should == 'reader' end end @@ -92,11 +92,11 @@ end shared_examples_for 'api group user with owner rights' do context 'api group user with destroy rights' do it 'should be able to perform destroy action' do - delete :destroy, :id => @group.id, :format => :json + delete :destroy, id: @group.id, format: :json response.should be_success end it 'ensures that group has been destroyed' do - lambda { delete :destroy, :id => @group.id, :format => :json }.should change{ Group.count }.by(-1) + lambda { delete :destroy, id: @group.id, format: :json }.should change{ Group.count }.by(-1) end end end @@ -106,21 +106,21 @@ shared_examples_for 'api group user without admin rights' do let(:member) { FactoryGirl.create(:user) } before do @group.add_member(member) - put :update_member, {:member_id => member.id, :role => 'reader', :id => @group.id}, :format => :json + put :update_member, {member_id: member.id, role: 'reader', id: @group.id}, format: :json end it 'should not be able to perform update_member action' do response.should_not be_success end it 'ensures that member role has not been updated in group' do - @group.actors.where(:actor_id => member, :actor_type => 'User').first. + @group.actors.where(actor_id: member, actor_type: 'User').first. role.should_not == 'reader' end end context 'api group user without update rights' do before do - put :update, {:group => {:description => 'new description'}, :id => @group.id}, :format => :json + put :update, {group: {description: 'new description'}, id: @group.id}, format: :json end it 'should not be able to perform update action' do @@ -135,7 +135,7 @@ shared_examples_for 'api group user without admin rights' do context 'api group user without add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :id => @group.id}, :format => :json + put :add_member, {member_id: member.id, id: @group.id}, format: :json end it 'should not be able to perform add_member action' do @@ -150,7 +150,7 @@ shared_examples_for 'api group user without admin rights' do let(:member) { FactoryGirl.create(:user) } before do @group.add_member(member) - delete :remove_member, {:member_id => member.id, :id => @group.id}, :format => :json + delete :remove_member, {member_id: member.id, id: @group.id}, format: :json end it 'should be able to perform update action' do @@ -166,11 +166,11 @@ end shared_examples_for 'api group user without owner rights' do context 'api group user without destroy rights' do it 'should not be able to perform destroy action' do - delete :destroy, :id => @group.id, :format => :json + delete :destroy, id: @group.id, format: :json response.should_not be_success end it 'ensures that group has not been destroyed' do - lambda { delete :destroy, :id => @group.id, :format => :json }.should_not change{ Group.count } + lambda { delete :destroy, id: @group.id, format: :json }.should_not change{ Group.count } end end end @@ -184,30 +184,30 @@ describe Api::V1::GroupsController do end context 'for guest' do - + it "should not be able to perform index action" do - get :index, :format => :json + get :index, format: :json response.status.should == 401 end it "should not be able to perform show action", :anonymous_access => false do - get :show, :id => @group.id, :format => :json + get :show, id: @group.id, format: :json response.status.should == 401 end it "should be able to perform show action", :anonymous_access => true do - get :show, :id => @group.id, :format => :json + get :show, id: @group.id, format: :json response.should be_success end context 'api group user without create rights' do - let(:params) { {:group => {:uname => 'test_uname'}} } + let(:params) { {group: {uname: 'test_uname'}} } it 'should not be able to perform create action' do - post :create, params, :format => :json + post :create, params, format: :json response.should_not be_success end it 'ensures that group has not been created' do - lambda { post :create, params, :format => :json }.should_not change{ Group.count } + lambda { post :create, params, format: :json }.should_not change{ Group.count } end end @@ -229,7 +229,7 @@ describe Api::V1::GroupsController do context 'for owner user' do before do - @group = FactoryGirl.create(:group, :owner => @user) + @group = FactoryGirl.create(:group, owner: @user) http_login(@user) end diff --git a/spec/controllers/api/v1/issues_controller_spec.rb b/spec/controllers/api/v1/issues_controller_spec.rb index aa3466500..477a2a2ad 100644 --- a/spec/controllers/api/v1/issues_controller_spec.rb +++ b/spec/controllers/api/v1/issues_controller_spec.rb @@ -4,30 +4,30 @@ describe Api::V1::IssuesController do before(:all) do stub_symlink_methods stub_redis - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) @project = FactoryGirl.create(:project_with_commit) - @issue = FactoryGirl.create(:issue, :project => @project) + @issue = FactoryGirl.create(:issue, project: @project) @membered_issue = FactoryGirl.create(:issue) @membered_project = @membered_issue.project - @membered_project.relations.create(:role => 'reader', :actor => @issue.user) + @membered_project.relations.create(role: 'reader', actor: @issue.user) @open_issue = FactoryGirl.create(:issue) @open_project = @open_issue.project - @own_hidden_project = FactoryGirl.create(:project, :owner => @issue.user) + @own_hidden_project = FactoryGirl.create(:project, owner: @issue.user) @own_hidden_project.update_column :visibility, 'hidden' - @own_hidden_issue = FactoryGirl.create(:issue, :project => @own_hidden_project, :assignee => @issue.user) + @own_hidden_issue = FactoryGirl.create(:issue, project: @own_hidden_project, assignee: @issue.user) @hidden_issue = FactoryGirl.create(:issue) @hidden_project = @hidden_issue.project @hidden_project.update_column :visibility, 'hidden' - @create_params = {:issue => {:title => 'title', :body => 'body'}, :project_id => @project.id, :format => :json} - @update_params = {:issue => {:title => 'new title'}, :project_id => @project.id, :id => @issue.serial_id, :format => :json} + @create_params = {issue: {title: 'title', body: 'body'}, project_id: @project.id, format: :json} + @update_params = {issue: {title: 'new title'}, project_id: @project.id, id: @issue.serial_id, format: :json} - @pull = @project.pull_requests.new :issue_attributes => {:title => 'test', :body => 'testing'} + @pull = @project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'} @pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project @pull.to_ref = 'master' @pull.from_project, @pull.from_ref = @project, 'non_conflicts' @@ -41,77 +41,77 @@ describe Api::V1::IssuesController do end it 'can show issue in own project' do - get :show, :project_id => @project.id, :id => @issue.serial_id, :format => :json + get :show, project_id: @project.id, id: @issue.serial_id, format: :json response.should be_success end it 'should render right template for show action' do - get :show, :project_id => @project.id, :id => @issue.serial_id, :format => :json + get :show, project_id: @project.id, id: @issue.serial_id, format: :json response.should render_template('api/v1/issues/show') end it 'can show issue in open project' do - get :show, :project_id => @open_project.id, :id => @open_issue.serial_id, :format => :json + get :show, project_id: @open_project.id, id: @open_issue.serial_id, format: :json response.should be_success end it 'can show issue in own hidden project' do - get :show, :project_id => @own_hidden_project.id, :id => @own_hidden_issue.serial_id, :format => :json + get :show, project_id: @own_hidden_project.id, id: @own_hidden_issue.serial_id, format: :json response.should be_success end it "can't show issue in hidden project" do - get :show, :project_id => @hidden_project.id, :id => @hidden_issue.serial_id, :format => :json + get :show, project_id: @hidden_project.id, id: @hidden_issue.serial_id, format: :json response.status.should == 403 end it 'should return three issues' do - get :all_index, :filter => 'all', :format => :json + get :all_index, filter: 'all', format: :json assigns[:issues].should include(@issue) assigns[:issues].should include(@own_hidden_issue) assigns[:issues].should include(@membered_issue) end it 'should render right template for all index action' do - get :all_index, :format => :json + get :all_index, format: :json response.should render_template('api/v1/issues/index') end it 'should return only assigned issue' do - get :user_index, :format => :json + get :user_index, format: :json assigns[:issues].should include(@own_hidden_issue) assigns[:issues].should have(1).item end it 'should render right template for user index action' do - get :user_index, :format => :json + get :user_index, format: :json response.should render_template('api/v1/issues/index') end it 'should return 404' do - get :show, :project_id => @project.id, :id => 999999, :format => :json + get :show, project_id: @project.id, id: 999999, format: :json response.status.should == 404 end it 'should redirect to pull request page' do - get :show, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get :show, project_id: @project.id, id: @pull.serial_id, format: :json response.should redirect_to(api_v1_project_pull_request_path(@project.id, @pull.serial_id)) end end context 'for anonymous user' do - it 'can show issue in open project', :anonymous_access => true do - get :show, :project_id => @project.id, :id => @issue.serial_id, :format => :json + it 'can show issue in open project', anonymous_access: true do + get :show, project_id: @project.id, id: @issue.serial_id, format: :json response.should be_success end - it "can't show issue in hidden project", :anonymous_access => true do - get :show, :project_id => @hidden_project.id, :id => @hidden_issue.serial_id, :format => :json + it "can't show issue in hidden project", anonymous_access: true do + get :show, project_id: @hidden_project.id, id: @hidden_issue.serial_id, format: :json response.status.should == 403 end it 'should not return any issues' do - get :all_index, :filter => 'all', :format => :json + get :all_index, filter: 'all', format: :json response.status.should == 401 end end @@ -128,35 +128,35 @@ describe Api::V1::IssuesController do end it 'can create issue in own hidden project' do - lambda { post :create, @create_params.merge(:project_id => @own_hidden_project.id)}.should change{ Issue.count }.by(1) + lambda { post :create, @create_params.merge(project_id: @own_hidden_project.id)}.should change{ Issue.count }.by(1) end it 'can create issue in open project' do - lambda { post :create, @create_params.merge(:project_id => @open_project.id)}.should change{ Issue.count }.by(1) + lambda { post :create, @create_params.merge(project_id: @open_project.id)}.should change{ Issue.count }.by(1) end it "can't create issue in hidden project" do - lambda { post :create, @create_params.merge(:project_id => @hidden_project.id)}.should change{ Issue.count }.by(0) + lambda { post :create, @create_params.merge(project_id: @hidden_project.id)}.should change{ Issue.count }.by(0) end it 'can assignee issue in own project' do - post :create, @create_params.deep_merge(:project_id => @own_hidden_project, :issue => {:assignee_id => @issue.user.id}) + post :create, @create_params.deep_merge(project_id: @own_hidden_project, issue: {assignee_id: @issue.user.id}) @own_hidden_project.issues.reload.last.assignee.id.should == @issue.user.id end it "can't assignee issue in open project" do - post :create, @create_params.deep_merge(:project_id => @open_project.id, :issue => {:assignee_id => @issue.user.id}) + post :create, @create_params.deep_merge(project_id: @open_project.id, issue: {assignee_id: @issue.user.id}) @open_project.issues.reload.last.assignee.should be_nil end end context 'for anonymous user' do - it "can't create issue in project", :anonymous_access => true do + it "can't create issue in project", anonymous_access: true do lambda { post :create, @create_params}.should change{ Issue.count }.by(0) end - it "can't create issue in hidden project", :anonymous_access => true do - lambda { post :create, @create_params.merge(:project_id => @hidden_project.id)}.should change{ Issue.count }.by(0) + it "can't create issue in hidden project", anonymous_access: true do + lambda { post :create, @create_params.merge(project_id: @hidden_project.id)}.should change{ Issue.count }.by(0) end end end @@ -173,27 +173,27 @@ describe Api::V1::IssuesController do end it 'can update issue in own hidden project' do - put :update, @update_params.merge(:project_id => @own_hidden_project.id, :id => @own_hidden_issue.serial_id) + put :update, @update_params.merge(project_id: @own_hidden_project.id, id: @own_hidden_issue.serial_id) @own_hidden_issue.reload.title.should == 'new title' end it "can't update issue in open project" do - put :update, @update_params.merge(:project_id => @open_project.id, :id => @open_issue.serial_id) + put :update, @update_params.merge(project_id: @open_project.id, id: @open_issue.serial_id) @open_issue.reload.title.should_not == 'new title' end it "can't update issue in hidden project" do - put :update, @update_params.merge(:project_id => @hidden_project.id, :id => @hidden_issue.serial_id) + put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_issue.serial_id) @hidden_issue.reload.title.should_not == 'title' end it "can't assignee issue in open project" do - post :create, @update_params.deep_merge(:project_id => @open_project.id, :issue => {:assignee_id => @issue.user.id}) + post :create, @update_params.deep_merge(project_id: @open_project.id, issue: {assignee_id: @issue.user.id}) @open_issue.reload.assignee.id.should_not == @issue.user.id end it 'can assignee issue in own project' do - post :create, @update_params.deep_merge(:issue => {:assignee_id => @issue.user.id}) + post :create, @update_params.deep_merge(issue: {assignee_id: @issue.user.id}) @issue.reload.assignee.id.should_not == @issue.user.id end end @@ -202,13 +202,13 @@ describe Api::V1::IssuesController do before(:each) do @count = Issue.count end - it "can't update issue in project", :anonymous_access => true do + it "can't update issue in project", anonymous_access: true do put :update, @update_params response.status.should == 401 end - it "can't update issue in hidden project", :anonymous_access => true do - put :update, @update_params.merge(:project_id => @hidden_project.id, :id => @hidden_issue.serial_id) + it "can't update issue in hidden project", anonymous_access: true do + put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_issue.serial_id) response.status.should == 401 end end diff --git a/spec/controllers/api/v1/maintainers_controller_spec.rb b/spec/controllers/api/v1/maintainers_controller_spec.rb index 6d28e2aad..c32292c44 100644 --- a/spec/controllers/api/v1/maintainers_controller_spec.rb +++ b/spec/controllers/api/v1/maintainers_controller_spec.rb @@ -2,18 +2,18 @@ require 'spec_helper' shared_examples_for 'api maintainers user with reader rights' do it 'should be able to perform index action' do - get :index, :platform_id => package.platform_id, :format => :json + get :index, platform_id: package.platform_id, format: :json should render_template(:index) end it 'loads all of the maintainers into @maintainers' do - get :index, :platform_id => package.platform_id, :format => :json + get :index, platform_id: package.platform_id, format: :json assigns(:maintainers).should have(2).items assigns(:maintainers).should include(package, package2) end it 'loads all of the maintainers into @maintainers when search by name' do - get :index, :platform_id => package.platform_id, :package_name => 'package1', :format => :json + get :index, platform_id: package.platform_id, package_name: 'package1', format: :json assigns(:maintainers).should have(1).item assigns(:maintainers).should include(package) end @@ -23,10 +23,10 @@ end describe Api::V1::MaintainersController do before do stub_symlink_methods - FactoryGirl.create(:build_list_package, :platform => package.platform) + FactoryGirl.create(:build_list_package, platform: package.platform) end - let(:package) { FactoryGirl.create(:build_list_package, :name => 'package1', :actual => true) } - let!(:package2) { FactoryGirl.create(:build_list_package, :platform => package.platform, :actual => true) } + let(:package) { FactoryGirl.create(:build_list_package, name: 'package1', actual: true) } + let!(:package2) { FactoryGirl.create(:build_list_package, platform: package.platform, actual: true) } context 'for guest' do @@ -34,7 +34,7 @@ describe Api::V1::MaintainersController do it_should_behave_like 'api maintainers user with reader rights' else it 'should not be able to perform index action', :anonymous_access => false do - get :index, :platform_id => package.platform_id, :format => :json + get :index, platform_id: package.platform_id, format: :json response.status.should == 401 end end diff --git a/spec/controllers/api/v1/platforms_controller_spec.rb b/spec/controllers/api/v1/platforms_controller_spec.rb index 18553c737..c3dd173a3 100644 --- a/spec/controllers/api/v1/platforms_controller_spec.rb +++ b/spec/controllers/api/v1/platforms_controller_spec.rb @@ -4,12 +4,12 @@ shared_examples_for 'api platform user with reader rights' do include_examples "api platform user with show rights" it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should render_template(:index) end it 'should be able to perform members action' do - get :members, :id => @platform.id, :format => :json + get :members, id: @platform.id, format: :json response.should render_template(:members) end end @@ -18,7 +18,7 @@ shared_examples_for 'api platform user with owner rights' do context 'api platform user with update rights' do before do - put :update, {:platform => {:description => 'new description'}, :id => @platform.id}, :format => :json + put :update, {platform: {description: 'new description'}, id: @platform.id}, format: :json end it 'should be able to perform update action' do @@ -32,18 +32,18 @@ shared_examples_for 'api platform user with owner rights' do context 'api platform user with destroy rights for main platforms only' do it 'should be able to perform destroy action for main platform' do - delete :destroy, :id => @platform.id, :format => :json + delete :destroy, id: @platform.id, format: :json response.should be_success end it 'ensures that main platform has been destroyed' do - lambda { delete :destroy, :id => @platform.id, :format => :json }.should change{ Platform.count }.by(-1) + lambda { delete :destroy, id: @platform.id, format: :json }.should change{ Platform.count }.by(-1) end it 'should not be able to perform destroy action for personal platform' do - delete :destroy, :id => @personal_platform.id, :format => :json + delete :destroy, id: @personal_platform.id, format: :json response.should_not be_success end it 'ensures that personal platform has not been destroyed' do - lambda { delete :destroy, :id => @personal_platform.id, :format => :json }.should_not change{ Platform.count } + lambda { delete :destroy, id: @personal_platform.id, format: :json }.should_not change{ Platform.count } end end end @@ -51,7 +51,7 @@ end shared_examples_for 'api platform user without owner rights' do context 'api platform user without update rights' do before do - put :update, {:platform => {:description => 'new description'}, :id => @platform.id}, :format => :json + put :update, {platform: {description: 'new description'}, id: @platform.id}, format: :json end it 'should not be able to perform update action' do @@ -65,18 +65,18 @@ shared_examples_for 'api platform user without owner rights' do context 'api platform user without destroy rights' do it 'should not be able to perform destroy action for main platform' do - delete :destroy, :id => @platform.id, :format => :json + delete :destroy, id: @platform.id, format: :json response.should_not be_success end it 'ensures that main platform has not been destroyed' do - lambda { delete :destroy, :id => @platform.id, :format => :json }.should_not change{ Platform.count } + lambda { delete :destroy, id: @platform.id, format: :json }.should_not change{ Platform.count } end it 'should not be able to perform destroy action for personal platform' do - delete :destroy, :id => @personal_platform.id, :format => :json + delete :destroy, id: @personal_platform.id, format: :json response.should_not be_success end it 'ensures that personal platform has not been destroyed' do - lambda { delete :destroy, :id => @personal_platform.id, :format => :json }.should_not change{ Platform.count } + lambda { delete :destroy, id: @personal_platform.id, format: :json }.should_not change{ Platform.count } end end @@ -87,7 +87,7 @@ shared_examples_for 'api platform user with member rights' do context 'api platform user with add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :id => @platform.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json end it 'should be able to perform add_member action' do @@ -102,7 +102,7 @@ shared_examples_for 'api platform user with member rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @platform.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json end it 'should be able to perform remove_member action' do @@ -120,7 +120,7 @@ shared_examples_for 'api platform user without member rights' do context 'api platform user without add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :id => @platform.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json end it 'should not be able to perform add_member action' do @@ -135,7 +135,7 @@ shared_examples_for 'api platform user without member rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @platform.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @platform.id}, format: :json end it 'should be able to perform update action' do @@ -151,24 +151,24 @@ end shared_examples_for 'api platform user without global admin rights' do context 'should not be able to perform clear action' do it 'for personal platform' do - put :clear, :id => @personal_platform.id, :format => :json + put :clear, id: @personal_platform.id, format: :json response.should_not be_success end it 'for main platform' do - put :clear, :id => @platform.id, :format => :json + put :clear, id: @platform.id, format: :json response.should_not be_success end end [:create, :clone].each do |action| context "api platform user without #{action} rights" do - before { any_instance_of(Platform, :create_directory => true) } + before { any_instance_of(Platform, create_directory: true) } it "should not be able to perform #{action} action" do - post action, clone_or_create_params, :format => :json + post action, clone_or_create_params, format: :json response.should_not be_success end it "ensures that platform has not been #{action}d" do - lambda { post action, clone_or_create_params, :format => :json }.should_not change{ Platform.count } + lambda { post action, clone_or_create_params, format: :json }.should_not change{ Platform.count } end end end @@ -189,7 +189,7 @@ shared_examples_for 'api platform user without reader rights for hidden platform [:show, :members].each do |action| it "should not be able to perform #{ action } action" do - get action, :id => @platform.id, :format => :json + get action, id: @platform.id, format: :json response.body.should == {"message" => "Access violation to this page!"}.to_json end end @@ -197,46 +197,46 @@ end shared_examples_for "api platform user with show rights" do it 'should be able to perform show action' do - get :show, :id => @platform.id, :format => :json + get :show, id: @platform.id, format: :json response.should render_template(:show) end it 'should be able to perform platforms_for_build action' do - get :platforms_for_build, :format => :json + get :platforms_for_build, format: :json response.should render_template(:index) end end describe Api::V1::PlatformsController do - let(:clone_or_create_params) { {:id => @platform.id, :platform => {:description => 'new description', :name => 'new_name', :owner_id => @user.id, :distrib_type => APP_CONFIG['distr_types'].first}} } + let(:clone_or_create_params) { {id: @platform.id, platform: {description: 'new description', name: 'new_name', owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first}} } before do stub_symlink_methods - @platform = FactoryGirl.create(:platform, :visibility => 'open') - @personal_platform = FactoryGirl.create(:platform, :platform_type => 'personal') + @platform = FactoryGirl.create(:platform, visibility: 'open') + @personal_platform = FactoryGirl.create(:platform, platform_type: 'personal') @user = FactoryGirl.create(:user) end context 'for guest' do - + it "should not be able to perform index action" do - get :index, :format => :json + get :index, format: :json response.status.should == 401 end it "should not be able to perform platforms_for_build action", :anonymous_access => false do - get :platforms_for_build, :format => :json + get :platforms_for_build, format: :json response.status.should == 401 end it "should not be able to perform show action", :anonymous_access => false do - get :show, :id => @platform, :format => :json + get :show, id: @platform, format: :json response.status.should == 401 end it 'should be able to perform members action', :anonymous_access => true do - get :members, :id => @platform.id, :format => :json + get :members, id: @platform.id, format: :json response.should render_template(:members) end @@ -254,12 +254,12 @@ describe Api::V1::PlatformsController do end it 'ensures that status 403 if platform does not exist' do - get :allowed, :path => "/rosa-server/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/rosa-server/repository/SRPMS/base/release/repodata/" response.status.should == 403 end it 'ensures that status 200 if platform open' do - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 200 end @@ -267,65 +267,65 @@ describe Api::V1::PlatformsController do before { @platform.change_visibility } it 'ensures that status 403 if no token' do - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 403 end it 'ensures that status 403 if no token and a lot of "/"' do - get :allowed, :path => "///#{@platform.name}///repository/SRPMS/base/release/repodata/" + get :allowed, path: "///#{@platform.name}///repository/SRPMS/base/release/repodata/" response.status.should == 403 end it 'ensures that status 200 if token correct and a lot of "/"' do - token = FactoryGirl.create(:platform_token, :subject => @platform) + token = FactoryGirl.create(:platform_token, subject: @platform) http_login token.authentication_token, '' - get :allowed, :path => "///#{@platform.name}///repository/SRPMS/base/release/repodata/" + get :allowed, path: "///#{@platform.name}///repository/SRPMS/base/release/repodata/" response.status.should == 200 end it 'ensures that status 403 on access to root of platform if no token' do - get :allowed, :path => "///#{@platform.name}" + get :allowed, path: "///#{@platform.name}" response.status.should == 403 end it 'ensures that status 200 on access to root of platform if token correct' do - token = FactoryGirl.create(:platform_token, :subject => @platform) + token = FactoryGirl.create(:platform_token, subject: @platform) http_login token.authentication_token, '' - get :allowed, :path => "///#{@platform.name}" + get :allowed, path: "///#{@platform.name}" response.status.should == 200 end it 'ensures that status 403 if wrong token' do http_login 'KuKu', '' - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 403 end it 'ensures that status 200 if token correct' do - token = FactoryGirl.create(:platform_token, :subject => @platform) + token = FactoryGirl.create(:platform_token, subject: @platform) http_login token.authentication_token, '' - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 200 end it 'ensures that status 403 if token correct but blocked' do - token = FactoryGirl.create(:platform_token, :subject => @platform) + token = FactoryGirl.create(:platform_token, subject: @platform) token.block http_login token.authentication_token, '' - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 403 end it 'ensures that status 200 if user token correct and user has ability to read platform' do http_login @platform.owner.authentication_token, '' - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 200 end it 'ensures that status 403 if user token correct but user has no ability to read platform' do user = FactoryGirl.create(:user) http_login user.authentication_token, '' - get :allowed, :path => "/#{@platform.name}/repository/SRPMS/base/release/repodata/" + get :allowed, path: "/#{@platform.name}/repository/SRPMS/base/release/repodata/" response.status.should == 403 end end @@ -346,15 +346,15 @@ describe Api::V1::PlatformsController do [:clone, :create].each do |action| context "with #{action} rights" do before do - any_instance_of(Platform, :create_directory => true) + any_instance_of(Platform, create_directory: true) clone_or_create_params[:platform][:owner_id] = @admin.id end it "should be able to perform #{action} action" do - post action, clone_or_create_params, :format => :json + post action, clone_or_create_params, format: :json response.should be_success end it "ensures that platform has been #{action}d" do - lambda { post action, clone_or_create_params, :format => :json }.should change{ Platform.count }.by(1) + lambda { post action, clone_or_create_params, format: :json }.should change{ Platform.count }.by(1) end end end @@ -365,7 +365,7 @@ describe Api::V1::PlatformsController do before do http_login(@user) @platform.owner = @user; @platform.save - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'api platform user with reader rights' @@ -386,7 +386,7 @@ describe Api::V1::PlatformsController do render_views %w(main personal).each do |type| it "ensures that filter by type = #{type} returns true result" do - get :index, :format => :json, :type => "#{type}" + get :index, format: :json, type: "#{type}" JSON.parse(response.body)['platforms'].map{ |p| p['platform_type'] }. uniq.should == ["#{type}"] end @@ -403,9 +403,9 @@ describe Api::V1::PlatformsController do context 'for member of repository' do before do http_login(@user) - repository = FactoryGirl.create(:repository, :platform => @platform) + repository = FactoryGirl.create(:repository, platform: @platform) repository.add_member(@user) - personal_repository = FactoryGirl.create(:repository, :platform => @personal_platform) + personal_repository = FactoryGirl.create(:repository, platform: @personal_platform) personal_repository.add_member(@user) end @@ -413,7 +413,7 @@ describe Api::V1::PlatformsController do render_views %w(main personal).each do |type| it "ensures that filter by type = #{type} returns true result" do - get :index, :format => :json, :type => "#{type}" + get :index, format: :json, type: "#{type}" JSON.parse(response.body)['platforms'].map{ |p| p['platform_type'] }. uniq.should == ["#{type}"] end @@ -422,7 +422,7 @@ describe Api::V1::PlatformsController do it 'should not be able to perform members action for hidden platform' do @platform.update_column(:visibility, 'hidden') - get :members, :id => @platform.id, :format => :json + get :members, id: @platform.id, format: :json response.status.should == 403 end it_should_behave_like 'api platform user with reader rights' diff --git a/spec/controllers/api/v1/product_build_lists_controller.rb b/spec/controllers/api/v1/product_build_lists_controller.rb index 8bf2848d2..faeeb4bd5 100644 --- a/spec/controllers/api/v1/product_build_lists_controller.rb +++ b/spec/controllers/api/v1/product_build_lists_controller.rb @@ -2,29 +2,29 @@ require 'spec_helper' shared_examples_for 'api user without reader rights' do it 'should not be able to perform show action', :anonymous_access => false do - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.status.should == 401 end it 'should be able to perform show action' do - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success end it 'should be able to perform show action for the personal platform' do @product_build_list.product.platform.update_column :visibility, 'hidden' - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success end it 'should not be able to perform create action' do - post :create, :format => :json + post :create, format: :json response.status.should == 401 end [:update, :destroy].each do |action| it "should not be able to perform #{action} action" do - put action, :id => @product_build_list.id, :format => :json + put action, id: @product_build_list.id, format: :json response.status.should == 401 end end @@ -32,24 +32,24 @@ end shared_examples_for 'api user with reader rights' do it 'should be able to perform show action' do - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success end it 'should be able to perform show action for the hidden main platform' do @product_build_list.product.platform.update_column :visibility, 'hidden' - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success # because main platform end it 'should not be able to perform create action' do - post :create, :format => :json + post :create, format: :json response.status.should == 403 end [:update, :destroy].each do |action| it "should not be able to perform #{action} action" do - put action, :id => @product_build_list.id, :format => :json + put action, id: @product_build_list.id, format: :json response.status.should == 403 end end @@ -57,57 +57,57 @@ end shared_examples_for 'api user with admin rights' do before(:each) do - @product_build_list.product.platform.relations.create!(:actor_type => 'User', :actor_id => @another_user.id, :role => 'admin') + @product_build_list.product.platform.relations.create!(actor_type: 'User', actor_id: @another_user.id, role: 'admin') http_login(@another_user) commit_hash = @product_build_list.project.repo.commits.first.id - params = {:product_id => @product_build_list.product_id, :arch_id => Arch.last.id, - :commit_hash => commit_hash, :main_script => @product_build_list.main_script} - @create_params = {:product_build_list =>{:time_living => 150}.merge(params)} - @update_params = {:product_build_list =>{:time_living => 250, :not_delete => true}} + params = {product_id: @product_build_list.product_id, arch_id: Arch.last.id, + commit_hash: commit_hash, main_script: @product_build_list.main_script} + @create_params = {product_build_list:{time_living: 150}.merge(params)} + @update_params = {product_build_list:{time_living: 250, not_delete: true}} end it 'should be able to perform show action' do - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success end it 'should be able to perform show action for the hidden platform' do @product_build_list.product.platform.update_column :visibility, 'hidden' - get :show, :id => @product_build_list.id, :format => :json + get :show, id: @product_build_list.id, format: :json response.should be_success end it 'should be able to perform create action' do - post :create, @create_params, :format => :json + post :create, @create_params, format: :json response.should be_success end it 'ensures that product has been created' do - lambda { post :create, @create_params, :format => :json }.should change{ ProductBuildList.count }.by(1) + lambda { post :create, @create_params, format: :json }.should change{ ProductBuildList.count }.by(1) end it "should be able to perform destroy action" do - put :destroy, :id => @product_build_list.id, :format => :json + put :destroy, id: @product_build_list.id, format: :json response.should be_success end it "ensures that product has been destroyed" do - lambda { put :destroy, :id => @product_build_list.id, :format => :json }.should change{ ProductBuildList.count }.by(-1) + lambda { put :destroy, id: @product_build_list.id, format: :json }.should change{ ProductBuildList.count }.by(-1) end it "should be able to perform update action" do - put :update, @update_params.merge(:id => @product_build_list.id), :format => :json + put :update, @update_params.merge(id: @product_build_list.id), format: :json response.should be_success end it "ensures that only not_delete field of product build list has been updated" do - put :update, @update_params.merge(:id => @product_build_list.id), :format => :json + put :update, @update_params.merge(id: @product_build_list.id), format: :json @product_build_list.reload.time_living.should == 150*60 # in seconds @product_build_list.not_delete.should be_true end it 'ensures that return correct answer for wrong creating action' do - post :create, :format => :json + post :create, format: :json response.status.should == 403 # Maybe 422? end end diff --git a/spec/controllers/api/v1/products_controller_spec.rb b/spec/controllers/api/v1/products_controller_spec.rb index 5e492676c..9d5809c3a 100644 --- a/spec/controllers/api/v1/products_controller_spec.rb +++ b/spec/controllers/api/v1/products_controller_spec.rb @@ -2,29 +2,29 @@ require 'spec_helper' shared_examples_for 'api user without reader rights' do it 'should not be able to perform show action', :anonymous_access => false do - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.status.should == 401 end it 'should be able to perform show action', :anonymous_access => true do - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.should be_success end it 'should not be able to perform show action for the hidden platform', :anonymous_access => true do @product.platform.update_column :visibility, 'hidden' - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.status.should == 403 end it 'should not be able to perform create action' do - post :create, :format => :json + post :create, format: :json response.status.should == 401 end [:update, :destroy].each do |action| it "should not be able to perform #{action} action" do - put action, :id => @product.id, :format => :json + put action, id: @product.id, format: :json response.status.should == 401 end end @@ -32,24 +32,24 @@ end shared_examples_for 'api user with reader rights' do it 'should be able to perform show action' do - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.should be_success end it 'should be able to perform show action for the hidden main platform' do @product.platform.update_column :visibility, 'hidden' - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.should be_success # because main platform end it 'should not be able to perform create action' do - post :create, :format => :json + post :create, format: :json response.status.should == 403 end [:update, :destroy].each do |action| it "should not be able to perform #{action} action" do - put action, :id => @product.id, :format => :json + put action, id: @product.id, format: :json response.status.should == 403 end end @@ -57,58 +57,58 @@ end shared_examples_for 'api user with admin rights' do before(:each) do - @product.platform.relations.create!(:actor_type => 'User', :actor_id => @another_user.id, :role => 'admin') + @product.platform.relations.create!(actor_type: 'User', actor_id: @another_user.id, role: 'admin') http_login(@another_user) - params = {:platform_id => @product.platform.id, :project_id => @product.project.id} - @create_params = {:product =>{:name => 'pro', :time_living => 150}.merge(params)} - @update_params = {:product =>{:name => 'pro2', :time_living => 250}} + params = {platform_id: @product.platform.id, project_id: @product.project.id} + @create_params = {product:{name: 'pro', time_living: 150}.merge(params)} + @update_params = {product:{name: 'pro2', time_living: 250}} end it 'should be able to perform show action' do - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.should be_success end it 'should be able to perform show action for the hidden platform' do @product.platform.update_column :visibility, 'hidden' - get :show, :id => @product.id, :format => :json + get :show, id: @product.id, format: :json response.should be_success end it 'should be able to perform create action' do - post :create, @create_params, :format => :json + post :create, @create_params, format: :json response.should be_success end it 'ensures that product has been created' do - lambda { post :create, @create_params, :format => :json }.should change{ Product.count }.by(1) + lambda { post :create, @create_params, format: :json }.should change{ Product.count }.by(1) end [:update, :destroy].each do |action| it "should be able to perform #{action} action" do - put action, :id => @product.id, :format => :json + put action, id: @product.id, format: :json response.should be_success end end it "ensures that product has been destroyed" do - lambda { put :destroy, :id => @product.id, :format => :json }.should change{ Product.count }.by(-1) + lambda { put :destroy, id: @product.id, format: :json }.should change{ Product.count }.by(-1) end it "ensures that product has been updated" do - put :update, @update_params.merge(:id => @product.id), :format => :json + put :update, @update_params.merge(id: @product.id), format: :json @product.reload.name.should == 'pro2' @product.reload.time_living.should == 250*60 # in seconds end it 'ensures that return correct answer for wrong creating action' do - post :create, :format => :json + post :create, format: :json response.status.should == 403 # Maybe 422? end #[:update, :destroy].each do |action| # it "ensures that return correct answer for wrong #{action} action" do - # put action, :id => nil, :format => :json + # put action, id: nil, format: :json # response.status.should == 404 # end #end diff --git a/spec/controllers/api/v1/projects_controller_spec.rb b/spec/controllers/api/v1/projects_controller_spec.rb index 49526ed8f..9934856b6 100644 --- a/spec/controllers/api/v1/projects_controller_spec.rb +++ b/spec/controllers/api/v1/projects_controller_spec.rb @@ -22,22 +22,22 @@ end shared_examples_for "api projects user without show rights" do it "should show access violation instead of project data" do - get :show, :id => @project.id, :format => :json + get :show, id: @project.id, format: :json response.should_not be_success end it "should show access violation instead of project refs_list" do - get :refs_list, :id => @project.id, :format => :json + get :refs_list, id: @project.id, format: :json response.should_not be_success end it "should access violation instead of project data by get_id" do - get :get_id, :name => @project.name, :owner => @project.owner.uname, :format => :json + get :get_id, name: @project.name, owner: @project.owner.uname, format: :json response.should_not be_success end it "should show access violation instead of project members data" do - get :members, :id => @project.id, :format => :json + get :members, id: @project.id, format: :json response.should_not be_success end @@ -45,32 +45,32 @@ end shared_examples_for 'api projects user without fork rights' do it 'should not be able to perform fork action' do - post :fork, :id => @project.id, :format => :json + post :fork, id: @project.id, format: :json response.should_not be_success end it 'ensures that project has not been forked' do - lambda { post :fork, :id => @project.id, :format => :json }.should_not change{ Project.count } + lambda { post :fork, id: @project.id, format: :json }.should_not change{ Project.count } end end shared_examples_for 'api projects user with fork rights' do it 'should be able to perform fork action' do - post :fork, :id => @project.id, :format => :json + post :fork, id: @project.id, format: :json response.should be_success end it 'ensures that project has been forked' do - lambda { post :fork, :id => @project.id, :format => :json }.should change{ Project.count }.by(1) + lambda { post :fork, id: @project.id, format: :json }.should change{ Project.count }.by(1) end it 'should be able to perform fork action with different name' do - post :fork, :id => @project.id, :fork_name => (@project.name + '_forked'), :format => :json + post :fork, id: @project.id, fork_name: (@project.name + '_forked'), format: :json response.should be_success end it 'ensures that project has been forked' do new_name = @project.name + '_forked' - lambda { post :fork, :id => @project.id, :fork_name => new_name, :format => :json }.should - change{ Project.where(:name => new_name).count }.by(1) + lambda { post :fork, id: @project.id, fork_name: new_name, format: :json }.should + change{ Project.where(name: new_name).count }.by(1) end end @@ -86,30 +86,30 @@ end shared_examples_for "api projects user with show rights" do it "should show project data" do - get :show, :id => @project.id, :format => :json + get :show, id: @project.id, format: :json render_template(:show) end it "should show refs_list of project" do - get :refs_list, :id => @project.id, :format => :json + get :refs_list, id: @project.id, format: :json render_template(:refs_list) end context 'project find by get_id' do it "should find project by name and owner name" do @project.reload - get :get_id, :name => @project.name, :owner => @project.owner.uname, :format => :json + get :get_id, name: @project.name, owner: @project.owner.uname, format: :json assigns[:project].id.should == @project.id end it "should not find project by non existing name and owner name" do - get :get_id, :name => 'NONE_EXISTING_NAME', :owner => @project.owner.uname, :format => :json + get :get_id, name: 'NONE_EXISTING_NAME', owner: @project.owner.uname, format: :json assigns[:project].should be_blank end it "should render 404 for non existing name and owner name" do - get :get_id, :name => 'NONE_EXISTING_NAME', :owner => @project.owner.uname, :format => :json - response.body.should == {:status => 404, :message => I18n.t("flash.404_message")}.to_json + get :get_id, name: 'NONE_EXISTING_NAME', owner: @project.owner.uname, format: :json + response.body.should == {status: 404, message: I18n.t("flash.404_message")}.to_json end end end @@ -117,13 +117,13 @@ end shared_examples_for 'api projects user with admin rights' do it "should be able to perform members action" do - get :members, :id => @project.id, :format => :json + get :members, id: @project.id, format: :json response.should be_success end context 'api project user with update rights' do before do - put :update, {:project => {:description => 'new description'}, :id => @project.id}, :format => :json + put :update, {project: {description: 'new description'}, id: @project.id}, format: :json end it 'should be able to perform update action' do @@ -138,7 +138,7 @@ shared_examples_for 'api projects user with admin rights' do context 'api project user with add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :role => 'admin', :id => @project.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', role: 'admin', id: @project.id}, format: :json end it 'should be able to perform add_member action' do @@ -153,7 +153,7 @@ shared_examples_for 'api projects user with admin rights' do let(:member) { FactoryGirl.create(:user) } before do @project.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @project.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @project.id}, format: :json end it 'should be able to perform remove_member action' do @@ -168,7 +168,7 @@ shared_examples_for 'api projects user with admin rights' do let(:member) { FactoryGirl.create(:user) } before do @project.add_member(member) - put :update_member, {:member_id => member.id, :type => 'User', :role => 'reader', :id => @project.id}, :format => :json + put :update_member, {member_id: member.id, type: 'User', role: 'reader', id: @project.id}, format: :json end it 'should be able to perform update_member action' do @@ -184,7 +184,7 @@ end shared_examples_for 'api projects user without admin rights' do it "should not be able to perform members action" do - get :members, :id => @project.id, :format => :json + get :members, id: @project.id, format: :json response.should_not be_success end @@ -192,7 +192,7 @@ shared_examples_for 'api projects user without admin rights' do let(:member) { FactoryGirl.create(:user) } before do @project.add_member(member) - put :update_member, {:member_id => member.id, :type => 'User', :role => 'reader', :id => @project.id}, :format => :json + put :update_member, {member_id: member.id, type: 'User', role: 'reader', id: @project.id}, format: :json end it 'should not be able to perform update_member action' do @@ -206,7 +206,7 @@ shared_examples_for 'api projects user without admin rights' do context 'api project user without update rights' do before do - put :update, {:project => {:description => 'new description'}, :id => @project.id}, :format => :json + put :update, {project: {description: 'new description'}, id: @project.id}, format: :json end it 'should not be able to perform update action' do @@ -221,7 +221,7 @@ shared_examples_for 'api projects user without admin rights' do context 'api project user without add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :role => 'admin', :id => @project.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', role: 'admin', id: @project.id}, format: :json end it 'should not be able to perform add_member action' do @@ -236,7 +236,7 @@ shared_examples_for 'api projects user without admin rights' do let(:member) { FactoryGirl.create(:user) } before do @project.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @project.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @project.id}, format: :json end it 'should be able to perform update action' do @@ -251,11 +251,11 @@ end shared_examples_for 'api projects user with owner rights' do context 'api project user with destroy rights' do it 'should be able to perform destroy action' do - delete :destroy, :id => @project.id, :format => :json + delete :destroy, id: @project.id, format: :json response.should be_success end it 'ensures that project has been destroyed' do - lambda { delete :destroy, :id => @project.id, :format => :json }.should change{ Project.count }.by(-1) + lambda { delete :destroy, id: @project.id, format: :json }.should change{ Project.count }.by(-1) end end end @@ -263,11 +263,11 @@ end shared_examples_for 'api projects user without owner rights' do context 'api project user with destroy rights' do it 'should not be able to perform destroy action' do - delete :destroy, :id => @project.id, :format => :json + delete :destroy, id: @project.id, format: :json response.should_not be_success end it 'ensures that project has not been destroyed' do - lambda { delete :destroy, :id => @project.id, :format => :json }.should_not change{ Project.count } + lambda { delete :destroy, id: @project.id, format: :json }.should_not change{ Project.count } end end end @@ -286,7 +286,7 @@ describe Api::V1::ProjectsController do [:index, :members].each do |action| it "should not be able to perform #{action} action" do - get action, :id => @project.id, :format => :json + get action, id: @project.id, format: :json response.should_not be_success end end @@ -310,30 +310,30 @@ describe Api::V1::ProjectsController do end it 'should be able to perform index action' do - get :index, :format => :json + get :index, format: :json response.should be_success end context 'api project user with create rights' do - let(:params) { {:project => {:name => 'test_name', :owner_id => @user.id, :owner_type => 'User', :visibility => 'open'}} } + let(:params) { {project: {name: 'test_name', owner_id: @user.id, owner_type: 'User', visibility: 'open'}} } it 'should be able to perform create action' do - post :create, params, :format => :json + post :create, params, format: :json response.should be_success end it 'ensures that project has been created' do - lambda { post :create, params, :format => :json }.should change{ Project.count }.by(1) + lambda { post :create, params, format: :json }.should change{ Project.count }.by(1) end it 'writer group should be able to create project for their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') - lambda { post :create, params.deep_merge({:project => {:owner_type => 'Group', :owner_id => group.id}})}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'writer') + lambda { post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}})}.should change{ Project.count }.by(1) end it 'reader group should not be able to create project for their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') - lambda { post :create, params.deep_merge({:project => {:owner_type => 'Group', :owner_id => group.id}})}.should change{ Project.count }.by(0) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') + lambda { post :create, params.deep_merge({project: {owner_type: 'Group', owner_id: group.id}})}.should change{ Project.count }.by(0) end end @@ -347,32 +347,32 @@ describe Api::V1::ProjectsController do context 'group writer' do it 'should be able to fork project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') - lambda {post :fork, :id => @project.id, :group_id => group.id}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'writer') + lambda {post :fork, id: @project.id, group_id: group.id}.should change{ Project.count }.by(1) end it 'should be able to fork project with different name to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'writer') new_name = @project.name + '_forked' - lambda { post :fork, :id => @project.id, :group_id => group.id, :fork_name => new_name }.should - change { Project.where(:name => new_name).count }.by(1) + lambda { post :fork, id: @project.id, group_id: group.id, fork_name: new_name }.should + change { Project.where(name: new_name).count }.by(1) end end context 'group reader' do it 'should not be able to fork project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') - lambda {post :fork, :id => @project.id, :group_id => group.id}.should change{ Project.count }.by(0) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') + lambda {post :fork, id: @project.id, group_id: group.id}.should change{ Project.count }.by(0) end it 'should not be able to fork project with different name to their group' do group = FactoryGirl.create(:group) new_name = @project.name + '_forked' - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') - lambda { post :fork, :id => @project.id, :group_id => group.id, :fork_name => new_name }.should - change{ Project.where(:name => new_name.count) }.by(0) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') + lambda { post :fork, id: @project.id, group_id: group.id, fork_name: new_name }.should + change{ Project.where(name: new_name.count) }.by(0) end end end @@ -395,7 +395,7 @@ describe Api::V1::ProjectsController do before(:each) do @user = FactoryGirl.create(:user) http_login(@user) - @project = FactoryGirl.create(:project, :owner => @user) + @project = FactoryGirl.create(:project, owner: @user) end it_should_behave_like 'api projects user with reader rights' @@ -410,7 +410,7 @@ describe Api::V1::ProjectsController do before(:each) do @user = FactoryGirl.create(:user) http_login(@user) - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'api projects user with reader rights' @@ -425,7 +425,7 @@ describe Api::V1::ProjectsController do before(:each) do @user = FactoryGirl.create(:user) http_login(@user) - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'api projects user with reader rights' @@ -455,12 +455,12 @@ describe Api::V1::ProjectsController do context 'owner of the project' do before(:each) do - @project = FactoryGirl.create(:project, :owner => @group) + @project = FactoryGirl.create(:project, owner: @group) end context 'reader user' do before(:each) do - @group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'api projects user with reader rights' @@ -473,7 +473,7 @@ describe Api::V1::ProjectsController do context 'admin user' do before(:each) do - @group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'api projects user with reader rights' @@ -488,12 +488,12 @@ describe Api::V1::ProjectsController do 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' + @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') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'api projects user with reader rights' @@ -506,7 +506,7 @@ describe Api::V1::ProjectsController do context 'admin user' do before(:each) do - @group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'api projects user with reader rights' @@ -520,12 +520,12 @@ describe Api::V1::ProjectsController do context 'with reader rights' do before(:each) do - @project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'reader' + @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') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'api projects user with reader rights' @@ -537,7 +537,7 @@ describe Api::V1::ProjectsController do 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' + @project.relations.create actor_id: @group_user.id, actor_type: @group_user.class.to_s, role: 'admin' end it_should_behave_like 'api projects user with reader rights' it_should_behave_like 'api projects user with fork rights' @@ -549,7 +549,7 @@ describe Api::V1::ProjectsController do context 'admin user' do before(:each) do - @group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @group_user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'api projects user with reader rights' diff --git a/spec/controllers/api/v1/pull_requests_controller.rb b/spec/controllers/api/v1/pull_requests_controller.rb index 4f205ddf0..52e45d68a 100644 --- a/spec/controllers/api/v1/pull_requests_controller.rb +++ b/spec/controllers/api/v1/pull_requests_controller.rb @@ -1,7 +1,7 @@ require 'spec_helper' def create_pull to_ref, from_ref, owner, project = @project - pull = project.pull_requests.new :issue_attributes => {:title => 'test', :body => 'testing'} + pull = project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'} pull.issue.user, pull.issue.project = owner, pull.to_project pull.to_ref, pull.from_ref, pull.from_project = to_ref, from_ref, project pull.save; pull.check @@ -22,23 +22,23 @@ describe Api::V1::PullRequestsController do @hidden_project.update_column :visibility, 'hidden' @hidden_pull = create_pull 'master', 'non_conflicts', @hidden_project.owner, @hidden_project - @own_hidden_project = FactoryGirl.create(:project_with_commit, :owner => @project.owner) + @own_hidden_project = FactoryGirl.create(:project_with_commit, owner: @project.owner) @own_hidden_project.update_column :visibility, 'hidden' @own_hidden_pull = create_pull 'master', 'non_conflicts', @own_hidden_project.owner, @own_hidden_project @own_hidden_pull.issue.update_column :assignee_id, @project.owner.id @membered_project = FactoryGirl.create(:project_with_commit) @membered_pull = create_pull 'master', 'non_conflicts', @membered_project.owner, @membered_project - @membered_project.relations.create(:role => 'reader', :actor => @pull.user) + @membered_project.relations.create(role: 'reader', actor: @pull.user) - @create_params = {:pull_request => {:title => 'title', :body => 'body', - :from_ref => 'conflicts', :to_ref => 'master'}, - :project_id => @project.id, :format => :json} + @create_params = {pull_request: {title: 'title', body: 'body', + from_ref: 'conflicts', to_ref: 'master'}, + project_id: @project.id, format: :json} - @update_params = {:pull_request => {:title => 'new title'}, - :project_id => @project.id, :id => @pull.serial_id, :format => :json} + @update_params = {pull_request: {title: 'new title'}, + project_id: @project.id, id: @pull.serial_id, format: :json} - @issue = FactoryGirl.create(:issue, :project => @project) + @issue = FactoryGirl.create(:issue, project: @project) end context 'read and accessible abilities' do @@ -48,111 +48,111 @@ describe Api::V1::PullRequestsController do end it 'can show pull request in own project' do - get :show, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get :show, project_id: @project.id, id: @pull.serial_id, format: :json response.should be_success end it 'should render right template for show action' do - get :show, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get :show, project_id: @project.id, id: @pull.serial_id, format: :json response.should render_template('api/v1/pull_requests/show') end it 'can show pull request in open project' do - get :show, :project_id => @another_project.id, :id => @another_pull.serial_id, :format => :json + get :show, project_id: @another_project.id, id: @another_pull.serial_id, format: :json response.should be_success end it 'can show pull request in own hidden project' do - get :show, :project_id => @own_hidden_project.id, :id => @own_hidden_pull.serial_id, :format => :json + get :show, project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id, format: :json response.should be_success end it 'cant show pull request in hidden project' do - get :show, :project_id => @hidden_project.id, :id => @hidden_pull.serial_id, :format => :json + get :show, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json response.status.should == 403 end it 'should return three pull requests' do - get :all_index, :filter => 'all', :format => :json + get :all_index, filter: 'all', format: :json assigns[:pulls].should include(@pull) assigns[:pulls].should include(@own_hidden_pull) assigns[:pulls].should include(@membered_pull) end it 'should render right template for all index action' do - get :all_index, :format => :json + get :all_index, format: :json response.should render_template('api/v1/pull_requests/index') end it 'should return only assigned pull request' do - get :user_index, :format => :json + get :user_index, format: :json assigns[:pulls].should include(@own_hidden_pull) assigns[:pulls].should have(1).item end it 'should render right template for user index action' do - get :user_index, :format => :json + get :user_index, format: :json response.should render_template('api/v1/pull_requests/index') end %w(commits files).each do |action| it "can show pull request #{action} in own project" do - get action, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get action, project_id: @project.id, id: @pull.serial_id, format: :json response.should be_success end it "should render right template for commits action" do - get action, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get action, project_id: @project.id, id: @pull.serial_id, format: :json response.should render_template("api/v1/pull_requests/#{action}") end it "can't show pull request #{action} in hidden project" do - get action, :project_id => @hidden_project.id, :id => @hidden_pull.serial_id, :format => :json + get action, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json response.should_not be_success end end it 'should return 404' do - get :show, :project_id => @project.id, :id => 999999, :format => :json + get :show, project_id: @project.id, id: 999999, format: :json response.status.should == 404 end it 'should redirect to issue page' do - get :show, :project_id => @project.id, :id => @issue.serial_id, :format => :json + get :show, project_id: @project.id, id: @issue.serial_id, format: :json response.should redirect_to(api_v1_project_issue_path(@project.id, @issue.serial_id)) end end context 'for anonymous user' do - it 'can show pull request in open project', :anonymous_access => true do - get :show, :project_id => @project.id, :id => @pull.serial_id, :format => :json + it 'can show pull request in open project', anonymous_access: true do + get :show, project_id: @project.id, id: @pull.serial_id, format: :json response.should be_success end - it 'cant show pull request in hidden project', :anonymous_access => true do + it 'cant show pull request in hidden project', anonymous_access: true do @project.update_column :visibility, 'hidden' - get :show, :project_id => @project.id, :id => @pull.serial_id, :format => :json + get :show, project_id: @project.id, id: @pull.serial_id, format: :json response.status.should == 403 end it 'should not return any pull requests' do - get :all_index, :filter => 'all', :format => :json + get :all_index, filter: 'all', format: :json response.status.should == 401 end %w(commits files).each do |action| - it "can show pull request #{action} in project", :anonymous_access => true do - get action, :project_id => @project.id, :id => @pull.serial_id, :format => :json + it "can show pull request #{action} in project", anonymous_access: true do + get action, project_id: @project.id, id: @pull.serial_id, format: :json response.should be_success end - it "should render right template for commits action", :anonymous_access => true do - get action, :project_id => @project.id, :id => @pull.serial_id, :format => :json + it "should render right template for commits action", anonymous_access: true do + get action, project_id: @project.id, id: @pull.serial_id, format: :json response.should render_template("api/v1/pull_requests/#{action}") end - it "can't show pull request #{action} in hidden project", :anonymous_access => true do - get action, :project_id => @hidden_project.id, :id => @hidden_pull.serial_id, :format => :json + it "can't show pull request #{action} in hidden project", anonymous_access: true do + get action, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json response.should_not be_success end end @@ -170,28 +170,28 @@ describe Api::V1::PullRequestsController do end it 'can create pull request in own hidden project' do - lambda { post :create, @create_params.merge(:project_id => @own_hidden_project.id) }.should + lambda { post :create, @create_params.merge(project_id: @own_hidden_project.id) }.should change{ PullRequest.count }.by(1) end it 'can create pull request in open project' do - lambda { post :create, @create_params.merge(:project_id => @another_project.id) }.should + lambda { post :create, @create_params.merge(project_id: @another_project.id) }.should change{ PullRequest.count }.by(1) end it 'cant create pull request in hidden project' do - lambda { post :create, @create_params.merge(:project_id => @hidden_project.id) }.should + lambda { post :create, @create_params.merge(project_id: @hidden_project.id) }.should change{ PullRequest.count }.by(0) end end context 'for anonymous user' do - it 'cant create pull request in project', :anonymous_access => true do + it 'cant create pull request in project', anonymous_access: true do lambda { post :create, @create_params }.should change{ PullRequest.count }.by(0) end - it 'cant create pull request in hidden project', :anonymous_access => true do - lambda { post :create, @create_params.merge(:project_id => @hidden_project.id) }.should + it 'cant create pull request in hidden project', anonymous_access: true do + lambda { post :create, @create_params.merge(project_id: @hidden_project.id) }.should change{ PullRequest.count }.by(0) end end @@ -209,64 +209,64 @@ describe Api::V1::PullRequestsController do end it 'can update pull request in own hidden project' do - put :update, @update_params.merge(:project_id => @own_hidden_project.id, :id => @own_hidden_pull.serial_id) + put :update, @update_params.merge(project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id) @own_hidden_pull.reload.title.should == 'new title' end it 'cant update pull request in open project' do - put :update, @update_params.merge(:project_id => @another_project.id, :id => @another_pull.serial_id) + put :update, @update_params.merge(project_id: @another_project.id, id: @another_pull.serial_id) @another_pull.reload.title.should_not == 'new title' end it 'cant update pull request in hidden project' do - put :update, @update_params.merge(:project_id => @hidden_project.id, :id => @hidden_pull.serial_id) + put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_pull.serial_id) @hidden_pull.reload.title.should_not == 'title' end it 'can merge pull request in own project' do - put :merge, :project_id => @project.id, :id => @pull.serial_id, :format => :json + put :merge, project_id: @project.id, id: @pull.serial_id, format: :json @pull.reload.status.should == 'merged' response.should be_success end it 'can merge pull request in own hidden project' do - put :merge, :project_id => @own_hidden_project.id, :id => @own_hidden_pull.serial_id, :format => :json + put :merge, project_id: @own_hidden_project.id, id: @own_hidden_pull.serial_id, format: :json @own_hidden_pull.reload.status.should == 'merged' response.should be_success end it 'cant merge pull request in open project' do - put :merge, :project_id => @another_project.id, :id => @another_pull.serial_id, :format => :json + put :merge, project_id: @another_project.id, id: @another_pull.serial_id, format: :json @another_pull.reload.status.should == 'ready' response.status.should == 403 end it 'cant merge pull request in hidden project' do - put :merge, :project_id => @hidden_project.id, :id => @hidden_pull.serial_id, :format => :json + put :merge, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json @hidden_pull.reload.status.should == 'ready' response.status.should == 403 end end context 'for anonymous user' do - it 'cant update pull request in project', :anonymous_access => true do + it 'cant update pull request in project', anonymous_access: true do put :update, @update_params response.status.should == 401 end - it 'cant update pull request in hidden project', :anonymous_access => true do - put :update, @update_params.merge(:project_id => @hidden_project.id, :id => @hidden_pull.serial_id) + it 'cant update pull request in hidden project', anonymous_access: true do + put :update, @update_params.merge(project_id: @hidden_project.id, id: @hidden_pull.serial_id) response.status.should == 401 end it 'cant merge pull request in open project' do - put :merge, :project_id => @another_project.id, :id => @another_pull.serial_id, :format => :json + put :merge, project_id: @another_project.id, id: @another_pull.serial_id, format: :json @another_pull.reload.status.should == 'ready' response.status.should == 401 end it 'cant merge pull request in hidden project' do - put :merge, :project_id => @hidden_project.id, :id => @hidden_pull.serial_id, :format => :json + put :merge, project_id: @hidden_project.id, id: @hidden_pull.serial_id, format: :json @hidden_pull.reload.status.should == 'ready' response.status.should == 401 end @@ -276,11 +276,11 @@ describe Api::V1::PullRequestsController do context 'send email messages' do before(:each) do @project_reader = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_reader.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @project_reader.id, role: 'reader') @project_admin = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_admin.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @project_admin.id, role: 'admin') @project_writer = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_writer.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @project_writer.id, role: 'writer') http_login(@project_writer) ActionMailer::Base.deliveries = [] @@ -294,7 +294,7 @@ describe Api::V1::PullRequestsController do end it 'should send two email messages to admins and one to assignee' do - post :create, @create_params.deep_merge(:pull_request => {:assignee_id => @project_reader.id}) + post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_reader.id}) @project.pull_requests.last.issue.send(:new_issue_notifications) @project.pull_requests.last.issue.send(:send_assign_notifications) ActionMailer::Base.deliveries.count.should == 3 @@ -302,13 +302,13 @@ describe Api::V1::PullRequestsController do it 'should send email message to new assignee' do http_login(@project_admin) - put :update, @update_params.deep_merge(:pull_request => {:assignee_id => @project_reader.id}) + put :update, @update_params.deep_merge(pull_request: {assignee_id: @project_reader.id}) @project.pull_requests.last.issue.send(:send_assign_notifications) ActionMailer::Base.deliveries.count.should == 1 end it 'should not duplicate email message' do - post :create, @create_params.deep_merge(:pull_request => {:assignee_id => @project_admin.id}) + post :create, @create_params.deep_merge(pull_request: {assignee_id: @project_admin.id}) @project.pull_requests.last.issue.send(:new_issue_notifications) @project.pull_requests.last.issue.send(:send_assign_notifications) ActionMailer::Base.deliveries.count.should == 2 # send only to admins diff --git a/spec/controllers/api/v1/repositories_controller_spec.rb b/spec/controllers/api/v1/repositories_controller_spec.rb index bf14067a7..e8aabfb97 100644 --- a/spec/controllers/api/v1/repositories_controller_spec.rb +++ b/spec/controllers/api/v1/repositories_controller_spec.rb @@ -14,14 +14,14 @@ end shared_examples_for 'api repository user without packages rights' do it 'should not be able to perform packages action' do - get :packages, :id => @repository.id, :format => :csv + get :packages, id: @repository.id, format: :csv response.should_not be_success end end shared_examples_for 'api repository user with packages rights' do it 'should be able to perform packages action' do - get :packages, :id => @repository.id, :format => :csv + get :packages, id: @repository.id, format: :csv response.should be_success end end @@ -36,25 +36,25 @@ end shared_examples_for "api repository user with show rights" do it 'should be able to perform show action' do - get :show, :id => @repository.id, :format => :json + get :show, id: @repository.id, format: :json response.should render_template(:show) end it 'should be able to perform projects action' do - get :projects, :id => @repository.id, :format => :json + get :projects, id: @repository.id, format: :json response.should render_template(:projects) end end shared_examples_for "api repository user without show rights" do it 'should not be able to perform show action' do - get :show, :id => @repository.id, :format => :json + get :show, id: @repository.id, format: :json response.body.should == {"message" => "Access violation to this page!"}.to_json end end shared_examples_for "api repository user without key_pair rights" do it 'should not be able to perform key_pair action' do - get :key_pair, :id => @repository.id, :format => :json + get :key_pair, id: @repository.id, format: :json response.should_not be_success end end @@ -63,7 +63,7 @@ shared_examples_for 'api repository user with writer rights' do context 'api repository user with update rights' do before do - put :update, {:repository => {:description => 'new description'}, :id => @repository.id}, :format => :json + put :update, {repository: {description: 'new description'}, id: @repository.id}, format: :json end it 'should be able to perform update action' do @@ -78,7 +78,7 @@ shared_examples_for 'api repository user with writer rights' do context 'api repository user with add/remove repo_lock_file rights' do [:add_repo_lock_file, :remove_repo_lock_file].each do |action| it "should be able to perform #{action} action" do - put action, :id => @repository.id, :format => :json + put action, id: @repository.id, format: :json response.should be_success end end @@ -87,7 +87,7 @@ shared_examples_for 'api repository user with writer rights' do context 'api repository user with add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :id => @repository.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json end it 'should be able to perform add_member action' do @@ -102,7 +102,7 @@ shared_examples_for 'api repository user with writer rights' do let(:member) { FactoryGirl.create(:user) } before do @repository.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @repository.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json end it 'should be able to perform remove_member action' do @@ -115,37 +115,37 @@ shared_examples_for 'api repository user with writer rights' do context 'api repository user with destroy rights' do it 'should be able to perform destroy action for main platform' do - delete :destroy, :id => @repository.id, :format => :json + delete :destroy, id: @repository.id, format: :json response.should be_success end it 'ensures that repository of main platform has been destroyed' do - lambda { delete :destroy, :id => @repository.id, :format => :json }.should change{ Repository.count }.by(-1) + lambda { delete :destroy, id: @repository.id, format: :json }.should change{ Repository.count }.by(-1) end context 'repository with name "main" of personal platform' do # hook for "ActiveRecord::ActiveRecordError: name is marked as readonly" - before { Repository.where(:id => @personal_repository.id).update_all("name = 'main'") } + before { Repository.where(id: @personal_repository.id).update_all("name = 'main'") } it 'should not be able to perform destroy action' do - delete :destroy, :id => @personal_repository.id, :format => :json + delete :destroy, id: @personal_repository.id, format: :json response.should_not be_success end it 'ensures that repository has not been destroyed' do - lambda { delete :destroy, :id => @personal_repository.id, :format => :json }.should_not change{ Repository.count } + lambda { delete :destroy, id: @personal_repository.id, format: :json }.should_not change{ Repository.count } end end it 'should be able to perform destroy action for repository with name not "main" of personal platform' do - delete :destroy, :id => @personal_repository.id, :format => :json + delete :destroy, id: @personal_repository.id, format: :json response.should be_success end it 'ensures that repository with name not "main" of personal platform has been destroyed' do - lambda { delete :destroy, :id => @personal_repository.id, :format => :json }.should change{ Repository.count }.by(-1) + lambda { delete :destroy, id: @personal_repository.id, format: :json }.should change{ Repository.count }.by(-1) end end context 'api repository user with update signatures rights' do before do kp = FactoryGirl.build(:key_pair) - put :signatures, :id => @repository.id, :repository => {:public => kp.public, :secret => kp.secret}, :format => :json + put :signatures, id: @repository.id, repository: {public: kp.public, secret: kp.secret}, format: :json end it 'should be able to perform signatures action' do response.should be_success @@ -160,7 +160,7 @@ end shared_examples_for 'api repository user with project manage rights' do context 'api repository user with add_project rights' do - before { put :add_project, :id => @repository.id, :project_id => @project.id, :format => :json } + before { put :add_project, id: @repository.id, project_id: @project.id, format: :json } it 'should be able to perform add_project action' do response.should be_success end @@ -172,7 +172,7 @@ shared_examples_for 'api repository user with project manage rights' do context 'api repository user with remove_project rights' do before do @repository.projects << @project - delete :remove_project, :id => @repository.id, :project_id => @project.id, :format => :json + delete :remove_project, id: @repository.id, project_id: @project.id, format: :json end it 'should be able to perform remove_project action' do response.should be_success @@ -189,7 +189,7 @@ shared_examples_for 'api repository user without writer rights' do context 'api repository user without update rights' do before do - put :update, {:repository => {:description => 'new description'}, :id => @repository.id}, :format => :json + put :update, {repository: {description: 'new description'}, id: @repository.id}, format: :json end it 'should not be able to perform update action' do @@ -204,7 +204,7 @@ shared_examples_for 'api repository user without writer rights' do context 'api repository user without add/remove repo_lock_file rights' do [:add_repo_lock_file, :remove_repo_lock_file].each do |action| it "should not be able to perform #{action} action" do - put action, :id => @repository.id, :format => :json + put action, id: @repository.id, format: :json response.should_not be_success end end @@ -213,7 +213,7 @@ shared_examples_for 'api repository user without writer rights' do context 'api repository user without add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :type => 'User', :id => @repository.id}, :format => :json + put :add_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json end it 'should not be able to perform add_member action' do @@ -228,7 +228,7 @@ shared_examples_for 'api repository user without writer rights' do let(:member) { FactoryGirl.create(:user) } before do @repository.add_member(member) - delete :remove_member, {:member_id => member.id, :type => 'User', :id => @repository.id}, :format => :json + delete :remove_member, {member_id: member.id, type: 'User', id: @repository.id}, format: :json end it 'should be able to perform update action' do @@ -241,25 +241,25 @@ shared_examples_for 'api repository user without writer rights' do context 'api repository user without destroy rights' do it 'should not be able to perform destroy action for repository of main platform' do - delete :destroy, :id => @repository.id, :format => :json + delete :destroy, id: @repository.id, format: :json response.should_not be_success end it 'ensures that repository of main platform has not been destroyed' do - lambda { delete :destroy, :id => @repository.id, :format => :json }.should_not change{ Repository.count } + lambda { delete :destroy, id: @repository.id, format: :json }.should_not change{ Repository.count } end it 'should not be able to perform destroy action for repository of personal platform' do - delete :destroy, :id => @personal_repository.id, :format => :json + delete :destroy, id: @personal_repository.id, format: :json response.should_not be_success end it 'ensures that repository of personal platform has not been destroyed' do - lambda { delete :destroy, :id => @personal_repository.id, :format => :json }.should_not change{ Repository.count } + lambda { delete :destroy, id: @personal_repository.id, format: :json }.should_not change{ Repository.count } end end context 'api repository user without update signatures rights' do before do kp = FactoryGirl.build(:key_pair) - put :signatures, :id => @repository.id, :repository => {:public => kp.public, :secret => kp.secret}, :format => :json + put :signatures, id: @repository.id, repository: {public: kp.public, secret: kp.secret}, format: :json end it 'should not be able to perform signatures action' do response.should_not be_success @@ -273,7 +273,7 @@ end shared_examples_for 'api repository user without project manage rights' do context 'api repository user without add_project rights' do - before { put :add_project, :id => @repository.id, :project_id => @project.id, :format => :json } + before { put :add_project, id: @repository.id, project_id: @project.id, format: :json } it 'should not be able to perform add_project action' do response.should_not be_success end @@ -285,7 +285,7 @@ shared_examples_for 'api repository user without project manage rights' do context 'api repository user without remove_project rights' do before do @repository.projects << @project - delete :remove_project, :id => @repository.id, :project_id => @project.id, :format => :json + delete :remove_project, id: @repository.id, project_id: @project.id, format: :json end it 'should not be able to perform remove_project action' do response.should_not be_success @@ -304,7 +304,7 @@ describe Api::V1::RepositoriesController do stub_redis @platform = FactoryGirl.create(:platform) - @repository = FactoryGirl.create(:repository, :platform => @platform) + @repository = FactoryGirl.create(:repository, platform: @platform) @personal_repository = FactoryGirl.create(:personal_repository) @project = FactoryGirl.create(:project) @another_user = FactoryGirl.create(:user) @@ -312,7 +312,7 @@ describe Api::V1::RepositoriesController do context 'for guest' do it "should not be able to perform show action", :anonymous_access => false do - get :show, :id => @repository.id, :format => :json + get :show, id: @repository.id, format: :json response.status.should == 401 end @@ -325,8 +325,8 @@ describe Api::V1::RepositoriesController do it_should_behave_like 'api repository user without key_pair rights' it_should_behave_like 'api repository user without packages rights' - it 'should not be able to perform projects action', :anonymous_access => false do - get :projects, :id => @repository.id, :format => :json + it 'should not be able to perform projects action', anonymous_access: false do + get :projects, id: @repository.id, format: :json response.should_not be_success end end @@ -351,7 +351,7 @@ describe Api::V1::RepositoriesController do [@repository, @personal_repository].each do |repository| platform = repository.platform platform.owner = @user; platform.save - repository.platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + repository.platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end end @@ -395,18 +395,18 @@ describe Api::V1::RepositoriesController do context 'for system user' do before(:each) do - @user = FactoryGirl.create(:user, :role => 'system') + @user = FactoryGirl.create(:user, role: 'system') http_login(@user) end it 'should be able to perform key_pair action when repository has not keys' do - get :key_pair, :id => @repository.id, :format => :json + get :key_pair, id: @repository.id, format: :json response.should be_success end it 'should be able to perform key_pair action when repository has keys' do - FactoryGirl.create(:key_pair, :repository => @repository) - get :key_pair, :id => @repository.id, :format => :json + FactoryGirl.create(:key_pair, repository: @repository) + get :key_pair, id: @repository.id, format: :json response.should be_success end diff --git a/spec/controllers/api/v1/search_controller_spec.rb b/spec/controllers/api/v1/search_controller_spec.rb index 084e6fa59..a6ff9c519 100644 --- a/spec/controllers/api/v1/search_controller_spec.rb +++ b/spec/controllers/api/v1/search_controller_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' shared_examples_for 'able search with api' do it 'should be able to search' do - get :index, :format => :json + get :index, format: :json response.should be_success response.should render_template(:index) end end shared_examples_for 'not able search with api' do it 'should not be able to search' do - get :index, :format => :json + get :index, format: :json response.code.should eq('401') end end diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index d277ef4b2..174b1ebfb 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -8,27 +8,27 @@ describe Api::V1::UsersController do end context 'for guest' do - + [:show_current_user, :notifiers].each do |action| it "should not be able to perform #{ action } action for a current user" do - get action, :format => :json + get action, format: :json response.should_not be_success end end it 'should be able to perform show action for a single user', :anonymous_access => true do - get :show, :id => @user.id, :format => :json + get :show, id: @user.id, format: :json response.should render_template(:show) end it 'should not be able to perform show action for a single user', :anonymous_access => false do - get :show, :id => @user.id, :format => :json + get :show, id: @user.id, format: :json response.should_not be_success end context 'should not be able to perform update action for a current user' do before do - put :update, {:user => {:company => 'test_company'}}, :format => :json + put :update, {user: {company: 'test_company'}}, format: :json end it { response.should_not be_success } it 'ensures that user has not been updated' do @@ -39,7 +39,7 @@ describe Api::V1::UsersController do context 'should not be able to perform notifiers action for a current user' do before do - put :notifiers, {:notifiers => {:can_notify => false}}, :format => :json + put :notifiers, {notifiers: {can_notify: false}}, format: :json end it { response.should_not be_success } it 'ensures that user notification settings have not been updated' do @@ -57,19 +57,19 @@ describe Api::V1::UsersController do [:show_current_user, :notifiers].each do |action| it "should be able to perform #{ action } action for a current user" do - get action, :format => :json + get action, format: :json response.should be_success end end it 'should be able to perform show action for a single user' do - get :show, :id => @user.id, :format => :json + get :show, id: @user.id, format: :json response.should render_template(:show) end context 'should be able to perform update action for a current user' do before do - put :update, {:user => {:company => 'test_company'}}, :format => :json + put :update, {user: {company: 'test_company'}}, format: :json end it { response.should be_success } it 'ensures that user has been updated' do @@ -80,7 +80,7 @@ describe Api::V1::UsersController do context 'should be able to perform notifiers action for a current user' do before do - put :notifiers, {:notifiers => {:can_notify => false}}, :format => :json + put :notifiers, {notifiers: {can_notify: false}}, format: :json end it { response.should be_success } it 'ensures that user notification settings have been updated' do diff --git a/spec/controllers/autocompletes_controller_spec.rb b/spec/controllers/autocompletes_controller_spec.rb index a80d70991..858855631 100644 --- a/spec/controllers/autocompletes_controller_spec.rb +++ b/spec/controllers/autocompletes_controller_spec.rb @@ -20,7 +20,7 @@ describe AutocompletesController do end context 'autocomplete_extra_build_list' do - let(:build_list) { FactoryGirl.create(:build_list, :user => user) } + let(:build_list) { FactoryGirl.create(:build_list, user: user) } let(:params) { { :term => build_list.id, :platform_id => build_list.save_to_platform_id } } @@ -51,7 +51,7 @@ describe AutocompletesController do end it 'shows data when repository of personal platform' do - Platform.update_all(:platform_type => 'personal') + Platform.update_all(platform_type: 'personal') get :autocomplete_extra_repositories, params response.body.should_not == '[]' end diff --git a/spec/controllers/groups/members_controller_spec.rb b/spec/controllers/groups/members_controller_spec.rb index fa4f6ea4a..c33410971 100644 --- a/spec/controllers/groups/members_controller_spec.rb +++ b/spec/controllers/groups/members_controller_spec.rb @@ -7,9 +7,9 @@ describe Groups::MembersController do @user = @group.owner set_session_for @user @another_user = FactoryGirl.create(:user) - @add_params = {:group_id => @group, :user_uname => @another_user.uname} - @remove_params = {:group_id => @group, :user_remove => {"#{@group.owner.id}"=>["1"]}} - @update_params = {:group_id => @group, :user => {"#{@group.owner.id}"=>'reader'}} + @add_params = {group_id: @group, user_uname: @another_user.uname} + @remove_params = {group_id: @group, user_remove: {"#{@group.owner.id}"=>["1"]}} + @update_params = {group_id: @group, user: {"#{@group.owner.id}"=>'reader'}} end context 'for owner user' do @@ -35,7 +35,7 @@ describe Groups::MembersController do context 'for admin user' do before(:each) do @admin_user = FactoryGirl.create(:user) - @group.actors.create(:actor_id => @admin_user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @admin_user.id, actor_type: 'User', role: 'admin') set_session_for @admin_user end @@ -68,7 +68,7 @@ describe Groups::MembersController do context 'for writer user' do before(:each) do @writer_user = FactoryGirl.create(:user) - @group.actors.create(:actor_id => @writer_user.id, :actor_type => 'User', :role => 'writer') + @group.actors.create(actor_id: @writer_user.id, actor_type: 'User', role: 'writer') set_session_for @writer_user end diff --git a/spec/controllers/groups/profile_controller_spec.rb b/spec/controllers/groups/profile_controller_spec.rb index 567ae26e2..191168e75 100644 --- a/spec/controllers/groups/profile_controller_spec.rb +++ b/spec/controllers/groups/profile_controller_spec.rb @@ -2,31 +2,31 @@ require 'spec_helper' shared_examples_for 'group user with project show rights' do it 'should be able to perform show action' do - get :show, :uname => @group.uname + get :show, uname: @group.uname response.should render_template(:show) end end shared_examples_for 'group user without update rights' do it 'should be not able to perform update action' do - put :update, {:id => @group}.merge(@update_params) + put :update, {id: @group}.merge(@update_params) response.should redirect_to(forbidden_path) end it 'should not be able to update group data' do - put :update, :id => @group, :group => {:description => 'new description'} + put :update, id: @group, group: {description: 'new description'} @group.reload.description.should_not == 'new description' end end shared_examples_for 'group user without destroy rights' do it 'should not be able to destroy group' do - delete :destroy, :id => @group + delete :destroy, id: @group response.should redirect_to(forbidden_path) end it 'should not change groups count after destroy action' do - lambda { delete :destroy, :id => @group }.should change{ Group.count }.by(0) + lambda { delete :destroy, id: @group }.should change{ Group.count }.by(0) end end @@ -34,12 +34,12 @@ shared_examples_for 'group admin' do it_should_behave_like 'no group user' it 'should be able to update group data' do - put :update, :id => @group, :group => {:description => 'new description'} + put :update, id: @group, group: {description: 'new description'} @group.reload.description.should == 'new description' end it 'should be able to perform update action' do - put :update, {:id => @group}.merge(@update_params) + put :update, {id: @group}.merge(@update_params) response.should redirect_to(group_path(@group)) end end @@ -59,12 +59,12 @@ shared_examples_for 'group owner' do it_should_behave_like 'group admin' it 'should be able to destroy group' do - delete :destroy, :id => @group + delete :destroy, id: @group response.should redirect_to(groups_path) end it 'should change groups count after destroy action' do - lambda { delete :destroy, :id => @group }.should change{ Group.count }.by(-1) + lambda { delete :destroy, id: @group }.should change{ Group.count }.by(-1) end end @@ -73,8 +73,8 @@ describe Groups::ProfileController do stub_symlink_methods @group = FactoryGirl.create(:group) @another_user = FactoryGirl.create(:user) - @create_params = {:group => {:description => 'grp1', :uname => 'un_grp1'}} - @update_params = {:group => {:description => 'grp2'}} + @create_params = {group: {description: 'grp1', uname: 'un_grp1'}} + @update_params = {group: {description: 'grp2'}} end context 'for guest' do @@ -83,7 +83,7 @@ describe Groups::ProfileController do it_should_behave_like 'group user with project show rights' else it 'should not be able to perform show action' do - get :show, :id => @group + get :show, id: @group response.should redirect_to(new_user_session_path) end end @@ -94,7 +94,7 @@ describe Groups::ProfileController do end it 'should not be able to perform update action' do - put :update, {:id => @group}.merge(@update_params) + put :update, {id: @group}.merge(@update_params) response.should redirect_to(new_user_session_path) end @@ -120,7 +120,7 @@ describe Groups::ProfileController do end it 'should be able to perform update action' do - put :update, {:id => @group}.merge(@update_params) + put :update, {id: @group}.merge(@update_params) response.should redirect_to(group_path(@group)) end end @@ -129,7 +129,7 @@ describe Groups::ProfileController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'group user with project show rights' @@ -144,7 +144,7 @@ describe Groups::ProfileController do set_session_for(@user) @group.owner = @user @group.save - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'group user with project show rights' @@ -156,16 +156,16 @@ describe Groups::ProfileController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') end it "should remove user from groups" do - delete :remove_user, :id => @group + delete :remove_user, id: @group response.should redirect_to(groups_path) end it "should change relations count" do - lambda { delete :remove_user, :id => @group }.should change{ Relation.count }.by(-1) + lambda { delete :remove_user, id: @group }.should change{ Relation.count }.by(-1) end it_should_behave_like 'group user with project show rights' diff --git a/spec/controllers/platforms/contents_controller_spec.rb b/spec/controllers/platforms/contents_controller_spec.rb index ec85dcf19..e1e9603b7 100644 --- a/spec/controllers/platforms/contents_controller_spec.rb +++ b/spec/controllers/platforms/contents_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' shared_examples_for 'content platform user without show rights for hidden platform' do it 'should not be able to perform index action' do @platform.update_column(:visibility, 'hidden') - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should_not be_success end end @@ -11,19 +11,19 @@ end shared_examples_for 'content platform user with show rights for hidden platform' do it 'should be able to perform index action' do @platform.update_column(:visibility, 'hidden') - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should be_success end end shared_examples_for 'content platform user with show rights' do it 'should be able to perform index action for main platform' do - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should be_success end it 'should be able to perform index action for personal platform' do - get :index, :platform_id => @personal_platform + get :index, platform_id: @personal_platform response.should be_success end end @@ -33,20 +33,20 @@ describe Platforms::ContentsController do stub_symlink_methods @platform = FactoryGirl.create(:platform) - @personal_platform = FactoryGirl.create(:platform, :platform_type => 'personal') + @personal_platform = FactoryGirl.create(:platform, platform_type: 'personal') @user = FactoryGirl.create(:user) end context 'for guest' do - it 'should not be able to perform index action for main platform', :anonymous_access => false do - get :index, :platform_id => @platform + it 'should not be able to perform index action for main platform', anonymous_access: false do + get :index, platform_id: @platform response.should_not be_success end - it 'should not be able to perform index action for personal platform', :anonymous_access => false do - get :index, :platform_id => @personal_platform + it 'should not be able to perform index action for personal platform', anonymous_access: false do + get :index, platform_id: @personal_platform response.should_not be_success end @@ -67,7 +67,7 @@ describe Platforms::ContentsController do before do http_login(@user) @platform.owner = @user; @platform.save - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'content platform user with show rights' diff --git a/spec/controllers/platforms/key_pairs_controller_spec.rb b/spec/controllers/platforms/key_pairs_controller_spec.rb index bb21c11ac..750db5441 100644 --- a/spec/controllers/platforms/key_pairs_controller_spec.rb +++ b/spec/controllers/platforms/key_pairs_controller_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' def create_key_pair(repository, user) - @key_pair = FactoryGirl.create(:key_pair, :repository => repository, :user => user) + @key_pair = FactoryGirl.create(:key_pair, repository: repository, user: user) end shared_examples_for 'key_pair platform owner' do it 'should be able to perform index action' do - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should render_template(:index) end @@ -25,19 +25,19 @@ shared_examples_for 'key_pair platform owner' do end it 'should be able to perform action' do - delete :destroy, :platform_id => @platform, :id => @key_pair + delete :destroy, platform_id: @platform, id: @key_pair response.should redirect_to(platform_key_pairs_path(@platform)) end it 'should delete key pair into db' do - lambda { delete :destroy, :platform_id => @platform, :id => @key_pair }.should change{KeyPair.count}.by(-1) + lambda { delete :destroy, platform_id: @platform, id: @key_pair }.should change{KeyPair.count}.by(-1) end end end shared_examples_for 'key_pair platform reader' do it 'should be able to perform index action' do - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should render_template(:index) end @@ -56,12 +56,12 @@ shared_examples_for 'key_pair platform reader' do end it 'should not be able to perform action' do - delete :destroy, :platform_id => @platform, :id => @key_pair + delete :destroy, platform_id: @platform, id: @key_pair response.should redirect_to(forbidden_path) end it 'should not change objects count on destroy success' do - lambda { delete :destroy, :platform_id => @platform, :id => @key_pair }.should change{KeyPair.count}.by(0) + lambda { delete :destroy, platform_id: @platform, id: @key_pair }.should change{KeyPair.count}.by(0) end end end @@ -72,15 +72,15 @@ describe Platforms::KeyPairsController do stub_redis @platform = FactoryGirl.create(:platform) - @repository = FactoryGirl.create(:repository, :platform => @platform) + @repository = FactoryGirl.create(:repository, platform: @platform) @user = FactoryGirl.create(:user) kp = FactoryGirl.build(:key_pair) @create_params = { - :platform_id => @platform, - :key_pair => { - :repository_id => @repository.id, - :public => kp.public, - :secret => kp.secret + platform_id: @platform, + key_pair: { + repository_id: @repository.id, + public: kp.public, + secret: kp.secret } } end @@ -88,7 +88,7 @@ describe Platforms::KeyPairsController do context 'for guest' do [:index, :create].each do |action| it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform + get action, platform_id: @platform response.should redirect_to(new_user_session_path) end end @@ -103,11 +103,11 @@ describe Platforms::KeyPairsController do end it 'should not change objects count on destroy success' do - lambda { delete :destroy, :platform_id => @platform, :id => @key_pair }.should change{KeyPair.count}.by(0) + lambda { delete :destroy, platform_id: @platform, id: @key_pair }.should change{KeyPair.count}.by(0) end it "should not be able to perform destroy action" do - delete :destroy, :platform_id => @platform, :id => @key_pair + delete :destroy, platform_id: @platform, id: @key_pair response.should redirect_to(new_user_session_path) end end @@ -127,7 +127,7 @@ describe Platforms::KeyPairsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - + @platform.owner = @user @platform.save end @@ -139,7 +139,7 @@ describe Platforms::KeyPairsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'key_pair platform owner' @@ -149,7 +149,7 @@ describe Platforms::KeyPairsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'key_pair platform reader' diff --git a/spec/controllers/platforms/maintainers_controller_spec.rb b/spec/controllers/platforms/maintainers_controller_spec.rb index 6e5188871..6e1cf6176 100644 --- a/spec/controllers/platforms/maintainers_controller_spec.rb +++ b/spec/controllers/platforms/maintainers_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' shared_examples_for 'guest user' do it "should be able to view maintainers list(index)" do - get :index, :platform_id => @platform.id + get :index, platform_id: @platform.id response.should be_success end end @@ -20,13 +20,13 @@ describe Platforms::MaintainersController do context 'for guest' do before {set_session_for(User.new)} - it "should be able to view maintainers list(index)", :anonymous_access => true do - get :index, :platform_id => @platform.id + it "should be able to view maintainers list(index)", anonymous_access: true do + get :index, platform_id: @platform.id response.should be_success end - it "should not be able to view maintainers list(index)", :anonymous_access => false do - get :index, :platform_id => @platform.id + it "should not be able to view maintainers list(index)", anonymous_access: false do + get :index, platform_id: @platform.id response.should redirect_to(new_user_session_path) end end @@ -57,7 +57,7 @@ describe Platforms::MaintainersController do context 'for platform member' do before(:each) do - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'guest user' diff --git a/spec/controllers/platforms/mass_builds_controller_spec.rb b/spec/controllers/platforms/mass_builds_controller_spec.rb index d5fbc4b06..6896255f5 100644 --- a/spec/controllers/platforms/mass_builds_controller_spec.rb +++ b/spec/controllers/platforms/mass_builds_controller_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' shared_examples_for 'mass_build platform owner' do it 'should be able to perform index action' do - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should render_template(:index) end it 'should be able to perform new action' do - get :new, :platform_id => @platform + get :new, platform_id: @platform response.should render_template(:new) end @@ -17,28 +17,28 @@ shared_examples_for 'mass_build platform owner' do end it 'should be able to perform cancel action' do - post :cancel, :platform_id => @platform, :id => @mass_build + post :cancel, platform_id: @platform, id: @mass_build response.should redirect_to(platform_mass_builds_path(@platform)) end it 'should change stop_build on cancel' do - post :cancel, :platform_id => @platform, :id => @mass_build + post :cancel, platform_id: @platform, id: @mass_build @mass_build.reload.stop_build.should == true end it 'should be able to perform publish action' do - post :publish, :platform_id => @platform, :id => @mass_build + post :publish, platform_id: @platform, id: @mass_build response.should redirect_to(platform_mass_builds_path(@platform)) end it 'should change build_publish on publish' do - post :publish, :platform_id => @platform, :id => @mass_build + post :publish, platform_id: @platform, id: @mass_build @mass_build.reload.build_publish_count.should == 1 end it 'should not be able to perform cancel action if stop_build is true' do @mass_build.stop_build = true; @mass_build.save - post :cancel, :platform_id => @platform, :id => @mass_build + post :cancel, platform_id: @platform, id: @mass_build response.should redirect_to(forbidden_path) end @@ -47,14 +47,14 @@ shared_examples_for 'mass_build platform owner' do end it 'should be able to perform get_list action' do - get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + get :get_list, platform_id: @platform, id: @mass_build, kind: 'failed_builds_list' response.should be_success end end shared_examples_for 'mass_build platform owner of personal platform' do before(:each) do - Platform.update_all(:platform_type => 'personal') + Platform.update_all(platform_type: 'personal') repository = FactoryGirl.create(:repository) @mass_build.build_lists.each do |bl| bl.build_for_platform = repository.platform @@ -67,28 +67,28 @@ end shared_examples_for 'mass_build platform reader' do it 'should be able to perform index action' do - get :index, :platform_id => @platform + get :index, platform_id: @platform response.should render_template(:index) end it 'should be able to perform get_list action' do - get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + get :get_list, platform_id: @platform, id: @mass_build, kind: 'failed_builds_list' response.should be_success end it "should not be able to perform new action" do - get :new, :platform_id => @platform + get :new, platform_id: @platform response.should redirect_to(forbidden_path) end it "should not be able to perform create action" do - get :create, :platform_id => @platform + get :create, platform_id: @platform response.should redirect_to(forbidden_path) end [:cancel, :publish].each do |action| it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform, :id => @mass_build.id + get action, platform_id: @platform, id: @mass_build.id response.should redirect_to(forbidden_path) end end @@ -98,12 +98,12 @@ shared_examples_for 'mass_build platform reader' do end it 'should not change stop_build on cancel' do - post :cancel, :platform_id => @platform, :id => @mass_build + post :cancel, platform_id: @platform, id: @mass_build @mass_build.reload.stop_build.should == false end it 'should not change build_publish on publish' do - post :publish, :platform_id => @platform, :id => @mass_build + post :publish, platform_id: @platform, id: @mass_build @mass_build.reload.build_publish_count.should == 0 end end @@ -115,14 +115,14 @@ describe Platforms::MassBuildsController do FactoryGirl.create(:arch) @platform = FactoryGirl.create(:platform) - @repository = FactoryGirl.create(:repository, :platform => @platform) - @personal_platform = FactoryGirl.create(:platform, :platform_type => 'personal') + @repository = FactoryGirl.create(:repository, platform: @platform) + @personal_platform = FactoryGirl.create(:platform, platform_type: 'personal') @user = FactoryGirl.create(:user) - project = FactoryGirl.create(:project, :owner => @user) + project = FactoryGirl.create(:project, owner: @user) @repository.projects << project @create_params = { - :mass_build => { + mass_build: { :projects_list => @repository.projects.map(&:name).join("\n"), :auto_publish => true, :build_for_platform_id => @platform @@ -131,40 +131,40 @@ describe Platforms::MassBuildsController do :arches => [Arch.first.id], } - @mass_build = FactoryGirl.create(:mass_build, :save_to_platform => @platform, :user => @user, :projects_list => project.name) - FactoryGirl.create(:build_list, :mass_build => @mass_build, :status => BuildList::SUCCESS) + @mass_build = FactoryGirl.create(:mass_build, save_to_platform: @platform, user: @user, projects_list: project.name) + FactoryGirl.create(:build_list, mass_build: @mass_build, status: BuildList::SUCCESS) end context 'for guest' do - it 'should be able to perform index action', :anonymous_access => true do - get :index, :platform_id => @platform + it 'should be able to perform index action', anonymous_access: true do + get :index, platform_id: @platform response.should render_template(:index) end - it 'should not be able to perform index action', :anonymous_access => false do - get :index, :platform_id => @platform + it 'should not be able to perform index action', anonymous_access: false do + get :index, platform_id: @platform response.should redirect_to(new_user_session_path) end - it 'should be able to perform get_list action', :anonymous_access => true do - get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + it 'should be able to perform get_list action', anonymous_access: true do + get :get_list, platform_id: @platform, id: @mass_build, kind: 'failed_builds_list' response.should be_success end - it "should not be able to get failed builds list", :anonymous_access => false do - get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list' + it "should not be able to get failed builds list", anonymous_access: false do + get :get_list, platform_id: @platform, id: @mass_build, kind: 'failed_builds_list' response.should redirect_to(new_user_session_path) end it "should not be able to perform new action" do - get :new, :platform_id => @platform + get :new, platform_id: @platform response.should redirect_to(new_user_session_path) end [:cancel, :publish, :create].each do |action| it "should not be able to perform #{action} action" do - post action, :platform_id => @platform, :id => @mass_build + post action, platform_id: @platform, id: @mass_build response.should redirect_to(new_user_session_path) end end @@ -174,12 +174,12 @@ describe Platforms::MassBuildsController do end it 'should not change stop_build on cancel' do - post :cancel, :platform_id => @platform, :id => @mass_build + post :cancel, platform_id: @platform, id: @mass_build @mass_build.reload.stop_build.should == false end it 'should not change build_publish_count on publish' do - post :publish, :platform_id => @platform, :id => @mass_build + post :publish, platform_id: @platform, id: @mass_build @mass_build.reload.build_publish_count.should == 0 end @@ -200,7 +200,7 @@ describe Platforms::MassBuildsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - + @platform.owner = @user @platform.save end @@ -213,7 +213,7 @@ describe Platforms::MassBuildsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'mass_build platform owner' @@ -224,7 +224,7 @@ describe Platforms::MassBuildsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'mass_build platform reader' diff --git a/spec/controllers/platforms/platforms_controller_spec.rb b/spec/controllers/platforms/platforms_controller_spec.rb index e4498d871..b30b1066e 100644 --- a/spec/controllers/platforms/platforms_controller_spec.rb +++ b/spec/controllers/platforms/platforms_controller_spec.rb @@ -5,7 +5,7 @@ shared_examples_for 'platform user with reader rights' do [:members, :advisories].each do |action| it 'should be able to perform advisories action' do - get action, :id => @platform.id + get action, id: @platform.id response.should render_template(action) response.should be_success end @@ -16,7 +16,7 @@ shared_examples_for 'platform user with owner rights' do context 'platform user with update rights' do before do - put :update, {:platform => {:description => 'new description'}, :id => @platform.id} + put :update, {platform: {description: 'new description'}, id: @platform.id} end it 'should be able to perform update action' do @@ -31,7 +31,7 @@ shared_examples_for 'platform user with owner rights' do context 'perform change_visibility action' do before do @visibility = @platform.visibility - post :change_visibility, :id => @platform.id + post :change_visibility, id: @platform.id end it 'should be able to perform action' do @@ -46,18 +46,18 @@ shared_examples_for 'platform user with owner rights' do context 'platform user with destroy rights for main platforms only' do it 'should be able to perform destroy action for main platform' do - delete :destroy, :id => @platform.id + delete :destroy, id: @platform.id response.should redirect_to(platforms_path) end it 'ensures that main platform has been destroyed' do - lambda { delete :destroy, :id => @platform.id }.should change{ Platform.count }.by(-1) + lambda { delete :destroy, id: @platform.id }.should change{ Platform.count }.by(-1) end it 'should not be able to perform destroy action for personal platform' do - delete :destroy, :id => @personal_platform.id + delete :destroy, id: @personal_platform.id response.should_not be_success end it 'ensures that personal platform has not been destroyed' do - lambda { delete :destroy, :id => @personal_platform.id }.should_not change{ Platform.count } + lambda { delete :destroy, id: @personal_platform.id }.should_not change{ Platform.count } end end end @@ -65,7 +65,7 @@ end shared_examples_for 'platform user without owner rights' do context 'platform user without update rights' do before do - put :update, {:platform => {:description => 'new description'}, :id => @platform.id} + put :update, {platform: {description: 'new description'}, id: @platform.id} end it 'should not be able to perform update action' do @@ -80,7 +80,7 @@ shared_examples_for 'platform user without owner rights' do context 'perform change_visibility action' do before do @visibility = @platform.visibility - post :change_visibility, :id => @platform.id + post :change_visibility, id: @platform.id end it 'should not be able to perform action' do @@ -95,18 +95,18 @@ shared_examples_for 'platform user without owner rights' do context 'platform user without destroy rights' do it 'should not be able to perform destroy action for main platform' do - delete :destroy, :id => @platform.id + delete :destroy, id: @platform.id response.should_not be_success end it 'ensures that main platform has not been destroyed' do - lambda { delete :destroy, :id => @platform.id }.should_not change{ Platform.count } + lambda { delete :destroy, id: @platform.id }.should_not change{ Platform.count } end it 'should not be able to perform destroy action for personal platform' do - delete :destroy, :id => @personal_platform.id + delete :destroy, id: @personal_platform.id response.should_not be_success end it 'ensures that personal platform has not been destroyed' do - lambda { delete :destroy, :id => @personal_platform.id }.should_not change{ Platform.count } + lambda { delete :destroy, id: @personal_platform.id }.should_not change{ Platform.count } end end @@ -117,7 +117,7 @@ shared_examples_for 'platform user with member rights' do context 'platform user with add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :id => @platform.id} + put :add_member, {member_id: member.id, id: @platform.id} end it 'should be able to perform add_member action' do @@ -132,7 +132,7 @@ shared_examples_for 'platform user with member rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - delete :remove_member, {:member_id => member.id, :id => @platform.id} + delete :remove_member, {member_id: member.id, id: @platform.id} end it 'should be able to perform remove_member action' do @@ -147,7 +147,7 @@ shared_examples_for 'platform user with member rights' do let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - post :remove_members, {:user_remove => {member.id => [1]}, :id => @platform.id} + post :remove_members, {user_remove: {member.id => [1]}, id: @platform.id} end it 'should be able to perform remove_members action' do @@ -165,7 +165,7 @@ shared_examples_for 'platform user without member rights' do |guest = false| context 'platform user without add_member rights' do let(:member) { FactoryGirl.create(:user) } before do - put :add_member, {:member_id => member.id, :id => @platform.id} + put :add_member, {member_id: member.id, id: @platform.id} end it 'should not be able to perform add_member action' do @@ -180,7 +180,7 @@ shared_examples_for 'platform user without member rights' do |guest = false| let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - delete :remove_member, {:member_id => member.id, :id => @platform.id} + delete :remove_member, {member_id: member.id, id: @platform.id} end it 'should not be able to perform remove_member action' do @@ -195,7 +195,7 @@ shared_examples_for 'platform user without member rights' do |guest = false| let(:member) { FactoryGirl.create(:user) } before do @platform.add_member(member) - post :remove_members, {:user_remove => {member.id => [1]}, :id => @platform.id} + post :remove_members, {user_remove: {member.id => [1]}, id: @platform.id} end it 'should not be able to perform remove_members action' do @@ -211,22 +211,22 @@ end shared_examples_for 'platform user without global admin rights' do context 'should not be able to perform clear action' do it 'for personal platform' do - put :clear, :id => @personal_platform.id + put :clear, id: @personal_platform.id response.should_not be_success end it 'for main platform' do - put :clear, :id => @platform.id + put :clear, id: @platform.id response.should_not be_success end end context 'should not be able to perform clone action' do it 'for personal platform' do - get :clone, :id => @personal_platform.id + get :clone, id: @personal_platform.id response.should_not be_success end it 'for main platform' do - get :clone, :id => @platform.id + get :clone, id: @platform.id response.should_not be_success end end @@ -238,7 +238,7 @@ shared_examples_for 'platform user without global admin rights' do [:create, :make_clone].each do |action| context "platform user without #{action} rights" do - before { any_instance_of(Platform, :create_directory => true) } + before { any_instance_of(Platform, create_directory: true) } it "should not be able to perform #{action} action" do post action, clone_or_create_params response.should_not be_success @@ -265,7 +265,7 @@ shared_examples_for 'platform user without reader rights for hidden platform' do [:show, :members].each do |action| it "should not be able to perform #{ action } action" do - get action, :id => @platform.id + get action, id: @platform.id response.should redirect_to(forbidden_path) end end @@ -273,20 +273,20 @@ end shared_examples_for 'platform user with show rights' do it 'should be able to perform show action' do - get :show, :id => @platform.id + get :show, id: @platform.id response.should render_template(:show) assigns(:platform).should eq @platform end end describe Platforms::PlatformsController do - let(:clone_or_create_params) { {:id => @platform.id, :platform => {:description => 'new description', :name => 'new_name', :owner_id => @user.id, :distrib_type => APP_CONFIG['distr_types'].first}} } + let(:clone_or_create_params) { {id: @platform.id, platform: {description: 'new description', name: 'new_name', owner_id: @user.id, distrib_type: APP_CONFIG['distr_types'].first}} } before do stub_symlink_methods @platform = FactoryGirl.create(:platform) - @personal_platform = FactoryGirl.create(:platform, :platform_type => 'personal') - + @personal_platform = FactoryGirl.create(:platform, platform_type: 'personal') + @user = FactoryGirl.create(:user) end @@ -298,8 +298,8 @@ describe Platforms::PlatformsController do end [:show, :members, :advisories].each do |action| - it "should not be able to perform #{ action } action", :anonymous_access => false do - get action, :id => @platform + it "should not be able to perform #{ action } action", anonymous_access: false do + get action, id: @platform response.should redirect_to(new_user_session_path) end end @@ -323,19 +323,19 @@ describe Platforms::PlatformsController do it_should_behave_like 'platform user with owner rights' it "should be able to perform new action" do - get :new, :id => @platform + get :new, id: @platform response.should render_template(:new) end it "should be able to perform clone action" do - get :clone, :id => @platform + get :clone, id: @platform response.should render_template(:clone) end [:make_clone, :create].each do |action| context "with #{action} rights" do before do - any_instance_of(Platform, :create_directory => true) + any_instance_of(Platform, create_directory: true) clone_or_create_params[:platform][:owner_id] = @admin.id end it "should be able to perform #{action} action" do @@ -353,7 +353,7 @@ describe Platforms::PlatformsController do before do http_login(@user) @platform.owner = @user; @platform.save - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'platform user with reader rights' @@ -380,9 +380,9 @@ describe Platforms::PlatformsController do context 'for member of repository' do before do http_login(@user) - repository = FactoryGirl.create(:repository, :platform => @platform) + repository = FactoryGirl.create(:repository, platform: @platform) repository.add_member(@user) - personal_repository = FactoryGirl.create(:repository, :platform => @personal_platform) + personal_repository = FactoryGirl.create(:repository, platform: @personal_platform) personal_repository.add_member(@user) end diff --git a/spec/controllers/platforms/product_build_lists_controller_spec.rb b/spec/controllers/platforms/product_build_lists_controller_spec.rb index 4b2f63c6a..d976eb6c4 100644 --- a/spec/controllers/platforms/product_build_lists_controller_spec.rb +++ b/spec/controllers/platforms/product_build_lists_controller_spec.rb @@ -35,12 +35,12 @@ shared_examples_for 'product build list admin' do end 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}) + 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)) end it "ensures that only not_delete field of product build list has been updated" do - put :update, valid_attributes_for_show.merge(:product_build_list => {:time_living => 100,:not_delete => true}) + put :update, valid_attributes_for_show.merge(product_build_list: {time_living: 100,not_delete: true}) time_living = @pbl.time_living @pbl.reload.time_living.should == time_living @pbl.not_delete.should be_true @@ -103,15 +103,15 @@ describe Platforms::ProductBuildListsController do before(:each) do @product = FactoryGirl.create(:product) @arch = FactoryGirl.create(:arch) - @pbl = FactoryGirl.create(:product_build_list, :product => @product) + @pbl = FactoryGirl.create(:product_build_list, product: @product) end def valid_attributes - {:product_id => @product.id, :platform_id => @product.platform_id, :product_build_list => {:main_script => 'build.sh', :time_living => 60, :project_version => 'master', :arch_id => @arch.id}} + {product_id: @product.id, platform_id: @product.platform_id, product_build_list: {main_script: 'build.sh', time_living: 60, project_version: 'master', arch_id: @arch.id}} end def valid_attributes_for_destroy - {:id => @pbl.id, :product_id => @pbl.product.id, :platform_id => @pbl.product.platform.id } + {id: @pbl.id, product_id: @pbl.product.id, platform_id: @pbl.product.platform.id } end def valid_attributes_for_show @@ -145,7 +145,7 @@ describe Platforms::ProductBuildListsController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @product.platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @product.platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'product build list admin' diff --git a/spec/controllers/platforms/products_controller_spec.rb b/spec/controllers/platforms/products_controller_spec.rb index 61560f955..95cbf03ab 100644 --- a/spec/controllers/platforms/products_controller_spec.rb +++ b/spec/controllers/platforms/products_controller_spec.rb @@ -8,14 +8,14 @@ shared_examples_for 'admin user' do end it 'should be able to update product' do - put :update, {:id => @product.id}.merge(@update_params) + put :update, {id: @product.id}.merge(@update_params) response.should redirect_to platform_product_path(@platform, @product) @product.reload @product.name.should eql('pro2') end it 'should be able to destroy product' do - lambda { delete :destroy, :id => @product.id, :platform_id => @platform }.should change{ Product.count }.by(-1) + lambda { delete :destroy, id: @product.id, platform_id: @platform }.should change{ Product.count }.by(-1) response.should redirect_to(platform_products_path(@platform)) end @@ -27,12 +27,12 @@ describe Platforms::ProductsController do @another_user = FactoryGirl.create(:user) @platform = FactoryGirl.create(:platform) - @product = FactoryGirl.create(:product, :platform => @platform) + @product = FactoryGirl.create(:product, platform: @platform) @project = FactoryGirl.create(:project) - params = {:platform_id => @platform, :src_project => @project.name_with_owner} - @create_params = params.merge({:product => {:name => 'pro', :time_living => 150}}) - @update_params = params.merge({:product => {:name => 'pro2'}}) + params = {platform_id: @platform, src_project: @project.name_with_owner} + @create_params = params.merge({product: {name: 'pro', time_living: 150}}) + @update_params = params.merge({product: {name: 'pro2'}}) @user = FactoryGirl.create(:user) set_session_for(@user) @@ -45,28 +45,28 @@ describe Platforms::ProductsController do [:create].each do |action| it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform.id + get action, platform_id: @platform.id response.should redirect_to(new_user_session_path) end end [:new, :edit, :update, :destroy].each do |action| it "should not be able to perform #{ action } action" do - get action, :id => @product.id, :platform_id => @platform.id + get action, id: @product.id, platform_id: @platform.id response.should redirect_to(new_user_session_path) end end [:show, :index].each do |action| - it "should not be able to perform #{ action } action", :anonymous_access => false do - get action, :id => @product.id, :platform_id => @platform.id + it "should not be able to perform #{ action } action", anonymous_access: false do + get action, id: @product.id, platform_id: @platform.id response.should redirect_to(new_user_session_path) end end [:show, :index].each do |action| - it "should be able to perform #{ action } action", :anonymous_access => true do - get action, :id => @product.id, :platform_id => @platform.id + it "should be able to perform #{ action } action", anonymous_access: true do + get action, id: @product.id, platform_id: @platform.id response.should render_template(action) response.should be_success end @@ -93,7 +93,7 @@ describe Platforms::ProductsController do context 'for admin relation user' do before(:each) do - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'admin user' @@ -107,12 +107,12 @@ describe Platforms::ProductsController do end it 'should not be able to perform update action' do - put :update, {:id => @product.id}.merge(@update_params) + put :update, {id: @product.id}.merge(@update_params) response.should redirect_to(forbidden_path) end it 'should not be able to destroy product' do - lambda { delete :destroy, :id => @product.id, :platform_id => @platform }.should change{ Product.count }.by(0) + lambda { delete :destroy, id: @product.id, platform_id: @platform }.should change{ Product.count }.by(0) response.should redirect_to(forbidden_path) end diff --git a/spec/controllers/platforms/repositories_controller_spec.rb b/spec/controllers/platforms/repositories_controller_spec.rb index 68993464a..1392c9f71 100644 --- a/spec/controllers/platforms/repositories_controller_spec.rb +++ b/spec/controllers/platforms/repositories_controller_spec.rb @@ -3,18 +3,18 @@ require 'spec_helper' shared_examples_for 'user with change projects in repository rights' do it 'should be able to see add_project page' do - get :add_project, :id => @repository.id, :platform_id => @platform.id + get :add_project, id: @repository.id, platform_id: @platform.id response.should render_template(:projects_list) end it 'should be able to add project to repository' do - get :add_project, :id => @repository.id, :platform_id => @platform.id, :project_id => @project.id + get :add_project, id: @repository.id, platform_id: @platform.id, project_id: @project.id response.should redirect_to(platform_repository_path(@repository.platform, @repository)) @repository.projects.should include(@project) end it 'should be able to remove project from repository' do - get :remove_project, :id => @repository.id, :platform_id => @platform.id, :project_id => @project.id + get :remove_project, id: @repository.id, platform_id: @platform.id, project_id: @project.id response.should redirect_to(platform_repository_path(@repository.platform, @repository)) @repository.projects.should_not include(@project) end @@ -23,33 +23,33 @@ end shared_examples_for 'user with rights of add/remove sync_lock_file to repository' do it 'should be able to perform sync_lock_file action' do - put :sync_lock_file, :id => @repository.id, :platform_id => @platform.id + put :sync_lock_file, id: @repository.id, platform_id: @platform.id response.should redirect_to(edit_platform_repository_path(@platform, @repository)) end end shared_examples_for 'user without rights of add/remove sync_lock_file to repository' do it 'should not be able to perform #{action} action' do - put :sync_lock_file, :id => @repository.id, :platform_id => @platform.id + put :sync_lock_file, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) end end shared_examples_for 'user without change projects in repository rights' do it 'should not be able to add project to repository' do - get :add_project, :id => @repository.id, :platform_id => @platform.id, :project_id => @project.id + get :add_project, id: @repository.id, platform_id: @platform.id, project_id: @project.id response.should redirect_to(redirect_path) @repository.projects.should_not include(@project) end it 'should not be able to perform regenerate_metadata action' do - put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id + put :regenerate_metadata, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) @repository.repository_statuses.should have(:no).items end it 'should not be able to remove project from repository' do - delete :remove_project, :id => @repository.id, :platform_id => @platform.id, :project_id => @project.id + delete :remove_project, id: @repository.id, platform_id: @platform.id, project_id: @project.id response.should redirect_to(redirect_path) @repository.projects.should_not include(@project) end @@ -57,18 +57,18 @@ end shared_examples_for 'registered user or guest' do it 'should not be able to perform new action' do - get :new, :platform_id => @platform.id + get :new, platform_id: @platform.id response.should redirect_to(redirect_path) end it 'should not be able to perform regenerate_metadata action' do - put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id + put :regenerate_metadata, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) @repository.repository_statuses.should have(:no).items end it 'should not be able to perform regenerate_metadata action of personal repository' do - put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id + put :regenerate_metadata, id: @personal_repository.id, platform_id: @personal_repository.platform.id response.should redirect_to(redirect_path) @personal_repository.repository_statuses.should have(:no).items end @@ -80,46 +80,46 @@ shared_examples_for 'registered user or guest' do end it 'should not be able to perform edit action' do - get :edit, :id => @repository.id, :platform_id => @platform.id + get :edit, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) end it 'should not be able to perform update action' do - put :update, :id => @repository.id, :platform_id => @platform.id + put :update, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) end it 'should not be able to add new member to repository' do - post :add_member, :id => @repository.id, :platform_id => @platform.id, :member_id => @another_user.id + post :add_member, id: @repository.id, platform_id: @platform.id, member_id: @another_user.id response.should redirect_to(redirect_path) @repository.members.should_not include(@another_user) end it 'should not be able to remove member from repository' do - @repository.relations.create(:role => 'admin', :actor => @another_user) - delete :remove_member, :id => @repository.id, :platform_id => @platform.id, :member_id => @another_user.id + @repository.relations.create(role: 'admin', actor: @another_user) + delete :remove_member, id: @repository.id, platform_id: @platform.id, member_id: @another_user.id response.should redirect_to(redirect_path) @repository.members.should include(@another_user) end it 'should not be able to remove members from repository' do another_user2 = FactoryGirl.create(:user) - @repository.relations.create(:role => 'admin', :actor => @another_user) - @repository.relations.create(:role => 'admin', :actor => another_user2) - post :remove_members, :id => @repository.id, :platform_id => @platform.id, - :user_remove => {@another_user.id => [1], another_user2.id => [1]} + @repository.relations.create(role: 'admin', actor: @another_user) + @repository.relations.create(role: 'admin', actor: another_user2) + post :remove_members, id: @repository.id, platform_id: @platform.id, + user_remove: {@another_user.id => [1], another_user2.id => [1]} response.should redirect_to(redirect_path) @repository.members.should include(@another_user, another_user2) end it 'should not be able to destroy repository in main platform' do - delete :destroy, :id => @repository.id, :platform_id => @platform.id + delete :destroy, id: @repository.id, platform_id: @platform.id response.should redirect_to(redirect_path) - lambda { delete :destroy, :id => @repository.id }.should_not change{ Repository.count }.by(-1) + lambda { delete :destroy, id: @repository.id }.should_not change{ Repository.count }.by(-1) end it 'should not be able to destroy personal repository' do - lambda { delete :destroy, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id} + lambda { delete :destroy, id: @personal_repository.id, platform_id: @personal_repository.platform.id} .should change{ Repository.count }.by(0) response.should redirect_to(redirect_path) end @@ -127,49 +127,49 @@ end shared_examples_for 'registered user' do it 'should be able to perform index action' do - get :index, :platform_id => @platform.id + get :index, platform_id: @platform.id response.should render_template(:index) end it 'should be able to perform show action' do - get :show, :id => @repository.id + get :show, id: @repository.id response.should render_template(:show) end it 'should be able to perform projects_list action' do - get :projects_list, :id => @repository.id, :platform_id => @platform.id, :format => :json + get :projects_list, id: @repository.id, platform_id: @platform.id, format: :json response.should be_success end end shared_examples_for 'platform admin user' do - + it_should_behave_like 'registered user' it_should_behave_like 'user with rights of add/remove sync_lock_file to repository' it 'should be able to perform new action' do - get :new, :platform_id => @platform.id + get :new, platform_id: @platform.id response.should render_template(:new) end it 'should be able to perform regenerate_metadata action' do - put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id + put :regenerate_metadata, id: @repository.id, platform_id: @platform.id response.should redirect_to(platform_repository_path(@platform, @repository)) @repository.repository_statuses.find_by_platform_id(@platform.id). waiting_for_regeneration?.should be_true end it 'should be able to perform regenerate_metadata action of personal repository' do - put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id, :build_for_platform_id => @platform.id + put :regenerate_metadata, id: @personal_repository.id, platform_id: @personal_repository.platform.id, build_for_platform_id: @platform.id response.should redirect_to(platform_repository_path(@personal_repository.platform, @personal_repository)) @personal_repository.repository_statuses.find_by_platform_id(@platform.id). waiting_for_regeneration?.should be_true end it 'should not be able to perform regenerate_metadata action of personal repository when build_for_platform does not exist' do - put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id - response.should render_template(:file => "#{Rails.root}/public/404.html") + put :regenerate_metadata, id: @personal_repository.id, platform_id: @personal_repository.platform.id + response.should render_template(file: "#{Rails.root}/public/404.html") @personal_repository.repository_statuses.should have(:no).items end @@ -177,50 +177,50 @@ shared_examples_for 'platform admin user' do lambda { post :create, @create_params }.should change{ Repository.count }.by(1) response.should redirect_to(platform_repository_path(@platform, Repository.last)) end - + it 'should be able to destroy repository in main platform' do - lambda { delete :destroy, :id => @repository.id, :platform_id => @platform.id }.should change{ Repository.count }.by(-1) + lambda { delete :destroy, id: @repository.id, platform_id: @platform.id }.should change{ Repository.count }.by(-1) response.should redirect_to(platform_repositories_path(@repository.platform)) end it 'should be able to perform edit action' do - get :edit, :id => @repository.id, :platform_id => @platform.id + get :edit, id: @repository.id, platform_id: @platform.id response.should render_template(:edit) end it 'should be able to add new member to repository' do - post :add_member, :id => @repository.id, :platform_id => @platform.id, :member_id => @another_user.id + post :add_member, id: @repository.id, platform_id: @platform.id, member_id: @another_user.id response.should redirect_to(edit_platform_repository_path(@repository.platform, @repository)) @repository.members.should include(@another_user) end it 'should be able to remove member from repository' do - @repository.relations.create(:role => 'admin', :actor => @another_user) - delete :remove_member, :id => @repository.id, :platform_id => @platform.id, :member_id => @another_user.id + @repository.relations.create(role: 'admin', actor: @another_user) + delete :remove_member, id: @repository.id, platform_id: @platform.id, member_id: @another_user.id response.should redirect_to(edit_platform_repository_path(@repository.platform, @repository)) @repository.members.should_not include(@another_user) end it 'should be able to remove members from repository' do another_user2 = FactoryGirl.create(:user) - @repository.relations.create(:role => 'admin', :actor => @another_user) - @repository.relations.create(:role => 'admin', :actor => another_user2) - post :remove_members, :id => @repository.id, :platform_id => @platform.id, - :user_remove => {@another_user.id => [1], another_user2.id => [1]} + @repository.relations.create(role: 'admin', actor: @another_user) + @repository.relations.create(role: 'admin', actor: another_user2) + post :remove_members, id: @repository.id, platform_id: @platform.id, + user_remove: {@another_user.id => [1], another_user2.id => [1]} response.should redirect_to(edit_platform_repository_path(@repository.platform, @repository)) @repository.members.should_not include(@another_user, another_user2) end it 'should not be able to destroy personal repository with name "main"' do # hook for "ActiveRecord::ActiveRecordError: name is marked as readonly" - Repository.where(:id => @personal_repository.id).update_all("name = 'main'") - lambda { delete :destroy, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id} + Repository.where(id: @personal_repository.id).update_all("name = 'main'") + lambda { delete :destroy, id: @personal_repository.id, platform_id: @personal_repository.platform.id} .should change{ Repository.count }.by(0) response.should redirect_to(forbidden_path) end it 'should be able to destroy personal repository with name not "main"' do - lambda { delete :destroy, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id} + lambda { delete :destroy, id: @personal_repository.id, platform_id: @personal_repository.platform.id} .should change{ Repository.count }.by(-1) response.should redirect_to(platform_repositories_path(@personal_repository.platform)) end @@ -234,11 +234,11 @@ describe Platforms::RepositoriesController do stub_redis @platform = FactoryGirl.create(:platform) - @repository = FactoryGirl.create(:repository, :platform => @platform) + @repository = FactoryGirl.create(:repository, platform: @platform) @personal_repository = FactoryGirl.create(:personal_repository) @project = FactoryGirl.create(:project) @another_user = FactoryGirl.create(:user) - @create_params = {:repository => {:name => 'pro', :description => 'pro2'}, :platform_id => @platform.id} + @create_params = {repository: {name: 'pro', description: 'pro2'}, platform_id: @platform.id} @user = FactoryGirl.create(:user) set_session_for(@user) @@ -256,22 +256,22 @@ describe Platforms::RepositoriesController do it_should_behave_like 'registered user or guest' it_should_behave_like 'user without change projects in repository rights' it_should_behave_like 'user without rights of add/remove sync_lock_file to repository' - - it "should not be able to perform show action", :anonymous_access => false do - get :show, :id => @repository + + it "should not be able to perform show action", anonymous_access: false do + get :show, id: @repository response.should redirect_to(new_user_session_path) end - it "should not be able to perform index action", :anonymous_access => false do - get :index, :platform_id => @platform + it "should not be able to perform index action", anonymous_access: false do + get :index, platform_id: @platform response.should redirect_to(new_user_session_path) end - it 'should not be able to perform projects_list action', :anonymous_access => false do - get :projects_list, :id => @repository.id, :platform_id => @platform.id, :format => :json + it 'should not be able to perform projects_list action', anonymous_access: false do + get :projects_list, id: @repository.id, platform_id: @platform.id, format: :json response.response_code.should == 401 end - + end context 'for user' do @@ -290,7 +290,7 @@ describe Platforms::RepositoriesController do end it_should_behave_like 'platform admin user' - + end context 'for platform owner user' do @@ -299,7 +299,7 @@ describe Platforms::RepositoriesController do platform = @personal_repository.platform platform.owner = @user # Owner of personal platform can't be changed - platform.save(:validate => false) + platform.save(validate: false) set_session_for(@user) end @@ -309,7 +309,7 @@ describe Platforms::RepositoriesController do context 'for platform member user' do before(:each) do [@repository, @personal_repository].each do |repo| - repo.platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + repo.platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end end diff --git a/spec/controllers/platforms/tokens_controller_spec.rb b/spec/controllers/platforms/tokens_controller_spec.rb index 5e27049d9..45d002b2a 100644 --- a/spec/controllers/platforms/tokens_controller_spec.rb +++ b/spec/controllers/platforms/tokens_controller_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' def create_key_pair(repository, user) - @key_pair = FactoryGirl.create(:key_pair, :repository => repository, :user => user) + @key_pair = FactoryGirl.create(:key_pair, repository: repository, user: user) end shared_examples_for 'token of platform for owner' do [:index, :new].each do |action| it "should be able to perform #{action} action" do - get action, :platform_id => @platform + get action, platform_id: @platform response.should render_template(action) end end it 'should not be able to perform show action' do - get :show, :platform_id => @platform, :id => @platform_token + get :show, platform_id: @platform, id: @platform_token response.should render_template(:show) end @@ -30,13 +30,13 @@ end shared_examples_for 'token of platform for simple user or guest' do [:index, :new].each do |action| it "should not be able to perform #{ action } action" do - get action, :platform_id => @platform + get action, platform_id: @platform response.should redirect_to(redirected_url) end end it 'should not be able to perform show action' do - get :show, :platform_id => @platform, :id => @platform_token + get :show, platform_id: @platform, id: @platform_token response.should redirect_to(redirected_url) end @@ -56,11 +56,11 @@ describe Platforms::TokensController do @platform = FactoryGirl.create(:platform) @user = FactoryGirl.create(:user) - @platform_token = FactoryGirl.create(:platform_token, :subject => @platform) + @platform_token = FactoryGirl.create(:platform_token, subject: @platform) @create_params = { - :platform_id => @platform, - :tokens => { - :description => 'description' + platform_id: @platform, + tokens: { + description: 'description' } } end @@ -83,7 +83,7 @@ describe Platforms::TokensController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - + @platform.owner = @user @platform.save end @@ -95,7 +95,7 @@ describe Platforms::TokensController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'token of platform for owner' @@ -105,7 +105,7 @@ describe Platforms::TokensController do before do @user = FactoryGirl.create(:user) set_session_for(@user) - @platform.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @platform.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'token of platform for simple user or guest' do diff --git a/spec/controllers/projects/build_lists_controller_spec.rb b/spec/controllers/projects/build_lists_controller_spec.rb index efc6ef466..69b3e961c 100644 --- a/spec/controllers/projects/build_lists_controller_spec.rb +++ b/spec/controllers/projects/build_lists_controller_spec.rb @@ -9,7 +9,7 @@ describe Projects::BuildListsController do end it 'should be able to perform index action in project scope' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should be_success end end @@ -21,7 +21,7 @@ describe Projects::BuildListsController do end it 'should not be able to perform index action in project scope' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(forbidden_url) end end @@ -32,32 +32,32 @@ describe Projects::BuildListsController do } it 'should be able to perform new action' do - get :new, :owner_name => @project.owner.uname, :project_name => @project.name + get :new, owner_name: @project.owner.uname, project_name: @project.name response.should render_template(:new) end it 'should be able to perform create action' do - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params) response.should redirect_to project_build_lists_path(@project) end it 'should save correct commit_hash for branch based build' do - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "master"}) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params).deep_merge(build_list: {project_version: "master"}) @project.build_lists.last.commit_hash.should == @project.repo.commits('master').first.id end it 'should save correct commit_hash for tag based build' do system("cd #{@project.repo.path} && git tag 4.7.5.3") # TODO REDO through grit - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "4.7.5.3"}) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params).deep_merge(build_list: {project_version: "4.7.5.3"}) @project.build_lists.last.commit_hash.should == @project.repo.commits('4.7.5.3').first.id end it 'should not be able to create with wrong project version' do - lambda{ post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "wrong", :commit_hash => nil})}.should change{@project.build_lists.count}.by(0) + lambda{ post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params).deep_merge(build_list: {project_version: "wrong", commit_hash: nil})}.should change{@project.build_lists.count}.by(0) end it 'should not be able to create with wrong git hash' do - lambda{ post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:commit_hash => 'wrong'})}.should change{@project.build_lists.count}.by(0) + lambda{ post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params).deep_merge(build_list: {commit_hash: 'wrong'})}.should change{@project.build_lists.count}.by(0) end end @@ -67,12 +67,12 @@ describe Projects::BuildListsController do } it 'should not be able to perform new action' do - get :new, :owner_name => @project.owner.uname, :project_name => @project.name + get :new, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(forbidden_url) end unless skip_new it 'should not be able to perform create action' do - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params) response.should redirect_to(forbidden_url) end end @@ -83,26 +83,26 @@ describe Projects::BuildListsController do before(:each) do @platform = FactoryGirl.create(:platform_with_repos) @create_params = { - :build_list => { - :project_version => 'master', - :save_to_repository_id => @platform.repositories.first.id, - :update_type => 'security', - :include_repos => [@platform.repositories.first.id] + build_list: { + project_version: 'master', + save_to_repository_id: @platform.repositories.first.id, + update_type: 'security', + include_repos: [@platform.repositories.first.id] }, - :arches => [FactoryGirl.create(:arch).id], - :build_for_platforms => [@platform.id] + arches: [FactoryGirl.create(:arch).id], + build_for_platforms: [@platform.id] } - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) stub_redis end context 'for guest' do - it 'should be able to perform index action', :anonymous_access => true do + it 'should be able to perform index action', anonymous_access: true do get :index response.should be_success end - it 'should not be able to perform index action', :anonymous_access => false do + it 'should not be able to perform index action', anonymous_access: false do get :index response.should redirect_to(new_user_session_path) end @@ -111,17 +111,17 @@ describe Projects::BuildListsController do context 'for user' do before(:each) do - any_instance_of(BuildList, :current_duration => 100) + any_instance_of(BuildList, current_duration: 100) @build_list = FactoryGirl.create(:build_list) @project = @build_list.project @owner_user = @project.owner @member_user = FactoryGirl.create(:user) - rel = @project.relations.build(:role => 'reader') + rel = @project.relations.build(role: 'reader') rel.actor = @member_user rel.save @user = FactoryGirl.create(:user) set_session_for(@user) - @show_params = {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @build_list.id} + @show_params = {owner_name: @project.owner.uname, project_name: @project.name, id: @build_list.id} @build_list.save_to_repository.update_column(:publish_without_qa, false) @request.env['HTTP_REFERER'] = build_list_path(@build_list) end @@ -130,7 +130,7 @@ describe Projects::BuildListsController do before(:each) {@build_list.save_to_repository.update_column(:publish_without_qa, true)} def do_reject_publish - put :reject_publish, :id => @build_list + put :reject_publish, id: @build_list end context 'if user is project owner' do @@ -185,7 +185,7 @@ describe Projects::BuildListsController do @another_user = FactoryGirl.create(:user) @build_list.update_column(:status, BuildList::SUCCESS) @build_list.save_to_repository.update_column(:publish_without_qa, true) - @build_list.project.collaborators.create(:actor_type => 'User', :actor_id => @another_user.id, :role => 'reader') + @build_list.project.collaborators.create(actor_type: 'User', actor_id: @another_user.id, role: 'reader') set_session_for(@another_user) do_reject_publish end @@ -205,7 +205,7 @@ describe Projects::BuildListsController do @writer_user = FactoryGirl.create(:user) @build_list.update_column(:status, BuildList::SUCCESS) @build_list.save_to_repository.update_column(:publish_without_qa, true) - @build_list.project.relations.create!(:actor_type => 'User', :actor_id => @writer_user.id, :role => 'writer') + @build_list.project.relations.create!(actor_type: 'User', actor_id: @writer_user.id, role: 'writer') set_session_for(@writer_user) do_reject_publish end @@ -227,12 +227,12 @@ describe Projects::BuildListsController do @build_list2 = FactoryGirl.create(:build_list) @build_list2.project.update_column(:visibility, 'hidden') - project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user) - @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project) + project = FactoryGirl.create(:project_with_commit, visibility: 'hidden', owner: @user) + @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, project: project) @build_list4 = FactoryGirl.create(:build_list) @build_list4.project.update_column(:visibility, 'hidden') - @build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User' + @build_list4.project.relations.create! role: 'reader', actor_id: @user.id, actor_type: 'User' end it 'should be able to perform index action' do @@ -241,7 +241,7 @@ describe Projects::BuildListsController do end it 'should show only accessible build_lists' do - get :index, :filter => {:ownership => 'everything'} + get :index, filter: {ownership: 'everything'} assigns(:build_lists).should include(@build_list1) assigns(:build_lists).should_not include(@build_list2) assigns(:build_lists).should include(@build_list3) @@ -262,8 +262,8 @@ describe Projects::BuildListsController do before do repository = FactoryGirl.create(:repository) repository.platform.change_visibility - Platform.where(:id => @platform.id).update_all(:platform_type => 'personal') - @create_params[:build_list].merge!({:include_repos => [repository.id]}) + Platform.where(id: @platform.id).update_all(platform_type: 'personal') + @create_params[:build_list].merge!({include_repos: [repository.id]}) @create_params[:build_for_platforms] = [repository.platform_id] end it_should_behave_like 'not create build list', true @@ -314,10 +314,10 @@ describe Projects::BuildListsController do @member_group = FactoryGirl.create(:group) @member_user = FactoryGirl.create(:user) - @member_group.actors.create :role => 'reader', :actor_id => @member_user.id, :actor_type => 'User' - @project.relations.create :role => 'reader', :actor_id => @member_group.id, :actor_type => 'Group' + @member_group.actors.create role: 'reader', actor_id: @member_user.id, actor_type: 'User' + @project.relations.create role: 'reader', actor_id: @member_group.id, actor_type: 'Group' - @show_params = {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @build_list.id} + @show_params = {owner_name: @project.owner.uname, project_name: @project.name, id: @build_list.id} end context 'for all build lists' do @@ -327,12 +327,12 @@ describe Projects::BuildListsController do @build_list2 = FactoryGirl.create(:build_list) @build_list2.project.update_column(:visibility, 'hidden') - project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user) - @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project) + project = FactoryGirl.create(:project_with_commit, visibility: 'hidden', owner: @user) + @build_list3 = FactoryGirl.create(:build_list_with_attaching_project, project: project) @build_list4 = FactoryGirl.create(:build_list) @build_list4.project.update_column(:visibility, 'hidden') - @build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User' + @build_list4.project.relations.create! role: 'reader', actor_id: @user.id, actor_type: 'User' end it 'should be able to perform index action' do @@ -341,7 +341,7 @@ describe Projects::BuildListsController do end it 'should show only accessible build_lists' do - get :index, :filter => {:ownership => 'everything'} + get :index, filter: {ownership: 'everything'} assigns(:build_lists).should include(@build_list1) assigns(:build_lists).should_not include(@build_list2) assigns(:build_lists).should include(@build_list3) @@ -399,29 +399,29 @@ describe Projects::BuildListsController do @build_list1 = FactoryGirl.create(:build_list) @build_list2 = FactoryGirl.create(:build_list) @build_list3 = FactoryGirl.create(:build_list) - @build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1.day), - :project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform, - :arch => @build_list3.arch) + @build_list4 = FactoryGirl.create(:build_list, updated_at: (Time.now - 1.day), + project: @build_list3.project, save_to_platform: @build_list3.save_to_platform, + arch: @build_list3.arch) end it 'should filter by id' do - get :index, :filter => {:id => @build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json + get :index, filter: {id: @build_list1.id, project_name: 'fdsfdf', any_other_field: 'do not matter'}, format: :json assigns[:build_lists].should include(@build_list1) assigns[:build_lists].should_not include(@build_list2) assigns[:build_lists].should_not include(@build_list3) end it 'should filter by project_name' do - # Project.where(:id => build_list2.project.id).update_all(:name => 'project_name') - get :index, :filter => {:project_name => @build_list2.project.name, :ownership => 'everything'}, :format => :json + # Project.where(id: build_list2.project.id).update_all(name: 'project_name') + get :index, filter: {project_name: @build_list2.project.name, ownership: 'everything'}, format: :json assigns[:build_lists].should_not include(@build_list1) assigns[:build_lists].should include(@build_list2) assigns[:build_lists].should_not include(@build_list3) end it 'should filter by project_name and update_date' do - get :index, :filter => {:project_name => @build_list3.project.name, :ownership => 'everything', - "updated_at_start" => @build_list3.updated_at.strftime('%d/%m/%Y')}, :format => :json + get :index, filter: {project_name: @build_list3.project.name, ownership: 'everything', + "updated_at_start" => @build_list3.updated_at.strftime('%d/%m/%Y')}, format: :json assigns[:build_lists].should_not include(@build_list1) assigns[:build_lists].should_not include(@build_list2) assigns[:build_lists].should include(@build_list3) diff --git a/spec/controllers/projects/collaborators_controller_spec.rb b/spec/controllers/projects/collaborators_controller_spec.rb index 443f4c407..68e4dc381 100644 --- a/spec/controllers/projects/collaborators_controller_spec.rb +++ b/spec/controllers/projects/collaborators_controller_spec.rb @@ -8,70 +8,70 @@ shared_context "collaborators controller" do @group = FactoryGirl.create(:group) @member_user = FactoryGirl.create(:user) # Create relation with 'writer' rights - @collaborator = Collaborator.create(:actor => @member_user, :project => @project, :role => 'writer') + @collaborator = Collaborator.create(actor: @member_user, project: @project, role: 'writer') @user = FactoryGirl.create(:user) set_session_for(@user) - + @user_params = { - :actor_id => @another_user.id.to_s, - :actor_type => 'user', - :role => 'reader' + actor_id: @another_user.id.to_s, + actor_type: 'user', + role: 'reader' } @group_params = { - :actor_id => @group.id.to_s, - :actor_type => 'group', - :role => 'reader' + actor_id: @group.id.to_s, + actor_type: 'group', + role: 'reader' } if @group @create_params = { - :owner_name => @project.owner.uname, :project_name => @project.name, - :format => :json + owner_name: @project.owner.uname, project_name: @project.name, + format: :json } - @update_params = @create_params.merge(:collaborator => {:role => 'reader'}) + @update_params = @create_params.merge(collaborator: {role: 'reader'}) end end shared_examples_for 'project admin user' do it 'should be able to view collaborators list' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should be_success end it 'should be able to perform update action' do - put :update, {:id => @collaborator.id}.merge(@update_params) + put :update, {id: @collaborator.id}.merge(@update_params) response.should be_success end it 'should add new collaborator with reader role' do - post :create, @create_params.merge(:collaborator => @user_params) - @project.relations.exists?(:actor_type => 'User', :actor_id => @another_user.id, :role => 'reader').should be_true + post :create, @create_params.merge(collaborator: @user_params) + @project.relations.exists?(actor_type: 'User', actor_id: @another_user.id, role: 'reader').should be_true end it 'should add new group with reader role' do - post :create, @create_params.merge(:collaborator => @group_params) - @project.relations.exists?(:actor_type => 'Group', :actor_id => @group.id, :role => 'reader').should be_true + post :create, @create_params.merge(collaborator: @group_params) + @project.relations.exists?(actor_type: 'Group', actor_id: @group.id, role: 'reader').should be_true end it 'should be able to set reader role for any user' do - put :update, {:id => @collaborator.id}.merge(@update_params) - @another_user.relations.exists? :target_id => @project.id, :target_type => 'Project', :role => 'read' + put :update, {id: @collaborator.id}.merge(@update_params) + @another_user.relations.exists? target_id: @project.id, target_type: 'Project', role: 'read' end end shared_examples_for 'user with no rights for this project' do it 'should not be able to view collaborators list' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(forbidden_path) end it 'should not be able to perform update action' do - put :update, {:id => @collaborator.id}.merge(@update_params) + put :update, {id: @collaborator.id}.merge(@update_params) response.should redirect_to(forbidden_path) end it 'should not be able to set reader role for any user' do - put :update, {:id => @collaborator.id}.merge(@update_params) - !@another_user.relations.exists? :target_id => @project.id, :target_type => 'Project', :role => 'read' + put :update, {id: @collaborator.id}.merge(@update_params) + !@another_user.relations.exists? target_id: @project.id, target_type: 'Project', role: 'read' end end @@ -83,12 +83,12 @@ describe Projects::CollaboratorsController do set_session_for(User.new) end it 'should not be able to perform index action' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(new_user_session_path) end it 'should not be able to perform update action' do - put :update, {:id => @collaborator.id}.merge(@update_params) + put :update, {id: @collaborator.id}.merge(@update_params) response.code.should == '401' end end @@ -104,7 +104,7 @@ describe Projects::CollaboratorsController do context 'for admin user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'project admin user' @@ -121,7 +121,7 @@ describe Projects::CollaboratorsController do context 'for reader user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'user with no rights for this project' @@ -129,7 +129,7 @@ describe Projects::CollaboratorsController do context 'for writer user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'user with no rights for this project' diff --git a/spec/controllers/projects/comments_controller_for_commit_spec.rb b/spec/controllers/projects/comments_controller_for_commit_spec.rb index 0632a3682..ac1749b4c 100644 --- a/spec/controllers/projects/comments_controller_for_commit_spec.rb +++ b/spec/controllers/projects/comments_controller_for_commit_spec.rb @@ -6,21 +6,21 @@ describe Projects::CommentsController do @project = FactoryGirl.create(:project_with_commit) @commit = @project.repo.commits.first - @create_params = {:comment => {:body => 'I am a comment!'}, :owner_name => @project.owner.uname, :project_name => @project.name, :commit_id => @commit.id} - @update_params = {:comment => {:body => 'updated'}, :owner_name => @project.owner.uname, :project_name => @project.name, :commit_id => @commit.id} + @create_params = {comment: {body: 'I am a comment!'}, owner_name: @project.owner.uname, project_name: @project.name, commit_id: @commit.id} + @update_params = {comment: {body: 'updated'}, owner_name: @project.owner.uname, project_name: @project.name, commit_id: @commit.id} - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) - @comment = FactoryGirl.create(:comment, :commentable => @commit, :project => @project) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) + @comment = FactoryGirl.create(:comment, commentable: @commit, project: @project) @user = FactoryGirl.create(:user) - @own_comment = FactoryGirl.create(:comment, :commentable => @commit, :user => @user, :project => @project) + @own_comment = FactoryGirl.create(:comment, commentable: @commit, user: @user, project: @project) set_session_for(@user) - @path = {:owner_name => @project.owner.uname, :project_name => @project.name, :commit_id => @commit.id} + @path = {owner_name: @project.owner.uname, project_name: @project.name, commit_id: @commit.id} @return_path = commit_path(@project, @commit.id) end context 'for project admin user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'user with create comment ability' @@ -43,7 +43,7 @@ describe Projects::CommentsController do context 'for project reader user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'user with create comment ability' @@ -54,7 +54,7 @@ describe Projects::CommentsController do context 'for project writer user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'user with create comment ability' diff --git a/spec/controllers/projects/comments_controller_spec.rb b/spec/controllers/projects/comments_controller_spec.rb index e171546ca..64bebb98f 100644 --- a/spec/controllers/projects/comments_controller_spec.rb +++ b/spec/controllers/projects/comments_controller_spec.rb @@ -5,18 +5,18 @@ shared_context "comments controller" do stub_symlink_methods @project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project_id => @project.id) - @comment = FactoryGirl.create(:comment, :commentable => @issue, :project_id => @project.id) + @issue = FactoryGirl.create(:issue, project_id: @project.id) + @comment = FactoryGirl.create(:comment, commentable: @issue, project_id: @project.id) @user = FactoryGirl.create(:user) - @own_comment = FactoryGirl.create(:comment, :commentable => @issue, :user => @user, :project_id => @project.id) + @own_comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project_id: @project.id) set_session_for(@user) - @path = {:owner_name => @project.owner.uname, :project_name => @project.name, :issue_id => @issue.serial_id} + @path = {owner_name: @project.owner.uname, project_name: @project.name, issue_id: @issue.serial_id} @return_path = project_issue_path(@project, @issue) - @create_params = {:comment => {:body => 'I am a comment!'}}.merge(@path) - @update_params = {:comment => {:body => 'updated'}}.merge(@path) + @create_params = {comment: {body: 'I am a comment!'}}.merge(@path) + @update_params = {comment: {body: 'updated'}}.merge(@path) end end @@ -38,7 +38,7 @@ describe Projects::CommentsController do context 'for project admin user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'user with create comment ability' @@ -60,7 +60,7 @@ describe Projects::CommentsController do context 'for project reader user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'user with create comment ability' @@ -71,7 +71,7 @@ describe Projects::CommentsController do context 'for project writer user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'user with create comment ability' diff --git a/spec/controllers/projects/git/git_trees_controller_spec.rb b/spec/controllers/projects/git/git_trees_controller_spec.rb index ddf639f70..d1a756b44 100644 --- a/spec/controllers/projects/git/git_trees_controller_spec.rb +++ b/spec/controllers/projects/git/git_trees_controller_spec.rb @@ -6,48 +6,48 @@ describe Projects::Git::TreesController do stub_symlink_methods @project = FactoryGirl.create(:project) - @params = { :owner_name => @project.owner.uname, - :project_name => @project.name, - :treeish => "#{@project.name}-master"} - fill_project @project + @params = { owner_name: @project.owner.uname, + project_name: @project.name, + treeish: "#{@project.name}-master"} + fill_project @project end context 'for guest' do [:tags, :branches].each do |action| - it "should be able to perform #{action} action with anonymous acccess", :anonymous_access => true do - get action, @params.merge(:treeish => 'master') + it "should be able to perform #{action} action with anonymous acccess", anonymous_access: true do + get action, @params.merge(treeish: 'master') response.should be_success end - it "should not be able to perform #{action} action without anonymous acccess", :anonymous_access => false do - get action, @params.merge(:treeish => 'master') + it "should not be able to perform #{action} action without anonymous acccess", anonymous_access: false do + get action, @params.merge(treeish: 'master') response.should_not be_success end end - it "should be able to perform archive action with anonymous acccess", :anonymous_access => true do + it "should be able to perform archive action with anonymous acccess", anonymous_access: true do stub(controller).render - get :archive, @params.merge(:format => 'tar.gz') + get :archive, @params.merge(format: 'tar.gz') response.should be_success end - it "should not be able to perform archive action without anonymous acccess", :anonymous_access => false do - get :archive, @params.merge(:format => 'tar.gz') + it "should not be able to perform archive action without anonymous acccess", anonymous_access: false do + get :archive, @params.merge(format: 'tar.gz') response.code.should == '401' end it 'should not be able to perform destroy action' do - delete :destroy, @params.merge(:treeish => 'master') + delete :destroy, @params.merge(treeish: 'master') response.should_not be_success end it 'should not be able to perform restore_branch action' do - put :restore_branch, @params.merge(:treeish => 'master') + put :restore_branch, @params.merge(treeish: 'master') response.should_not be_success end it 'should not be able to perform create action' do - post :create, @params.merge(:treeish => '', :from_ref => 'master', :new_ref => 'master-1') + post :create, @params.merge(treeish: '', from_ref: 'master', new_ref: 'master-1') response.should_not be_success end @@ -57,41 +57,41 @@ describe Projects::Git::TreesController do before { set_session_for FactoryGirl.create(:user) } it 'should not be able to archive empty project' do %x(rm -rf #{@project.path}) - expect { get :archive, @params.merge(:format => 'tar.gz') }.to raise_error(ActionController::RoutingError) + expect { get :archive, @params.merge(format: 'tar.gz') }.to raise_error(ActionController::RoutingError) end it 'should not be able to injection code with format' do - expect { get :archive, @params.merge(:format => "tar.gz master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError) + expect { get :archive, @params.merge(format: "tar.gz master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError) end it 'should not be able to injection code with treeish' do - expect { get :archive, @params.merge(:treeish => "master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError) + expect { get :archive, @params.merge(treeish: "master > /dev/null; echo 'I am hacker!';\#") }.to raise_error(ActionController::RoutingError) end it 'should be able to perform archive action' do stub(controller).render - get :archive, @params.merge(:format => 'tar.gz') + get :archive, @params.merge(format: 'tar.gz') response.should be_success end it 'should not be able to perform destroy action' do - delete :destroy, @params.merge(:treeish => 'master') + delete :destroy, @params.merge(treeish: 'master') response.should_not be_success end it 'should not be able to perform restore_branch action' do - put :restore_branch, @params.merge(:treeish => 'master') + put :restore_branch, @params.merge(treeish: 'master') response.should_not be_success end it 'should not be able to perform create action' do - post :create, @params.merge(:treeish => '', :from_ref => 'master', :new_ref => 'master-1') + post :create, @params.merge(treeish: '', from_ref: 'master', new_ref: 'master-1') response.should_not be_success end [:tags, :branches].each do |action| it "should be able to perform #{action} action" do - get action, @params.merge(:treeish => 'master') + get action, @params.merge(treeish: 'master') response.should be_success end end @@ -100,27 +100,27 @@ describe Projects::Git::TreesController do context 'for writer user' do before(:each) do user = FactoryGirl.create(:user) - @project.relations.create!(:actor_type => 'User', :actor_id => user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: user.id, role: 'writer') set_session_for user end it 'should be able to perform destroy action' do - delete :destroy, @params.merge(:treeish => 'conflicts') + delete :destroy, @params.merge(treeish: 'conflicts') response.should be_success end it 'should not be able to perform destroy action for master branch' do - delete :destroy, @params.merge(:treeish => 'master') + delete :destroy, @params.merge(treeish: 'master') response.should_not be_success end it 'should be able to perform restore_branch action' do - put :restore_branch, @params.merge(:treeish => 'master-1', :sha => 'master') + put :restore_branch, @params.merge(treeish: 'master-1', sha: 'master') response.should be_success end it 'should be able to perform create action' do - post :create, @params.merge(:treeish => '', :from_ref => 'master', :new_ref => 'master-1') + post :create, @params.merge(treeish: '', from_ref: 'master', new_ref: 'master-1') response.should be_success end end diff --git a/spec/controllers/projects/hooks_controller_spec.rb b/spec/controllers/projects/hooks_controller_spec.rb index 8f2e36bf6..eb9432a08 100644 --- a/spec/controllers/projects/hooks_controller_spec.rb +++ b/spec/controllers/projects/hooks_controller_spec.rb @@ -2,54 +2,54 @@ require 'spec_helper' shared_examples_for 'hooks user with project admin rights' do it 'should be able to perform index action' do - get :index, {:owner_name => @project.owner.uname, :project_name => @project.name} + get :index, {owner_name: @project.owner.uname, project_name: @project.name} response.should be_success end it 'should be able to perform new action' do - get :new, {:owner_name => @project.owner.uname, :project_name => @project.name, :hook => {:name => 'web'}} + get :new, {owner_name: @project.owner.uname, project_name: @project.name, hook: {name: 'web'}} response.should be_success end it 'should be able to perform edit action' do - get :new, {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @hook.id} + get :new, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id} response.should be_success end it 'should be able to perform update action' do - put :update, {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @hook.id}.merge(@update_params) - response.should redirect_to(project_hooks_path(@project, :name => 'web')) + put :update, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}.merge(@update_params) + response.should redirect_to(project_hooks_path(@project, name: 'web')) end it 'should be able to perform create action' do - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params) - response.should redirect_to(project_hooks_path(@project, :name => 'web')) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params) + response.should redirect_to(project_hooks_path(@project, name: 'web')) end end shared_examples_for 'hooks user without project admin rights' do it 'should not be able to perform index action' do - get :index, {:owner_name => @project.owner.uname, :project_name => @project.name} + get :index, {owner_name: @project.owner.uname, project_name: @project.name} response.should redirect_to(forbidden_path) end it 'should not be able to perform new action' do - get :new, {:owner_name => @project.owner.uname, :project_name => @project.name, :hook => {:name => 'web'}} + get :new, {owner_name: @project.owner.uname, project_name: @project.name, hook: {name: 'web'}} response.should redirect_to(forbidden_path) end it 'should not be able to perform edit action' do - get :new, {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @hook.id} + get :new, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id} response.should redirect_to(forbidden_path) end it 'should not be able to perform update action' do - put :update, {:owner_name => @project.owner.uname, :project_name => @project.name, :id => @hook.id}.merge(@update_params) + put :update, {owner_name: @project.owner.uname, project_name: @project.name, id: @hook.id}.merge(@update_params) response.should redirect_to(forbidden_path) end it 'should not be able to perform create action' do - post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params) + post :create, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@create_params) response.should redirect_to(forbidden_path) end end @@ -60,10 +60,10 @@ describe Projects::HooksController do stub_symlink_methods @project = FactoryGirl.create(:project) - @hook = FactoryGirl.create(:hook, :project => @project) + @hook = FactoryGirl.create(:hook, project: @project) - @create_params = {:hook => {:name => 'web', :data => {:url => 'create'}}} - @update_params = {:hook => {:data => {:url => 'update'}}} + @create_params = {hook: {name: 'web', data: {url: 'create'}}} + @update_params = {hook: {data: {url: 'update'}}} @user = FactoryGirl.create(:user) set_session_for(@user) @@ -94,14 +94,14 @@ describe Projects::HooksController do context 'for reader user' do before do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'hooks user without project admin rights' end context 'for writer user' do before do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'hooks user without project admin rights' end @@ -115,20 +115,20 @@ describe Projects::HooksController do context 'group is owner of the project' do before do - @project = FactoryGirl.create(:project, :owner => @group) - @hook = FactoryGirl.create(:hook, :project => @project) + @project = FactoryGirl.create(:project, owner: @group) + @hook = FactoryGirl.create(:hook, project: @project) end context 'group member user with reader role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'hooks user without project admin rights' context 'user should has best role' do before do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'admin' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'admin' end it_should_behave_like 'hooks user with project admin rights' end @@ -136,7 +136,7 @@ describe Projects::HooksController do context 'group member user with admin role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'hooks user with project admin rights' @@ -146,19 +146,19 @@ describe Projects::HooksController do context 'group is member of the project' do context 'with admin rights' do before do - @project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'admin' + @project.relations.create actor_id: @group.id, actor_type: @group.class.to_s, role: 'admin' end context 'group member user with reader role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'hooks user with project admin rights' context 'user should has best role' do before do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'reader' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'reader' end it_should_behave_like 'hooks user with project admin rights' end @@ -166,7 +166,7 @@ describe Projects::HooksController do context 'group member user with admin role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'hooks user with project admin rights' @@ -175,18 +175,18 @@ describe Projects::HooksController do context 'with reader rights' do before do - @project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'reader' + @project.relations.create actor_id: @group.id, actor_type: @group.class.to_s, role: 'reader' end context 'group member user with reader role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'hooks user without project admin rights' context 'user should has best role' do before do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'admin' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'admin' end it_should_behave_like 'hooks user with project admin rights' end @@ -194,7 +194,7 @@ describe Projects::HooksController do context 'group member user with admin role' do before do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'hooks user without project admin rights' end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index a541faecd..d04208560 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -7,33 +7,33 @@ shared_context "issues controller" do @project = FactoryGirl.create(:project_with_commit) @issue_user = FactoryGirl.create(:user) - @issue = FactoryGirl.create(:issue, :project_id => @project.id, :assignee_id => @issue_user.id) - @label = FactoryGirl.create(:label, :project_id => @project.id) + @issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id) + @label = FactoryGirl.create(:label, project_id: @project.id) + + @project_with_turned_off_issues = FactoryGirl.create(:project, has_issues: false) + @turned_of_issue = FactoryGirl.create(:issue, project_id: @project_with_turned_off_issues.id, assignee_id: @issue_user.id) - @project_with_turned_off_issues = FactoryGirl.create(:project, :has_issues => false) - @turned_of_issue = FactoryGirl.create(:issue, :project_id => @project_with_turned_off_issues.id, :assignee_id => @issue_user.id) - @user = FactoryGirl.create(:user) set_session_for(@user) @create_params = { - :owner_name => @project.owner.uname, :project_name => @project.name, - :issue => { - :title => "issue1", - :body => "issue body", - :labelings_attributes => { @label.id => {:label_id => @label.id}}, - :assignee_id => @issue_user.id + owner_name: @project.owner.uname, project_name: @project.name, + issue: { + title: "issue1", + body: "issue body", + labelings_attributes: { @label.id => {label_id: @label.id}}, + assignee_id: @issue_user.id } } @update_params = { - :owner_name => @project.owner.uname, :project_name => @project.name, - :issue => { - :title => "issue2" + owner_name: @project.owner.uname, project_name: @project.name, + issue: { + title: "issue2" } } - @pull = @project.pull_requests.new :issue_attributes => {:title => 'test', :body => 'testing'} + @pull = @project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'} @pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project @pull.to_ref = 'master' @pull.from_project, @pull.from_ref = @project, 'non_conflicts' @@ -44,12 +44,12 @@ end shared_examples_for 'issue user with project guest rights' do it 'should be able to perform index action' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + 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 + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @issue.serial_id response.should render_template(:show) end end @@ -57,8 +57,8 @@ end shared_examples_for 'issue user with project reader rights' do it 'should be able to perform index action on hidden project' do - @project.update_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should render_template(:index) end @@ -74,8 +74,8 @@ end shared_examples_for 'issue user with project writer rights' do it 'should be able to perform index action on hidden project' do - @project.update_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should render_template(:index) end @@ -98,47 +98,47 @@ end shared_examples_for 'user with issue update rights' do it 'should be able to perform update action' do - put :update, {:id => @issue.serial_id}.merge(@update_params) + put :update, {id: @issue.serial_id}.merge(@update_params) response.code.should eq('200') end it 'should update issue title' do - put :update, {:id => @issue.serial_id}.merge(@update_params) + put :update, {id: @issue.serial_id}.merge(@update_params) @issue.reload.title.should == 'issue2' end end shared_examples_for 'user without issue update rights' do it 'should not be able to perform update action' do - put :update, {:id => @issue.serial_id}.merge(@update_params) + put :update, {id: @issue.serial_id}.merge(@update_params) response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path) end it 'should not update issue title' do - put :update, {:id => @issue.serial_id}.merge(@update_params) + put :update, {id: @issue.serial_id}.merge(@update_params) @issue.reload.title.should_not == 'issue2' end end shared_examples_for 'user without issue destroy rights' do it 'should not be able to perform destroy action' do - delete :destroy, :id => @issue.serial_id, :owner_name => @project.owner.uname, :project_name => @project.name + delete :destroy, id: @issue.serial_id, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(controller.current_user ? forbidden_path : new_user_session_path) end it 'should not reduce issues count' do - lambda{ delete :destroy, :id => @issue.serial_id, :owner_name => @project.owner.uname, :project_name => @project.name }.should_not change{ Issue.count } + lambda{ delete :destroy, id: @issue.serial_id, owner_name: @project.owner.uname, project_name: @project.name }.should_not change{ Issue.count } end end shared_examples_for 'project with issues turned off' do it 'should not be able to perform index action' do - get :index, :owner_name => @project_with_turned_off_issues.owner.uname, :project_name => @project_with_turned_off_issues.name + get :index, owner_name: @project_with_turned_off_issues.owner.uname, project_name: @project_with_turned_off_issues.name response.should redirect_to(forbidden_path) end it 'should not be able to perform show action' do - get :show, :owner_name => @project_with_turned_off_issues.owner.uname, :project_name => @project_with_turned_off_issues.name, :id => @turned_of_issue.serial_id + get :show, owner_name: @project_with_turned_off_issues.owner.uname, project_name: @project_with_turned_off_issues.name, id: @turned_of_issue.serial_id response.should redirect_to(forbidden_path) end end @@ -162,7 +162,7 @@ describe Projects::IssuesController do context 'for project admin user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'issue user with project guest rights' @@ -189,7 +189,7 @@ describe Projects::IssuesController do context 'for project reader user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'issue user with project guest rights' @@ -220,19 +220,19 @@ describe Projects::IssuesController do # end it 'should return 404' do - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => 999999 - render_template(:file => "#{Rails.root}/public/404.html") + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: 999999 + render_template(file: "#{Rails.root}/public/404.html") end it 'should redirect to pull request page' do - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @pull.serial_id + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @pull.serial_id response.should redirect_to(project_pull_request_path(@project, @pull)) end end context 'for project writer user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'issue user with project guest rights' @@ -260,29 +260,29 @@ describe Projects::IssuesController do end if APP_CONFIG['anonymous_access'] - + it_should_behave_like 'issue user with project guest rights' - + it 'should not be able to perform index action on hidden project' do - @project.update_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(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 + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(new_user_session_path) end it 'should not be able to perform show action' do - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id + 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_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(new_user_session_path) end end diff --git a/spec/controllers/projects/projects_controller_spec.rb b/spec/controllers/projects/projects_controller_spec.rb index b1a5868e5..40d3f9129 100644 --- a/spec/controllers/projects/projects_controller_spec.rb +++ b/spec/controllers/projects/projects_controller_spec.rb @@ -3,58 +3,58 @@ require 'spec_helper' shared_examples_for 'projects user with reader rights' do it 'should be able to fork project' do - post :fork, :owner_name => @project.owner.uname, :project_name => @project.name + post :fork, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(project_path(Project.last)) end it 'should be able to fork project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') - lambda {post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, - :group => group.id}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') + lambda {post :fork, owner_name: @project.owner.uname, project_name: @project.name, + group: group.id}.should change{ Project.count }.by(1) end it 'should be able to fork project to own group' do - group = FactoryGirl.create(:group, :owner => @user) - lambda {post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, - :group => group.id}.should change{ Project.count }.by(1) + group = FactoryGirl.create(:group, owner: @user) + lambda {post :fork, owner_name: @project.owner.uname, project_name: @project.name, + group: group.id}.should change{ Project.count }.by(1) end it 'should be able to fork project with different name' do - post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, :fork_name => 'another_name' - response.should redirect_to(project_path(Project.where(:name => 'another_name').last)) + post :fork, owner_name: @project.owner.uname, project_name: @project.name, fork_name: 'another_name' + response.should redirect_to(project_path(Project.where(name: 'another_name').last)) end end shared_examples_for 'projects user with project admin rights' do it 'should be able to perform update action' do - put :update, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@update_params) + put :update, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@update_params) response.should redirect_to(project_path(@project)) end end shared_examples_for 'user with destroy rights' do it 'should be able to perform destroy action' do - delete :destroy, {:owner_name => @project.owner.uname, :project_name => @project.name} + delete :destroy, {owner_name: @project.owner.uname, project_name: @project.name} response.should redirect_to(@project.owner) end it 'should change objects count on destroy' do - lambda { delete :destroy, :owner_name => @project.owner.uname, :project_name => @project.name }.should change{ Project.count }.by(-1) + lambda { delete :destroy, owner_name: @project.owner.uname, project_name: @project.name }.should change{ Project.count }.by(-1) end end shared_examples_for 'projects user without project admin rights' do 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 + put :update, :project=>{description:"hack"}, owner_name: @project.owner.uname, project_name: @project.name @project.reload.description.should == description response.should redirect_to(forbidden_path) 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 + post :sections, project:{has_wiki: !has_wiki, has_issues: !has_issues}, owner_name: @project.owner.uname, project_name: @project.name @project.reload.has_wiki.should == has_wiki @project.reload.has_issues.should == has_issues response.should redirect_to(forbidden_path) @@ -62,28 +62,28 @@ shared_examples_for 'projects user without project admin rights' do it 'writer group should be able to fork project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') - lambda {post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, - :group => group.id}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'writer') + lambda {post :fork, owner_name: @project.owner.uname, project_name: @project.name, + group: group.id}.should change{ Project.count }.by(1) end it 'reader group should not be able to fork project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') - lambda {post :fork, :owner_name => @project.owner.uname, :project_name => @project.name, - :group => group.id}.should change{ Project.count }.by(0) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') + lambda {post :fork, owner_name: @project.owner.uname, project_name: @project.name, + group: group.id}.should change{ Project.count }.by(0) end it 'writer group should be able to create project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') - lambda {post :create, @create_params.merge(:who_owns => 'group', :owner_id => group.id)}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'writer') + lambda {post :create, @create_params.merge(who_owns: 'group', owner_id: group.id)}.should change{ Project.count }.by(1) end it 'reader group should not be able to create project to their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') - lambda {post :create, @create_params.merge(:who_owns => 'group', :owner_id => group.id)}.should change{ Project.count }.by(0) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') + lambda {post :create, @create_params.merge(who_owns: 'group', owner_id: group.id)}.should change{ Project.count }.by(0) end end @@ -94,8 +94,8 @@ describe Projects::ProjectsController do @project = FactoryGirl.create(:project) - @create_params = {:project => {:name => 'pro'}} - @update_params = {:project => {:description => 'pro2'}} + @create_params = {project: {name: 'pro'}} + @update_params = {project: {description: 'pro2'}} @user = FactoryGirl.create(:user) set_session_for(@user) @@ -115,7 +115,7 @@ describe Projects::ProjectsController do end it 'should not be able to perform update action' do - put :update, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@update_params) + put :update, {owner_name: @project.owner.uname, project_name: @project.name}.merge(@update_params) response.should redirect_to(new_user_session_path) end @@ -133,7 +133,7 @@ describe Projects::ProjectsController do end context 'create project for myself' do - + it 'should be able to perform create action' do post :create, @create_params response.should redirect_to(project_path( Project.last )) @@ -148,21 +148,21 @@ describe Projects::ProjectsController do it 'should not be able to create project for alien group' do group = FactoryGirl.create(:group) - post :create, @create_params.merge({:who_owns => 'group', :owner_id => group.id}) + post :create, @create_params.merge({who_owns: 'group', owner_id: group.id}) response.should redirect_to(forbidden_path) end it 'should be able to create project for their group' do group = FactoryGirl.create(:group) - group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') - lambda { post :create, @create_params.merge({:who_owns => 'group', :owner_id => group.id})}.should change{ Project.count }.by(1) + group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') + lambda { post :create, @create_params.merge({who_owns: 'group', owner_id: group.id})}.should change{ Project.count }.by(1) end it 'should be able to create project for own group' do - group = FactoryGirl.create(:group, :owner => @user) - lambda { post :create, @create_params.merge({:who_owns => 'group', :owner_id => group.id})}.should change{ Project.count }.by(1) + group = FactoryGirl.create(:group, owner: @user) + lambda { post :create, @create_params.merge({who_owns: 'group', owner_id: group.id})}.should change{ Project.count }.by(1) end - end + end end # context 'registered user' end # context 'for users' @@ -193,7 +193,7 @@ describe Projects::ProjectsController do it_should_behave_like 'user with destroy rights' it 'should not be able to fork own project' do - post :fork, :owner_name => @project.owner.uname, :project_name => @project.name + post :fork, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(@project) end @@ -201,7 +201,7 @@ describe Projects::ProjectsController do context 'for reader user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'projects user with reader rights' @@ -210,7 +210,7 @@ describe Projects::ProjectsController do context 'for writer user' do before(:each) do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'projects user with reader rights' @@ -221,8 +221,8 @@ describe Projects::ProjectsController do context 'for other user' do it 'should not be able to fork hidden project' do - @project.update_attributes(:visibility => 'hidden') - post :fork, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + post :fork, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(forbidden_path) end @@ -239,12 +239,12 @@ describe Projects::ProjectsController do context 'group is owner of the project' do before(:each) do - @project = FactoryGirl.create(:project, :owner => @group) + @project = FactoryGirl.create(:project, owner: @group) end context 'group member user with reader role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'projects user with reader rights' @@ -256,7 +256,7 @@ describe Projects::ProjectsController do context 'user should has best role' do before(:each) do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'admin' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'admin' end it_should_behave_like 'projects user with project admin rights' end @@ -264,7 +264,7 @@ describe Projects::ProjectsController do context 'group member user with admin role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'projects user with project admin rights' @@ -275,12 +275,12 @@ describe Projects::ProjectsController do context 'group is 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' + @project.relations.create actor_id: @group.id, actor_type: @group.class.to_s, role: 'admin' end context 'group member user with reader role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'projects user with reader rights' @@ -288,7 +288,7 @@ describe Projects::ProjectsController do context 'user should has best role' do before(:each) do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'reader' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'reader' end it_should_behave_like 'projects user with project admin rights' end @@ -296,7 +296,7 @@ describe Projects::ProjectsController do context 'group member user with admin role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'projects user with project admin rights' @@ -306,12 +306,12 @@ describe Projects::ProjectsController do context 'with reader rights' do before(:each) do - @project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'reader' + @project.relations.create actor_id: @group.id, actor_type: @group.class.to_s, role: 'reader' end context 'group member user with reader role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'reader') end it_should_behave_like 'projects user with reader rights' @@ -319,7 +319,7 @@ describe Projects::ProjectsController do context 'user should has best role' do before(:each) do - @project.relations.create :actor_id => @user.id, :actor_type => @user.class.to_s, :role => 'admin' + @project.relations.create actor_id: @user.id, actor_type: @user.class.to_s, role: 'admin' end it_should_behave_like 'projects user with project admin rights' end @@ -327,7 +327,7 @@ describe Projects::ProjectsController do context 'group member user with admin role' do before(:each) do - @group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: 'admin') end it_should_behave_like 'projects user with reader rights' diff --git a/spec/controllers/projects/pull_requests_controller_spec.rb b/spec/controllers/projects/pull_requests_controller_spec.rb index 526a6c33f..5770d2d6b 100644 --- a/spec/controllers/projects/pull_requests_controller_spec.rb +++ b/spec/controllers/projects/pull_requests_controller_spec.rb @@ -8,50 +8,50 @@ shared_context "pull request controller" do @project = FactoryGirl.create(:project_with_commit) - @pull = @project.pull_requests.new :issue_attributes => {:title => 'test', :body => 'testing'} + @pull = @project.pull_requests.new issue_attributes: {title: 'test', body: 'testing'} @pull.issue.user, @pull.issue.project = @project.owner, @pull.to_project @pull.to_ref = 'master' @pull.from_project, @pull.from_ref = @project, 'non_conflicts' @pull.save @create_params = { - :pull_request => {:issue_attributes => {:title => 'create', :body => 'creating'}, - :to_ref => 'non_conflicts', - :from_ref => 'master'}, - :to_project => @project.name_with_owner, - :owner_name => @project.owner.uname, - :project_name => @project.name } + pull_request: {issue_attributes: {title: 'create', body: 'creating'}, + to_ref: 'non_conflicts', + from_ref: 'master'}, + to_project: @project.name_with_owner, + owner_name: @project.owner.uname, + project_name: @project.name } @update_params = @create_params.merge( - :pull_request_action => 'close', - :id => @pull.serial_id) + pull_request_action: 'close', + id: @pull.serial_id) @wrong_update_params = @create_params.merge( - :pull_request => {:issue_attributes => {:title => 'update', :body => 'updating', :id => @pull.issue.id}}, - :id => @pull.serial_id) + pull_request: {issue_attributes: {title: 'update', body: 'updating', id: @pull.issue.id}}, + id: @pull.serial_id) @user = FactoryGirl.create(:user) set_session_for(@user) - @issue = FactoryGirl.create(:issue, :project => @project) + @issue = FactoryGirl.create(:issue, project: @project) end end shared_examples_for 'pull request user with project guest rights' do it 'should be able to perform index action' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + 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 when pull request has been created' do @pull.check - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @pull.serial_id + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @pull.serial_id response.should render_template(:show) end end shared_examples_for 'pull request user with project reader rights' do it 'should be able to perform index action on hidden project' do - @project.update_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should render_template(:index) end @@ -62,33 +62,33 @@ shared_examples_for 'pull request user with project reader rights' do it 'should create pull request object into db' do lambda{ post :create, @create_params }.should change{ PullRequest.joins(:issue). - where(:issues => {:title => 'create', :body => 'creating'}).count }.by(1) + where(issues: {title: 'create', body: 'creating'}).count }.by(1) end it "should not create same pull" do - post :create, @create_params.merge({:pull_request => {:issue_attributes => {:title => 'same', :body => 'creating'}, :from_ref => 'non_conflicts', :to_ref => 'master'}, :to_project_id => @project.id}) - PullRequest.joins(:issue).where(:issues => {:title => 'same', :body => 'creating'}).count.should == 0 + post :create, @create_params.merge({pull_request: {issue_attributes: {title: 'same', body: 'creating'}, from_ref: 'non_conflicts', to_ref: 'master'}, to_project_id: @project.id}) + PullRequest.joins(:issue).where(issues: {title: 'same', body: 'creating'}).count.should == 0 end it "should not create already up-to-date pull" do - post :create, @create_params.merge({:pull_request => {:issue_attributes => {:title => 'already', :body => 'creating'}, :to_ref => 'master', :from_ref => 'master'}, :to_project_id => @project.id}) - PullRequest.joins(:issue).where(:issues => {:title => 'already', :body => 'creating'}).count.should == 0 + post :create, @create_params.merge({pull_request: {issue_attributes: {title: 'already', body: 'creating'}, to_ref: 'master', from_ref: 'master'}, to_project_id: @project.id}) + PullRequest.joins(:issue).where(issues: {title: 'already', body: 'creating'}).count.should == 0 end it "should create pull request to the same project" do @parent = FactoryGirl.create(:project) - @project.update_attributes({:parent_id => @parent}, :without_protection => true) + @project.update_attributes({parent_id: @parent}, without_protection: true) lambda{ post :create, @create_params }.should change{ PullRequest.joins(:issue). - where(:issues => {:user_id => @user}, :to_project_id => @project, :from_project_id => @project).count }.by(1) + where(issues: {user_id: @user}, to_project_id: @project, from_project_id: @project).count }.by(1) end it "should create pull request to the parent project" do @parent = FactoryGirl.create(:project_with_commit) - @project.update_attributes({:parent_id => @parent}, :without_protection => true) + @project.update_attributes({parent_id: @parent}, without_protection: true) - lambda{ post :create, @create_params.merge({:to_project => @parent.name_with_owner}) }.should change{ PullRequest.joins(:issue). - where(:issues => {:user_id => @user}, :to_project_id => @parent, :from_project_id => @project).count }.by(1) + lambda{ post :create, @create_params.merge({to_project: @parent.name_with_owner}) }.should change{ PullRequest.joins(:issue). + where(issues: {user_id: @user}, to_project_id: @parent, from_project_id: @project).count }.by(1) end end @@ -161,15 +161,15 @@ shared_examples_for 'user without pull request update rights' do end shared_examples_for 'pull request when project with issues turned off' do - before { @project.update_attributes(:has_issues => false) } + before { @project.update_attributes(has_issues: false) } it 'should be able to perform index action' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + 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 when pull request has been created' do @pull.check - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @pull.serial_id + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @pull.serial_id response.should render_template(:show) end end @@ -191,7 +191,7 @@ describe Projects::PullRequestsController do context 'for project admin user' do before do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'pull request user with project guest rights' @@ -214,7 +214,7 @@ describe Projects::PullRequestsController do context 'for project reader user' do before do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'reader') end it_should_behave_like 'pull request user with project guest rights' @@ -223,19 +223,19 @@ describe Projects::PullRequestsController do it_should_behave_like 'pull request when project with issues turned off' it 'should return 404' do - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => 999999 - render_template(:file => "#{Rails.root}/public/404.html") + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: 999999 + render_template(file: "#{Rails.root}/public/404.html") end it 'should redirect to issue page' do - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @issue.serial_id response.should redirect_to(project_issue_path(@project, @issue)) end end context 'for project writer user' do before do - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'writer') end it_should_behave_like 'pull request user with project guest rights' @@ -268,19 +268,19 @@ describe Projects::PullRequestsController do else it 'should not be able to perform index action' do - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(new_user_session_path) end it 'should not be able to perform show action' do @pull.check - get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @pull.serial_id + get :show, owner_name: @project.owner.uname, project_name: @project.name, id: @pull.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_attributes(:visibility => 'hidden') - get :index, :owner_name => @project.owner.uname, :project_name => @project.name + @project.update_attributes(visibility: 'hidden') + get :index, owner_name: @project.owner.uname, project_name: @project.name response.should redirect_to(new_user_session_path) end end @@ -300,11 +300,11 @@ describe Projects::PullRequestsController do context 'send email messages' do before(:each) do @project_reader = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_reader.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @project_reader.id, role: 'reader') @project_admin = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_admin.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @project_admin.id, role: 'admin') @project_writer = FactoryGirl.create :user - @project.relations.create!(:actor_type => 'User', :actor_id => @project_writer.id, :role => 'writer') + @project.relations.create!(actor_type: 'User', actor_id: @project_writer.id, role: 'writer') set_session_for(@project_writer) ActionMailer::Base.deliveries = [] @@ -318,14 +318,14 @@ describe Projects::PullRequestsController do end it 'should send two email messages to admins and one to assignee' do - post :create, @create_params.deep_merge(:issue => {:assignee_id => @project_reader.id}) + post :create, @create_params.deep_merge(issue: {assignee_id: @project_reader.id}) @project.pull_requests.last.issue.send(:new_issue_notifications) @project.pull_requests.last.issue.send(:send_assign_notifications) ActionMailer::Base.deliveries.count.should == 3 end it 'should not duplicate email message' do - post :create, @create_params.deep_merge(:issue => {:assignee_id => @project_admin.id}) + post :create, @create_params.deep_merge(issue: {assignee_id: @project_admin.id}) @project.pull_requests.last.issue.send(:new_issue_notifications) @project.pull_requests.last.issue.send(:send_assign_notifications) ActionMailer::Base.deliveries.count.should == 2 # send only to admins diff --git a/spec/controllers/projects/subscribes_controller_spec.rb b/spec/controllers/projects/subscribes_controller_spec.rb index e5c855e09..60c85fae5 100644 --- a/spec/controllers/projects/subscribes_controller_spec.rb +++ b/spec/controllers/projects/subscribes_controller_spec.rb @@ -51,12 +51,12 @@ describe Projects::SubscribesController do stub_symlink_methods @project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project_id => @project.id) + @issue = FactoryGirl.create(:issue, project_id: @project.id) - @create_params = {:issue_id => @issue.serial_id, :owner_name => @project.owner.uname, :project_name => @project.name} - @destroy_params = {:issue_id => @issue.serial_id, :owner_name => @project.owner.uname, :project_name => @project.name} + @create_params = {issue_id: @issue.serial_id, owner_name: @project.owner.uname, project_name: @project.name} + @destroy_params = {issue_id: @issue.serial_id, owner_name: @project.owner.uname, project_name: @project.name} - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) @request.env['HTTP_REFERER'] = project_issue_path(@project, @issue) end @@ -65,13 +65,13 @@ describe Projects::SubscribesController do before(:each) do @user = FactoryGirl.create(:admin) set_session_for(@user) - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') - @destroy_params = @destroy_params.merge({:id => @user.id}) + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') + @destroy_params = @destroy_params.merge({id: @user.id}) end context 'subscribed' do before(:each) do - ss = @issue.subscribes.build(:user => @user) + ss = @issue.subscribes.build(user: @user) ss.save! end @@ -88,12 +88,12 @@ describe Projects::SubscribesController do before(:each) do @user = FactoryGirl.create(:user) set_session_for(@user) - @destroy_params = @destroy_params.merge({:id => @user.id}) + @destroy_params = @destroy_params.merge({id: @user.id}) end context 'subscribed' do before(:each) do - ss = @issue.subscribes.build(:user => @user) + ss = @issue.subscribes.build(user: @user) ss.save! end diff --git a/spec/controllers/users/profile_controller_spec.rb b/spec/controllers/users/profile_controller_spec.rb index f6ec9dcb3..629f71d53 100644 --- a/spec/controllers/users/profile_controller_spec.rb +++ b/spec/controllers/users/profile_controller_spec.rb @@ -8,18 +8,18 @@ describe Users::ProfileController do @other_user = FactoryGirl.create(:user) @admin = FactoryGirl.create(:admin) %w[user1 user2 user3].each do |uname| - FactoryGirl.create(:user, :uname => uname, :email => "#{ uname }@nonexistanceserver.com") + FactoryGirl.create(:user, uname: uname, email: "#{ uname }@nonexistanceserver.com") end - @update_params = {:email => 'new_email@test.com'} + @update_params = {email: 'new_email@test.com'} end context 'for guest' do - it 'should be able to view profile', :anonymous_access => true do - get :show, :uname => @simple_user.uname + it 'should be able to view profile', anonymous_access: true do + get :show, uname: @simple_user.uname response.code.should eq('200') end - it 'should not be able to perform show action', :anonymous_access => false do - get :show, :uname => @simple_user.uname + it 'should not be able to perform show action', anonymous_access: false do + get :show, uname: @simple_user.uname response.should redirect_to(new_user_session_path) end end @@ -30,7 +30,7 @@ describe Users::ProfileController do end it 'should be able to view profile' do - get :show, :uname => @other_user.uname + get :show, uname: @other_user.uname response.code.should eq('200') end diff --git a/spec/factories/build_lists.rb b/spec/factories/build_lists.rb index 7ff38250d..3d5230859 100644 --- a/spec/factories/build_lists.rb +++ b/spec/factories/build_lists.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :build_list do association :user #association :project - association :save_to_platform, :factory => :platform_with_repos + association :save_to_platform, factory: :platform_with_repos project { |bl| pr = FactoryGirl.create(:project_with_commit) bl.save_to_platform.repositories.first.projects << pr @@ -17,11 +17,11 @@ FactoryGirl.define do commit_hash {|bl| Grit::Repo.new(bl.project.path).commits.first.id} end - factory :build_list_with_attaching_project, :parent => :build_list do + factory :build_list_with_attaching_project, parent: :build_list do before(:create) { |bl| attach_project_to_build_list bl } end - factory :build_list_by_group_project, :parent => :build_list do + factory :build_list_by_group_project, parent: :build_list do project { |bl| pr = FactoryGirl.create(:group_project_with_commit) bl.save_to_platform.repositories.first.projects << pr @@ -29,7 +29,7 @@ FactoryGirl.define do } end - factory :build_list_package, :class => BuildList::Package do + factory :build_list_package, class: BuildList::Package do association :build_list association :project association :platform diff --git a/spec/factories/comments.rb b/spec/factories/comments.rb index ee85deacc..b3db0a512 100644 --- a/spec/factories/comments.rb +++ b/spec/factories/comments.rb @@ -1,8 +1,8 @@ FactoryGirl.define do factory :comment do body { FactoryGirl.generate(:string) } - association :user, :factory => :user - association :commentable, :factory => :issue + association :user, factory: :user + association :commentable, factory: :issue project { |c| c.commentable.project } after(:create) { |c| c.send(:new_comment_notifications) } end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 68af57a7b..485fa4eeb 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -2,6 +2,6 @@ FactoryGirl.define do factory :group do uname { FactoryGirl.generate(:uname) } description 'Description' - association :owner, :factory => :user + association :owner, factory: :user end end diff --git a/spec/factories/hook.rb b/spec/factories/hook.rb index 282083a95..a4b550484 100644 --- a/spec/factories/hook.rb +++ b/spec/factories/hook.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :hook do name 'web' - association :project, :factory => :project - data { |hook| hook.data = {:url => 'url'} } + association :project, factory: :project + data { |hook| hook.data = {url: 'url'} } end end diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb index 66340557c..af7b6dcac 100644 --- a/spec/factories/issues.rb +++ b/spec/factories/issues.rb @@ -2,9 +2,9 @@ FactoryGirl.define do factory :issue do title { FactoryGirl.generate(:string) } body { FactoryGirl.generate(:string) } - association :project, :factory => :project - association :user, :factory => :user - association :assignee, :factory => :user + association :project, factory: :project + association :user, factory: :user + association :assignee, factory: :user status "open" # Hooks for #after_commit after(:create) { |i| i.send(:new_issue_notifications) } diff --git a/spec/factories/label.rb b/spec/factories/label.rb index bcd6fd1b4..bf3cb0fe4 100644 --- a/spec/factories/label.rb +++ b/spec/factories/label.rb @@ -2,6 +2,6 @@ FactoryGirl.define do factory :label do name { FactoryGirl.generate(:string) } color 'FFF' - association :project, :factory => :project + association :project, factory: :project end end \ No newline at end of file diff --git a/spec/factories/labeling.rb b/spec/factories/labeling.rb index 16b84ea7d..981327e41 100644 --- a/spec/factories/labeling.rb +++ b/spec/factories/labeling.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :labeling do - association :project, :factory => :project - association :label, :factory => :label + association :project, factory: :project + association :label, factory: :label end end \ No newline at end of file diff --git a/spec/factories/mass_build.rb b/spec/factories/mass_build.rb index dc6a08972..2266a9e1a 100644 --- a/spec/factories/mass_build.rb +++ b/spec/factories/mass_build.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :mass_build do - association :save_to_platform, :factory => :platform + association :save_to_platform, factory: :platform association :user projects_list "first" arches { [ Arch.find_or_create_by_name('x86_64').id ] } diff --git a/spec/factories/platforms.rb b/spec/factories/platforms.rb index ae53f40d3..2241f0e2e 100644 --- a/spec/factories/platforms.rb +++ b/spec/factories/platforms.rb @@ -4,7 +4,7 @@ FactoryGirl.define do description { FactoryGirl.generate(:string) } platform_type 'main' distrib_type APP_CONFIG['distr_types'].first - association :owner, :factory => :user + association :owner, factory: :user factory :platform_with_repos do after(:create) {|p| FactoryGirl.create_list(:repository, 1, platform: p)} diff --git a/spec/factories/private_users.rb b/spec/factories/private_users.rb index 702398ef0..e761d80ab 100644 --- a/spec/factories/private_users.rb +++ b/spec/factories/private_users.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :private_user do login { FactoryGirl.generate(:string) } password { FactoryGirl.generate(:string) } - association :platform, :factory => :platform - association :user, :factory => :user + association :platform, factory: :platform + association :user, factory: :user end end diff --git a/spec/factories/product_build_lists.rb b/spec/factories/product_build_lists.rb index a5870b971..e37d190de 100644 --- a/spec/factories/product_build_lists.rb +++ b/spec/factories/product_build_lists.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :product_build_list do - association :product, :factory => :product - association :arch, :factory => :arch + association :product, factory: :product + association :arch, factory: :arch project { |pbl| pbl.product.project } status 0 # BUILD_COMPLETED main_script 'build.sh' diff --git a/spec/factories/products.rb b/spec/factories/products.rb index c6b333742..5918ed477 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -1,8 +1,8 @@ FactoryGirl.define do factory :product do name { FactoryGirl.generate(:string) } - association :platform, :factory => :platform - association :project, :factory => :project_with_commit + association :platform, factory: :platform + association :project, factory: :project_with_commit time_living 150 # see: before_validation in ProductBuildList model diff --git a/spec/factories/project_statistic.rb b/spec/factories/project_statistic.rb index 091ad56cc..581e297cb 100644 --- a/spec/factories/project_statistic.rb +++ b/spec/factories/project_statistic.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :project_statistic do - association :project, :factory => :project - association :arch, :factory => :arch + association :project, factory: :project + association :arch, factory: :arch end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 1ddf76c2d..10ddeb7cb 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -2,18 +2,18 @@ FactoryGirl.define do factory :project do description { FactoryGirl.generate(:string) } name { FactoryGirl.generate(:unixname) } - association :owner, :factory => :user + association :owner, factory: :user end - factory :group_project, :parent => :project do - association :owner, :factory => :group + factory :group_project, parent: :project do + association :owner, factory: :group end - factory :project_with_commit, :parent => :project do + factory :project_with_commit, parent: :project do after(:build) {|project| fill_project project} end - factory :group_project_with_commit, :parent => :group_project do + factory :group_project_with_commit, parent: :group_project do after(:build) {|project| fill_project project} end end diff --git a/spec/factories/pull_request.rb b/spec/factories/pull_request.rb index 2822fc213..60e1e8c44 100644 --- a/spec/factories/pull_request.rb +++ b/spec/factories/pull_request.rb @@ -2,8 +2,8 @@ FactoryGirl.define do factory :pull_request do title { FactoryGirl.generate(:string) } body { FactoryGirl.generate(:string) } - association :project, :factory => :project - association :user, :factory => :user - association :assignee, :factory => :user + association :project, factory: :project + association :user, factory: :user + association :assignee, factory: :user end end diff --git a/spec/factories/repositories.rb b/spec/factories/repositories.rb index e7b2a4842..f2027c174 100644 --- a/spec/factories/repositories.rb +++ b/spec/factories/repositories.rb @@ -2,11 +2,11 @@ FactoryGirl.define do factory :repository do description { FactoryGirl.generate(:string) } name { FactoryGirl.generate(:unixname) } - association :platform, :factory => :platform + association :platform, factory: :platform end - factory :personal_repository, :parent => :repository do - association :platform, :factory => :personal_platform + factory :personal_repository, parent: :repository do + association :platform, factory: :personal_platform end - + end diff --git a/spec/factories/subscribes.rb b/spec/factories/subscribes.rb index f43fa837f..b77dd8c09 100644 --- a/spec/factories/subscribes.rb +++ b/spec/factories/subscribes.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :subscribe do - association :subscribeable, :factory => :issue - association :user, :factory => :user + association :subscribeable, factory: :issue + association :user, factory: :user end end diff --git a/spec/factories/token.rb b/spec/factories/token.rb index f00f17189..e4bc45898 100644 --- a/spec/factories/token.rb +++ b/spec/factories/token.rb @@ -1,9 +1,9 @@ FactoryGirl.define do factory :token do - association :creator, :factory => :user + association :creator, factory: :user end - factory :platform_token, :parent => :token do - association :subject, :factory => :platform + factory :platform_token, parent: :token do + association :subject, factory: :platform end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 4d06ab4f3..3bd5fc3a5 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -9,7 +9,7 @@ FactoryGirl.define do after(:create) { |u| u.send(:new_user_notification) } end - factory :admin, :parent => :user do + factory :admin, parent: :user do role 'admin' end end diff --git a/spec/integration/api_defender_spec.rb b/spec/integration/api_defender_spec.rb index ecc8e71ae..619fa6ec3 100644 --- a/spec/integration/api_defender_spec.rb +++ b/spec/integration/api_defender_spec.rb @@ -32,8 +32,8 @@ describe ApiDefender do end before(:each) do - @user = FactoryGirl.create :user, :password => @password - @system_user = FactoryGirl.create :user, :role => 'system' + @user = FactoryGirl.create :user, password: @password + @system_user = FactoryGirl.create :user, role: 'system' end if APP_CONFIG['anonymous_access'] == true diff --git a/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb b/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb index 4a64ea82c..6a45a4a13 100644 --- a/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb +++ b/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb @@ -66,10 +66,10 @@ describe AbfWorker::BuildListsPublishTaskManager do context 'grouping build lists for publishing into same repository' do let(:build_list2) { FactoryGirl.create(:build_list, - :new_core => true, - :save_to_platform => build_list.save_to_platform, - :save_to_repository => build_list.save_to_repository, - :build_for_platform => build_list.build_for_platform + new_core: true, + save_to_platform: build_list.save_to_platform, + save_to_repository: build_list.save_to_repository, + build_for_platform: build_list.build_for_platform ) } before do build_list.update_column(:status, BuildList::BUILD_PUBLISH) @@ -84,7 +84,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status publish" do - RepositoryStatus.where(:status => RepositoryStatus::PUBLISH).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item end it "ensures that 'locked build lists' has 2 items" do @@ -103,14 +103,14 @@ describe AbfWorker::BuildListsPublishTaskManager do before do build_list.update_column(:status, BuildList::BUILD_PUBLISH) 4.times { - bl = FactoryGirl.create(:build_list, :new_core => true) + bl = FactoryGirl.create(:build_list, new_core: true) bl.update_column(:status, BuildList::BUILD_PUBLISH) } 2.times{ subject.new.run } end it "ensures that 4 repository_statuses have status publish" do - RepositoryStatus.where(:status => RepositoryStatus::PUBLISH).should have(4).items + RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(4).items end it "ensures that 'locked build lists' has 4 items" do @@ -126,8 +126,8 @@ describe AbfWorker::BuildListsPublishTaskManager do context 'creates task for removing project from repository' do before do build_list.update_column(:status, BuildList::BUILD_PUBLISHED) - FactoryGirl.create(:build_list_package, :build_list => build_list) - ProjectToRepository.where(:project_id => build_list.project_id, :repository_id => build_list.save_to_repository_id).destroy_all + FactoryGirl.create(:build_list_package, build_list: build_list) + ProjectToRepository.where(project_id: build_list.project_id, repository_id: build_list.save_to_repository_id).destroy_all 2.times{ subject.new.run } end @@ -144,7 +144,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status publish" do - RepositoryStatus.where(:status => RepositoryStatus::PUBLISH).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item end it "ensures that 'locked projects for cleanup' has only one item" do @@ -161,22 +161,22 @@ describe AbfWorker::BuildListsPublishTaskManager do context 'grouping build lists for publishing and tasks for removing project from repository' do let(:build_list2) { FactoryGirl.create(:build_list, - :new_core => true, - :save_to_platform => build_list.save_to_platform, - :save_to_repository => build_list.save_to_repository, - :build_for_platform => build_list.build_for_platform + new_core: true, + save_to_platform: build_list.save_to_platform, + save_to_repository: build_list.save_to_repository, + build_for_platform: build_list.build_for_platform ) } let(:build_list3) { FactoryGirl.create(:build_list, - :new_core => true, - :save_to_platform => build_list.save_to_platform, - :save_to_repository => build_list.save_to_repository, - :build_for_platform => build_list.build_for_platform + new_core: true, + save_to_platform: build_list.save_to_platform, + save_to_repository: build_list.save_to_repository, + build_for_platform: build_list.build_for_platform ) } before do build_list.update_column(:status, BuildList::BUILD_PUBLISH) build_list2.update_column(:status, BuildList::BUILD_PUBLISHED) build_list3.update_column(:status, BuildList::BUILD_PUBLISHED) - ProjectToRepository.where(:project_id => build_list3.project_id, :repository_id => build_list3.save_to_repository_id).destroy_all + ProjectToRepository.where(project_id: build_list3.project_id, repository_id: build_list3.save_to_repository_id).destroy_all 2.times{ subject.new.run } end @@ -187,7 +187,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status publish" do - RepositoryStatus.where(:status => RepositoryStatus::PUBLISH).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::PUBLISH).should have(1).item end it "ensures that 'locked projects for cleanup' has only one item" do @@ -210,7 +210,7 @@ describe AbfWorker::BuildListsPublishTaskManager do context 'resign packages in repository' do before do build_list.update_column(:status, BuildList::BUILD_PUBLISH) - FactoryGirl.create(:key_pair, :repository => build_list.save_to_repository) + FactoryGirl.create(:key_pair, repository: build_list.save_to_repository) 2.times{ subject.new.run } end @@ -221,7 +221,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status resign" do - RepositoryStatus.where(:status => RepositoryStatus::RESIGN).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::RESIGN).should have(1).item end it "ensure that new task for resign has been created" do @@ -239,7 +239,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status regenerating" do - RepositoryStatus.where(:status => RepositoryStatus::REGENERATING).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::REGENERATING).should have(1).item end it 'ensures that new task has been created' do @@ -256,7 +256,7 @@ describe AbfWorker::BuildListsPublishTaskManager do end it "ensures that only one repository_status has status regenerating" do - RepositoryStatus.where(:status => RepositoryStatus::REGENERATING).should have(1).item + RepositoryStatus.where(status: RepositoryStatus::REGENERATING).should have(1).item end it 'ensures that new task has been created' do diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index b0167e089..f6b9d4237 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -9,9 +9,9 @@ describe UserMailer do @project = FactoryGirl.create(:project) @issue_user = FactoryGirl.create(:user) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) - @issue = FactoryGirl.create(:issue, :project_id => @project.id, :assignee_id => @issue_user.id, :user => @issue_user) + @issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user) @email = UserMailer.new_issue_notification(@issue, @issue_user).deliver! end @@ -44,9 +44,9 @@ describe UserMailer do @issue_user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) - @issue = FactoryGirl.create(:issue, :project_id => @project.id, :assignee_id => @issue_user.id, :user => @issue_user) + @issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user) @email = UserMailer.issue_assign_notification(@issue, @user).deliver! end @@ -76,10 +76,10 @@ describe UserMailer do @issue_user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) - @issue = FactoryGirl.create(:issue, :project_id => @project.id, :assignee_id => @issue_user.id, :user => @issue_user) - @comment = FactoryGirl.create(:comment, :commentable => @issue, :user_id => @user.id, :project => @project) + @issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user) + @comment = FactoryGirl.create(:comment, commentable: @issue, user_id: @user.id, project: @project) @email = UserMailer.new_comment_notification(@comment, @issue_user).deliver! end diff --git a/spec/models/build_list_spec.rb b/spec/models/build_list_spec.rb index 6817f481b..84e4ebe12 100644 --- a/spec/models/build_list_spec.rb +++ b/spec/models/build_list_spec.rb @@ -18,17 +18,17 @@ describe BuildList do context "#notify_users" do let!(:user) { FactoryGirl.create(:user) } let!(:build_list) { FactoryGirl.create(:build_list, - :user => user, - :auto_publish => false) } + user: user, + auto_publish: false) } let!(:build_list_package) { FactoryGirl.create(:build_list_package, - :build_list => build_list, - :project => build_list.project) } + build_list: build_list, + project: build_list.project) } before(:all) { ActionMailer::Base.deliveries = [] } before do - build_list.update_attributes({:commit_hash => build_list.project.repo.commits('master').last.id, - :status => BuildList::BUILD_STARTED}, :without_protection => true) + build_list.update_attributes({commit_hash: build_list.project.repo.commits('master').last.id, + status: BuildList::BUILD_STARTED}, without_protection: true) end after { ActionMailer::Base.deliveries = [] } @@ -44,49 +44,49 @@ describe BuildList do end it "gets notification by email when auto_publish and status - Build error" do - build_list.update_attributes(:auto_publish => true) + build_list.update_attributes(auto_publish: true) build_list.build_error should have(1).item end it "gets notification by email when status - Failed publish" do - build_list.update_attributes({:status => BuildList::BUILD_PUBLISH}, :without_protection => true) + build_list.update_attributes({status: BuildList::BUILD_PUBLISH}, without_protection: true) build_list.fail_publish should have(1).item end it "gets notification by email when auto_publish and status - Failed publish" do - build_list.update_attributes({:auto_publish => true, :status => BuildList::BUILD_PUBLISH}, :without_protection => true) + build_list.update_attributes({auto_publish: true, status: BuildList::BUILD_PUBLISH}, without_protection: true) build_list.fail_publish should have(1).item end it "gets notification by email when status - Build published" do - build_list.update_attributes({:status => BuildList::BUILD_PUBLISH}, :without_protection => true) + build_list.update_attributes({status: BuildList::BUILD_PUBLISH}, without_protection: true) build_list.published should have(1).item end it "gets notification by email when auto_publish and status - Build published" do - build_list.update_attributes({:auto_publish => true, :status => BuildList::BUILD_PUBLISH}, :without_protection => true) + build_list.update_attributes({auto_publish: true, status: BuildList::BUILD_PUBLISH}, without_protection: true) build_list.published should have(1).item end it "doesn't get notification by email when auto_publish and status - Build complete" do - build_list.update_attributes(:auto_publish => true) + build_list.update_attributes(auto_publish: true) build_list.build_success should have(:no).items end it "doesn't get notification by email when mass build" do - build_list.update_attributes({:mass_build_id => 1, :status => BuildList::BUILD_PUBLISH}, :without_protection => true) + build_list.update_attributes({mass_build_id: 1, status: BuildList::BUILD_PUBLISH}, without_protection: true) build_list.published should have(:no).items end it "doesn't get notification by email when notification by email has been disabled" do - notifier.update_attributes(:can_notify => false) + notifier.update_attributes(can_notify: false) build_list.build_success should have(:no).items end @@ -97,20 +97,20 @@ describe BuildList do context "user created build task" do let!(:notifier) { user.notifier } before do - notifier.update_attributes(:new_associated_build => false) - build_list.project.owner.notifier.update_attributes(:can_notify => false) + notifier.update_attributes(new_associated_build: false) + build_list.project.owner.notifier.update_attributes(can_notify: false) end it_should_behave_like 'build list notifications by email' it "doesn't get notification by email when 'build list' notifications has been disabled" do - notifier.update_attributes(:new_build => false) + notifier.update_attributes(new_build: false) build_list.build_success should have(:no).items end it "doesn't get notification by email when 'build list' notifications - enabled, email notifications - disabled" do - notifier.update_attributes(:can_notify => false, :new_build => true) + notifier.update_attributes(can_notify: false, new_build: true) build_list.build_success should have(:no).items end @@ -119,35 +119,35 @@ describe BuildList do context "build task has been created and associated user" do let!(:notifier) { build_list.project.owner.notifier } before do - notifier.update_attributes(:new_build => false) - user.notifier.update_attributes(:can_notify => false) + notifier.update_attributes(new_build: false) + user.notifier.update_attributes(can_notify: false) end it_should_behave_like 'build list notifications by email' it "doesn't get notification by email when 'associated build list' notifications has been disabled" do - notifier.update_attributes(:new_associated_build => false) + notifier.update_attributes(new_associated_build: false) build_list.build_success should have(:no).items end it "doesn't get notification by email when 'associated build list' notifications - enabled, email notifications - disabled" do - notifier.update_attributes(:can_notify => false, :new_associated_build => true) + notifier.update_attributes(can_notify: false, new_associated_build: true) build_list.build_success should have(:no).items end end it "doesn't get 2 notification by email when user associated to project and created task" do - project = FactoryGirl.create(:project_with_commit, :owner => user) + project = FactoryGirl.create(:project_with_commit, owner: user) bl = FactoryGirl.create(:build_list_with_attaching_project, - :user => user, - :auto_publish => true, - :project => project + user: user, + auto_publish: true, + project: project ) - FactoryGirl.create(:build_list_package, :build_list => bl, :project => bl.project) - bl.update_attributes({:commit_hash => bl.project.repo.commits('master').last.id, - :status => BuildList::BUILD_PUBLISH}, :without_protection => true) + FactoryGirl.create(:build_list_package, build_list: bl, project: bl.project) + bl.update_attributes({commit_hash: bl.project.repo.commits('master').last.id, + status: BuildList::BUILD_PUBLISH}, without_protection: true) bl.published should have(1).item end @@ -156,29 +156,29 @@ describe BuildList do context '#has_new_packages?' do let!(:build_list) { FactoryGirl.create( :build_list, - :status => BuildList::SUCCESS, - :auto_publish => true) } + status: BuildList::SUCCESS, + auto_publish: true) } let!(:build_list_package) { FactoryGirl.create( :build_list_package, - :build_list => build_list, - :version => '3.1.12', - :release => 6, - :platform => build_list.save_to_platform, - :project => build_list.project) } + build_list: build_list, + version: '3.1.12', + release: 6, + platform: build_list.save_to_platform, + project: build_list.project) } let!(:published_build_list) { FactoryGirl.create( :build_list, - :project => build_list.project, - :status => BuildList::BUILD_PUBLISHED, - :save_to_platform => build_list.save_to_platform, - :arch => build_list.arch) } + project: build_list.project, + status: BuildList::BUILD_PUBLISHED, + save_to_platform: build_list.save_to_platform, + arch: build_list.arch) } let!(:published_build_list_package) { FactoryGirl.create( :build_list_package, - :build_list => published_build_list, - :platform => published_build_list.save_to_platform, - :actual => true, - :version => '3.1.12', - :release => 6, - :project => published_build_list.project) } + build_list: published_build_list, + platform: published_build_list.save_to_platform, + actual: true, + version: '3.1.12', + release: 6, + project: published_build_list.project) } it 'ensures that return false if version of packages are same and platform is released' do - build_list.save_to_platform.update_attributes(:released => true) + build_list.save_to_platform.update_attributes(released: true) build_list.has_new_packages?.should be_false end @@ -189,18 +189,18 @@ describe BuildList do context 'ensures that return false if version of published package >' do it 'published: 3.1.13, new: 3.1.12' do - published_build_list_package.update_attributes(:version => '3.1.13') + published_build_list_package.update_attributes(version: '3.1.13') build_list.has_new_packages?.should be_false end it 'published: 3.1.12, new: 3.0.999' do - build_list_package.update_attributes(:version => '3.0.999') + build_list_package.update_attributes(version: '3.0.999') build_list.has_new_packages?.should be_false end it 'published: 3.0.0, new: 3.0.rc1' do - published_build_list_package.update_attributes(:version => '3.0.0') - build_list_package.update_attributes(:version => '3.0.rc1') + published_build_list_package.update_attributes(version: '3.0.0') + build_list_package.update_attributes(version: '3.0.rc1') build_list.has_new_packages?.should be_false end @@ -209,25 +209,25 @@ describe BuildList do context 'ensures that return true if version of published package <' do it 'published: 3.1.11, new: 3.1.12' do - published_build_list_package.update_attributes(:version => '3.1.11') + published_build_list_package.update_attributes(version: '3.1.11') build_list.has_new_packages?.should be_true end it 'published: 3.0.999, new: 3.1.12' do - published_build_list_package.update_attributes(:version => '3.0.999') + published_build_list_package.update_attributes(version: '3.0.999') build_list.has_new_packages?.should be_true end it 'published: 3.0.rc1, new: 3.0.0' do - published_build_list_package.update_attributes(:version => '3.0.rc1') - build_list_package.update_attributes(:version => '3.0.0') + published_build_list_package.update_attributes(version: '3.0.rc1') + build_list_package.update_attributes(version: '3.0.0') build_list.has_new_packages?.should be_true end end it 'ensures that return true if release of published package <' do - published_build_list_package.update_attributes(:release => 5) + published_build_list_package.update_attributes(release: 5) build_list.has_new_packages?.should be_true end diff --git a/spec/models/cancan_spec.rb b/spec/models/cancan_spec.rb index 8474e9697..f10dcc8f4 100644 --- a/spec/models/cancan_spec.rb +++ b/spec/models/cancan_spec.rb @@ -16,15 +16,15 @@ def guest_create end describe CanCan do - let(:open_platform) { FactoryGirl.create(:platform, :visibility => 'open') } + let(:open_platform) { FactoryGirl.create(:platform, visibility: 'open') } before(:each) do stub_symlink_methods end context 'Site admin' do - let(:personal_platform) { FactoryGirl.create(:platform, :platform_type => 'personal') } - let(:personal_repository_main) { FactoryGirl.create(:personal_repository, :name => 'main') } + let(:personal_platform) { FactoryGirl.create(:platform, platform_type: 'personal') } + let(:personal_repository_main) { FactoryGirl.create(:personal_repository, name: 'main') } let(:personal_repository) { FactoryGirl.create(:personal_repository) } before(:each) do admin_create @@ -114,7 +114,7 @@ describe CanCan do end it "shoud be able to read open projects" do - @project = FactoryGirl.create(:project, :visibility => 'open') + @project = FactoryGirl.create(:project, visibility: 'open') @ability.should be_able_to(:read, @project) end @@ -148,12 +148,12 @@ describe CanCan do context 'as project collaborator' do before(:each) do @project = FactoryGirl.create(:project_with_commit) - @issue = FactoryGirl.create(:issue, :project_id => @project.id) + @issue = FactoryGirl.create(:issue, project_id: @project.id) end context 'with read rights' do before(:each) do - @project.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @project.relations.create!(actor_id: @user.id, actor_type: 'User', role: 'reader') end it 'should be able to read project' do @@ -167,7 +167,7 @@ describe CanCan do context 'with writer rights' do before(:each) do - @project.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'writer') + @project.relations.create!(actor_id: @user.id, actor_type: 'User', role: 'writer') end [:read, :create, :new].each do |action| @@ -178,7 +178,7 @@ describe CanCan do [:new, :create].each do |action| it "should be able to #{action} build_list" do - @build_list = FactoryGirl.create(:build_list_with_attaching_project, :project => @project) + @build_list = FactoryGirl.create(:build_list_with_attaching_project, project: @project) @ability.should be_able_to(action, @build_list) end end @@ -186,7 +186,7 @@ describe CanCan do context 'with admin rights' do before(:each) do - @project.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'admin') + @project.relations.create!(actor_id: @user.id, actor_type: 'User', role: 'admin') end [:read, :update].each do |action| @@ -197,7 +197,7 @@ describe CanCan do [:new, :create].each do |action| it "should be able to #{action} build_list" do - @build_list = FactoryGirl.create(:build_list_with_attaching_project, :project => @project) + @build_list = FactoryGirl.create(:build_list_with_attaching_project, project: @project) @ability.should be_able_to(action, @build_list) end end @@ -215,8 +215,8 @@ describe CanCan do context 'with owner rights' do before(:each) do - @project = FactoryGirl.create(:project_with_commit, :owner => @user) - @issue = FactoryGirl.create(:issue, :project_id => @project.id) + @project = FactoryGirl.create(:project_with_commit, owner: @user) + @issue = FactoryGirl.create(:issue, project_id: @project.id) end [:read, :update, :destroy].each do |action| @@ -227,7 +227,7 @@ describe CanCan do [:new, :create].each do |action| it "should be able to #{action} build_list" do - @build_list = FactoryGirl.create(:build_list_with_attaching_project, :project => @project) + @build_list = FactoryGirl.create(:build_list_with_attaching_project, project: @project) @ability.should be_able_to(action, @build_list) end end @@ -242,7 +242,7 @@ describe CanCan do context 'through group-member' do before(:each) do @group_member = FactoryGirl.create(:group) - @project.relations.create!(:actor_id => @group_member.id, :actor_type => 'Group', :role => 'reader') + @project.relations.create!(actor_id: @group_member.id, actor_type: 'Group', role: 'reader') @group_member_ability = Ability.new(@group_member.owner) end @@ -257,7 +257,7 @@ describe CanCan do it 'should include hidden project in list' do @project.update_attribute :visibility, 'hidden' - Project.accessible_by(@group_member_ability, :show).where(:projects => {:id => @project.id}).count.should == 1 + Project.accessible_by(@group_member_ability, :show).where(projects: {id: @project.id}).count.should == 1 end end end @@ -289,7 +289,7 @@ describe CanCan do context 'with read rights' do before(:each) do - @platform.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @platform.relations.create!(actor_id: @user.id, actor_type: 'User', role: 'reader') @ability = Ability.new(@user) end @@ -325,7 +325,7 @@ describe CanCan do context 'with read rights' do before(:each) do - @repository.platform.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'reader') + @repository.platform.relations.create!(actor_id: @user.id, actor_type: 'User', role: 'reader') end it "should be able to read repository" do diff --git a/spec/models/comment_for_commit_spec.rb b/spec/models/comment_for_commit_spec.rb index 9ebc36b1f..c0a4d15b3 100644 --- a/spec/models/comment_for_commit_spec.rb +++ b/spec/models/comment_for_commit_spec.rb @@ -2,26 +2,26 @@ require 'spec_helper' require "cancan/matchers" def create_comment user - FactoryGirl.create(:comment, :user => user, :commentable => @commit, :project => @project) + FactoryGirl.create(:comment, user: user, commentable: @commit, project: @project) end def create_comment_in_commit commit, project, body - FactoryGirl.create(:comment, :user => @user, :commentable => commit, :project => project, :body => body) + FactoryGirl.create(:comment, user: @user, commentable: commit, project: project, body: body) end def set_comments_data_for_commit @ability = Ability.new(@user) - @project = FactoryGirl.create(:project_with_commit, :owner => @user) + @project = FactoryGirl.create(:project_with_commit, owner: @user) @commit = @project.repo.commits.first @comment = create_comment(@user) @stranger_comment = create_comment(@stranger) - @subscribe_params = {:project_id => @project.id, :subscribeable_id => @commit.id.hex, :subscribeable_type => @commit.class.name} + @subscribe_params = {project_id: @project.id, subscribeable_id: @commit.id.hex, subscribeable_type: @commit.class.name} Subscribe.destroy_all - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) end def should_send_email(args={}) @@ -60,7 +60,7 @@ describe Comment do set_comments_data_for_commit @admin = FactoryGirl.create(:user) @ability = Ability.new(@admin) - @project.relations.create!(:actor_type => 'User', :actor_id => @admin.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @admin.id, role: 'admin') ActionMailer::Base.deliveries = [] end @@ -106,7 +106,7 @@ describe Comment do context 'for unsubscribe commit' do it 'should not send an e-mail' do - Subscribe.unsubscribe_from_commit @subscribe_params.merge(:user_id => @user.id) + Subscribe.unsubscribe_from_commit @subscribe_params.merge(user_id: @user.id) should_not_send_email(commentor: @stranger) end end @@ -176,7 +176,7 @@ describe Comment do context 'for unsubscribe project' do it 'should not send an e-mail' do - Subscribe.unsubscribe_from_commit @subscribe_params.merge(:user_id => @user.id) + Subscribe.unsubscribe_from_commit @subscribe_params.merge(user_id: @user.id) should_not_send_email(commentor: @stranger) end end @@ -205,7 +205,7 @@ describe Comment do @comment = create_comment(@simple) @ability = Ability.new(@simple) ActionMailer::Base.deliveries = [] - Subscribe.unsubscribe_from_commit @subscribe_params.merge(:user_id => [@stranger.id, @project.owner.id]) + Subscribe.unsubscribe_from_commit @subscribe_params.merge(user_id: [@stranger.id, @project.owner.id]) end it_should_behave_like 'user with create comment ability (for model)' @@ -226,7 +226,7 @@ describe Comment do end it 'should send an e-mail when subscribed to project' do - Subscribe.subscribe_to_commit @subscribe_params.merge(:user_id => @simple.id) + Subscribe.subscribe_to_commit @subscribe_params.merge(user_id: @simple.id) should_send_email(commentor: @project.owner, receiver: @simple) end @@ -242,7 +242,7 @@ describe Comment do end it 'should send a one e-mail when subscribed to commit' do - Subscribe.subscribe_to_commit @subscribe_params.merge(:user_id => @simple.id) + Subscribe.subscribe_to_commit @subscribe_params.merge(user_id: @simple.id) @simple.update_column :email, 'test@test.test' should_send_email(commentor: @stranger, receiver: @simple) end @@ -269,59 +269,59 @@ describe Comment do context 'automatic issue linking' do before(:each) do - @same_name_project = FactoryGirl.create(:project, :name => @project.name) - @issue_in_same_name_project = FactoryGirl.create(:issue, :project => @same_name_project, :user => @same_name_project.owner) - @another_project = FactoryGirl.create(:project, :owner => @user) + @same_name_project = FactoryGirl.create(:project, name: @project.name) + @issue_in_same_name_project = FactoryGirl.create(:issue, project: @same_name_project, user: @same_name_project.owner) + @another_project = FactoryGirl.create(:project, owner: @user) @other_user_project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project => @project, :user => @user) - @second_issue = FactoryGirl.create(:issue, :project => @project, :user => @user) - @issue_in_another_project = FactoryGirl.create(:issue, :project => @another_project, :user => @user) - @issue_in_other_user_project = FactoryGirl.create(:issue, :project => @other_user_project, :user => @other_user_project.owner) + @issue = FactoryGirl.create(:issue, project: @project, user: @user) + @second_issue = FactoryGirl.create(:issue, project: @project, user: @user) + @issue_in_another_project = FactoryGirl.create(:issue, project: @another_project, user: @user) + @issue_in_other_user_project = FactoryGirl.create(:issue, project: @other_user_project, user: @other_user_project.owner) end it 'should create automatic comment' do create_comment_in_commit(@commit, @project, "test link to ##{@issue.serial_id}; [##{@second_issue.serial_id}]") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_commit_hash => @commit.id.hex).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_commit_hash: @commit.id.hex).count.should == 1 end it 'should create automatic comment in the another project issue' do body = "[#{@another_project.name_with_owner}##{@issue_in_another_project.serial_id}]" create_comment_in_commit(@commit, @project, body) - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @issue_in_another_project.id, - :created_from_commit_hash => @commit.id.hex).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @issue_in_another_project.id, + created_from_commit_hash: @commit.id.hex).count.should == 1 end it 'should create automatic comment in the same name project issue' do body = "[#{@same_name_project.owner.uname}##{@issue_in_same_name_project.serial_id}]" create_comment_in_commit(@commit, @project, body) - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @issue_in_same_name_project.id, - :created_from_commit_hash => @commit.id.hex).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @issue_in_same_name_project.id, + created_from_commit_hash: @commit.id.hex).count.should == 1 end it 'should not create duplicate automatic comment' do create_comment_in_commit(@commit, @project, "test link to [##{@second_issue.serial_id}]") create_comment_in_commit(@commit, @project, "test duplicate link to [##{@second_issue.serial_id}]") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_commit_hash => @commit.id.hex).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_commit_hash: @commit.id.hex).count.should == 1 end it 'should not create duplicate automatic comment from one' do create_comment_in_commit(@commit, @project, "test link to [##{@second_issue.serial_id}]; ##{@second_issue.serial_id}") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_commit_hash => @commit.id.hex).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_commit_hash: @commit.id.hex).count.should == 1 end it 'should create two automatic comment' do body = "test ##{@second_issue.serial_id}" + " && [#{@another_project.name_with_owner}##{@issue_in_another_project.serial_id}]" create_comment_in_commit(@commit, @project, body) - Comment.where(:automatic => true, - :created_from_commit_hash => @commit.id.hex).count.should == 2 + Comment.where(automatic: true, + created_from_commit_hash: @commit.id.hex).count.should == 2 end end end diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 713bb6497..95a5c0983 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -5,16 +5,16 @@ def set_commentable_data @ability = Ability.new(@user) @project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project_id => @project.id, :user => @user) + @issue = FactoryGirl.create(:issue, project_id: @project.id, user: @user) - @comment = FactoryGirl.create(:comment, :commentable => @issue, :user => @user, :project => @project) - @stranger_comment = FactoryGirl.create(:comment, :commentable => @issue, :user => @stranger, :project => @project) + @comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project) + @stranger_comment = FactoryGirl.create(:comment, commentable: @issue, user: @stranger, project: @project) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) end def create_comment_in_issue issue, body - FactoryGirl.create(:comment, :user => issue.user, :commentable => issue, :project => issue.project, :body => body) + FactoryGirl.create(:comment, user: issue.user, commentable: issue, project: issue.project, body: body) end describe Comment do @@ -41,7 +41,7 @@ describe Comment do set_commentable_data - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'user with create comment ability (for model)' @@ -64,7 +64,7 @@ describe Comment do @project.owner = @user @project.save - @project.relations.create!(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @project.relations.create!(actor_type: 'User', actor_id: @user.id, role: 'admin') end it_should_behave_like 'user with create comment ability (for model)' @@ -90,7 +90,7 @@ describe Comment do context 'with mass assignment' do it 'should not be able to update commentable' do - @comment.update_attributes({:commentable_type => 'Grit::Commit', :commentable_id => 0}) + @comment.update_attributes({commentable_type: 'Grit::Commit', commentable_id: 0}) @comment.reload.commentable_id.should eql @issue.id @comment.reload.commentable_type.should eql @issue.class.name end @@ -106,88 +106,88 @@ describe Comment do context 'automatic issue linking' do before(:each) do - @same_name_project = FactoryGirl.create(:project, :name => @project.name) - @issue_in_same_name_project = FactoryGirl.create(:issue, :project => @same_name_project, :user => @same_name_project.owner) - @another_project = FactoryGirl.create(:project, :owner => @user) + @same_name_project = FactoryGirl.create(:project, name: @project.name) + @issue_in_same_name_project = FactoryGirl.create(:issue, project: @same_name_project, user: @same_name_project.owner) + @another_project = FactoryGirl.create(:project, owner: @user) @other_user_project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project => @project, :user => @user) - @second_issue = FactoryGirl.create(:issue, :project => @project, :user => @user) - @issue_in_another_project = FactoryGirl.create(:issue, :project => @another_project, :user => @user) - @issue_in_other_user_project = FactoryGirl.create(:issue, :project => @other_user_project, :user => @other_user_project.owner) + @issue = FactoryGirl.create(:issue, project: @project, user: @user) + @second_issue = FactoryGirl.create(:issue, project: @project, user: @user) + @issue_in_another_project = FactoryGirl.create(:issue, project: @another_project, user: @user) + @issue_in_other_user_project = FactoryGirl.create(:issue, project: @other_user_project, user: @other_user_project.owner) end it 'should create automatic comment' do create_comment_in_issue(@issue, "test link to ##{@issue.serial_id}; [##{@second_issue.serial_id}]") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_issue_id: @issue.id).count.should == 1 end it 'should not create automatic comment to the same issue' do create_comment_in_issue(@issue, "test link to ##{@issue.serial_id}; [##{@second_issue.serial_id}]") - Comment.where(:automatic => true, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, + created_from_issue_id: @issue.id).count.should == 1 end it 'should create automatic comment in the another project issue' do body = "[#{@another_project.name_with_owner}##{@issue_in_another_project.serial_id}]" create_comment_in_issue(@issue, body) - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @issue_in_another_project.id, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @issue_in_another_project.id, + created_from_issue_id: @issue.id).count.should == 1 end it 'should create automatic comment in the same name project issue' do body = "[#{@same_name_project.owner.uname}##{@issue_in_same_name_project.serial_id}]" create_comment_in_issue(@issue, body) - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @issue_in_same_name_project.id, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @issue_in_same_name_project.id, + created_from_issue_id: @issue.id).count.should == 1 end it 'should not create duplicate automatic comment' do create_comment_in_issue(@issue, "test link to [##{@second_issue.serial_id}]") create_comment_in_issue(@issue, "test duplicate link to [##{@second_issue.serial_id}]") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_issue_id: @issue.id).count.should == 1 end it 'should not create duplicate automatic comment from one' do create_comment_in_issue(@issue, "test link to [##{@second_issue.serial_id}]; ##{@second_issue.serial_id}") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :commentable_id => @second_issue.id, - :created_from_issue_id => @issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + commentable_id: @second_issue.id, + created_from_issue_id: @issue.id).count.should == 1 end it 'should create two automatic comment' do body = "test ##{@second_issue.serial_id}" + " && [#{@another_project.name_with_owner}##{@issue_in_another_project.serial_id}]" create_comment_in_issue(@issue, body) - Comment.where(:automatic => true, - :created_from_issue_id => @issue.id).count.should == 2 + Comment.where(automatic: true, + created_from_issue_id: @issue.id).count.should == 2 end it 'should create automatic comment by issue title' do - issue = FactoryGirl.create(:issue, :project => @project, :user => @user, - :title => "link to ##{@issue.serial_id}") - Comment.where(:automatic => true, - :created_from_issue_id => issue.id).count.should == 1 + issue = FactoryGirl.create(:issue, project: @project, user: @user, + title: "link to ##{@issue.serial_id}") + Comment.where(automatic: true, + created_from_issue_id: issue.id).count.should == 1 end it 'should create automatic comment from issue body' do - issue = FactoryGirl.create(:issue, :project => @project, :user => @user, - :body => "link to ##{@issue.serial_id}") - Comment.where(:automatic => true, - :created_from_issue_id => issue.id).count.should == 1 + issue = FactoryGirl.create(:issue, project: @project, user: @user, + body: "link to ##{@issue.serial_id}") + Comment.where(automatic: true, + created_from_issue_id: issue.id).count.should == 1 end it 'should create only one automatic comment from issue title and body' do - issue = FactoryGirl.create(:issue, :project => @project, :user => @user, - :title => "link to ##{@issue.serial_id} in title", + issue = FactoryGirl.create(:issue, project: @project, user: @user, + title: "link to ##{@issue.serial_id} in title", :body => "link to ##{@issue.serial_id} in body") - Comment.where(:automatic => true, - :created_from_issue_id => issue.id).count.should == 1 + Comment.where(automatic: true, + created_from_issue_id: issue.id).count.should == 1 end diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index ac66c2c09..730061734 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -33,7 +33,7 @@ describe Group do before(:each) do @user = FactoryGirl.create(:user) @another_user = FactoryGirl.create(:user) - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') @ability = Ability.new(@user) end @@ -49,11 +49,11 @@ describe Group do context 'with mass assignment' do it 'should not be able to update uname' do - @group.should_not allow_mass_assignment_of :uname => 'new_uname' + @group.should_not allow_mass_assignment_of uname: 'new_uname' end it 'should not be able to update owner' do - @group.should_not allow_mass_assignment_of :owner_type => 'User', :owner_id => @another_user.id + @group.should_not allow_mass_assignment_of owner_type: 'User', owner_id: @another_user.id end end end @@ -65,7 +65,7 @@ describe Group do @group.owner = @user @group.save - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'admin') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'admin') @ability = Ability.new(@user) end @@ -79,7 +79,7 @@ describe Group do context 'for group reader and writer user' do before(:each) do @user = FactoryGirl.create(:user) - @group.actors.create(:actor_type => 'User', :actor_id => @user.id, :role => 'reader') + @group.actors.create(actor_type: 'User', actor_id: @user.id, role: 'reader') @ability = Ability.new(@user) end diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 2ea3e032c..70760afc5 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -7,19 +7,19 @@ end def create_issue issue_owner ActionMailer::Base.deliveries = [] - @issue = FactoryGirl.create(:issue, :project_id => @project.id, - :user => issue_owner, :assignee => nil) + @issue = FactoryGirl.create(:issue, project_id: @project.id, + user: issue_owner, assignee: nil) end describe Issue do before do stub_symlink_methods - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) end context 'for project admin user' do before(:each) do set_data - @project = FactoryGirl.create(:project, :owner => @user) + @project = FactoryGirl.create(:project, owner: @user) end it 'should send an e-mail' do @@ -35,19 +35,19 @@ describe Issue do it 'should create automatic comment from another issue' do create_issue(@user) - another_issue = FactoryGirl.create(:issue, :project => @project, :title => "[##{@issue.serial_id}]") - Comment.where(:automatic => true, :commentable_type => 'Issue', - :created_from_issue_id => another_issue.id).count.should == 1 + another_issue = FactoryGirl.create(:issue, project: @project, title: "[##{@issue.serial_id}]") + Comment.where(automatic: true, commentable_type: 'Issue', + created_from_issue_id: another_issue.id).count.should == 1 end it 'should create automatic comment after updating another issue body' do create_issue(@user) - another_issue = FactoryGirl.create(:issue, :project => @project) + another_issue = FactoryGirl.create(:issue, project: @project) another_issue.update_attribute(:title, "[##{@issue.serial_id}]") another_issue.send(:send_assign_notifications) - Comment.where(:automatic => true, :commentable_type => 'Issue', - :created_from_issue_id => another_issue.id).count.should == 1 + Comment.where(automatic: true, commentable_type: 'Issue', + created_from_issue_id: another_issue.id).count.should == 1 end it 'should send email message to new assignee' do @@ -62,36 +62,36 @@ describe Issue do context 'for member-group' do before(:each) do set_data - @project = FactoryGirl.create(:project, :owner => @user) + @project = FactoryGirl.create(:project, owner: @user) @group = FactoryGirl.create(:group) @reader = FactoryGirl.create :user - @group.actors.create(:actor_type => 'User', :actor_id => @reader.id, :role => 'reader') + @group.actors.create(actor_type: 'User', actor_id: @reader.id, role: 'reader') end it 'should send an e-mail to all members of the admin group' do - @project.relations.create!(:actor_type => 'Group', :actor_id => @group.id, :role => 'admin') + @project.relations.create!(actor_type: 'Group', actor_id: @group.id, role: 'admin') create_issue(@stranger) ActionMailer::Base.deliveries.count.should == 3 # 1 owner + 2 group member. enough? end it 'should send an e-mail to all members of the admin group except creator' do - @project.relations.create!(:actor_type => 'Group', :actor_id => @group.id, :role => 'admin') + @project.relations.create!(actor_type: 'Group', actor_id: @group.id, role: 'admin') create_issue(@group.owner) ActionMailer::Base.deliveries.count.should == 2 # 1 owner + 1 group member. enough? end it 'should not send an e-mail to members of the reader group' do - @project.relations.create!(:actor_type => 'Group', :actor_id => @group.id, :role => 'reader') + @project.relations.create!(actor_type: 'Group', actor_id: @group.id, role: 'reader') create_issue(@stranger) ActionMailer::Base.deliveries.count.should == 1 # 1 project owner end it 'should reset issue assignee after remove him from group' do - @project.relations.create!(:actor_type => 'Group', :actor_id => @group.id, :role => 'reader') + @project.relations.create!(actor_type: 'Group', actor_id: @group.id, role: 'reader') create_issue(@group.owner) @issue.update_column :assignee_id, @reader.id @group.remove_member @reader @@ -99,8 +99,8 @@ describe Issue do end it 'should not reset issue assignee' do - @project.relations.create!(:actor_type => 'Group', :actor_id => @group.id, :role => 'reader') - @project.relations.create!(:actor_type => 'User', :actor_id => @reader.id, :role => 'reader') + @project.relations.create!(actor_type: 'Group', actor_id: @group.id, role: 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @reader.id, role: 'reader') create_issue(@group.owner) @issue.update_column :assignee_id, @reader.id @group.remove_member @reader @@ -108,7 +108,7 @@ describe Issue do end it 'should reset issue assignee after remove him from project' do - @project.relations.create!(:actor_type => 'User', :actor_id => @reader.id, :role => 'reader') + @project.relations.create!(actor_type: 'User', actor_id: @reader.id, role: 'reader') create_issue(@reader) @issue.update_column :assignee_id, @reader.id @project.remove_member @reader # via api @@ -120,8 +120,8 @@ describe Issue do context 'Group project' do before(:each) do set_data - @group = FactoryGirl.create(:group, :owner => @user) - @project = FactoryGirl.create(:project, :owner => @group) + @group = FactoryGirl.create(:group, owner: @user) + @project = FactoryGirl.create(:project, owner: @group) end context 'for admin of the group' do @@ -140,7 +140,7 @@ describe Issue do context 'for reader of the group' do it 'should not send an e-mail' do reader = FactoryGirl.create :user - @group.actors.create(:actor_type => 'User', :actor_id => reader.id, :role => 'reader') + @group.actors.create(actor_type: 'User', actor_id: reader.id, role: 'reader') create_issue(@stranger) ActionMailer::Base.deliveries.count.should == 1 diff --git a/spec/models/mass_build_spec.rb b/spec/models/mass_build_spec.rb index 3e213af38..91e773380 100644 --- a/spec/models/mass_build_spec.rb +++ b/spec/models/mass_build_spec.rb @@ -30,10 +30,10 @@ describe MassBuild do it 'ensures that projects_list contains unique projects' do projects_list = %(at - at - ab + at + ab ) - mass_build = FactoryGirl.create(:mass_build, :projects_list => projects_list) + mass_build = FactoryGirl.create(:mass_build, projects_list: projects_list) list = mass_build.projects_list.split(/[\r]*\n/) list.should have(2).items list.should include('at', 'ab') diff --git a/spec/models/platform_content.rb b/spec/models/platform_content.rb index b8f7a64d0..31b243590 100644 --- a/spec/models/platform_content.rb +++ b/spec/models/platform_content.rb @@ -39,7 +39,7 @@ describe PlatformContent do end context '#build_list' do - let!(:package) { FactoryGirl.create(:build_list_package, :actual => true) } + let!(:package) { FactoryGirl.create(:build_list_package, actual: true) } let(:platform) { package.build_list.save_to_platform } let(:repository) { platform.repositories.first } diff --git a/spec/models/platform_spec.rb b/spec/models/platform_spec.rb index 0a7b5eb3c..e65e6774a 100644 --- a/spec/models/platform_spec.rb +++ b/spec/models/platform_spec.rb @@ -56,7 +56,7 @@ describe Platform do it 'ensures that owner of platform of group can not be changed' do group = FactoryGirl.create :group - platform = FactoryGirl.create :personal_platform, :owner => group + platform = FactoryGirl.create :personal_platform, owner: group platform.owner = FactoryGirl.create :user platform.save.should be_false end diff --git a/spec/models/product_build_list_spec.rb b/spec/models/product_build_list_spec.rb index b2b3b943d..d871ec98d 100644 --- a/spec/models/product_build_list_spec.rb +++ b/spec/models/product_build_list_spec.rb @@ -28,7 +28,7 @@ describe ProductBuildList do it { should allow_mass_assignment_of(:base_url) } # see app/ability.rb - # can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work + # can :read, ProductBuildList#, product: {platform: {visibility: 'open'}} # double nested hash don't work it 'should generate correct sql to get product build lists' do user = FactoryGirl.create(:user) ability = Ability.new user diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index 6d5c75b13..1682f8c30 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -31,9 +31,9 @@ describe Product do before do stub_symlink_methods stub_redis - params = {:main_script => 'text.sh', :project_version => product.project.default_branch} - product.update_attributes params.merge(:autostart_status => Product::ONCE_A_12_HOURS) - FactoryGirl.create :product, params.merge(:autostart_status => Product::ONCE_A_DAY) + params = {main_script: 'text.sh', project_version: product.project.default_branch} + product.update_attributes params.merge(autostart_status: Product::ONCE_A_12_HOURS) + FactoryGirl.create :product, params.merge(autostart_status: Product::ONCE_A_DAY) end it 'should be created only one product_build_list' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 8aec0a4e3..df98bb337 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -22,15 +22,15 @@ describe Project do before { root_project.destroy } it "should not be delete child" do - Project.where(:id => child_project).count.should == 1 + Project.where(id: child_project).count.should == 1 end it "should not be delete child of the child" do - Project.where(:id => child_child_project).count.should == 1 + Project.where(id: child_child_project).count.should == 1 end end - pending 'when will be available :orphan_strategy => :adopt' do + pending 'when will be available orphan_strategy: :adopt' do context 'middle node' do before{ child_project.destroy } @@ -39,7 +39,7 @@ describe Project do end it "should not be delete child of the child" do - Project.where(:id => child_child_project).count.should == 1 + Project.where(id: child_child_project).count.should == 1 end end end @@ -48,30 +48,30 @@ describe Project do context 'attach personal repository' do let(:user) { FactoryGirl.create(:user) } it "ensures that personal repository has been attached when project had been created as package" do - project = FactoryGirl.create(:project, :owner => user, :is_package => true) + project = FactoryGirl.create(:project, owner: user, is_package: true) project.repositories.should == [user.personal_repository] end it "ensures that personal repository has not been attached when project had been created as not package" do - project = FactoryGirl.create(:project, :owner => user, :is_package => false) + project = FactoryGirl.create(:project, owner: user, is_package: false) project.repositories.should have(:no).items end it "ensures that personal repository has been attached when project had been updated as package" do - project = FactoryGirl.create(:project, :owner => user, :is_package => false) + project = FactoryGirl.create(:project, owner: user, is_package: false) project.update_attribute(:is_package, true) project.repositories.should == [user.personal_repository] end it "ensures that personal repository has been removed from project when project had been updated as not package" do - project = FactoryGirl.create(:project, :owner => user, :is_package => true) + project = FactoryGirl.create(:project, owner: user, is_package: true) project.update_attribute(:is_package, false) project.repositories.should have(:no).items end end context 'truncates project name before validation' do - let!(:project) { FactoryGirl.build(:project, :name => ' test_name ') } + let!(:project) { FactoryGirl.build(:project, name: ' test_name ') } it 'ensures that validation passed' do project.valid?.should be_true @@ -84,16 +84,16 @@ describe Project do end context 'Validate project name' do - let!(:project) { FactoryGirl.build(:project, :name => ' test_name ') } + let!(:project) { FactoryGirl.build(:project, name: ' test_name ') } it "'hacked' uname should not pass" do - lambda {FactoryGirl.create(:project, :name => "...\nbeatiful_name\n for project")}.should raise_error(ActiveRecord::RecordInvalid) + lambda {FactoryGirl.create(:project, name: "...\nbeatiful_name\n for project")}.should raise_error(ActiveRecord::RecordInvalid) end end it 'ensures that path to git repository has been changed after rename of project' do project = FactoryGirl.create(:project_with_commit) - project.update_attributes(:name => "#{project.name}-new") + project.update_attributes(name: "#{project.name}-new") Dir.exists?(project.path).should be_true end @@ -173,7 +173,7 @@ describe Project do repository = FactoryGirl.create(:repository) url = 'http://abf-downloads.rosalinux.ru/abf_personal/repository/test-mass-import' visibility = 'open' - + Project.run_mass_import(url, "abf-worker-service-1-3.src.rpm\nredir-2.2.1-7.res6.src.rpm\n", visibility, owner, repository.id) Project.count.should == 2 diff --git a/spec/models/project_to_repository_spec.rb b/spec/models/project_to_repository_spec.rb index 437ca789e..442197e62 100644 --- a/spec/models/project_to_repository_spec.rb +++ b/spec/models/project_to_repository_spec.rb @@ -4,15 +4,15 @@ describe ProjectToRepository do before(:each) do stub_symlink_methods @platform = FactoryGirl.create(:platform) - @first_repo = FactoryGirl.create(:repository, :platform_id => @platform.id) - @second_repo = FactoryGirl.create(:repository, :platform_id => @platform.id) + @first_repo = FactoryGirl.create(:repository, platform_id: @platform.id) + @second_repo = FactoryGirl.create(:repository, platform_id: @platform.id) @project = FactoryGirl.create(:project) @first_repo.projects << @project @first_repo.save end it 'should not add the same project in different repositories of same platform' do - p2r = @second_repo.project_to_repositories.build :project_id => @project.id + p2r = @second_repo.project_to_repositories.build project_id: @project.id p2r.should_not be_valid end diff --git a/spec/models/pull_request_spec.rb b/spec/models/pull_request_spec.rb index 634b9531f..b68ac98ab 100644 --- a/spec/models/pull_request_spec.rb +++ b/spec/models/pull_request_spec.rb @@ -3,14 +3,14 @@ require 'spec_helper' def set_data_for_pull @ability = Ability.new(@user) - @project = FactoryGirl.create(:project_with_commit, :owner => @user) + @project = FactoryGirl.create(:project_with_commit, owner: @user) @clone_path = File.join(APP_CONFIG['root_path'], 'repo_clone', @project.id.to_s) FileUtils.mkdir_p(@clone_path) - @other_project = FactoryGirl.create(:project_with_commit, :owner => @user) + @other_project = FactoryGirl.create(:project_with_commit, owner: @user) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) end describe PullRequest do @@ -19,13 +19,13 @@ describe PullRequest do stub_symlink_methods @user = FactoryGirl.create(:user) set_data_for_pull - @pull = @project.pull_requests.new(:issue_attributes => {:title => 'test', :body => 'testing'}) + @pull = @project.pull_requests.new(issue_attributes: {title: 'test', body: 'testing'}) @pull.issue.user, @pull.issue.project = @user, @pull.to_project @pull.to_ref = 'master' @pull.from_project, @pull.from_ref = @project, 'non_conflicts' @pull.save - @other_pull = @project.pull_requests.new(:issue_attributes => {:title => 'test_other', :body => 'testing_other'}) + @other_pull = @project.pull_requests.new(issue_attributes: {title: 'test_other', body: 'testing_other'}) @other_pull.issue.user, @other_pull.issue.project = @user, @other_pull.to_project @other_pull.to_ref = 'master' @other_pull.from_project, @other_pull.from_ref = @other_project, 'non_conflicts' @@ -34,7 +34,7 @@ describe PullRequest do it 'ensures that path to pull_request repository has been changed after rename of project' do @pull.check - @project.update_attributes(:name => "#{@project.name}-new") + @project.update_attributes(name: "#{@project.name}-new") @pull.reload Dir.exists?(@pull.path).should be_true end @@ -76,46 +76,46 @@ describe PullRequest do end it "should not create same pull" do - @same_pull = @project.pull_requests.new(:issue_attributes => {:title => 'same', :body => 'testing'}) + @same_pull = @project.pull_requests.new(issue_attributes: {title: 'same', body: 'testing'}) @same_pull.issue.user, @same_pull.issue.project = @user, @same_pull.to_project @same_pull.to_ref = 'master' @same_pull.from_project, @same_pull.from_ref = @project, 'non_conflicts' @same_pull.save - @project.pull_requests.joins(:issue).where(:issues => {:title => @same_pull.title}).count.should == 0 + @project.pull_requests.joins(:issue).where(issues: {title: @same_pull.title}).count.should == 0 end it "should not create pull with wrong base ref" do - @wrong_pull = @project.pull_requests.new(:issue_attributes => {:title => 'wrong base', :body => 'testing'}) + @wrong_pull = @project.pull_requests.new(issue_attributes: {title: 'wrong base', body: 'testing'}) @wrong_pull.issue.user, @wrong_pull.issue.project = @user, @wrong_pull.to_project @wrong_pull.to_ref = 'wrong' @wrong_pull.from_project, @wrong_pull.from_ref = @project, 'non_conflicts' @wrong_pull.save - @project.pull_requests.joins(:issue).where(:issues => {:title => @wrong_pull.title}).count.should == 0 + @project.pull_requests.joins(:issue).where(issues: {title: @wrong_pull.title}).count.should == 0 end it "should not create pull with wrong head ref" do - @wrong_pull = @project.pull_requests.new(:issue_attributes => {:title => 'wrong head', :body => 'testing'}) + @wrong_pull = @project.pull_requests.new(issue_attributes: {title: 'wrong head', body: 'testing'}) @wrong_pull.issue.user, @wrong_pull.issue.project = @user, @wrong_pull.to_project @wrong_pull.to_ref = 'master' @wrong_pull.from_project, @wrong_pull.from_ref = @project, 'wrong' @wrong_pull.save - @project.pull_requests.joins(:issue).where(:issues => {:title => @wrong_pull.title}).count.should == 0 + @project.pull_requests.joins(:issue).where(issues: {title: @wrong_pull.title}).count.should == 0 end it "should create pull with tag" do system("cd #{@project.path} && git tag 4.7.5.3 $(git rev-parse #{@pull.from_ref})") # TODO REDO through grit - @pull = @project.pull_requests.new(:issue_attributes => {:title => 'tag', :body => 'testing'}) + @pull = @project.pull_requests.new(issue_attributes: {title: 'tag', body: 'testing'}) @pull.issue.user, @pull.issue.project = @user, @pull.to_project @pull.to_ref = 'master' @pull.from_project, @pull.from_ref = @project, '4.7.5.3' @pull.save - @project.pull_requests.joins(:issue).where(:issues => {:title => @pull.title}).count.should == 1 + @project.pull_requests.joins(:issue).where(issues: {title: @pull.title}).count.should == 1 end it "should close pull when deleting from branch" do system("cd #{@project.path} && git branch -D #{@pull.from_branch}") @pull.check - @project.pull_requests.joins(:issue).where(:issues => {:title => @pull.title, :status => 'closed'}).count.should == 1 + @project.pull_requests.joins(:issue).where(issues: {title: @pull.title, status: 'closed'}).count.should == 1 end end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 006cbbb2c..e101963a1 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -70,7 +70,7 @@ describe Repository do context 'when create with same owner that platform' do before do @platform = FactoryGirl.create(:platform) - @params = {:name => 'tst_platform', :description => 'test platform'} + @params = {name: 'tst_platform', description: 'test platform'} end it 'it should increase Repository.count by 1' do @@ -116,7 +116,7 @@ describe Repository do it 'user has no ability to read of adding project' do repository = FactoryGirl.create(:repository) - project = FactoryGirl.create(:project, :visibility => 'hidden') + project = FactoryGirl.create(:project, visibility: 'hidden') repository.add_projects("#{project.owner.uname}/#{project.name}", FactoryGirl.create(:user)) repository.projects.should have(:no).items end diff --git a/spec/models/subscribe_spec.rb b/spec/models/subscribe_spec.rb index 333610c9f..4dbc53e13 100644 --- a/spec/models/subscribe_spec.rb +++ b/spec/models/subscribe_spec.rb @@ -5,9 +5,9 @@ def set_testable_data @ability = Ability.new(@user) @project = FactoryGirl.create(:project) - @issue = FactoryGirl.create(:issue, :project_id => @project.id) + @issue = FactoryGirl.create(:issue, project_id: @project.id) - any_instance_of(Project, :versions => ['v1.0', 'v2.0']) + any_instance_of(Project, versions: ['v1.0', 'v2.0']) end describe Subscribe do @@ -21,13 +21,13 @@ describe Subscribe do end it 'should create subscribe' do - @ability.should be_able_to(:create, Subscribe.new(:subscribeable => @issue, :user => @user)) + @ability.should be_able_to(:create, Subscribe.new(subscribeable: @issue, user: @user)) end context 'destroy' do before(:each) do - @subscribe = FactoryGirl.create(:subscribe, :subscribeable => @issue, :user => @user) - @stranger_subscribe = FactoryGirl.create(:subscribe, :subscribeable => @issue, :user => @stranger) + @subscribe = FactoryGirl.create(:subscribe, subscribeable: @issue, user: @user) + @stranger_subscribe = FactoryGirl.create(:subscribe, subscribeable: @issue, user: @stranger) end context 'own subscribe' do @@ -53,13 +53,13 @@ describe Subscribe do end it 'should create subscribe' do - @ability.should be_able_to(:create, Subscribe.new(:subscribeable => @issue, :user => @user)) + @ability.should be_able_to(:create, Subscribe.new(subscribeable: @issue, user: @user)) end context 'destroy' do before(:each) do - @subscribe = FactoryGirl.create(:subscribe, :subscribeable => @issue, :user => @user) - @stranger_subscribe = FactoryGirl.create(:subscribe, :subscribeable => @issue, :user => @stranger) + @subscribe = FactoryGirl.create(:subscribe, subscribeable: @issue, user: @user) + @stranger_subscribe = FactoryGirl.create(:subscribe, subscribeable: @issue, user: @stranger) end context 'own subscribe' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7f24e0aeb..f2606d301 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,4 +1,4 @@ - + require 'spec_helper' describe User do @@ -25,13 +25,13 @@ describe User do %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 + @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) + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: role) end it "should have #{group_role} role to project" do @@ -48,13 +48,13 @@ describe User do @project.owner = @group @project.save - @project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin' + @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) + @group.actors.create(actor_id: @user.id, actor_type: 'User', role: role) end it "should have #{role} role to project" do @@ -66,7 +66,7 @@ describe User do %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) + @project.relations.create(actor_id: @user.id, actor_type: 'User', role: role) end it "should have #{role} role to project" do @@ -77,16 +77,16 @@ describe User do 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') + @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') + @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 diff --git a/spec/routing/product_build_lists_routing_spec.rb b/spec/routing/product_build_lists_routing_spec.rb index dece03748..41846875f 100644 --- a/spec/routing/product_build_lists_routing_spec.rb +++ b/spec/routing/product_build_lists_routing_spec.rb @@ -1,36 +1,36 @@ - + # require "spec_helper" -# +# # describe ProductBuildListsController do # describe "routing" do -# +# # it "routes to #index" do # get("/product_build_lists").should route_to("product_build_lists#index") # end -# +# # it "routes to #new" do # get("/product_build_lists/new").should route_to("product_build_lists#new") # end -# +# # it "routes to #show" do -# get("/product_build_lists/1").should route_to("product_build_lists#show", :id => "1") +# get("/product_build_lists/1").should route_to("product_build_lists#show", id: "1") # end -# +# # it "routes to #edit" do -# get("/product_build_lists/1/edit").should route_to("product_build_lists#edit", :id => "1") +# get("/product_build_lists/1/edit").should route_to("product_build_lists#edit", id: "1") # end -# +# # it "routes to #create" do # post("/product_build_lists").should route_to("product_build_lists#create") # end -# +# # it "routes to #update" do -# put("/product_build_lists/1").should route_to("product_build_lists#update", :id => "1") +# put("/product_build_lists/1").should route_to("product_build_lists#update", id: "1") # end -# +# # it "routes to #destroy" do -# delete("/product_build_lists/1").should route_to("product_build_lists#destroy", :id => "1") +# delete("/product_build_lists/1").should route_to("product_build_lists#destroy", id: "1") # end -# +# # end # end diff --git a/spec/routing/projects_routing_spec.rb.rb b/spec/routing/projects_routing_spec.rb.rb index 8a70e79af..291502136 100644 --- a/spec/routing/projects_routing_spec.rb.rb +++ b/spec/routing/projects_routing_spec.rb.rb @@ -1,4 +1,4 @@ - + require "spec_helper" describe Projects::ProjectsController do @@ -13,7 +13,7 @@ describe Projects::ProjectsController do end it "routes to #edit" do - get("/import/glib2.0-mib/modify").should route_to("projects/projects#edit", :owner_name => 'import', :project_name => 'glib2.0-mib') + get("/import/glib2.0-mib/modify").should route_to("projects/projects#edit", owner_name: 'import', project_name: 'glib2.0-mib') end it "routes to #create" do @@ -21,11 +21,11 @@ describe Projects::ProjectsController do end it "routes to #update" do - put("/import/glib2.0-mib").should route_to("projects/projects#update", :owner_name => 'import', :project_name => 'glib2.0-mib') + put("/import/glib2.0-mib").should route_to("projects/projects#update", owner_name: 'import', project_name: 'glib2.0-mib') end it "routes to #destroy" do - delete("/import/glib2.0-mib").should route_to("projects/projects#destroy", :owner_name => 'import', :project_name => 'glib2.0-mib') + delete("/import/glib2.0-mib").should route_to("projects/projects#destroy", owner_name: 'import', project_name: 'glib2.0-mib') end end @@ -35,12 +35,12 @@ describe Projects::Git::TreesController do describe "routing" do it "routes to #show" do - get("/import/glib2.0-mib").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib') - get("/import/glib2.0-mib/tree/lib2safe-0.03").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'lib2safe-0.03') - get("/import/glib2.0-mib/tree/branch-with.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'branch-with.dot', :path => 'folder_with.dot/path-with.dot') - # get("/import/glib2.0-mib/tree/ветка-с.точкой/папка_с.точкой/путь-с.точкой").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'ветка-с.точкой', :path => 'папка_с.точкой/путь-с.точкой') - get("/import/glib2.0-mib/tree/branch-with/slash.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'branch-with/slash.dot', :path => 'folder_with.dot/path-with.dot') - get("/import/glib2.0-mib/tree/tag13.52-5").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'tag13.52-5') + get("/import/glib2.0-mib").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib') + get("/import/glib2.0-mib/tree/lib2safe-0.03").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib', treeish: 'lib2safe-0.03') + get("/import/glib2.0-mib/tree/branch-with.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib', treeish: 'branch-with.dot', path: 'folder_with.dot/path-with.dot') + # get("/import/glib2.0-mib/tree/ветка-с.точкой/папка_с.точкой/путь-с.точкой").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib', treeish: 'ветка-с.точкой', path: 'папка_с.точкой/путь-с.точкой') + get("/import/glib2.0-mib/tree/branch-with/slash.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib', treeish: 'branch-with/slash.dot', path: 'folder_with.dot/path-with.dot') + get("/import/glib2.0-mib/tree/tag13.52-5").should route_to("projects/git/trees#show", owner_name: 'import', project_name: 'glib2.0-mib', treeish: 'tag13.52-5') end # TODO write more specs also with slash in branch name! diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3203da2d8..7fd052ad2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,7 +25,7 @@ RSpec.configure do |config| # instead of true. config.use_transactional_fixtures = true - config.filter_run_excluding :anonymous_access => !(APP_CONFIG['anonymous_access']) + config.filter_run_excluding anonymous_access: !(APP_CONFIG['anonymous_access']) config.before(:all) { init_test_root } config.after(:all) { clear_test_root } @@ -44,8 +44,8 @@ def http_login(user=nil, password = '123456') end def stub_symlink_methods - any_instance_of(Platform, :symlink_directory => true) - any_instance_of(Platform, :remove_symlink_directory => true) + any_instance_of(Platform, symlink_directory: true) + any_instance_of(Platform, remove_symlink_directory: true) end Resque.inline = true diff --git a/spec/support/devise.rb b/spec/support/devise.rb index 3552bea58..799989558 100644 --- a/spec/support/devise.rb +++ b/spec/support/devise.rb @@ -1,3 +1,3 @@ RSpec.configure do |config| - config.include Devise::TestHelpers, :type => :controller + config.include Devise::TestHelpers, type: :controller end diff --git a/spec/support/shared_examples/comments.rb b/spec/support/shared_examples/comments.rb index 5ac6f1aeb..903c8a34b 100644 --- a/spec/support/shared_examples/comments.rb +++ b/spec/support/shared_examples/comments.rb @@ -47,54 +47,54 @@ shared_examples_for 'user with create comment ability' do end shared_examples_for 'user with update own comment ability' do it 'should be able to perform update action' do - put :update, {:id => @own_comment.id}.merge(@update_params) + put :update, {id: @own_comment.id}.merge(@update_params) response.status.should == 200 end it 'should update subscribe body' do - put :update, {:id => @own_comment.id}.merge(@update_params) + put :update, {id: @own_comment.id}.merge(@update_params) @own_comment.reload.body.should == 'updated' end end shared_examples_for 'user with update stranger comment ability' do it 'should be able to perform update action' do - put :update, {:id => @comment.id}.merge(@update_params) + put :update, {id: @comment.id}.merge(@update_params) response.status.should == 200 end it 'should update comment body' do - put :update, {:id => @comment.id}.merge(@update_params) + put :update, {id: @comment.id}.merge(@update_params) @comment.reload.body.should == 'updated' end end shared_examples_for 'user without update stranger comment ability' do it 'should not be able to perform update action' do - put :update, {:id => @comment.id}.merge(@update_params) + put :update, {id: @comment.id}.merge(@update_params) response.should redirect_to(forbidden_path) end it 'should not update comment body' do - put :update, {:id => @comment.id}.merge(@update_params) + put :update, {id: @comment.id}.merge(@update_params) @comment.reload.body.should_not == 'updated' end end shared_examples_for 'user with destroy comment ability' do it 'should be able to perform destroy action' do - delete :destroy, {:id => @comment.id}.merge(@path) + delete :destroy, {id: @comment.id}.merge(@path) response.should redirect_to(@return_path) end it 'should delete comment from database' do - lambda{ delete :destroy, {:id => @comment.id}.merge(@path)}.should change{ Comment.count }.by(-1) + lambda{ delete :destroy, {id: @comment.id}.merge(@path)}.should change{ Comment.count }.by(-1) end end shared_examples_for 'user without destroy comment ability' do it 'should not be able to perform destroy action' do - delete :destroy, {:id => @comment.id}.merge(@path) + delete :destroy, {id: @comment.id}.merge(@path) response.should redirect_to(forbidden_path) end it 'should not delete comment from database' do - lambda{ delete :destroy, {:id => @comment.id}.merge(@path)}.should change{ Issue.count }.by(0) + lambda{ delete :destroy, {id: @comment.id}.merge(@path)}.should change{ Issue.count }.by(0) end end diff --git a/spec/support/shared_examples/members_controller.rb b/spec/support/shared_examples/members_controller.rb index dde99c184..6cfe4192a 100644 --- a/spec/support/shared_examples/members_controller.rb +++ b/spec/support/shared_examples/members_controller.rb @@ -1,6 +1,6 @@ shared_examples_for 'update_member_relation' do it 'should update member relation' do - @another_user.relations.exists? :target_id => @group.id, :target_type => 'Group', :role => 'read' + @another_user.relations.exists? target_id: @group.id, target_type: 'Group', role: 'read' end end
" comments.each do |comment| res << "
- #{render 'projects/comments/comment', :comment => comment, :data => {:project => @project, :commentable => @commentable, :add_anchor => 'inline', :in_discussion => @in_discussion}} + #{render 'projects/comments/comment', comment: comment, data: {project: @project, commentable: @commentable, add_anchor: 'inline', in_discussion: @in_discussion}}
" end - res << link_to(t('layout.comments.new_inline'), new_comment_path, :class => 'new_inline_comment button') if current_user + res << link_to(t('layout.comments.new_inline'), new_comment_path, class: 'new_inline_comment button') if current_user res << "