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



10
11
12
# File 'lib/bddgen/app.rb', line 10

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

Instance Method Details

#cucumberObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bddgen/app.rb', line 20

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



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/bddgen/app.rb', line 58

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/project/version.erb", "lib/#{name}/version.rb"
  
  cucumber if options.cucumber?
  rspec    if options.rspec?
  yard     if options.yard?
end

#rspecObject



33
34
35
36
37
38
39
40
41
# File 'lib/bddgen/app.rb', line 33

def rspec
  init_gemfile
  append_gem 'rspec'

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

#versionObject



15
16
17
# File 'lib/bddgen/app.rb', line 15

def version
  say BDDGen::VERSION
end

#yardObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/bddgen/app.rb', line 44

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