Class: WatirSplash::Generators::NewProject
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- WatirSplash::Generators::NewProject
show all
- Includes:
- Thor::Actions, Helper
- Defined in:
- lib/watirsplash/generators/new_project.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Helper
#frameworks_banner, #supported_frameworks
Class Method Details
.source_root ⇒ Object
14
15
16
|
# File 'lib/watirsplash/generators/new_project.rb', line 14
def self.source_root
File.dirname(__FILE__) + "/templates"
end
|
Instance Method Details
#default_url? ⇒ Boolean
41
42
43
|
# File 'lib/watirsplash/generators/new_project.rb', line 41
def default_url?
url.to_s == "about:blank"
end
|
37
38
39
|
# File 'lib/watirsplash/generators/new_project.rb', line 37
def formatted_name
Thor::Util.camel_case name.gsub("-", "_")
end
|
28
29
30
31
32
33
34
35
|
# File 'lib/watirsplash/generators/new_project.rb', line 28
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
|
#generate ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/watirsplash/generators/new_project.rb', line 18
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
|