Class: Breakfast::Generators::InstallGenerator

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

Constant Summary collapse

NODE_VERSION =
Gem::Version.new("4.1.0")

Instance Method Summary collapse

Instance Method Details

#installObject



9
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
# File 'lib/generators/breakfast/install_generator.rb', line 9

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

    puts "\n      ---> BREAKFAST INSTALLED SUCCESSFULLY\n      ---> See https://github.com/devlocker/breakfast for documentation and examples.\n\n    SUCCESS\n  else\n    puts <<-ERROR.strip_heredoc\n\n      ---> ERROR - MISSING NODE & YARN\n\n      ---> Node version >= \#{NODE_VERSION} & yarn are required to run Breakfast.\n      ---> Please install them before attempting to continue.\n      ---> https://nodejs.org\n      ---> https://yarnpkg.com/docs/install/\n\n    ERROR\n  end\nend\n".strip_heredoc