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

Enable SpaceAfterComma cop

This commit is contained in:
William Johnston 2016-03-01 09:02:00 -06:00 committed by William Johnston
parent 90574e065b
commit a39277bb6f
11 changed files with 23 additions and 25 deletions

View file

@ -23,8 +23,6 @@ Style/AndOr:
Enabled: false
Style/Documentation:
Enabled: false
Style/SpaceAfterComma:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/SignalException:

View file

@ -98,7 +98,7 @@ module Capistrano
# allows the `cap install` task to load without a capfile
def capfile
File.expand_path(File.join(File.dirname(__FILE__),"..","Capfile"))
File.expand_path(File.join(File.dirname(__FILE__), "..", "Capfile"))
end
def version

View file

@ -118,7 +118,7 @@ module Capistrano
sshkit.backend.configure do |backend|
backend.pty = fetch(:pty)
backend.connection_timeout = fetch(:connection_timeout)
backend.ssh_options = (backend.ssh_options || {}).merge(fetch(:ssh_options,{}))
backend.ssh_options = (backend.ssh_options || {}).merge(fetch(:ssh_options, {}))
end
end
end
@ -131,7 +131,7 @@ module Capistrano
@filters = cmdline_filters.clone
@filters << Filter.new(:role, ENV["ROLES"]) if ENV["ROLES"]
@filters << Filter.new(:host, ENV["HOSTS"]) if ENV["HOSTS"]
fh = fetch_for(:filter,{}) || {}
fh = fetch_for(:filter, {}) || {}
@filters << Filter.new(:host, fh[:hosts]) if fh[:hosts]
@filters << Filter.new(:role, fh[:roles]) if fh[:roles]
@filters << Filter.new(:host, fh[:host]) if fh[:host]
@ -144,7 +144,7 @@ module Capistrano
def filter(list)
setup_filters if @filters.nil?
@filters.reduce(list) { |l,f| f.filter l }
@filters.reduce(list) { |l, f| f.filter l }
end
private

View file

@ -25,7 +25,7 @@ module Capistrano
end
def select?(options)
options.each do |k,v|
options.each do |k, v|
callable = v.respond_to?(:call) ? v : ->(server) { server.fetch(v) }
result = \
case k

View file

@ -1 +1 @@
load File.expand_path(File.join(File.dirname(__FILE__),"tasks/install.rake"))
load File.expand_path(File.join(File.dirname(__FILE__), "tasks/install.rake"))

View file

@ -110,7 +110,7 @@ describe Capistrano::DSL do
subject { dsl.roles(:app) }
it "ignores it" do
dsl.set :filter, :role => :web
expect(subject.map(&:hostname)).to eq(["example3.com","example4.com"])
expect(subject.map(&:hostname)).to eq(["example3.com", "example4.com"])
end
end
@ -118,7 +118,7 @@ describe Capistrano::DSL do
subject { dsl.roles(:app) }
it "ignores it" do
dsl.set :filter, :role => :web, :host => "example1.com"
expect(subject.map(&:hostname)).to eq(["example3.com","example4.com"])
expect(subject.map(&:hostname)).to eq(["example3.com", "example4.com"])
end
end
@ -142,7 +142,7 @@ describe Capistrano::DSL do
subject { dsl.roles(:app) }
it "ignores it" do
dsl.set :filter, :roles => :web
expect(subject.map(&:hostname)).to eq(["example3.com","example4.com"])
expect(subject.map(&:hostname)).to eq(["example3.com", "example4.com"])
end
end
@ -150,7 +150,7 @@ describe Capistrano::DSL do
subject { dsl.roles(:app) }
it "ignores it" do
dsl.set :filter, :roles => :web, :hosts => "example1.com"
expect(subject.map(&:hostname)).to eq(["example3.com","example4.com"])
expect(subject.map(&:hostname)).to eq(["example3.com", "example4.com"])
end
end
@ -585,7 +585,7 @@ describe Capistrano::DSL do
it "retrieves properties for multiple roles as a set" do
rps = dsl.role_properties(:app, :web)
expect(rps).to eq(Set[{ :hostname => "example3.com", :role => :app },{ :hostname => "example1.com", :role => :web, :port => 80 },{ :hostname => "example2.com", :role => :web, :port => 81 }])
expect(rps).to eq(Set[{ :hostname => "example3.com", :role => :app }, { :hostname => "example1.com", :role => :web, :port => 80 }, { :hostname => "example2.com", :role => :web, :port => 81 }])
end
it "yields the properties for a single role" do

View file

@ -4,7 +4,7 @@ module Capistrano
class Configuration
describe Filter do
let(:available) {
[Server.new("server1").add_roles([:web,:db]),
[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),

View file

@ -6,7 +6,7 @@ module Capistrano
subject(:role_filter) { RoleFilter.new(values) }
let(:available) {
[Server.new("server1").add_roles([:web,:db]),
[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),

View file

@ -167,22 +167,22 @@ module Capistrano
end
it "concatenates previously defined array properties" do
servers.add_host("1", :roles => [:b], :steps => [1,3,5])
servers.add_host("1", :roles => [:b], :steps => [1,9])
servers.add_host("1", :roles => [:b], :steps => [1, 3, 5])
servers.add_host("1", :roles => [:b], :steps => [1, 9])
expect(servers.count).to eq(1)
expect(servers.roles_for([:b]).first.properties.steps).to eq([1,3,5,1,9])
expect(servers.roles_for([:b]).first.properties.steps).to eq([1, 3, 5, 1, 9])
end
it "merges previously defined set properties" do
servers.add_host("1", :roles => [:b], :endpoints => Set[123,333])
servers.add_host("1", :roles => [:b], :endpoints => Set[222,333])
servers.add_host("1", :roles => [:b], :endpoints => Set[123, 333])
servers.add_host("1", :roles => [:b], :endpoints => Set[222, 333])
expect(servers.count).to eq(1)
expect(servers.roles_for([:b]).first.properties.endpoints).to eq(Set[123,222,333])
expect(servers.roles_for([:b]).first.properties.endpoints).to eq(Set[123, 222, 333])
end
it "adds array property value only ones for a new host" do
servers.add_host("2", :roles => [:array_test], :array_property => [1,2])
expect(servers.roles_for([:array_test]).first.properties.array_property).to eq [1,2]
servers.add_host("2", :roles => [:array_test], :array_property => [1, 2])
expect(servers.roles_for([:array_test]).first.properties.array_property).to eq [1, 2]
end
it "updates roles when custom user defined" do

View file

@ -88,7 +88,7 @@ describe Capistrano::DSL::Paths do
context "where the release path has been set" do
before do
dsl.set(:release_path,"/var/www/release_path")
dsl.set(:release_path, "/var/www/release_path")
end
it "returns the set `release_path` value" do

View file

@ -10,7 +10,7 @@ Vagrant.configure("2") do |config|
primary.vm.network "forwarded_port", :guest => 22, :host => "222#{i}".to_i
primary.vm.provision :shell, :inline => "sudo apt-get -y install git-core"
vagrantkey = open("https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub", "r",&:read)
vagrantkey = open("https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub", "r", &:read)
primary.vm.provision :shell,
:inline => <<-INLINE