Class: Turbo::Generator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Turbo::Generator
- Includes:
- Thor::Actions
- Defined in:
- lib/turbo/generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_gitignore ⇒ Object
- #create_root ⇒ Object
- #create_tests_or_specs ⇒ Object
- #initialize_git_repo ⇒ Object
Class Method Details
.say_step(message) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/turbo/generator.rb', line 16 def self.say_step() @step = (@step || 0) + 1 class_eval <<-METHOD, __FILE__, __LINE__ + 1 def step_#{@step} #{"puts" if @step > 1} say_status "STEP #{@step}", #{.inspect} end METHOD end |
.source_root ⇒ Object
12 13 14 |
# File 'lib/turbo/generator.rb', line 12 def self.source_root @_source_root ||= File.('../templates', __FILE__) end |
Instance Method Details
#create_gitignore ⇒ Object
44 45 46 |
# File 'lib/turbo/generator.rb', line 44 def create_gitignore template "gitignore", ".gitignore" end |
#create_root ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/turbo/generator.rb', line 36 def create_root self.destination_root = File.(path, destination_root) set_accessors! directory "root", "." FileUtils.cd(destination_root) end |
#create_tests_or_specs ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/turbo/generator.rb', line 48 def create_tests_or_specs directory test_path empty_directory dummy_path empty_directory File.join(dummy_path, 'config') empty_directory File.join(dummy_path, 'db') empty_directory File.join(dummy_path, 'log') empty_directory File.join(dummy_path, 'public') template 'dummy/routes.rb', File.join(dummy_path, 'config', 'routes.rb') template 'dummy/database.yml', File.join(dummy_path, 'config', 'database.yml') template 'dummy/schema.rb', File.join(dummy_path, 'db', 'schema.rb') create_file File.join(dummy_path, 'public', 'favicon.ico') create_file File.join(dummy_path, 'log', '.gitignore') do '*.log' end end |
#initialize_git_repo ⇒ Object
64 65 66 67 68 |
# File 'lib/turbo/generator.rb', line 64 def initialize_git_repo run 'git init' run 'git add .' run 'git commit -am "initial commit"' end |