lib/watirsplash/cli.rb in watirsplash-1.0.0 vs lib/watirsplash/cli.rb in watirsplash-1.1.0

- old
+ new

@@ -1,27 +1,34 @@ require "thor" require "thor/group" require "watirsplash/generators/new_project" require "watirsplash/generators/new_common_project" require "watirsplash/generators/migrate_project" +require "watirsplash/util" module WatirSplash class CLI < Thor + framework_option = proc do + method_option :framework, :default => WatirSplash::Util.send(:default_framework).to_s, :aliases => "-f", + :desc => "Framework to use. Possible values are watir, firewatir, watir-webdriver/ie, watir-webdriver/firefox, watir-webdriver/chrome." + end - desc "new [APPLICATION_NAME]", "Creates a new WatirSplash project." + desc "new [APPLICATION_NAME]", "Create a new WatirSplash project." method_option :load_common, :type => :boolean, :default => false, :aliases => "-l", :desc => "Load WatirSplash common project automatically." method_option :url, :default => "about:blank", :aliases => "-u", :desc => "URL to open in the browser before each test. May be relative if WatirSplash common project is loaded." + framework_option.call def new(name = "Application") - WatirSplash::Generators::NewProject.start([Thor::Util.camel_case(name), options[:url], options.load_common?]) + WatirSplash::Generators::NewProject.start([Thor::Util.camel_case(name), options[:url], options[:framework], options.load_common?]) end desc "new_common", "Create a new WatirSplash common project." - method_option :url, :default => "http://localhost", - :desc => "url for the application main page" + method_option :url, :default => "http://localhost", :aliases => "-u", + :desc => "URL for the application main page." + framework_option.call def new_common - WatirSplash::Generators::NewCommonProject.start([options[:url]]) + WatirSplash::Generators::NewCommonProject.start([options[:url], options[:framework]]) end if File.basename(Dir.pwd) =~ /^ui-test(-common)?$/ desc "migrate", "Migrates old WatirSplash generated project to new." def migrate