Class: WatirInstall::Generators::Page

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/watir_install/generators/page.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



15
16
17
# File 'lib/watir_install/generators/page.rb', line 15

def self.source_root
  "#{File.dirname(__FILE__)}/pages"
end

Instance Method Details

#gitObject



19
20
21
# File 'lib/watir_install/generators/page.rb', line 19

def git
  @git = Git.open('./') if Dir.entries('./').include?('.git')
end

#nameObject



23
24
25
# File 'lib/watir_install/generators/page.rb', line 23

def name
  Dir.pwd[/[^\/]*$/]
end

#page_filesObject



27
28
29
30
31
# File 'lib/watir_install/generators/page.rb', line 27

def page_files
  file = "#{Dir.pwd}/spec/support/pages/#{klass.downcase.gsub('::', '/')}.rb"
  template "spec/support/pages/page.rb.tt", file
  @git.add(file) if @git
end