Class: Eyeballs::ScaffoldGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Eyeballs::ScaffoldGenerator
show all
- Includes:
- AppDetector, Thor::Actions
- Defined in:
- lib/eyeballs/scaffold_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#app_path, #new_app_path, #prefix, #public_path, #rack_app?
Class Method Details
.destination_root ⇒ Object
15
16
17
|
# File 'lib/eyeballs/scaffold_generator.rb', line 15
def self.destination_root
"#{name}"
end
|
.source_root ⇒ Object
11
12
13
|
# File 'lib/eyeballs/scaffold_generator.rb', line 11
def self.source_root
File.join(File.dirname(__FILE__), '..', '..')
end
|
Instance Method Details
#attributes ⇒ Object
41
42
43
|
# File 'lib/eyeballs/scaffold_generator.rb', line 41
def attributes
AttributeCollector.new(attrs)
end
|
#build_the_controller ⇒ Object
27
28
29
|
# File 'lib/eyeballs/scaffold_generator.rb', line 27
def build_the_controller
template "templates/scaffold_controller.js", "#{app_path}/app/controllers/#{name.downcase.pluralize}_controller.js"
end
|
#build_the_model ⇒ Object
23
24
25
|
# File 'lib/eyeballs/scaffold_generator.rb', line 23
def build_the_model
template "templates/model.js", "app/models/#{name.downcase}.js"
end
|
#build_the_views ⇒ Object
31
32
33
34
35
|
# File 'lib/eyeballs/scaffold_generator.rb', line 31
def build_the_views
template "templates/scaffold_index.html", "#{public_path}/#{name.downcase.pluralize}.html"
template "templates/scaffold_partial.html.mustache", "#{app_path}/app/views/#{name.downcase.pluralize}/_#{name.downcase}.html.mustache"
template "templates/scaffold_edit.html.mustache", "#{app_path}/app/views/#{name.downcase.pluralize}/edit.html.mustache"
end
|
#farewell ⇒ Object
37
38
39
|
# File 'lib/eyeballs/scaffold_generator.rb', line 37
def farewell
$stdout.puts "Your scaffold is ready to rumble!"
end
|
#greeting ⇒ Object
19
20
21
|
# File 'lib/eyeballs/scaffold_generator.rb', line 19
def greeting
$stdout.puts "Creating new eyeballs.js scaffold, model controller and views for #{name}"
end
|