Sha256: 95379ae43e82b376500c1cd5e6a566be9676e596cc5b9beeb9ebd03f5cbc798b

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

module HappySeed
  module Generators
    class SplashGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)

      def install_landing_page
        unless gem_available?( "bootstrap-sass" )
          puts "The splash generator requires bootstrap"

          if yes?( "Run happy_seed:bootstrap now?" )
            generate "happy_seed:bootstrap"
          else
            exit
          end
        end

        gem 'gibbon'

        Bundler.with_clean_env do
          run "bundle install"
        end

        remove_file 'public/index.html'

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

        directory 'app'
        directory "docs"
        append_to_file ".env", "MAILCHIMP_API_KEY=\nMAILCHIMP_SPLASH_SIGNUP_LIST_ID=\n"
      end

      private    
        def gem_available?(name)
           Gem::Specification.find_by_name(name)
        rescue Gem::LoadError
           false
        rescue
           Gem.available?(name)
        end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
happy_seed-0.0.5 lib/generators/happy_seed/splash/splash_generator.rb
happy_seed-0.0.4 lib/generators/happy_seed/splash/splash_generator.rb
happy_seed-0.0.3 lib/generators/happy_seed/splash/splash_generator.rb
happy_seed-0.0.2 lib/generators/happy_seed/splash/splash_generator.rb
happy_seed-0.0.1 lib/generators/happy_seed/splash/splash_generator.rb