diff --git a/.rubocop.yml b/.rubocop.yml index e3897daa..879d3e31 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,8 +23,6 @@ Style/AndOr: Enabled: false Style/Documentation: Enabled: false -Style/SpaceAfterComma: - Enabled: false Style/RegexpLiteral: Enabled: false Style/SignalException: diff --git a/lib/capistrano/application.rb b/lib/capistrano/application.rb index 020fbd02..db187143 100644 --- a/lib/capistrano/application.rb +++ b/lib/capistrano/application.rb @@ -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 diff --git a/lib/capistrano/configuration.rb b/lib/capistrano/configuration.rb index d0491d4a..c02d94a8 100644 --- a/lib/capistrano/configuration.rb +++ b/lib/capistrano/configuration.rb @@ -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 diff --git a/lib/capistrano/configuration/server.rb b/lib/capistrano/configuration/server.rb index 2a62005f..fc344843 100644 --- a/lib/capistrano/configuration/server.rb +++ b/lib/capistrano/configuration/server.rb @@ -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 diff --git a/lib/capistrano/install.rb b/lib/capistrano/install.rb index d0cd605d..b0e55c67 100644 --- a/lib/capistrano/install.rb +++ b/lib/capistrano/install.rb @@ -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")) diff --git a/spec/integration/dsl_spec.rb b/spec/integration/dsl_spec.rb index b2c7b49e..69a5f7a4 100644 --- a/spec/integration/dsl_spec.rb +++ b/spec/integration/dsl_spec.rb @@ -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 diff --git a/spec/lib/capistrano/configuration/filter_spec.rb b/spec/lib/capistrano/configuration/filter_spec.rb index 15ef02ad..5665298c 100644 --- a/spec/lib/capistrano/configuration/filter_spec.rb +++ b/spec/lib/capistrano/configuration/filter_spec.rb @@ -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), diff --git a/spec/lib/capistrano/configuration/role_filter_spec.rb b/spec/lib/capistrano/configuration/role_filter_spec.rb index f68e1511..da27f01f 100644 --- a/spec/lib/capistrano/configuration/role_filter_spec.rb +++ b/spec/lib/capistrano/configuration/role_filter_spec.rb @@ -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), diff --git a/spec/lib/capistrano/configuration/servers_spec.rb b/spec/lib/capistrano/configuration/servers_spec.rb index c69620b6..fe809946 100644 --- a/spec/lib/capistrano/configuration/servers_spec.rb +++ b/spec/lib/capistrano/configuration/servers_spec.rb @@ -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 diff --git a/spec/lib/capistrano/dsl/paths_spec.rb b/spec/lib/capistrano/dsl/paths_spec.rb index 0e4c1afb..3f9c35f6 100644 --- a/spec/lib/capistrano/dsl/paths_spec.rb +++ b/spec/lib/capistrano/dsl/paths_spec.rb @@ -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 diff --git a/spec/support/Vagrantfile b/spec/support/Vagrantfile index cd26710f..b9ef1764 100644 --- a/spec/support/Vagrantfile +++ b/spec/support/Vagrantfile @@ -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