Class: Jazz::Generators::Scaffold
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Jazz::Generators::Scaffold
- Includes:
- Thor::Actions
- Defined in:
- lib/jazz/generators/scaffold/scaffold.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #convert_attributes ⇒ Object
- #create ⇒ Object
- #create_controller ⇒ Object
- #create_database ⇒ Object
- #create_fixture ⇒ Object
- #create_helper ⇒ Object
- #create_model ⇒ Object
- #create_scenario ⇒ Object
- #create_views ⇒ Object
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 6 def attributes @attributes end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 6 def name @name end |
Class Method Details
.source_root ⇒ Object
8 9 10 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 8 def self.source_root File.join(File.dirname(__FILE__)) end |
Instance Method Details
#convert_attributes ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 44 def convert_attributes @attribute_hash = Hash.new attributes.each do |attribute| val = attribute.split(':') if val[0] && val[1] @attribute_hash[val[0]] = val[1] end end self.attributes = {} self.attributes = @attribute_hash end |
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 12 def create convert_attributes create_model create_database create_fixture create_controller create_helper create_scenario create_views end |
#create_controller ⇒ Object
59 60 61 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 59 def create_controller template "templates/controller.js", "app/controllers/#{name.downcase.pluralize}_controller.js" end |
#create_database ⇒ Object
28 29 30 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 28 def create_database template "templates/database.js", "db/create/create_#{name.pluralize.downcase}.js" end |
#create_fixture ⇒ Object
32 33 34 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 32 def create_fixture template "templates/fixture.js", "db/fixtures/#{name.pluralize.downcase}.js" end |
#create_helper ⇒ Object
63 64 65 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 63 def create_helper template "templates/helper.js", "app/helpers/#{name.downcase.pluralize}_helper.js" end |
#create_model ⇒ Object
24 25 26 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 24 def create_model template "templates/model.js", "app/models/#{name.singularize.downcase}.js" end |
#create_scenario ⇒ Object
67 68 69 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 67 def create_scenario template "templates/scenario.js", "app/scenarios/#{name.downcase.pluralize}_scenario.js" end |
#create_views ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/jazz/generators/scaffold/scaffold.rb', line 36 def create_views template "templates/view_form.handlebars", "app/views/#{name.pluralize.downcase}/_form.handlebars" template "templates/view_edit.handlebars", "app/views/#{name.pluralize.downcase}/edit.handlebars" template "templates/view_index.handlebars", "app/views/#{name.pluralize.downcase}/index.handlebars" template "templates/view_new.handlebars", "app/views/#{name.pluralize.downcase}/new.handlebars" template "templates/view_show.handlebars", "app/views/#{name.pluralize.downcase}/show.handlebars" end |