Class: BrowserSyncRails::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#setupObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/browser_sync_rails/install_generator.rb', line 8

def setup
  unless exist_command? 'npm'
    puts 'You should have Node installed to continue. Download page: https://nodejs.org/en/download/'
    puts 'Or you can also install via NVM - Node Version Manager -. Check it out: https://github.com/creationix/nvm'
    exit
  end

  unless exist_command? 'browser-sync'
    puts 'Installing browser sync. Just a moment.'
    exec 'npm i -g browser-sync'
  end

  create_file "config/browser_sync.yml"
end