Sha256: 2e00ea1ba0afad11c6f8eacdc7b2c7bd04600d64386b9378076c4b2ae8e6fb32

Contents?: true

Size: 1019 Bytes

Versions: 10

Compression:

Stored size: 1019 Bytes

Contents

require "uri"

module WatirSplash
  module Generators
    class NewProject < Thor::Group
      include Thor::Actions

      argument :name 
      argument :url
      argument :framework
      argument :load_common, :optional => true

      def self.source_root
        File.dirname(__FILE__) + "/templates"
      end

      def generate
        directory("new_project", "ui-test")
      end

      def load_common_cmd
        cmd = "WatirSplash::Util.load_common"
        cmd = "# Uncomment the following line to load functionality from ui-test-common\n# " + cmd unless load_common
        cmd
      end

      def formatted_name
        Thor::Util.snake_case(name)
      end

      def formatted_url
        uri = URI.parse(url)
        if load_common && !default_url? && uri.relative?
          %Q[Config.full_url("#{uri}")] 
        else
          %Q["#{uri}"]
        end
      end

      def default_url?
        url.to_s == "about:blank"
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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