Skip to content

Commit

Permalink
Clean up formatting of questions
Browse files Browse the repository at this point in the history
  • Loading branch information
kfaustino committed Jan 14, 2011
1 parent 829cb60 commit 0d0dd7d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
17 changes: 11 additions & 6 deletions lib/template/core_extensions.rb
Expand Up @@ -9,22 +9,27 @@ def initialize_templater
@post_bundler_strategies = []
@template_options = {}
end

def execute_post_bundler_strategies
post_bundler_strategies.each {|strategy| strategy.call }
end

def load_options
@template_options[:design] = ask("Which design framework? [none(default), compass]: ").downcase
@template_options[:design] = "none" if @template_options[:design].nil?
say "Would you like to use a design framework?\n", Thor::Shell::Color::BLUE
print_table [ ['Option','Framework'], ['1', 'Compass with blueprint semantic'] ], :ident => 2
design_input = ask("Option: ", Thor::Shell::Color::BLUE)
@template_options[:design] = case design_input
when "1"
:compass
else
:none
end
end

def recipe(name)
File.join File.dirname(__FILE__), 'recipes', "#{name}.rb"
end

# TODO: Refactor loading of files

def load_snippet(name, group)
path = File.expand_path name, snippet_path(group)
File.read path
Expand All @@ -33,7 +38,7 @@ def load_snippet(name, group)
def load_template(name, group)
path = File.expand_path name, template_path(group)
File.read path
end
end

def snippet_path(name)
File.join(File.dirname(__FILE__), 'snippets', name)
Expand Down
2 changes: 1 addition & 1 deletion lib/template/recipes/design.rb
@@ -1,4 +1,4 @@
if template_options[:design] == "compass"
if template_options[:design] == :compass
gem 'compass'

# TODO: support more than one framework from compass
Expand Down
4 changes: 3 additions & 1 deletion lib/template/templater.rb
Expand Up @@ -5,8 +5,10 @@
required_recipes = %w(default mongoid jquery haml rspec factory_girl remarkable)
required_recipes.each {|required_recipe| apply recipe(required_recipe)}

say("\nInitial generation complete\n", Thor::Shell::Color::YELLOW)

load_options
apply(recipe('cucumber')) if yes?("Would you like to add integration testing with Cucumber? [y|n]: ", Thor::Shell::Color::GREEN)
apply(recipe('cucumber')) if yes?("\nWould you like to add integration testing with Cucumber? [y|n]: ", Thor::Shell::Color::BLUE)
apply recipe('design')

run 'bundle install'
Expand Down

0 comments on commit 0d0dd7d

Please sign in to comment.