mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Fix RuboCop 0.48 violations
This commit is contained in:
parent
77481802b9
commit
2e208fc774
12 changed files with 21 additions and 15 deletions
|
@ -13,6 +13,11 @@ Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Style/DoubleNegation:
|
Style/DoubleNegation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Style/FileName:
|
||||||
|
Exclude:
|
||||||
|
- "Dangerfile"
|
||||||
|
Style/IndentHeredoc:
|
||||||
|
Enabled: false
|
||||||
Style/SpaceAroundEqualsInParameterDefault:
|
Style/SpaceAroundEqualsInParameterDefault:
|
||||||
EnforcedStyle: no_space
|
EnforcedStyle: no_space
|
||||||
Style/StringLiterals:
|
Style/StringLiterals:
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -3,7 +3,7 @@ require "cucumber/rake/task"
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "rubocop/rake_task"
|
require "rubocop/rake_task"
|
||||||
|
|
||||||
task default: [:spec, :rubocop]
|
task default: %i(spec rubocop)
|
||||||
RSpec::Core::RakeTask.new
|
RSpec::Core::RakeTask.new
|
||||||
|
|
||||||
Cucumber::Rake::Task.new(:features)
|
Cucumber::Rake::Task.new(:features)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
lib = File.expand_path("../lib", __FILE__)
|
lib = File.expand_path("../lib", __FILE__)
|
||||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||||
require "capistrano/version"
|
require "capistrano/version"
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Capistrano
|
||||||
class Configuration
|
class Configuration
|
||||||
class Filter
|
class Filter
|
||||||
def initialize(type, values=nil)
|
def initialize(type, values=nil)
|
||||||
raise "Invalid filter type #{type}" unless [:host, :role].include? type
|
raise "Invalid filter type #{type}" unless %i(host role).include? type
|
||||||
av = Array(values)
|
av = Array(values)
|
||||||
@strategy = if av.empty? then EmptyFilter.new
|
@strategy = if av.empty? then EmptyFilter.new
|
||||||
elsif av.include?(:all) || av.include?("all") then NullFilter.new
|
elsif av.include?(:all) || av.include?("all") then NullFilter.new
|
||||||
|
|
|
@ -8,7 +8,7 @@ validate :application do |_key, value|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
[:git_strategy, :hg_strategy, :svn_strategy].each do |strategy|
|
%i(git_strategy hg_strategy svn_strategy).each do |strategy|
|
||||||
validate(strategy) do |key, _value|
|
validate(strategy) do |key, _value|
|
||||||
warn(
|
warn(
|
||||||
"[Deprecation Warning] #{key} is deprecated and will be removed in "\
|
"[Deprecation Warning] #{key} is deprecated and will be removed in "\
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Capistrano
|
||||||
class VariablesDoctor
|
class VariablesDoctor
|
||||||
# These are keys that have no default values in Capistrano, but are
|
# These are keys that have no default values in Capistrano, but are
|
||||||
# nonetheless expected to be set.
|
# nonetheless expected to be set.
|
||||||
WHITELIST = [:application, :repo_url, :repo_tree].freeze
|
WHITELIST = %i(application repo_url repo_tree).freeze
|
||||||
private_constant :WHITELIST
|
private_constant :WHITELIST
|
||||||
|
|
||||||
include Capistrano::Doctor::OutputHelpers
|
include Capistrano::Doctor::OutputHelpers
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Capistrano::SCM::Git < Capistrano::SCM::Plugin
|
||||||
set_if_empty :git_wrapper_path, lambda {
|
set_if_empty :git_wrapper_path, lambda {
|
||||||
# Try to avoid permissions issues when multiple users deploy the same app
|
# Try to avoid permissions issues when multiple users deploy the same app
|
||||||
# by using different file names in the same dir for each deployer and stage.
|
# by using different file names in the same dir for each deployer and stage.
|
||||||
suffix = [:application, :stage, :local_user].map { |key| fetch(key).to_s }.join("-")
|
suffix = %i(application stage local_user).map { |key| fetch(key).to_s }.join("-")
|
||||||
"#{fetch(:tmp_dir)}/git-ssh-#{suffix}.sh"
|
"#{fetch(:tmp_dir)}/git-ssh-#{suffix}.sh"
|
||||||
}
|
}
|
||||||
set_if_empty :git_environmental_variables, lambda {
|
set_if_empty :git_environmental_variables, lambda {
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Capistrano
|
||||||
describe Filter do
|
describe Filter do
|
||||||
let(:available) do
|
let(:available) do
|
||||||
[
|
[
|
||||||
Server.new("server1").add_roles([:web, :db]),
|
Server.new("server1").add_roles(%i(web db)),
|
||||||
Server.new("server2").add_role(:web),
|
Server.new("server2").add_role(:web),
|
||||||
Server.new("server3").add_role(:redis),
|
Server.new("server3").add_role(:redis),
|
||||||
Server.new("server4").add_role(:db),
|
Server.new("server4").add_role(:db),
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Capistrano
|
||||||
|
|
||||||
let(:available) do
|
let(:available) do
|
||||||
[
|
[
|
||||||
Server.new("server1").add_roles([:web, :db]),
|
Server.new("server1").add_roles(%i(web db)),
|
||||||
Server.new("server2").add_role(:web),
|
Server.new("server2").add_role(:web),
|
||||||
Server.new("server3").add_role(:redis),
|
Server.new("server3").add_role(:redis),
|
||||||
Server.new("server4").add_role(:db),
|
Server.new("server4").add_role(:db),
|
||||||
|
@ -41,7 +41,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with multiple roles" do
|
context "with multiple roles" do
|
||||||
let(:values) { [:web, :db] }
|
let(:values) { %i(web db) }
|
||||||
it_behaves_like "it filters roles correctly", 3, %w{server1 server2 server4}
|
it_behaves_like "it filters roles correctly", 3, %w{server1 server2 server4}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "adding roles" do
|
describe "adding roles" do
|
||||||
subject { server.add_roles([:things, :stuff]) }
|
subject { server.add_roles(%i(things stuff)) }
|
||||||
it "adds the roles" do
|
it "adds the roles" do
|
||||||
expect { subject }.to change { server.roles.size }.from(0).to(2)
|
expect { subject }.to change { server.roles.size }.from(0).to(2)
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Capistrano
|
||||||
|
|
||||||
describe "collecting server roles" do
|
describe "collecting server roles" do
|
||||||
let(:app) { Set.new([:app]) }
|
let(:app) { Set.new([:app]) }
|
||||||
let(:web_app) { Set.new([:web, :app]) }
|
let(:web_app) { Set.new(%i(web app)) }
|
||||||
let(:web) { Set.new([:web]) }
|
let(:web) { Set.new([:web]) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -108,7 +108,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the correct app and web servers" do
|
it "returns the correct app and web servers" do
|
||||||
expect(servers.roles_for([:app, :web]).map(&:hostname)).to eq %w{1 2 3}
|
expect(servers.roles_for(%i(app web)).map(&:hostname)).to eq %w{1 2 3}
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns all servers" do
|
it "returns all servers" do
|
||||||
|
@ -284,7 +284,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when selecting specific roles" do
|
context "when selecting specific roles" do
|
||||||
let(:roles) { [:app, :web] }
|
let(:roles) { %i(app web) }
|
||||||
it "ignores it" do
|
it "ignores it" do
|
||||||
expect(subject).to eq %w{1 2 3 4}
|
expect(subject).to eq %w{1 2 3 4}
|
||||||
end
|
end
|
||||||
|
@ -312,7 +312,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when selecting specific roles" do
|
context "when selecting specific roles" do
|
||||||
let(:roles) { [:app, :web] }
|
let(:roles) { %i(app web) }
|
||||||
it "ignores it" do
|
it "ignores it" do
|
||||||
expect(subject).to eq %w{1 2 3 4}
|
expect(subject).to eq %w{1 2 3 4}
|
||||||
end
|
end
|
||||||
|
|
|
@ -238,7 +238,7 @@ module Capistrano
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns all set keys" do
|
it "returns all set keys" do
|
||||||
expect(subject).to match_array [:key1, :key2]
|
expect(subject).to match_array %i(key1 key2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ module Capistrano
|
||||||
|
|
||||||
describe "asking" do
|
describe "asking" do
|
||||||
let(:question) { stub }
|
let(:question) { stub }
|
||||||
let(:options) { Hash.new }
|
let(:options) { {} }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Configuration::Question.expects(:new).with(:branch, :default, options)
|
Configuration::Question.expects(:new).with(:branch, :default, options)
|
||||||
|
|
Loading…
Reference in a new issue