Sha256: 596ba953d4dc5e95e04c472580173e9a3008db8d5e9dda26d669d51b8df093e2

Contents?: true

Size: 1.74 KB

Versions: 10

Compression:

Stored size: 1.74 KB

Contents

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]", "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[:framework], options.load_common?])
    end

    desc "new_common", "Create a new WatirSplash common project."
    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], options[:framework]])
    end

    if File.basename(Dir.pwd) =~ /^ui-test(-common)?$/
      desc "migrate", "Migrates old WatirSplash generated project to new."
      def migrate
        WatirSplash::Generators::MigrateProject.start
      end
    end

  end  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
watirsplash-1.4.3 lib/watirsplash/cli.rb
watirsplash-1.4.2 lib/watirsplash/cli.rb
watirsplash-1.4.1 lib/watirsplash/cli.rb
watirsplash-1.4.0 lib/watirsplash/cli.rb
watirsplash-1.3.0 lib/watirsplash/cli.rb
watirsplash-1.2.1 lib/watirsplash/cli.rb
watirsplash-1.2.0 lib/watirsplash/cli.rb
watirsplash-1.1.2 lib/watirsplash/cli.rb
watirsplash-1.1.1 lib/watirsplash/cli.rb
watirsplash-1.1.0 lib/watirsplash/cli.rb