From 4db54092e6d11e4bc2036828f6bb7c51d37876c4 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 18 Oct 2018 01:26:07 +0200 Subject: [PATCH] Removes unrelated dashboard changes --- app/helpers/application_helper.rb | 2 -- app/models/abilities/administrator.rb | 2 +- app/views/shared/_subnavigation.html.erb | 4 +-- bin/rspec | 2 ++ config/deploy-secrets.yml.example | 33 ----------------------- config/deploy.rb | 30 +++++---------------- config/deploy/preproduction.rb | 1 + config/deploy/production.rb | 1 + config/deploy/staging.rb | 8 +++--- lib/capistrano/tasks/restart.cap | 17 +++--------- spec/features/budgets/investments_spec.rb | 3 +-- 11 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 config/deploy-secrets.yml.example diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8a0c87194..06939294b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -61,8 +61,6 @@ module ApplicationHelper "#{root_url.chomp("\/")}#{url}" end - # This method is used to embed the font inside CSS when the asset is precompiled. It is required in order to allow - # wkpdfhtml embeding custom fonts inside the PDF. def self.asset_data_base64(path) asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)).find_asset(path) throw "Could not find asset '#{path}'" if asset.nil? diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index 40793f14c..b9f627b0e 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -69,7 +69,7 @@ module Abilities can [:create, :destroy, :manage], ::Poll::BoothAssignment can [:create, :destroy], ::Poll::OfficerAssignment can [:read, :create, :update], Poll::Question - can :destroy, Poll::Question + can :destroy, Poll::Question # , comments_count: 0, votes_up: 0 can :manage, SiteCustomization::Page can :manage, SiteCustomization::Image diff --git a/app/views/shared/_subnavigation.html.erb b/app/views/shared/_subnavigation.html.erb index 278d3db7c..7a942f13a 100644 --- a/app/views/shared/_subnavigation.html.erb +++ b/app/views/shared/_subnavigation.html.erb @@ -13,7 +13,7 @@
  • <%= layout_menu_link_to t("layouts.header.proposals"), proposals_path, - controller_name == 'proposals' || @poll&.related&.is_a?(Proposal), + controller_name == 'proposals', accesskey: "2", title: t("shared.go_to_page") + t("layouts.header.proposals") %>
  • @@ -22,7 +22,7 @@
  • <%= layout_menu_link_to t("layouts.header.poll_questions"), polls_path, - (controller_name == "polls" && @poll&.related.nil?) || (controller_name == "questions" && controller.class.parent == Polls), + controller_name == "polls" || (controller_name == "questions" && controller.class.parent == Polls), accesskey: "3", title: t("shared.go_to_page") + t("layouts.header.poll_questions") %>
  • diff --git a/bin/rspec b/bin/rspec index ccc1e49af..b207dde29 100755 --- a/bin/rspec +++ b/bin/rspec @@ -4,6 +4,8 @@ begin rescue LoadError => e raise unless e.message.include?('spring') end +# frozen_string_literal: true +# # This file was generated by Bundler. # # The application 'rspec' is installed as part of a gem, and diff --git a/config/deploy-secrets.yml.example b/config/deploy-secrets.yml.example deleted file mode 100644 index 9755ee4a5..000000000 --- a/config/deploy-secrets.yml.example +++ /dev/null @@ -1,33 +0,0 @@ -staging: - deploy_to: "/var/www/consul" - ssh_port: 21 - server: "staging.consul.es" - db_server: "postgre.consul.es" - user: "xxxxx" - server_name: "staging.consul.es" - full_app_name: "consul" -# use_rvm: Yes -# ruby_version: 2.3.7 -# repository: https://github.com/consul/consul.git -# branch: master -# rails_env: staging - -preproduction: - deploy_to: "/var/www/consul" - ssh_port: 2222 - server1: xxx.xxx.xxx.xxx - server2: xxx.xxx.xxx.xxx - db_server: xxx.xxx.xxx.xxx - user: xxxxx - server_name: pre.consul.es - full_app_name: "consul" - -production: - deploy_to: "/var/www/consul" - ssh_port: 22 - server1: xxx.xxx.xxx.xxx - server2: xxx.xxx.xxx.xxx - db_server: xxx.xxx.xxx.xxx - user: "deploy" - server_name: "consul.es" - full_app_name: "consul" diff --git a/config/deploy.rb b/config/deploy.rb index 3e8cce298..a268bb326 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,23 +1,19 @@ # config valid only for current version of Capistrano lock '~> 3.10.1' -def deploysecret(key, default = 'undefined') +def deploysecret(key) @deploy_secrets_yml ||= YAML.load_file('config/deploy-secrets.yml')[fetch(:stage).to_s] - @deploy_secrets_yml.fetch(key.to_s, default) + @deploy_secrets_yml.fetch(key.to_s, 'undefined') end set :rails_env, fetch(:stage) - -if deploysecret(:use_rvm, true) - require 'rvm1/capistrano3' - set :rvm1_ruby_version, deploysecret(:ruby_version, '2.3.2') -end +set :rvm1_ruby_version, '2.3.2' set :application, 'consul' set :full_app_name, deploysecret(:full_app_name) set :server_name, deploysecret(:server_name) -set :repo_url, deploysecret(:repository, 'https://github.com/consul/consul.git') +set :repo_url, 'https://github.com/consul/consul.git' set :revision, `git rev-parse --short #{fetch(:branch)}`.strip @@ -44,22 +40,10 @@ set(:config_files, %w( set :whenever_roles, -> { :app } -set :user, deploysecret(:user) -set :ssh_options, -> { - { - user: deploysecret(:user), - forward_agent: true, - compression: 'none', - port: deploysecret(:ssh_port) - } -} - namespace :deploy do - if deploysecret(:use_rvm, true) - before :starting, 'rvm1:install:rvm' # install/update RVM - before :starting, 'rvm1:install:ruby' # install Ruby and create gemset - before :starting, 'install_bundler_gem' # install bundler gem - end + before :starting, 'rvm1:install:rvm' # install/update RVM + before :starting, 'rvm1:install:ruby' # install Ruby and create gemset + before :starting, 'install_bundler_gem' # install bundler gem after :publishing, 'deploy:restart' after :published, 'delayed_job:restart' diff --git a/config/deploy/preproduction.rb b/config/deploy/preproduction.rb index fec5d3306..74c96871e 100644 --- a/config/deploy/preproduction.rb +++ b/config/deploy/preproduction.rb @@ -2,6 +2,7 @@ set :deploy_to, deploysecret(:deploy_to) set :server_name, deploysecret(:server_name) set :db_server, deploysecret(:db_server) set :branch, ENV['branch'] || :master +set :ssh_options, port: deploysecret(:ssh_port) set :stage, :preproduction set :rails_env, :preproduction diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 17d14e44d..90eb501c2 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -2,6 +2,7 @@ set :deploy_to, deploysecret(:deploy_to) set :server_name, deploysecret(:server_name) set :db_server, deploysecret(:db_server) set :branch, :stable +set :ssh_options, port: deploysecret(:ssh_port) set :stage, :production set :rails_env, :production diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index f416e7c9a..35dda87d0 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,9 +1,9 @@ -set :deploy_to, -> { deploysecret(:deploy_to) } +set :deploy_to, deploysecret(:deploy_to) set :server_name, deploysecret(:server_name) set :db_server, deploysecret(:db_server) -set :branch, deploysecret(:branch, ENV['branch']) || :master +set :branch, ENV['branch'] || :master +set :ssh_options, port: deploysecret(:ssh_port) set :stage, :staging -set :rails_env, deploysecret(:rails_env, 'staging').to_sym +set :rails_env, :staging server deploysecret(:server), user: deploysecret(:user), roles: %w(web app db importer cron) - diff --git a/lib/capistrano/tasks/restart.cap b/lib/capistrano/tasks/restart.cap index dd08de9a4..54c90819a 100644 --- a/lib/capistrano/tasks/restart.cap +++ b/lib/capistrano/tasks/restart.cap @@ -1,18 +1,9 @@ namespace :deploy do - desc 'Commands for passenger/unicorn application' - if File.exist?("/etc/init.d/unicorn_#{fetch(:full_app_name)}") - %w(start stop force-stop restart upgrade reopen-logs).each do |command| - task command.to_sym do - on roles(:app), in: :sequence, wait: 5 do - execute "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}" - end - end - end - else - task :restart do + desc 'Commands for unicorn application' + %w(start stop force-stop restart upgrade reopen-logs).each do |command| + task command.to_sym do on roles(:app), in: :sequence, wait: 5 do - # Your restart mechanism here, for example: - execute :touch, release_path.join('tmp/restart.txt') + execute "/etc/init.d/unicorn_#{fetch(:full_app_name)} #{command}" end end end diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index da1b2f36e..aed73ffeb 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -802,7 +802,7 @@ feature 'Budget Investments' do visit new_budget_investment_path(budget) fill_in "budget_investment_title", with: "item" - within('div#js-suggest', visible: false) do + within('div#js-suggest') do expect(page).not_to have_content 'You are seeing' end end @@ -1151,7 +1151,6 @@ feature 'Budget Investments' do it_behaves_like "followable", "budget_investment", "budget_investment_path", { "budget_id": "budget_id", "id": "id" } it_behaves_like "imageable", "budget_investment", "budget_investment_path", { "budget_id": "budget_id", "id": "id" } - it_behaves_like "imageable destroy", "budget_investment", "budget_investment_path", { "budget_id": "budget_id", "id": "id" } it_behaves_like "nested imageable", "budget_investment",