Class: HappySeed::Generators::SplashGenerator

Inherits:
HappySeedGenerator
  • Object
show all
Defined in:
lib/generators/happy_seed/splash/splash_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fingerprintObject



8
9
10
# File 'lib/generators/happy_seed/splash/splash_generator.rb', line 8

def self.fingerprint
  File.exists?( "docs/README.02.splash.rdoc" )
end

Instance Method Details

#install_landing_pageObject



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
40
41
42
43
# File 'lib/generators/happy_seed/splash/splash_generator.rb', line 12

def install_landing_page
  return if already_installed

  require_generator BootstrapGenerator

  gem 'gibbon'

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

  remove_file 'public/index.html'

  gsub_file "config/routes.rb", /\s*root.*\n/, "\n"
  route "root 'splash#index'"
  route "get '/splash' => 'splash#index'"
  route "post '/signup' => 'splash#signup', as: :splash_signup"

  directory 'app'
  directory "docs"
  directory "spec"
	directory "vendor"

  append_to_file "config/initializers/assets.rb", "Rails.application.config.assets.precompile += %w( splash.css scrollReveal.js )\n"

  begin
    add_env "MAILCHIMP_API_KEY"
    add_env "MAILCHIMP_SPLASH_SIGNUP_LIST_ID"
  rescue
    say_status :env, "Unable to add template .env files", :red
  end
end