Skip to content

Commit bdd05e0

Browse files
committed
Introduce standardrb; fix linter issues
1 parent d52d455 commit bdd05e0

85 files changed

Lines changed: 3134 additions & 3178 deletions

File tree

Some content is hidden

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

bosh-stemcell/Gemfile

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

3-
gemspec
3+
gemspec

bosh-stemcell/Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require "rspec/core/rake_task"
2+
require "standard/rake"
23

3-
task default: [:spec]
4+
task default: [:standard, :spec]
45

56
RSpec::Core::RakeTask.new(:spec)
67

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
# coding: utf-8
2-
require File.expand_path('../lib/bosh/stemcell/version', __FILE__)
1+
require File.expand_path("../lib/bosh/stemcell/version", __FILE__)
32

43
version = Bosh::Stemcell::VERSION
54

65
Gem::Specification.new do |spec|
7-
spec.name = 'bosh-stemcell'
8-
spec.version = version
9-
spec.authors = 'Pivotal'
10-
spec.email = 'support@cloudfoundry.com'
11-
spec.description = 'Bosh::Stemcell provides tools to manage stemcells'
12-
spec.summary = 'Bosh::Stemcell provides tools to manage stemcells'
13-
spec.homepage = 'https://github.com/cloudfoundry/bosh'
14-
spec.license = 'Apache 2.0'
6+
spec.name = "bosh-stemcell"
7+
spec.version = version
8+
spec.authors = "Pivotal"
9+
spec.email = "support@cloudfoundry.com"
10+
spec.description = "Bosh::Stemcell provides tools to manage stemcells"
11+
spec.summary = "Bosh::Stemcell provides tools to manage stemcells"
12+
spec.homepage = "https://github.com/cloudfoundry/bosh"
13+
spec.license = "Apache 2.0"
1514

16-
spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
15+
spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
1716

18-
spec.files = Dir['README.md', 'lib/**/*'].select{ |f| File.file? f }
19-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17+
spec.files = Dir["README.md", "lib/**/*"].select { |f| File.file? f }
18+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
2119
spec.require_paths = %w[lib]
2220

23-
spec.add_development_dependency 'fakefs'
24-
spec.add_development_dependency 'rake'
25-
spec.add_development_dependency 'rspec'
26-
spec.add_development_dependency 'rspec-instafail'
27-
spec.add_development_dependency 'rspec-its'
28-
spec.add_development_dependency 'standard'
29-
spec.add_development_dependency 'timecop'
21+
spec.add_development_dependency "fakefs"
22+
spec.add_development_dependency "rake"
23+
spec.add_development_dependency "rspec"
24+
spec.add_development_dependency "rspec-instafail"
25+
spec.add_development_dependency "rspec-its"
26+
spec.add_development_dependency "standard"
27+
spec.add_development_dependency "timecop"
3028
end

bosh-stemcell/lib/bosh/core/shell.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ def run_command(command, options)
2121
stdout.puts command if options[:output_command]
2222
lines = []
2323

24-
if options[:env]
24+
popen_args = if options[:env]
2525
# Wrap in a shell because existing api to Shell#run takes a string
2626
# which makes it really hard to pass it to popen with custom environment.
27-
popen_args = [options[:env], ENV['SHELL'] || 'bash', '-c', command]
27+
[options[:env], ENV["SHELL"] || "bash", "-c", command]
2828
else
29-
popen_args = command
29+
command
3030
end
3131

3232
io = IO.popen(popen_args)
@@ -50,7 +50,7 @@ def report(cmd, command_output, options)
5050

5151
redacted_cmd = cmd
5252
if options[:redact]
53-
redacted_cmd = redacted_cmd.gsub(/#{options[:redact].join('|')}/, "[REDACTED]")
53+
redacted_cmd = redacted_cmd.gsub(/#{options[:redact].join("|")}/, "[REDACTED]")
5454
end
5555

5656
err_msg = "Failed: '#{redacted_cmd}' from #{pwd}, with exit status #{$?.to_i}\n\n #{command_output}"
@@ -64,7 +64,7 @@ def command_exited_successfully?
6464
def pwd
6565
Dir.pwd
6666
rescue Errno::ENOENT
67-
'a deleted directory'
67+
"a deleted directory"
6868
end
6969
end
7070
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module Bosh::Stemcell
22
class Arch
33
def self.arch
4-
RbConfig::CONFIG['host_cpu']
4+
RbConfig::CONFIG["host_cpu"]
55
end
66

77
def self.x86_64?
8-
arch == 'x86_64'
8+
arch == "x86_64"
99
end
1010
end
1111
end

bosh-stemcell/lib/bosh/stemcell/archive.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
require 'yaml'
2-
require 'rake/file_utils_ext'
3-
require 'bosh/stemcell/aws/region'
1+
require "yaml"
2+
require "rake/file_utils_ext"
3+
require "bosh/stemcell/aws/region"
44

55
module Bosh::Stemcell
66
class Archive
77
attr_reader :path
88

9-
def initialize(path = '')
9+
def initialize(path = "")
1010
@path = path
1111
validate_stemcell
1212
end
@@ -16,25 +16,25 @@ def manifest
1616
end
1717

1818
def name
19-
manifest.fetch('name')
19+
manifest.fetch("name")
2020
end
2121

2222
def infrastructure
23-
cloud_properties.fetch('infrastructure')
23+
cloud_properties.fetch("infrastructure")
2424
end
2525

2626
def version
27-
cloud_properties.fetch('version')
27+
cloud_properties.fetch("version")
2828
end
2929

3030
def sha1
31-
sha1 = manifest.fetch('sha1')
32-
raise 'sha1 must not be nil' unless sha1
31+
sha1 = manifest.fetch("sha1")
32+
raise "sha1 must not be nil" unless sha1
3333
sha1.to_s
3434
end
3535

3636
def light?
37-
infrastructure == 'aws' && has_ami?
37+
infrastructure == "aws" && has_ami?
3838
end
3939

4040
def extract(tar_options = {}, &block)
@@ -51,11 +51,11 @@ def extract(tar_options = {}, &block)
5151
private
5252

5353
def has_ami?
54-
cloud_properties.has_key? 'ami'
54+
cloud_properties.has_key? "ami"
5555
end
5656

5757
def cloud_properties
58-
manifest.fetch('cloud_properties')
58+
manifest.fetch("cloud_properties")
5959
end
6060

6161
def validate_stemcell

bosh-stemcell/lib/bosh/stemcell/archive_filename.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require 'bosh/stemcell/arch'
2-
require 'forwardable'
1+
require "bosh/stemcell/arch"
2+
require "forwardable"
33

44
module Bosh::Stemcell
55
class ArchiveFilename
@@ -19,7 +19,7 @@ def to_s
1919
definition.stemcell_name(disk_format)
2020
]
2121

22-
"#{stemcell_filename_parts.join('-')}.tgz"
22+
"#{stemcell_filename_parts.join("-")}.tgz"
2323
end
2424

2525
private
@@ -28,7 +28,7 @@ def to_s
2828
:base_name,
2929
:version,
3030
:definition,
31-
:disk_format,
31+
:disk_format
3232
)
3333
end
3434
end

bosh-stemcell/lib/bosh/stemcell/aws/region.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
require 'net/http'
1+
require "net/http"
22

33
module Bosh
44
module Stemcell
55
module Aws
66
class Region
7-
DEFAULT = 'us-east-1'
8-
REGIONS = %w{
7+
DEFAULT = "us-east-1"
8+
REGIONS = %w[
99
us-east-1 us-west-1 us-west-2 eu-west-1 eu-central-1
1010
ap-southeast-1 ap-southeast-2 ap-northeast-1 ap-northeast-2
1111
sa-east-1
12-
}
12+
]
1313
end
1414
end
1515
end

0 commit comments

Comments
 (0)