Class: RedPotion::Generators::Scaffold

Inherits:
Thor::Group
  • Object
show all
Includes:
ModelGeneratorMethods, Thor::Actions
Defined in:
lib/redpotion/generators/scaffold.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelGeneratorMethods

#check_for_previous_schema!, #new_schema_number, #previous_schema_content, #previous_schema_filename, #previous_schema_number

Class Method Details

.source_rootObject



12
13
14
# File 'lib/redpotion/generators/scaffold.rb', line 12

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#enable_xlform_gemObject



35
36
37
# File 'lib/redpotion/generators/scaffold.rb', line 35

def enable_xlform_gem
  # TODO
end

#generate_modelObject



16
17
18
19
20
# File 'lib/redpotion/generators/scaffold.rb', line 16

def generate_model
  template "templates/cdq_model.tt", "app/models/#{model_name}.rb"
  check_for_previous_schema!
  template "templates/cdq_migration.tt", "schemas/#{new_schema_number}_create_#{model_name}.rb"
end

#generate_screensObject



22
23
24
25
26
27
# File 'lib/redpotion/generators/scaffold.rb', line 22

def generate_screens
  template "templates/cdq_table_screen.tt", "app/screens/#{model_name.pluralize}_screen.rb"
  template "templates/new_cdq_model_form_screen.tt", "app/screens/new_#{model_name}_screen.rb"
  template "templates/cdq_model_detail_screen.tt", "app/screens/#{model_name}_detail_screen.rb"
  template "templates/edit_cdq_model_form_screen.tt", "app/screens/edit_#{model_name}_screen.rb"
end

#generate_stylesheetsObject



29
30
31
32
33
# File 'lib/redpotion/generators/scaffold.rb', line 29

def generate_stylesheets
  template "templates/table_screen_stylesheet.tt", "app/stylesheets/#{model_name.pluralize}_screen_stylesheet.rb"
  template "templates/form_screen_stylesheet.tt", "app/stylesheets/#{model_name}_form_screen_stylesheet.rb"
  template "templates/detail_screen_stylesheet.tt", "app/stylesheets/#{model_name}_detail_screen_stylesheet.rb"
end