Class: Belly::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/belly/cli/init.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Init

Returns a new instance of Init.



19
20
21
# File 'lib/belly/cli/init.rb', line 19

def initialize(options)
  @options = options
end

Instance Method Details

#run(ui) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/belly/cli/init.rb', line 23

def run(ui)
  unless File.exists?('features/support')
    ui.die("It doesn't look like you are in a project with Cucumber features")
  end

  create_file('features/support/belly.rb') do
    <<-EOF
require 'belly/for/cucumber'
EOF
  end
  
  create_file('.belly') do
    <<-EOF
hub: #{default_config.host}:#{default_config.port}
project: #{default_config.project}
user:
  name: #{default_config.user[:name]}
  email: #{default_config.user[:email]}
EOF
  end

  puts
  puts "Lovely. Your project is now initialized for use with Belly."
  puts "You can edit your project's settings by editing the .belly file in this folder."
end