Class: HappySeed::Generators::ReactGenerator

Inherits:
HappySeedGenerator show all
Defined in:
lib/generators/happy_seed/react/react_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fingerprintObject



8
9
10
# File 'lib/generators/happy_seed/react/react_generator.rb', line 8

def self.fingerprint
  gem_available?( 'react_on_rails' )
end

Instance Method Details

#install_reactObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/happy_seed/react/react_generator.rb', line 12

def install_react
  return if already_installed

  gem 'react_on_rails'

  Bundler.with_clean_env do
    run "bundle install --without production"
  end

  say_status :react, "Adding files to git", :green

  git add: "."
  git commit: "-a -m 'Adding react_on_rails'"

  generate 'react_on_rails:install'

  system "npm install"

  directory  "."

  say_status :react, "Now run: foreman start -f Procfile.dev", :green
end