module Shoestrap::ApplicationGenerator

Constants

APPLICATION_TEMPLATE

Public Instance Methods

apply_special_sauce(application_name) click to toggle source
# File lib/shoestrap/application_generator.rb, line 57
def apply_special_sauce(application_name)
  Shell.exec "sauce apply . --appname=#{application_name.split('/').last}"
end
call_generator(name) click to toggle source
# File lib/shoestrap/application_generator.rb, line 45
def call_generator(name)
  "Shoestrap::#{"#{name}_generator".camelcase}".constantize.start
end
install_gems(gemlist) click to toggle source
# File lib/shoestrap/application_generator.rb, line 39
def install_gems(gemlist)
  Shoestrap::GemInstallGenerator.start(gemlist)
  Shell.exec('bundle')
  reload_gemfile_for_application
end
required_gems(options) click to toggle source
# File lib/shoestrap/application_generator.rb, line 49
def required_gems(options)
  Array.new.tap do |gems|
    gems << 'kuhsaft' if options[:kuhsaft]
    gems << 'bootstrap-sass' if options[:css] == 'bootstrap'
    gems << 'zurb-foundation' if options[:css] == 'foundation'
  end
end
shoestrap_generators(application_name, options) click to toggle source
# File lib/shoestrap/application_generator.rb, line 18
def shoestrap_generators(application_name, options)
  Dir.chdir(application_name) do
    # Sorry guys, a tiny little bit of setup that is very SC specific is added
    # by an additional gem we maintain privately.
    # This ugly hack allows us to run it here while not messing
    # with your setup.
    #
    if ENV['GIVE_ME_SPECIAL_SAUCE']
      apply_special_sauce(application_name)
    end

    install_gems(required_gems(options))
    generators = [
      'database', 'smacss_files', 'coffee_files', options[:css],
      'bdd', 'mailcatcher', 'simple_navigation', 'view_files'
    ]
    generators << 'kuhsaft' if options[:kuhsaft]
    generators.each{|name| call_generator name }
  end
end
start(application_name, options) click to toggle source
# File lib/shoestrap/application_generator.rb, line 12
def start(application_name, options)
  puts "[shoestrap] Generating new Rails Application #{application_name}"
  rails_new_with_template(application_name, options[:database])
  shoestrap_generators(application_name, options)
end

Private Instance Methods

rails_new_with_template(application_name, database) click to toggle source
# File lib/shoestrap/application_generator.rb, line 62
def rails_new_with_template(application_name, database)
  Shell.exec "rails new #{application_name} -m #{APPLICATION_TEMPLATE} -d #{database}"
end
reload_gemfile_for_application() click to toggle source
# File lib/shoestrap/application_generator.rb, line 66
def reload_gemfile_for_application
  ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, 'Gemfile')
  require 'bundler'
  Bundler.require(:default)
end