lib/cukedep/application.rb in cukedep-0.0.8 vs lib/cukedep/application.rb in cukedep-0.1.03

- old
+ new

@@ -1,8 +1,7 @@ # File: application.rb -require 'yaml' require_relative 'cli/cmd-line' require_relative 'config' require_relative 'gherkin-listener' require_relative 'gherkin-facade' @@ -14,21 +13,21 @@ class Application attr_reader(:proj_dir) public # Entry point for the application object. - def start!(theCmdLineArgs) + def run!(theCmdLineArgs) options = options_from(theCmdLineArgs) create_default_cfg if options[:setup] - config = load_cfg + config = Config.load_cfg(Cukedep::YMLFilename) # Complain if no project dir is specified if config.proj_dir.nil? || config.proj_dir.empty? if options[:project] @proj_dir = options[:project] else - msg_p1 = "No project dir specified via 'Cukedep::YMLFilename'" + msg_p1 = "No project dir specified in '#{Cukedep::YMLFilename}'" msg_p2 = ' nor via --project option.' fail(StandardError, msg_p1 + msg_p2) end else @proj_dir = config.proj_dir @@ -60,22 +59,23 @@ puts "OK to overwrite file #{Cukedep::YMLFilename}." puts '(Y/N)?' answer = $stdin.gets exit if answer =~ /^\s*[Nn]\s*$/ end - File.open(Cukedep::YMLFilename, 'w') { |f| YAML.dump(Config.default, f) } + Config.default.write(Cukedep::YMLFilename) + exit end - +=begin # Read the .cukedep.yml file in the current working directory def load_cfg() if File.exist?(Cukedep::YMLFilename) YAML.load_file(Cukedep::YMLFilename) else Config.default end end - +=end # Parse the feature files (with the specified external encoding) def parse_features(external_encoding) # Create a Gherkin listener listener = Cukedep::GherkinListener.new