Class: CwTestGen::Generators::Project

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



13
14
15
# File 'lib/cwtestgen/generators/project.rb', line 13

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

Instance Method Details

#copy_cucumber_ymlObject



21
22
23
# File 'lib/cwtestgen/generators/project.rb', line 21

def copy_cucumber_yml
  template "cucumber.yml.tt", "#{name}/cucumber.yml"
end

#copy_envObject



43
44
45
# File 'lib/cwtestgen/generators/project.rb', line 43

def copy_env
  template "env.rb.tt", "#{name}/features/support/env.rb"
end

#copy_hooksObject



39
40
41
# File 'lib/cwtestgen/generators/project.rb', line 39

def copy_hooks
  template "hooks.rb.tt", "#{name}/features/support/hooks.rb"
end

#copy_page_templatesObject



51
52
53
54
55
56
57
58
# File 'lib/cwtestgen/generators/project.rb', line 51

def copy_page_templates
  if gen_page_templates
    template "clockwork_page.rb.tt", "#{name}/features/support/pages/clockwork_page.rb" 
    template "home_page.rb.tt", "#{name}/features/support/pages/home_page.rb"
    template "sample_cucumber.feature.tt", "#{name}/features/sample_cucumber.feature"
    template "sample_steps.rb.tt", "#{name}/features/support/step_definitions/#{name}_steps.rb"
  end
end

#create_cucumber_directoriesObject



25
26
27
28
29
# File 'lib/cwtestgen/generators/project.rb', line 25

def create_cucumber_directories
  empty_directory("#{name}/features")
  empty_directory("#{name}/features/support")
  empty_directory("#{name}/features/step_definitions")
end

#create_log_directoryObject



31
32
33
# File 'lib/cwtestgen/generators/project.rb', line 31

def create_log_directory
  empty_directory("#{name}/features/logs")
end

#create_pages_directoryObject



47
48
49
# File 'lib/cwtestgen/generators/project.rb', line 47

def create_pages_directory
  empty_directory("#{name}/features/support/pages")
end

#create_screenshot_directoryObject



35
36
37
# File 'lib/cwtestgen/generators/project.rb', line 35

def create_screenshot_directory
  empty_directory("#{name}/features/screenshots")
end


60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cwtestgen/generators/project.rb', line 60

def create_symlink_to_lib
  if gen_symlink_to_lib
    if File.symlink?("#{name}/features/support/lib")
      return nil
    end

    if File.directory?("../lib")
      File.symlink("../../../../lib","#{name}/features/support/lib")
    end
  end
end

#create_top_directoryObject



17
18
19
# File 'lib/cwtestgen/generators/project.rb', line 17

def create_top_directory
  empty_directory(name)
end