Class: TemplateEngineGenerator

Inherits:
BaseScaffold show all
Defined in:
lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb

Direct Known Subclasses

FreemarkerGenerator, JspGenerator

Instance Method Summary (collapse)

Methods inherited from BaseScaffold

#base_path, #class_name, #controller_class_name, #controller_test_class_name, #controller_test_param, #imports, #initialize, #model_parameter_name, #repository_impl_name, #repository_interface_name, #repository_test_class_name, #test_class_name

Constructor Details

This class inherits a constructor from BaseScaffold

Instance Method Details

- (Object) build



3
4
5
6
7
8
9
10
# File 'lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb', line 3

def build
  define_source_paths
  create_view("index")
  create_view("show")
  create_view("form")
  create_view("edit")
  create_view("new", "new#{class_name}")
end

- (Object) create_view(template_name, file_name = template_name)



12
13
14
# File 'lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb', line 12

def create_view(template_name, file_name=template_name)
  template("#{template_name}.erb", "#{views_path}/#{file_name}.#{extension}")
end

- (Object) template_path



20
21
22
# File 'lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb', line 20

def template_path
  "src/templates/views"
end

- (Object) views_path



16
17
18
# File 'lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb', line 16

def views_path
  File.join Configuration::WEB_INF, view_folder, model_parameter_name
end