Skip to content

Commit b4f485d

Browse files
committed
Merge pull request #1594 from will-in-wi/rubocop
Rubocop
2 parents eb21808 + c69f423 commit b4f485d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1311
-1313
lines changed

.rubocop.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
AllCops:
2+
DisplayCopNames: true
3+
DisplayStyleGuide: true
4+
TargetRubyVersion: 2.0
5+
6+
Style/ClassAndModuleChildren:
7+
Enabled: false
8+
Style/DoubleNegation:
9+
Enabled: false
10+
Style/HashSyntax:
11+
EnforcedStyle: hash_rockets
12+
Style/SpaceAroundEqualsInParameterDefault:
13+
EnforcedStyle: no_space
14+
Style/StringLiterals:
15+
EnforcedStyle: double_quotes
16+
Style/TrivialAccessors:
17+
AllowPredicates: true
18+
19+
# Need discussion
20+
Style/AndOr:
21+
Enabled: false
22+
Style/Documentation:
23+
Enabled: false
24+
Style/RedundantSelf:
25+
Enabled: false
26+
Style/RedundantReturn:
27+
Enabled: false
28+
Style/SpaceAfterComma:
29+
Enabled: false
30+
Style/ParallelAssignment:
31+
Enabled: false
32+
Style/RegexpLiteral:
33+
Enabled: false
34+
Style/SignalException:
35+
Enabled: false
36+
Performance/RedundantMerge:
37+
Enabled: false
38+
Style/PercentLiteralDelimiters:
39+
Enabled: false
40+
Style/BlockDelimiters:
41+
Enabled: false
42+
Style/ConditionalAssignment:
43+
Enabled: false
44+
Style/AlignParameters:
45+
Enabled: false
46+
Style/IfUnlessModifier:
47+
Enabled: false
48+
Style/Next:
49+
Enabled: false
50+
Style/Lambda:
51+
Enabled: false
52+
Style/EmptyLiteral:
53+
Enabled: false
54+
Style/RaiseArgs:
55+
Enabled: false
56+
Style/SingleLineBlockParams:
57+
Enabled: false
58+
Style/Not:
59+
Enabled: false
60+
Style/WhileUntilModifier:
61+
Enabled: false
62+
Style/RescueModifier:
63+
Enabled: false
64+
Style/SpecialGlobalVars:
65+
Enabled: false
66+
Style/ModuleFunction:
67+
Enabled: false
68+
Style/DotPosition:
69+
Enabled: false
70+
Style/BlockEndNewline:
71+
Enabled: false
72+
Style/MultilineBlockLayout:
73+
Enabled: false
74+
Style/TrailingCommaInLiteral:
75+
Enabled: false
76+
Style/Proc:
77+
Enabled: false
78+
Style/CommandLiteral:
79+
Enabled: false
80+
Style/AlignHash:
81+
Enabled: false
82+
83+
# Needs refactors
84+
Metrics/PerceivedComplexity:
85+
Enabled: false
86+
Metrics/CyclomaticComplexity:
87+
Enabled: false
88+
Metrics/MethodLength:
89+
Enabled: false
90+
Style/PredicateName:
91+
Enabled: false
92+
Metrics/LineLength:
93+
Enabled: false
94+
Metrics/AbcSize:
95+
Enabled: false
96+
Style/PerlBackrefs:
97+
Enabled: false
98+
Metrics/ClassLength:
99+
Enabled: false
100+
Metrics/ModuleLength:
101+
Enabled: false
102+
Style/AccessorMethodName:
103+
Enabled: false

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

33
# Specify your gem's dependencies in capistrano.gemspec
44
gemspec
55

66
group :cucumber do
7-
gem 'cucumber'
8-
gem 'rspec', '~> 3.0.0'
7+
gem "cucumber"
8+
gem "rspec", "~> 3.0.0"
99
end

bin/cap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env ruby
2-
require 'capistrano/all'
2+
require "capistrano/all"
33
Capistrano::Application.new.run

capistrano.gemspec

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# -*- encoding: utf-8 -*-
2-
lib = File.expand_path('../lib', __FILE__)
2+
lib = File.expand_path("../lib", __FILE__)
33
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4-
require 'capistrano/version'
4+
require "capistrano/version"
55

66
Gem::Specification.new do |gem|
77
gem.name = "capistrano"
88
gem.version = Capistrano::VERSION
99
gem.authors = ["Tom Clements", "Lee Hambley"]
1010
11-
gem.description = %q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
12-
gem.summary = %q{Capistrano - Welcome to easy deployment with Ruby over SSH}
11+
gem.description = "Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH."
12+
gem.summary = "Capistrano - Welcome to easy deployment with Ruby over SSH"
1313
gem.homepage = "http://capistranorb.com/"
1414

1515
gem.files = `git ls-files`.split($/)
16-
gem.executables = ['cap', 'capify']
16+
gem.executables = %w(cap capify)
1717
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
1818
gem.require_paths = ["lib"]
1919

20-
gem.licenses = ['MIT']
20+
gem.licenses = ["MIT"]
2121

22-
gem.required_ruby_version = '>= 1.9.3'
23-
gem.add_dependency 'airbrussh', '>= 1.0.0.beta1'
24-
gem.add_dependency 'i18n'
25-
gem.add_dependency 'rake', '>= 10.0.0'
26-
gem.add_dependency 'sshkit', '>= 1.9.0.rc1'
22+
gem.required_ruby_version = ">= 1.9.3"
23+
gem.add_dependency "airbrussh", ">= 1.0.0.beta1"
24+
gem.add_dependency "i18n"
25+
gem.add_dependency "rake", ">= 10.0.0"
26+
gem.add_dependency "sshkit", ">= 1.9.0.rc1"
2727

28-
gem.add_development_dependency 'rspec'
29-
gem.add_development_dependency 'mocha'
30-
gem.add_development_dependency 'rubocop'
28+
gem.add_development_dependency "rspec"
29+
gem.add_development_dependency "mocha"
30+
gem.add_development_dependency "rubocop"
3131
end

features/step_definitions/assertions.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Then(/^references in the remote repo are listed$/) do
2-
expect(@output).to include('refs/heads/master')
2+
expect(@output).to include("refs/heads/master")
33
end
44

55
Then(/^the shared path is created$/) do
@@ -18,7 +18,7 @@
1818

1919
Then(/^directories referenced in :linked_files are created in shared$/) do
2020
dirs = TestApp.linked_files.map { |path| TestApp.shared_path.join(path).dirname }
21-
dirs.each do | dir|
21+
dirs.each do |dir|
2222
run_vagrant_command(test_dir_exists(dir))
2323
end
2424
end
@@ -49,25 +49,25 @@
4949
end
5050

5151
Then(/^the deploy\.rb file is created$/) do
52-
file = TestApp.test_app_path.join('config/deploy.rb')
52+
file = TestApp.test_app_path.join("config/deploy.rb")
5353
expect(File.exist?(file)).to be true
5454
end
5555

5656
Then(/^the default stage files are created$/) do
57-
staging = TestApp.test_app_path.join('config/deploy/staging.rb')
58-
production = TestApp.test_app_path.join('config/deploy/production.rb')
57+
staging = TestApp.test_app_path.join("config/deploy/staging.rb")
58+
production = TestApp.test_app_path.join("config/deploy/production.rb")
5959
expect(File.exist?(staging)).to be true
6060
expect(File.exist?(production)).to be true
6161
end
6262

6363
Then(/^the tasks folder is created$/) do
64-
path = TestApp.test_app_path.join('lib/capistrano/tasks')
64+
path = TestApp.test_app_path.join("lib/capistrano/tasks")
6565
expect(Dir.exist?(path)).to be true
6666
end
6767

6868
Then(/^the specified stage files are created$/) do
69-
qa = TestApp.test_app_path.join('config/deploy/qa.rb')
70-
production = TestApp.test_app_path.join('config/deploy/production.rb')
69+
qa = TestApp.test_app_path.join("config/deploy/qa.rb")
70+
production = TestApp.test_app_path.join("config/deploy/production.rb")
7171
expect(File.exist?(qa)).to be true
7272
expect(File.exist?(production)).to be true
7373
end
@@ -91,18 +91,18 @@
9191
end
9292

9393
Then(/^the failure task will run$/) do
94-
failed = TestApp.shared_path.join('failed')
94+
failed = TestApp.shared_path.join("failed")
9595
run_vagrant_command(test_file_exists(failed))
9696
end
9797

9898
Then(/^the failure task will not run$/) do
99-
failed = TestApp.shared_path.join('failed')
99+
failed = TestApp.shared_path.join("failed")
100100
expect { run_vagrant_command(test_file_exists(failed)) }
101101
.to raise_error(VagrantHelpers::VagrantSSHCommandError)
102102
end
103103

104104
When(/^an error is raised$/) do
105-
error = TestApp.shared_path.join('fail')
105+
error = TestApp.shared_path.join("fail")
106106
run_vagrant_command(test_file_exists(error))
107107
end
108108

features/step_definitions/cap_commands.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
When(/^I run "(.*?)"$/) do |command|
1010
@success, @output = TestApp.run(command)
1111
end
12-

features/step_definitions/setup.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
end
44

55
Given(/^servers with the roles app and web$/) do
6-
vagrant_cli_command('up') rescue nil
6+
vagrant_cli_command("up") rescue nil
77
end
88

99
Given(/^a linked file "(.*?)"$/) do |file|
@@ -24,27 +24,27 @@
2424
end
2525

2626
Given(/^a custom task to generate a file$/) do
27-
TestApp.copy_task_to_test_app('spec/support/tasks/database.rake')
27+
TestApp.copy_task_to_test_app("spec/support/tasks/database.rake")
2828
end
2929

3030
Given(/^a task which executes as root$/) do
31-
TestApp.copy_task_to_test_app('spec/support/tasks/root.rake')
31+
TestApp.copy_task_to_test_app("spec/support/tasks/root.rake")
3232
end
3333

3434
Given(/config stage file has line "(.*?)"/) do |line|
3535
TestApp.append_to_deploy_file(line)
3636
end
3737

3838
Given(/^the configuration is in a custom location$/) do
39-
TestApp.move_configuration_to_custom_location('app')
39+
TestApp.move_configuration_to_custom_location("app")
4040
end
4141

4242
Given(/^a custom task that will simulate a failure$/) do
43-
safely_remove_file(TestApp.shared_path.join('failed'))
44-
TestApp.copy_task_to_test_app('spec/support/tasks/fail.rake')
43+
safely_remove_file(TestApp.shared_path.join("failed"))
44+
TestApp.copy_task_to_test_app("spec/support/tasks/fail.rake")
4545
end
4646

4747
Given(/^a custom task to run in the event of a failure$/) do
48-
safely_remove_file(TestApp.shared_path.join('failed'))
49-
TestApp.copy_task_to_test_app('spec/support/tasks/failed.rake')
48+
safely_remove_file(TestApp.shared_path.join("failed"))
49+
TestApp.copy_task_to_test_app("spec/support/tasks/failed.rake")
5050
end

features/support/env.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
PROJECT_ROOT = File.expand_path('../../../', __FILE__)
2-
VAGRANT_ROOT = File.join(PROJECT_ROOT, 'spec/support')
3-
VAGRANT_BIN = ENV['VAGRANT_BIN'] || "vagrant"
1+
PROJECT_ROOT = File.expand_path("../../../", __FILE__)
2+
VAGRANT_ROOT = File.join(PROJECT_ROOT, "spec/support")
3+
VAGRANT_BIN = ENV["VAGRANT_BIN"] || "vagrant"
44

55
at_exit do
6-
if ENV['KEEP_RUNNING']
6+
if ENV["KEEP_RUNNING"]
77
VagrantHelpers.run_vagrant_command("rm -rf /home/vagrant/var")
88
end
99
end
1010

11-
require_relative '../../spec/support/test_app'
11+
require_relative "../../spec/support/test_app"

features/support/remote_command_helpers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module RemoteCommandHelpers
22
def test_dir_exists(path)
3-
exists?('d', path)
3+
exists?("d", path)
44
end
55

66
def test_symlink_exists(path)
7-
exists?('L', path)
7+
exists?("L", path)
88
end
99

1010
def test_file_exists(path)
11-
exists?('f', path)
11+
exists?("f", path)
1212
end
1313

1414
def exists?(type, path)

features/support/vagrant_helpers.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module VagrantHelpers
44
class VagrantSSHCommandError < RuntimeError; end
55

66
at_exit do
7-
if ENV['KEEP_RUNNING']
7+
if ENV["KEEP_RUNNING"]
88
puts "Vagrant vm will be left up because KEEP_RUNNING is set."
99
puts "Rerun without KEEP_RUNNING set to cleanup the vm."
1010
else
@@ -29,7 +29,6 @@ def run_vagrant_command(command)
2929
fail VagrantSSHCommandError, status
3030
end
3131
end
32-
3332
end
3433

3534
World(VagrantHelpers)

lib/Capfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env cap
22
include Capistrano::DSL
3-
require 'capistrano/install'
3+
require "capistrano/install"

lib/capistrano/all.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
require 'rake'
2-
require 'sshkit'
1+
require "rake"
2+
require "sshkit"
33

4-
require 'io/console'
4+
require "io/console"
55

66
Rake.application.options.trace = true
77

8-
require 'capistrano/version'
9-
require 'capistrano/version_validator'
10-
require 'capistrano/i18n'
11-
require 'capistrano/dsl'
12-
require 'capistrano/application'
13-
require 'capistrano/configuration'
8+
require "capistrano/version"
9+
require "capistrano/version_validator"
10+
require "capistrano/i18n"
11+
require "capistrano/dsl"
12+
require "capistrano/application"
13+
require "capistrano/configuration"
1414

1515
module Capistrano
16-
1716
end

0 commit comments

Comments
 (0)