Class: Venom::Generators::Workshop

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



15
16
17
# File 'lib/venom/generators/workshop.rb', line 15

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

Instance Method Details

#copy_baseObject



83
84
85
86
87
88
89
# File 'lib/venom/generators/workshop.rb', line 83

def copy_base
  if use_library
    template "base.rb.tt", "#{name}/lib/definitions/base.rb"
  else
    template "base.rb.tt", "#{name}/specs/definitions/base.rb"
  end
end

#copy_driverObject



67
68
69
# File 'lib/venom/generators/workshop.rb', line 67

def copy_driver
  template "driver.rb.tt", "#{name}/specs/support/driver.rb"
end

#copy_dsl_runnerObject



55
56
57
# File 'lib/venom/generators/workshop.rb', line 55

def copy_dsl_runner
  copy_file "cucumber.yml", "#{name}/cucumber.yml"
end

#copy_envObject



71
72
73
# File 'lib/venom/generators/workshop.rb', line 71

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

#copy_errorsObject



79
80
81
# File 'lib/venom/generators/workshop.rb', line 79

def copy_errors
  copy_file "errors.rb", "#{name}/specs/support/errors.rb"
end

#copy_gemfileObject



63
64
65
# File 'lib/venom/generators/workshop.rb', line 63

def copy_gemfile
  template "Gemfile.tt", "#{name}/Gemfile"
end

#copy_hooksObject



75
76
77
# File 'lib/venom/generators/workshop.rb', line 75

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

#copy_rakefileObject



59
60
61
# File 'lib/venom/generators/workshop.rb', line 59

def copy_rakefile
  copy_file "Rakefile", "#{name}/Rakefile"
end

#create_definitions_directoryObject



47
48
49
50
51
52
53
# File 'lib/venom/generators/workshop.rb', line 47

def create_definitions_directory
  if use_library
    empty_directory("#{name}/lib/definitions")
  else
    empty_directory("#{name}/specs/definitions")
  end
end

#create_library_directoryObject



29
30
31
# File 'lib/venom/generators/workshop.rb', line 29

def create_library_directory
  empty_directory("#{name}/lib") if use_library
end

#create_workshop_directoryObject



25
26
27
# File 'lib/venom/generators/workshop.rb', line 25

def create_workshop_directory
  empty_directory(name)
end

#create_workshop_structureObject



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/venom/generators/workshop.rb', line 33

def create_workshop_structure
  empty_directory("#{name}/specs")
  empty_directory("#{name}/specs/support")
  if use_library
    empty_directory("#{name}/lib/test_steps")
    empty_directory("#{name}/lib/test_data")
    empty_directory("#{name}/lib/test_helpers")
  else
    empty_directory("#{name}/specs/support/test_steps")
    empty_directory("#{name}/specs/support/test_data")
    empty_directory("#{name}/specs/support/test_helpers")
  end
end

#spit_back_valuesObject



19
20
21
22
23
# File 'lib/venom/generators/workshop.rb', line 19

def spit_back_values
  puts "Create workshop '#{name}' using #{driver}."
  puts "Use a separate library." if use_library
  puts "Restart browser for each scenario." if restart_browser
end