Class: Breakfast::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/breakfast/install_generator.rb

Constant Summary collapse

NODE_VERSION =
"v4.1.1"
NPM_VERSION =
"3.10.6"

Instance Method Summary collapse

Instance Method Details

#installObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/generators/breakfast/install_generator.rb', line 10

def install
  if node_prerequisites_installed?
    create_brunch_config
    create_package_json
    create_directory_structure
    create_app_js_file
    create_app_scss_file
    create_gitkeep_files
    run_npm_install
    add_node_modules_to_gitignore

    puts <<-SUCCESS.strip_heredoc

      ---> BREAKFAST INSTALLED SUCCESSFULLY
      ---> See https://github.com/devlocker/breakfast for documentation and examples.

    SUCCESS
  else
    puts <<-ERROR.strip_heredoc

      ---> ERROR - MISSING NODE & NPM

      ---> Node version >= #{NODE_VERSION} & npm version >= #{NPM_VERSION} are required to run Breakfast.
      ---> Please install them before attempting to continue.
      ---> https://nodejs.org
      ---> https://npmjs.org

    ERROR
  end
end