cartage 2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cartage/cli.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cartage'
4
- require_relative 'gli_ext'
3
+ require "cartage"
4
+ require_relative "gli_ext"
5
5
 
6
6
  ::GLI::Commands::Help.skips_pre = false
7
7
 
@@ -14,7 +14,7 @@ class Cartage
14
14
  class QuietExit < StandardError
15
15
  include ::GLI::StandardException
16
16
 
17
- def initialize(exit_code) #:nodoc:
17
+ def initialize(exit_code) # :nodoc:
18
18
  @exit_code = exit_code
19
19
  end
20
20
 
@@ -38,7 +38,7 @@ class Cartage
38
38
 
39
39
  Cartage::Plugin.load
40
40
 
41
- include ::GLI::App #:nodoc:
41
+ include ::GLI::App # :nodoc:
42
42
 
43
43
  class << self
44
44
  # When called with a block, this method reopens Cartage::CLI to add new
@@ -48,7 +48,7 @@ class Cartage
48
48
  # +mods+ are the modules to extend onto Cartage::CLI. +block+ is the
49
49
  # block that contains CLI command extensions (using the GLI DSL).
50
50
  def extend(*mods, &block)
51
- return super(*mods) unless block_given?
51
+ return super(*mods) unless block
52
52
  cli.instance_eval(&block)
53
53
  end
54
54
 
@@ -72,7 +72,7 @@ class Cartage
72
72
  # +config+ (which must be a Cartage::Config object) may be provided.
73
73
  def cartage(config = nil)
74
74
  if defined?(@cartage) && @cartage && config
75
- fail 'Cannot provide another configuration after initialization.'
75
+ fail "Cannot provide another configuration after initialization."
76
76
  end
77
77
  @cartage ||= Cartage.new(config)
78
78
  end
@@ -90,11 +90,11 @@ class Cartage
90
90
  Cartage::Config.load(value)
91
91
  end
92
92
 
93
- program_desc 'Manage releaseable packages'
94
- program_long_desc <<-'DESC'
95
- Cartage provides a repeatable means to create a package for a server-side
96
- application that can be used in deployment with a configuration tool like
97
- Ansible, Chef, Puppet, or Salt.
93
+ program_desc "Manage releaseable packages"
94
+ program_long_desc <<~'DESC'
95
+ Cartage provides a repeatable means to create a package for a server-side
96
+ application that can be used in deployment with a configuration tool like
97
+ Ansible, Chef, Puppet, or Salt.
98
98
  DESC
99
99
  version Cartage::VERSION
100
100
 
@@ -102,77 +102,77 @@ Ansible, Chef, Puppet, or Salt.
102
102
  arguments :strict
103
103
  synopsis_format :terminal
104
104
 
105
- desc 'Silence normal output.'
106
- switch %i(q quiet)
105
+ desc "Silence normal output."
106
+ switch %i[q quiet]
107
107
 
108
- desc 'Show verbose output.'
109
- switch %i(v verbose)
108
+ desc "Show verbose output."
109
+ switch %i[v verbose]
110
110
 
111
- desc 'Show the backtrace when an error occurs.'
112
- switch %i(T trace), negatable: false
111
+ desc "Show the backtrace when an error occurs."
112
+ switch %i[T trace], negatable: false
113
113
 
114
- desc 'Use the specified Cartage configuration file.'
115
- long_desc <<-'DESC'
116
- Use the specified configuration file. If not specified, the configuration is
117
- found relative to the current working directory (assumed to be the project
118
- root) at one of the following locations:
119
-
120
- 1. config/cartage.yml
121
- 2. cartage.yml
122
- 3. .cartage.yml
114
+ desc "Use the specified Cartage configuration file."
115
+ long_desc <<~'DESC'
116
+ Use the specified configuration file. If not specified, the configuration is
117
+ found relative to the current working directory (assumed to be the project
118
+ root) at one of the following locations:
119
+
120
+ 1. config/cartage.yml
121
+ 2. cartage.yml
122
+ 3. .cartage.yml
123
123
  DESC
124
- flag [ :C, 'config-file' ],
124
+ flag [:C, "config-file"],
125
125
  type: Cartage::Config,
126
126
  arg_name: :FILE,
127
127
  default_value: :'<project-config>'
128
128
 
129
- desc 'The name of the package.'
130
- long_desc <<-'DESC'
131
- The name of the package is used with the timestamp to create the final package
132
- name. Defaults to the last part of the repo URL.
129
+ desc "The name of the package."
130
+ long_desc <<~'DESC'
131
+ The name of the package is used with the timestamp to create the final package
132
+ name. Defaults to the last part of the repo URL.
133
133
  DESC
134
- flag %i(n name), arg_name: :NAME, default_value: :'<repo-name>'
134
+ flag %i[n name], arg_name: :NAME, default_value: :'<repo-name>'
135
135
 
136
- desc 'The destination of the created package.'
137
- long_desc 'Where the final package will be written.'
138
- flag %i(t target), arg_name: :PATH, default_value: :tmp
136
+ desc "The destination of the created package."
137
+ long_desc "Where the final package will be written."
138
+ flag %i[t target], arg_name: :PATH, default_value: :tmp
139
139
 
140
- desc 'The package source root path.'
141
- long_desc <<-'DESC'
142
- Where the package is built from. Defaults to the root of the repository.
140
+ desc "The package source root path."
141
+ long_desc <<~'DESC'
142
+ Where the package is built from. Defaults to the root of the repository.
143
143
  DESC
144
- flag [ :r, 'root-path' ], arg_name: :PATH, default_value: :'<repo-root-path>'
144
+ flag [:r, "root-path"], arg_name: :PATH, default_value: :'<repo-root-path>'
145
145
 
146
- desc 'The timestamp used for building the package.'
147
- long_desc <<-'DESC'
148
- The timestamp is used with the name of the package is used to create the final
149
- package name.
146
+ desc "The timestamp used for building the package."
147
+ long_desc <<~'DESC'
148
+ The timestamp is used with the name of the package is used to create the final
149
+ package name.
150
150
  DESC
151
- flag [ :timestamp ], arg_name: :TIMESTAMP
151
+ flag [:timestamp], arg_name: :TIMESTAMP
152
152
 
153
- desc 'Disable the use of vendor dependency caching.'
154
- switch [ 'disable-dependency-cache' ], negatable: false
153
+ desc "Disable the use of vendor dependency caching."
154
+ switch ["disable-dependency-cache"], negatable: false
155
155
 
156
- desc 'The path where vendored dependencies will be cached between builds.'
157
- long_desc <<-'DESC'
158
- Dependencies for deployable packages are vendored. To reduce network calls and
159
- build time, Cartage will cache the vendored dependencies in a tarball
160
- (dependency-cache.tar.bz2) in this path.
156
+ desc "The path where vendored dependencies will be cached between builds."
157
+ long_desc <<~'DESC'
158
+ Dependencies for deployable packages are vendored. To reduce network calls and
159
+ build time, Cartage will cache the vendored dependencies in a tarball
160
+ (dependency-cache.tar.bz2) in this path.
161
161
  DESC
162
- flag [ 'dependency-cache-path' ],
162
+ flag ["dependency-cache-path"],
163
163
  arg_name: :PATH,
164
164
  default_value: :'<default-dependency-cache-path>'
165
165
 
166
- commands_from 'cartage/commands'
166
+ commands_from "cartage/commands"
167
167
 
168
- desc 'Save the computed configuration as a configuration file.'
168
+ desc "Save the computed configuration as a configuration file."
169
169
  arg :'CONFIG-FILE'
170
- command '_save' do |save|
170
+ command "_save" do |save|
171
171
  save.hide!
172
172
 
173
173
  save.action do |_global, _options, args|
174
174
  name = args.first
175
- name = "#{name}.yml" unless name == '-' || name.end_with?('.yml')
175
+ name = "#{name}.yml" unless name == "-" || name.end_with?(".yml")
176
176
 
177
177
  Cartage::Config.new(cartage.config).tap do |config|
178
178
  config.name ||= cartage.name
@@ -185,7 +185,7 @@ build time, Cartage will cache the vendored dependencies in a tarball
185
185
  config.quiet = cartage.quiet || false
186
186
  config.verbose = cartage.verbose || false
187
187
 
188
- if name == '-'
188
+ if name == "-"
189
189
  puts config.to_yaml
190
190
  else
191
191
  Pathname(name).write(config.to_yaml)
@@ -195,7 +195,7 @@ build time, Cartage will cache the vendored dependencies in a tarball
195
195
  end
196
196
 
197
197
  on_error do |ex|
198
- unless ex.kind_of?(Cartage::CLI::QuietExit)
198
+ unless ex.is_a?(Cartage::CLI::QuietExit)
199
199
  output_error_message(ex)
200
200
  ex.backtrace.each { |l| puts l } if backtrace?
201
201
  end
@@ -206,26 +206,26 @@ build time, Cartage will cache the vendored dependencies in a tarball
206
206
 
207
207
  clear_defaults_from(global)
208
208
 
209
- config = case global['config-file']
210
- when Cartage::Config
211
- global['config-file']
212
- when nil
213
- Cartage::Config.load(:default)
214
- else
215
- fail 'Invalid config-file'
216
- end
209
+ config = case global["config-file"]
210
+ when Cartage::Config
211
+ global["config-file"]
212
+ when nil
213
+ Cartage::Config.load(:default)
214
+ else
215
+ fail "Invalid config-file"
216
+ end
217
217
 
218
218
  # Configure Cartage from the config file and global switches.
219
- config.disable_dependency_cache ||= global['disable-dependency-cache']
220
- config.quiet ||= global['quiet']
221
- config.verbose ||= global['verbose']
222
-
223
- config.name = global['name'] if global['name']
224
- config.target = global['target'] if global['target']
225
- config.root_path = global['root-path'] if global['root-path']
226
- config.timestamp = global['timestamp'] if global['timestamp']
227
- if global['dependency-cache-path']
228
- config.dependency_cache_path = global['dependency-cache-path']
219
+ config.disable_dependency_cache ||= global["disable-dependency-cache"]
220
+ config.quiet ||= global["quiet"]
221
+ config.verbose ||= global["verbose"]
222
+
223
+ config.name = global["name"] if global["name"]
224
+ config.target = global["target"] if global["target"]
225
+ config.root_path = global["root-path"] if global["root-path"]
226
+ config.timestamp = global["timestamp"] if global["timestamp"]
227
+ if global["dependency-cache-path"]
228
+ config.dependency_cache_path = global["dependency-cache-path"]
229
229
  end
230
230
 
231
231
  cartage(config)
@@ -3,16 +3,16 @@
3
3
  ##
4
4
  # Call +extend+ Cartage::CLI to add the commands defined in the block.
5
5
  Cartage::CLI.extend do
6
- desc 'Echo the provided text'
6
+ desc "Echo the provided text"
7
7
  arg :TEXT, :multiple
8
- command 'echo' do |echo|
8
+ command "echo" do |echo|
9
9
  echo.hide!
10
- echo.desc 'Suppress newlines'
11
- echo.switch [ :c, 'no-newlines' ], negatable: false
10
+ echo.desc "Suppress newlines"
11
+ echo.switch [:c, "no-newlines"], negatable: false
12
12
  echo.action do |_g, options, args|
13
13
  unless cartage.quiet
14
- message = args.join(' ')
15
- if options['no-newlines'] || cartage.config(for_command: 'echo').no_newlines
14
+ message = args.join(" ")
15
+ if options["no-newlines"] || cartage.config(for_command: "echo").no_newlines
16
16
  puts message
17
17
  else
18
18
  print message
@@ -4,33 +4,33 @@
4
4
  # Call +extend+ Cartage::CLI to add the commands defined in the block.
5
5
  Cartage::CLI.extend do
6
6
  # Use +desc+ to write a description about the next command.
7
- desc 'Show information about Cartage itself'
7
+ desc "Show information about Cartage itself"
8
8
 
9
9
  # Use +long_desc+ to write a long description about the next command that can
10
10
  # be included in a generated RDoc file.
11
- long_desc <<-'DESC'
12
- Shows various bits of information about Cartage based on the running instance.
13
- Some plug-ins do run-time resolution of configuration values, so what is shown
14
- through these subcommands will not represent that resolution.
11
+ long_desc <<~'DESC'
12
+ Shows various bits of information about Cartage based on the running instance.
13
+ Some plug-ins do run-time resolution of configuration values, so what is shown
14
+ through these subcommands will not represent that resolution.
15
15
  DESC
16
16
 
17
17
  # Declare a new command with +command+ and one or more names for the command.
18
18
  # This command is available as both <tt>cartage info</tt> and <tt>cartage
19
19
  # i</tt>. The block contains the definition of the switches, flags,
20
20
  # subcommands, and actions for this command.
21
- command %w(info i) do |info|
21
+ command %w[info i] do |info|
22
22
  # Use this extension method to hide this command. GLI 2.13 does not support
23
23
  # hiding subcommands.
24
24
  info.hide!
25
25
 
26
26
  # The same GLI::DSL works on the command being created, Here, we are
27
27
  # creating <tt>cartage info plugins</tt>.
28
- info.desc 'Show the plug-ins that have been found.'
29
- info.long_desc <<-'DESC'
30
- Only plug-ins using the class plug-in protocol are found this way. Plug-ins
31
- that just provide commands are not reported as plugins.
28
+ info.desc "Show the plug-ins that have been found."
29
+ info.long_desc <<~'DESC'
30
+ Only plug-ins using the class plug-in protocol are found this way. Plug-ins
31
+ that just provide commands are not reported as plugins.
32
32
  DESC
33
- info.command 'plugins' do |plugins|
33
+ info.command "plugins" do |plugins|
34
34
  # Implement the #action as a block. It accepts three parameters: the
35
35
  # global options hash, the local command options hash, and any arguments
36
36
  # passed on the command-line.
@@ -40,16 +40,16 @@ that just provide commands are not reported as plugins.
40
40
  plugins.action do |_global, _options, _args|
41
41
  plugs = cartage.plugins.enabled
42
42
  if plugs.empty?
43
- puts 'No active plug-ins.'
43
+ puts "No active plug-ins."
44
44
  else
45
45
  plugs.map! do |plug|
46
46
  "* #{plug.plugin_name} (#{plug.version})"
47
47
  end
48
- puts <<-plugins
49
- Active Plug-ins:
50
-
51
- #{plugs.join("\n")}
52
- plugins
48
+ puts <<~PLUGINS
49
+ Active Plug-ins:
50
+
51
+ #{plugs.sort.join("\n")}
52
+ PLUGINS
53
53
  end
54
54
  end
55
55
  end
@@ -1,74 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Cartage::CLI.extend do
4
- desc 'Work with the Manifest.txt file'
5
- long_desc <<-'DESC'
6
- Commands that manage the Cartage manifest (Manifest.txt) and ignore
7
- (.cartignore) files for a project.
4
+ desc "Work with the Manifest.txt file"
5
+ long_desc <<~'DESC'
6
+ Commands that manage the Cartage manifest (Manifest.txt) and ignore
7
+ (.cartignore) files for a project.
8
8
  DESC
9
- command 'manifest' do |manifest|
10
- manifest.desc 'Check the Manifest.txt file against the current repository'
11
- manifest.long_desc <<-'DESC'
12
- Compares the current Cartage manifest against what would be calculated. If
13
- there is a difference, it will be displayed in unified ('diff -u') format and a
14
- non-zero exit status will be returned.
15
-
16
- The diff output can be suppressed by specifying -q on cartage:
17
-
18
- cartage -q manifest check
9
+ command "manifest" do |manifest|
10
+ manifest.desc "Check the Manifest.txt file against the current repository"
11
+ manifest.long_desc <<~'DESC'
12
+ Compares the current Cartage manifest against what would be calculated. If
13
+ there is a difference, it will be displayed in unified ('diff -u') format and a
14
+ non-zero exit status will be returned.
15
+
16
+ The diff output can be suppressed by specifying -q on cartage:
17
+
18
+ cartage -q manifest check
19
19
  DESC
20
- manifest.command 'check' do |check|
20
+ manifest.command "check" do |check|
21
21
  check.action do |_global, _options, _args|
22
22
  cartage.manifest.check or
23
23
  fail Cartage::CLI::QuietExit, $?.exitstatus
24
24
  end
25
25
  end
26
26
 
27
- manifest.desc 'Install or update the .cartignore file'
28
- manifest.long_desc <<-'DESC'
29
- Creates, replaces, or updates the Cartage ignore file (.cartignore). Will not
30
- modify an existing .cartignore unless the --mode is overwrite or merge.
27
+ manifest.desc "Install or update the .cartignore file"
28
+ manifest.long_desc <<~'DESC'
29
+ Creates, replaces, or updates the Cartage ignore file (.cartignore). Will not
30
+ modify an existing .cartignore unless the --mode is overwrite or merge.
31
31
  DESC
32
- manifest.command 'cartignore' do |cartignore|
33
- cartignore.desc 'Overwrite or merge an existing .cartignore'
34
- cartignore.long_desc <<-'DESC'
35
- Sets the mode for updating the ignore file. When --mode overwrite, the ignore
36
- file will be replaced with the default ignore file contents. When --mode merge,
37
- the existing ignore file will be merged with the default ignore file contents.
32
+ manifest.command "cartignore" do |cartignore|
33
+ cartignore.desc "Overwrite or merge an existing .cartignore"
34
+ cartignore.long_desc <<~'DESC'
35
+ Sets the mode for updating the ignore file. When --mode overwrite, the ignore
36
+ file will be replaced with the default ignore file contents. When --mode merge,
37
+ the existing ignore file will be merged with the default ignore file contents.
38
38
  DESC
39
- cartignore.flag :mode, must_match: %w(overwrite merge), arg_name: :MODE
39
+ cartignore.flag :mode, must_match: %w[overwrite merge], arg_name: :MODE
40
40
 
41
- cartignore.desc 'Overwrite an existing .cartignore (--mode overwrite)'
42
- cartignore.switch %i(f force overwrite), negatable: false
41
+ cartignore.desc "Overwrite an existing .cartignore (--mode overwrite)"
42
+ cartignore.switch %i[f force overwrite], negatable: false
43
43
 
44
- cartignore.desc 'Merge an existing .cartignore (--mode merge)'
45
- cartignore.switch %i(m merge), negatable: false
44
+ cartignore.desc "Merge an existing .cartignore (--mode merge)"
45
+ cartignore.switch %i[m merge], negatable: false
46
46
 
47
47
  cartignore.action do |_global, options, _args|
48
- message = if options['merge'] && options['force']
49
- 'Cannot mix options --force and --merge'
50
- elsif options['merge'] && options['mode'] == 'overwrite'
51
- 'Cannot mix option --merge and --mode overwrite'
52
- elsif options['force'] && options['mode'] == 'merge'
53
- 'Cannot mix option --force and --mode merge'
54
- end
48
+ message = if options["merge"] && options["force"]
49
+ "Cannot mix options --force and --merge"
50
+ elsif options["merge"] && options["mode"] == "overwrite"
51
+ "Cannot mix option --merge and --mode overwrite"
52
+ elsif options["force"] && options["mode"] == "merge"
53
+ "Cannot mix option --force and --mode merge"
54
+ end
55
55
 
56
56
  if message
57
57
  fail Cartage::CLI::CommandException.new(message, cartignore.name_for_help, 64)
58
58
  end
59
59
 
60
- mode = if options['merge'] || options['mode'] == 'merge'
61
- 'merge'
62
- elsif options['force'] || options['mode'] == 'overwrite'
63
- 'overwrite'
64
- end
60
+ mode = if options["merge"] || options["mode"] == "merge"
61
+ "merge"
62
+ elsif options["force"] || options["mode"] == "overwrite"
63
+ "overwrite"
64
+ end
65
65
 
66
66
  cartage.manifest.install_default_ignore(mode: mode)
67
67
  end
68
68
  end
69
69
 
70
- manifest.desc 'Show the files that will be included in the package'
71
- manifest.command 'show' do |show|
70
+ manifest.desc "Show the files that will be included in the package"
71
+ manifest.command "show" do |show|
72
72
  show.action do |_global, _options, _args|
73
73
  cartage.manifest.resolve do |tmpfile|
74
74
  puts Pathname(tmpfile).read
@@ -76,8 +76,8 @@ the existing ignore file will be merged with the default ignore file contents.
76
76
  end
77
77
  end
78
78
 
79
- manifest.desc 'Generate or update the Manifest.txt file'
80
- manifest.command %w(generate update) do |generate|
79
+ manifest.desc "Generate or update the Manifest.txt file"
80
+ manifest.command %w[generate update] do |generate|
81
81
  generate.action do |_global, _options, _args|
82
82
  cartage.manifest.generate
83
83
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ Cartage::CLI.extend do
4
+ desc "Create a release_metadata.json file in the current directory."
5
+ command %w[metadata] do |metadata|
6
+ metadata.action do |_global, _options, _args|
7
+ cartage.save_release_metadata(local: true)
8
+ end
9
+ end
10
+ end
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Cartage::CLI.extend do
4
- desc 'Create a package with Cartage based on the Manifest.'
5
- command %w(pack build) do |pack|
6
- pack.desc 'Do not check the status of the Manifest file before packaging.'
7
- pack.switch 'skip-check', negatable: false
4
+ desc "Create a package with Cartage based on the Manifest."
5
+ command %w[pack build] do |pack|
6
+ pack.desc "Do not check the status of the Manifest file before packaging."
7
+ pack.switch "skip-check", negatable: false
8
8
 
9
9
  pack.action do |_global, options, _args|
10
- unless options['skip-check'] || cartage.manifest.check
10
+ unless options["skip-check"] || cartage.manifest.check
11
11
  puts
12
- fail Cartage::CLI::CustomExit.new 'Manifest.txt is not up-to-date.',
12
+ fail Cartage::CLI::CustomExit.new "Manifest.txt is not up-to-date.",
13
13
  $?.exitstatus
14
14
  end
15
15
  cartage.build_package
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  begin
4
- require 'psych'
4
+ require "psych"
5
5
  rescue LoadError
6
6
  nil # This has been intentionally suppressed.
7
7
  end
8
- require 'ostruct'
9
- require 'pathname'
10
- require 'erb'
11
- require 'yaml'
8
+ require "ostruct"
9
+ require "pathname"
10
+ require "erb"
11
+ require "yaml"
12
12
 
13
13
  class Cartage
14
14
  # The Cartage configuration structure. The supported Cartage-wide
@@ -80,13 +80,15 @@ class Cartage
80
80
  # The contents of the configuration file are evaluated through ERB and then
81
81
  # parsed from YAML and converted to nested OpenStruct objects.
82
82
  class Config < OpenStruct
83
- #:stopdoc:
84
- DEFAULT_CONFIG_FILES = %w(
85
- ./config/cartage.yml
86
- ./cartage.yml
87
- ./.cartage.yml
88
- ).each(&:freeze).freeze
89
- #:startdoc:
83
+ # :stopdoc:
84
+ unless defined?(DEFAULT_CONFIG_FILES)
85
+ DEFAULT_CONFIG_FILES = %w[
86
+ ./config/cartage.yml
87
+ ./cartage.yml
88
+ ./.cartage.yml
89
+ ].each(&:freeze).freeze
90
+ end
91
+ # :startdoc:
90
92
 
91
93
  class << self
92
94
  # Load a Cartage configuration file as specified by +filename+. If
@@ -94,7 +96,7 @@ class Cartage
94
96
  # configuration files will be located.
95
97
  def load(filename)
96
98
  config_file = resolve_config_file(filename)
97
- config = ::YAML.load(ERB.new(config_file.read, nil, '%<>-').result)
99
+ config = ::YAML.unsafe_load(ERB.new(config_file.read, trim_mode: "%-").result)
98
100
  new(config)
99
101
  end
100
102
 
@@ -112,10 +114,10 @@ class Cartage
112
114
  filename = nil if filename == :default
113
115
 
114
116
  files = if filename
115
- [ filename ]
116
- else
117
- DEFAULT_CONFIG_FILES
118
- end
117
+ [filename]
118
+ else
119
+ DEFAULT_CONFIG_FILES
120
+ end
119
121
 
120
122
  file = files.find { |f| Pathname(f).expand_path.exist? }
121
123
 
@@ -124,7 +126,7 @@ class Cartage
124
126
  elsif filename
125
127
  fail ArgumentError, "Configuration file #{filename} does not exist."
126
128
  else
127
- StringIO.new('{}')
129
+ StringIO.new("{}")
128
130
  end
129
131
  end
130
132
 
@@ -168,13 +170,13 @@ class Cartage
168
170
  {}.tap { |h|
169
171
  object.each_pair { |k, v|
170
172
  k = case convert_keys
171
- when :to_s
172
- k.to_s
173
- when :to_sym
174
- k.to_sym
175
- else
176
- k
177
- end
173
+ when :to_s
174
+ k.to_s
175
+ when :to_sym
176
+ k.to_sym
177
+ else
178
+ k
179
+ end
178
180
  h[k.to_s] = hashify(v)
179
181
  }
180
182
  }