Class: TinyRails::Commands::New
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- TinyRails::Commands::New
show all
- Includes:
- Thor::Actions, Actions
- Defined in:
- lib/tiny-rails/commands/new.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Actions
#addon, #application, #enable_asset_pipeline!, #gem, #initializer, #migration, #route
Class Method Details
.banner ⇒ Object
16
17
18
|
# File 'lib/tiny-rails/commands/new.rb', line 16
def self.banner
"tiny-rails new #{self.arguments.map(&:usage).join(' ')} [options]"
end
|
.source_root ⇒ Object
TODO: Move to a base command
12
13
14
|
# File 'lib/tiny-rails/commands/new.rb', line 12
def self.source_root
"#{File.expand_path('../../../../templates', __FILE__)}/"
end
|
.templates ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/tiny-rails/commands/new.rb', line 20
def self.templates
@templates ||= %w(
.gitignore
Gemfile
boot.rb
application_controller.rb
index.html.erb
server
config.ru
)
end
|
Instance Method Details
#create_root ⇒ Object
32
33
34
35
36
|
# File 'lib/tiny-rails/commands/new.rb', line 32
def create_root
self.destination_root = File.expand_path(app_path)
empty_directory '.'
FileUtils.cd destination_root
end
|
#scaffold ⇒ Object
38
39
40
41
42
43
|
# File 'lib/tiny-rails/commands/new.rb', line 38
def scaffold
self.class.templates.each do |template|
template(template)
end
chmod 'server', 0755
end
|