main 4.7.4 → 4.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/main.rb +1 -1
- data/lib/main/program/class_methods.rb +9 -8
- data/main.gemspec +1 -1
- metadata +3 -3
data/lib/main.rb
CHANGED
@@ -304,20 +304,21 @@ module Main
|
|
304
304
|
if test(?s, config_path)
|
305
305
|
@config = Map.for(YAML.load(IO.read(config_path)))
|
306
306
|
else
|
307
|
-
config =
|
308
|
-
|
307
|
+
config = args.last
|
308
|
+
lines =
|
309
|
+
case config
|
309
310
|
when Hash
|
310
|
-
|
311
|
+
config.to_yaml.split(/\n/)
|
311
312
|
when String
|
312
|
-
|
313
|
+
Util.unindent(config)
|
313
314
|
else
|
314
|
-
|
315
|
+
[]
|
315
316
|
end
|
316
|
-
|
317
|
-
dash = lines.shift
|
317
|
+
dash = lines.shift if lines.first.to_s =~ /^---/
|
318
318
|
FileUtils.mkdir_p(File.dirname(config_path))
|
319
319
|
open(config_path, 'w') do |fd|
|
320
|
-
fd.puts '
|
320
|
+
fd.puts '## you may need to edit this config!'
|
321
|
+
fd.puts '#'
|
321
322
|
fd.puts
|
322
323
|
fd.puts lines
|
323
324
|
end
|
data/main.gemspec
CHANGED
metadata
CHANGED