1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Enable BlockDelimiters cop.

This commit is contained in:
William Johnston 2016-03-01 09:12:35 -06:00 committed by William Johnston
parent f563e28559
commit b962f21e3a
10 changed files with 41 additions and 39 deletions

View file

@ -25,8 +25,6 @@ Style/RegexpLiteral:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/BlockDelimiters:
Enabled: false
Style/Lambda:
Enabled: false
Style/SingleLineBlockParams:

View file

@ -104,46 +104,46 @@ module Capistrano
def version
["--version", "-V",
"Display the program version.",
lambda { |_value|
lambda do |_value|
puts "Capistrano Version: #{Capistrano::VERSION} (Rake Version: #{Rake::VERSION})"
exit
}
end
]
end
def dry_run
["--dry-run", "-n",
"Do a dry run without executing actions",
lambda { |_value|
lambda do |_value|
Configuration.env.set(:sshkit_backend, SSHKit::Backend::Printer)
}
end
]
end
def roles
["--roles ROLES", "-r",
"Run SSH commands only on hosts matching these roles",
lambda { |value|
lambda do |value|
Configuration.env.add_cmdline_filter(:role, value)
}
end
]
end
def hostfilter
["--hosts HOSTS", "-z",
"Run SSH commands only on matching hosts",
lambda { |value|
lambda do |value|
Configuration.env.add_cmdline_filter(:host, value)
}
end
]
end
def print_config_variables
["--print-config-variables", "-p",
"Display the defined config variables before starting the deployment tasks.",
lambda { |_value|
lambda do |_value|
Configuration.env.set(:print_config_variables, true)
}
end
]
end
end

View file

@ -165,9 +165,9 @@ describe Capistrano::DSL do
describe "when defining role with reserved name" do
it "fails with ArgumentError" do
expect {
expect do
dsl.role :all, %w{example1.com}
}.to raise_error(ArgumentError, "all reserved name for role. Please choose another name")
end.to raise_error(ArgumentError, "all reserved name for role. Please choose another name")
end
end

View file

@ -3,19 +3,21 @@ require "spec_helper"
module Capistrano
class Configuration
describe Filter do
let(:available) {
[Server.new("server1").add_roles([:web, :db]),
Server.new("server2").add_role(:web),
Server.new("server3").add_role(:redis),
Server.new("server4").add_role(:db),
Server.new("server5").add_role(:stageweb)]
}
let(:available) do
[
Server.new("server1").add_roles([:web, :db]),
Server.new("server2").add_role(:web),
Server.new("server3").add_role(:redis),
Server.new("server4").add_role(:db),
Server.new("server5").add_role(:stageweb)
]
end
describe '#new' do
it "won't create an invalid type of filter" do
expect {
expect do
Filter.new(:zarg)
}.to raise_error RuntimeError
end.to raise_error RuntimeError
end
context "with type :host" do

View file

@ -5,13 +5,13 @@ module Capistrano
describe HostFilter do
subject(:host_filter) { HostFilter.new(values) }
let(:available) {
let(:available) do
[Server.new("server1"),
Server.new("server2"),
Server.new("server3"),
Server.new("server4"),
Server.new("server5")]
}
end
shared_examples "it filters hosts correctly" do |expected|
it "filters correctly" do

View file

@ -5,13 +5,15 @@ module Capistrano
describe RoleFilter do
subject(:role_filter) { RoleFilter.new(values) }
let(:available) {
[Server.new("server1").add_roles([:web, :db]),
Server.new("server2").add_role(:web),
Server.new("server3").add_role(:redis),
Server.new("server4").add_role(:db),
Server.new("server5").add_role(:stageweb)]
}
let(:available) do
[
Server.new("server1").add_roles([:web, :db]),
Server.new("server2").add_role(:web),
Server.new("server3").add_role(:redis),
Server.new("server4").add_role(:db),
Server.new("server5").add_role(:stageweb)
]
end
shared_examples "it filters roles correctly" do |expected_size, expected|
it "filters correctly" do

View file

@ -263,7 +263,7 @@ module Capistrano
config.set :format, :pretty
config.set :log_level, :debug
config.set :ssh_options, :user => "albert"
SSHKit::Backend::Netssh.configure do |ssh| ssh.ssh_options = { :password => "einstein" } end
SSHKit::Backend::Netssh.configure { |ssh| ssh.ssh_options = { :password => "einstein" } }
config.configure_backend
expect(config.backend.config.backend.config.ssh_options).to eq(:user => "albert", :password => "einstein")
end

View file

@ -80,7 +80,7 @@ module Capistrano
end
it "invokes using the correct namespace when defined within a namespace" do
Rake.application.in_namespace("namespace") {
Rake.application.in_namespace("namespace") do
Rake::Task.define_task("task") do |t|
order.push(t.name)
end
@ -90,7 +90,7 @@ module Capistrano
task_enhancements.after("task", "after_task", :order) do |t|
order.push(t.name)
end
}
end
Rake::Task["namespace:task"].invoke

View file

@ -19,13 +19,13 @@ module Capistrano
message =~ /^WARNING: load:defaults has already been invoked/
end
expect {
expect do
namespace :load do
task :defaults do
# Never reached since load_defaults is frozen and can't be enhanced
end
end
}.to raise_error(/frozen/i)
end.to raise_error(/frozen/i)
end
end
end

View file

@ -5,9 +5,9 @@ require "capistrano/scm"
module RaiseNotImplementedMacro
def raise_not_implemented_on(method)
it "should raise NotImplemented on #{method}" do
expect {
expect do
subject.send(method)
}.to raise_error(NotImplementedError)
end.to raise_error(NotImplementedError)
end
end
end