Class: BDDGen::App

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bddgen/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/bddgen/app.rb', line 7

def self.source_root
  File.expand_path('../../templates', File.dirname(__FILE__))
end

Instance Method Details

#cucumberObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bddgen/app.rb', line 12

def cucumber
  init_gemfile
  append_gem 'cucumber'

  init_rakefile
  append_task BDDGen::Tasks.cucumber
  
  add_file "features/step_definitions/#{project_name}_steps.rb"
  copy_file "features/support/env.rb"
  template "features/support/helpers.erb", "features/support/helpers.rb"
end

#project(name) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/bddgen/app.rb', line 50

def project(name)
  empty_directory name
  self.destination_root = name

  empty_directory "lib/#{name}"
  
  init_gitignore
  init_gemfile
  init_rakefile
  
  add_file "CHANGELOG"
  add_file "README.markdown"
  
  template "lib/project.erb", "lib/#{name}.rb"
  template "lib/version.erb", "lib/version.rb"
  
  cucumber if options.cucumber?
  rspec    if options.rspec?
  yard     if options.yard?
end

#rspecObject



25
26
27
28
29
30
31
32
33
# File 'lib/bddgen/app.rb', line 25

def rspec
  init_gemfile
  append_gem 'rspec'

  init_rakefile
  append_task BDDGen::Tasks.rspec
  
  copy_file "spec/spec_helper.rb"
end

#yardObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/bddgen/app.rb', line 36

def yard
  init_gemfile
  append_gem 'yard'
  
  init_rakefile
  append_task BDDGen::Tasks.yard(project_name)

  init_gitignore
  append_file ".gitignore", "doc/*\n"
  append_file ".gitignore", ".yardoc\n"
end