lib/speckle/cli/environment.rb in speckle-0.1.22 vs lib/speckle/cli/environment.rb in speckle-0.1.23

- old
+ new

@@ -112,18 +112,22 @@ begin parser.parse!(args) if options.action.nil? - spec_dir = "#{options.cwd}/spec" - if File.directory?(spec_dir) - args << 'spec' - options.action = :compile_and_test + if args_empty?(args) + spec_dir = "#{options.cwd}/spec" + if File.directory?(spec_dir) + args << 'spec' + options.action = :compile_and_test + else + options.action = :show_no_spec_dir + end else - options.action = :show_no_spec_dir + options.action = :compile_and_test end - elsif action_needs_args?(options.action) and args.empty? + elsif action_needs_args?(options.action) and args_empty?(args) spec_dir = "#{options.cwd}/spec" if File.directory?(spec_dir) args << 'spec' options.action = :compile_and_test end @@ -161,9 +165,13 @@ end end end libs.uniq.join(':') + end + + def args_empty?(args) + args.empty? || (args.length == 1 && args[0] == '') end end end end