Class: FluteCLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/flute/cli.rb

Instance Method Summary collapse

Instance Method Details

#new(name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/flute/cli.rb', line 6

def new(name)
  dirs = [
    'tmp',
    'log',
    'config',
    'lib',
    'app',
    'app/utils',
  ]
  create_dir(name, dirs)
  FileUtils.touch "#{name}/tmp/.keep"
  FileUtils.touch "#{name}/log/.keep"

  copy_template 'Gemfile', "#{name}/Gemfile"
  copy_template 'main.rb', "#{name}/main.rb"
  copy_template 'Rakefile', "#{name}/Rakefile"

  FileUtils.cp_r template_path('items'), "#{name}/app/items"
  FileUtils.cp_r template_path('spiders'), "#{name}/app/spiders"
  FileUtils.cp_r template_path('middlewares'), "#{name}/app/middlewares"

  puts "cd #{name}"
  puts "bundle install"
  puts "rake start"
end