Class: Backbone::Generators::ScaffoldGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Backbone::Generators::ScaffoldGenerator
show all
- Includes:
- Helpers
- Defined in:
- lib/generators/backbone/scaffold/scaffold_generator.rb
Instance Method Summary
collapse
Methods included from Helpers
#app_filename, #app_name, #asset_path, #collection_namespace, #js_path, #model_namespace, #namespaced_path, #namespaces, #rails_app_name, #router_namespace, #template_namespace, #template_path, #view_namespace
Instance Method Details
#create_backbone_collection ⇒ Object
25
26
27
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 25
def create_backbone_collection
template "collection#{@ext}", File.join(js_path, namespaced_path, "collections", "#{file_name.pluralize}#{@ext}")
end
|
#create_backbone_model ⇒ Object
21
22
23
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 21
def create_backbone_model
template "model#{@ext}", File.join(js_path, namespaced_path, "models", "#{file_name.singularize}#{@ext}")
end
|
#create_backbone_router ⇒ Object
29
30
31
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 29
def create_backbone_router
template "router#{@ext}", File.join(js_path, namespaced_path, "routers", "#{file_name.pluralize}#{@ext}")
end
|
#create_backbone_template ⇒ Object
38
39
40
41
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 38
def create_backbone_template
empty_directory File.join(template_path, namespaced_path, file_name.pluralize)
template "template.jst#{@jst}", File.join(template_path, namespaced_path, file_name.pluralize, "index.jst#{@jst}")
end
|
#create_backbone_view ⇒ Object
33
34
35
36
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 33
def create_backbone_view
empty_directory File.join(js_path, namespaced_path, "views", file_name.pluralize)
template "view#{@ext}", File.join(js_path, namespaced_path, 'views', file_name.pluralize, "index#{@ext}")
end
|
#parse_options ⇒ Object
15
16
17
18
19
|
# File 'lib/generators/backbone/scaffold/scaffold_generator.rb', line 15
def parse_options
js = options[:javascript]
@ext = js ? ".js" : ".js.coffee"
@jst = js ? ".ejs" : ".eco"
end
|