Module: Shoestrap::ApplicationGenerator
- Extended by:
- ApplicationGenerator
- Included in:
- ApplicationGenerator
- Defined in:
- lib/shoestrap/application_generator.rb
Constant Summary collapse
- APPLICATION_TEMPLATE =
File.join(File.dirname(__FILE__), '../../templates/application_generator/application_template.rb')
Instance Method Summary collapse
- #apply_special_sauce(application_name) ⇒ Object
- #call_generator(name) ⇒ Object
- #install_gems(gemlist) ⇒ Object
- #required_gems(options) ⇒ Object
- #shoestrap_generators(application_name, options) ⇒ Object
- #start(application_name, options) ⇒ Object
Instance Method Details
#apply_special_sauce(application_name) ⇒ Object
57 58 59 |
# 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) ⇒ Object
45 46 47 |
# File 'lib/shoestrap/application_generator.rb', line 45 def call_generator(name) "Shoestrap::#{"#{name}_generator".camelcase}".constantize.start end |
#install_gems(gemlist) ⇒ Object
39 40 41 42 43 |
# 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) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/shoestrap/application_generator.rb', line 49 def required_gems() Array.new.tap do |gems| gems << 'kuhsaft' if [:kuhsaft] gems << 'bootstrap-sass' if [:css] == 'bootstrap' gems << 'zurb-foundation' if [:css] == 'foundation' end end |
#shoestrap_generators(application_name, options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/shoestrap/application_generator.rb', line 18 def shoestrap_generators(application_name, ) 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()) generators = [ 'database', 'smacss_files', 'coffee_files', [:css], 'bdd', 'mailcatcher', 'simple_navigation', 'view_files' ] generators << 'kuhsaft' if [:kuhsaft] generators.each{|name| call_generator name } end end |
#start(application_name, options) ⇒ Object
12 13 14 15 16 |
# File 'lib/shoestrap/application_generator.rb', line 12 def start(application_name, ) puts "[shoestrap] Generating new Rails Application #{application_name}" rails_new_with_template(application_name, [:database]) shoestrap_generators(application_name, ) end |