Class: FreemarkerTemplateEngine

Inherits:
VraptorScaffold::Base show all
Defined in:
lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path, options) ⇒ FreemarkerTemplateEngine

Returns a new instance of FreemarkerTemplateEngine.



7
8
9
10
11
12
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 7

def initialize(project_path, options)
  super
  self.destination_root=(project_path)
  @project_path = project_path
  @options = options
end

Class Method Details

.source_rootObject



3
4
5
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 3

def self.source_root
  File.join(File.dirname(__FILE__), "templates", "freemarker")
end

Instance Method Details

#configureObject



14
15
16
17
18
19
20
21
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 14

def configure
  directory("macros", File.join(Configuration::WEB_APP, "macros"))
  template("../decorators.erb", File.join(Configuration::WEB_INF, "decorators.xml"))
  template("main.ftl.erb", File.join(Configuration::WEB_INF, decorators_path, "main.ftl"))
  #copy_file("main.ftl", File.join(Configuration::WEB_INF, decorators_path, "main.ftl"))
  directory("infrastructure", infra_path)
  append_freemarker_servlet
end

#decorators_pathObject



27
28
29
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 27

def decorators_path
  File.join "views", "decorators"
end

#extensionObject



23
24
25
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 23

def extension
  "ftl"
end

#packageObject



31
32
33
34
# File 'lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb', line 31

def package
  file = File.join(@project_path, Configuration::FILENAME)
  package = YAML.load_file(file)['package']
end