Class: Flynn::Recipes::NodeWeb

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/flynn/recipes/node_web.rb

Instance Method Summary collapse

Methods included from Helpers

#create_file, #executable_path, #inside, #run

Instance Method Details

#create(app_name, options = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/flynn/recipes/node_web.rb', line 9

def create(app_name, options=[])
  namespace = lambda do
    @app_name = app_name
    @app_description = ""

    #TODO: make this pull from your git details if they exist
    @app_author = "You"
    @app_author_email = "[email protected]"
  end.call

  check_for_node
  check_for_npm

  run("git clone https://github.com/vertis/flynn-node-template.git #{app_name}")
  inside app_name do
    template = ERB.new(File.read('package.json.erb'), nil)
    create_file('package.json', template.result(namespace.send(:binding)))
    run('rm package.json.erb')
    run('git remote rm origin 2>/dev/null >/dev/null') # Borrowed from https://github.com/mwotton/instigator
    run("npm install")
  end
end