Sha256: 093f3ae08adaf76544cc811fdc190ccdd766df64d43b15ed7f237b8c6d92f0fa
Contents?: true
Size: 1.33 KB
Versions: 18
Compression:
Stored size: 1.33 KB
Contents
require "uri" require "watirsplash/version" module WatirSplash module Generators class NewProject < Thor::Group include Thor::Actions include Helper argument :name argument :url argument :framework def self.source_root File.dirname(__FILE__) + "/templates" end def generate directory("new_project", name) template("../../../../Gemfile", "#{name}/Gemfile") gsub_file("#{name}/Gemfile", "gemspec", %Q{gem "watirsplash", "#{WatirSplash::Version::WATIRSPLASH}"}) gsub_file("#{name}/Gemfile", /WatirSplash::Version::WATIR_WEBDRIVER/, "\"#{WatirSplash::Version::WATIR_WEBDRIVER}\"") gsub_file("#{name}/Gemfile", /WatirSplash::Version::WATIR/, "\"#{WatirSplash::Version::WATIR}\"") gsub_file("#{name}/Gemfile", /WatirSplash::Version::WIN32SCREENSHOT/, "\"#{WatirSplash::Version::WIN32SCREENSHOT}\"") end def formatted_url uri = URI.parse(url) if !default_url? && uri.relative? %Q[URI.join(#{formatted_name}::Config::URL, "#{uri}").to_s] else %Q["#{uri}"] end end def formatted_name Thor::Util.camel_case name.gsub("-", "_") end def default_url? url.to_s == "about:blank" end end end end
Version data entries
18 entries across 18 versions & 1 rubygems