vraptor-scaffold 0.0.1.rc → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -1
- data/.gitignore +1 -0
- data/Gemfile +3 -3
- data/History.txt +10 -0
- data/README.textile +32 -0
- data/Rakefile +6 -7
- data/VERSION.yml +1 -1
- data/bin/vraptor +1 -1
- data/lib/configuration.rb +31 -0
- data/lib/generators/app_generator/app_generator.rb +75 -126
- data/lib/generators/app_generator/freemarker_template_engine.rb +50 -0
- data/lib/generators/app_generator/jsp_template_engine.rb +21 -0
- data/lib/generators/app_generator/templates/build.properties.erb +16 -0
- data/lib/generators/app_generator/templates/build.xml +109 -0
- data/lib/generators/app_generator/templates/decorators.erb +7 -0
- data/lib/generators/app_generator/templates/eclipse/classpath +23 -0
- data/lib/generators/app_generator/templates/eclipse/project.erb +36 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.jdt.core.prefs +8 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.component.tt +10 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml +10 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container +1 -0
- data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name +1 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-ivy.xml +2 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-pom.xml +6 -0
- data/lib/generators/app_generator/templates/freemarker/freemarker-web.xml +23 -0
- data/lib/generators/app_generator/templates/freemarker/infrastructure/FreemarkerPathResolver.java.tt +21 -0
- data/lib/generators/app_generator/templates/{macros → freemarker/macros}/html.ftl +0 -0
- data/lib/generators/app_generator/templates/freemarker/main.ftl +14 -0
- data/lib/generators/app_generator/templates/ivy-2.2.0-rc1.jar +0 -0
- data/lib/generators/app_generator/templates/ivy.erb +35 -0
- data/lib/generators/app_generator/templates/jsp/main.jsp +16 -0
- data/lib/generators/app_generator/templates/pom.erb +24 -3
- data/lib/generators/app_generator/templates/{messages.properties → resources-test/.empty_directory} +0 -0
- data/lib/generators/app_generator/templates/{persistence.xml → resources/META-INF/persistence.xml} +0 -0
- data/lib/generators/app_generator/templates/{log4j.properties → resources/log4j.properties} +0 -0
- data/lib/generators/app_generator/templates/resources/messages.properties +0 -0
- data/lib/generators/app_generator/templates/src-test/controllers/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src-test/models/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src-test/repositories/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src/controllers/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/src/models/Entity.java.tt +45 -0
- data/lib/generators/app_generator/templates/src/repositories/Repository.java.tt +43 -0
- data/lib/generators/app_generator/templates/vraptor-scaffold.erb +2 -0
- data/lib/generators/app_generator/templates/webapp/WEB-INF/web.xml +38 -0
- data/lib/generators/app_generator/templates/webapp/images/.empty_directory +0 -0
- data/lib/generators/app_generator/templates/{index.jsp → webapp/index.jsp} +0 -0
- data/lib/generators/app_generator/templates/{javascripts → webapp/javascripts}/jquery-1.4.2.min.js +0 -0
- data/lib/generators/app_generator/templates/{stylesheets → webapp/stylesheets}/scaffold.css +0 -0
- data/lib/generators/scaffold_generator/attribute.rb +14 -6
- data/lib/generators/scaffold_generator/base_scaffold.rb +14 -10
- data/lib/generators/scaffold_generator/controller_generator/controller_generator.rb +6 -6
- data/lib/generators/scaffold_generator/controller_generator/templates/controller.erb +7 -7
- data/lib/generators/scaffold_generator/controller_generator/templates/controller_test.erb +1 -1
- data/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator.rb +5 -5
- data/lib/generators/scaffold_generator/freemarker_generator/templates/index.erb +2 -3
- data/lib/generators/scaffold_generator/jsp_generator/jsp_generator.rb +22 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/edit.erb +3 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/form.erb +27 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/index.erb +36 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/new.erb +3 -0
- data/lib/generators/scaffold_generator/jsp_generator/templates/show.erb +14 -0
- data/lib/generators/scaffold_generator/model_generator/model_generator.rb +5 -5
- data/lib/generators/scaffold_generator/model_generator/templates/model.erb +1 -1
- data/lib/generators/scaffold_generator/model_generator/templates/model_test.erb +1 -1
- data/lib/generators/scaffold_generator/repository_generator/repository_generator.rb +6 -5
- data/lib/generators/scaffold_generator/repository_generator/templates/repository.erb +17 -9
- data/lib/generators/scaffold_generator/repository_generator/templates/repository_impl.erb +16 -0
- data/lib/generators/scaffold_generator/repository_generator/templates/repository_test.erb +2 -2
- data/lib/generators/scaffold_generator/scaffold_generator.rb +31 -38
- data/lib/load_paths.rb +6 -2
- data/lib/vraptor-scaffold.rb +29 -5
- data/spec/lib/configuration_spec.rb +60 -0
- data/spec/lib/generators/app_generator/app_generator_spec.rb +237 -116
- data/spec/lib/generators/app_generator/freemarker_template_engine_spec.rb +92 -0
- data/spec/lib/generators/app_generator/jsp_template_engine_spec.rb +44 -0
- data/{lib → spec/lib}/generators/app_generator/templates/Entity.java +5 -2
- data/{lib → spec/lib}/generators/app_generator/templates/FreemarkerPathResolver.java +1 -1
- data/{lib → spec/lib}/generators/app_generator/templates/Repository.java +6 -6
- data/spec/lib/generators/app_generator/templates/build.properties +16 -0
- data/spec/lib/generators/app_generator/templates/decorators-jsp.xml +7 -0
- data/{lib → spec/lib}/generators/app_generator/templates/decorators.xml +2 -2
- data/spec/lib/generators/app_generator/templates/ivy.xml +35 -0
- data/spec/lib/generators/app_generator/templates/pom.xml +24 -3
- data/spec/lib/generators/scaffold_generator/attribute_spec.rb +47 -27
- data/spec/lib/generators/scaffold_generator/base_scaffold_spec.rb +31 -27
- data/spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb +11 -9
- data/spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java +2 -2
- data/spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb +16 -14
- data/spec/lib/generators/scaffold_generator/jsp_generator/jsp_generator_spec.rb +34 -0
- data/spec/lib/generators/scaffold_generator/model_generator/model_generator_spec.rb +11 -9
- data/spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb +17 -9
- data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepository.java +15 -7
- data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepositoryImpl.java +16 -0
- data/spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb +55 -57
- data/spec/lib/vraptor-scaffold_spec.rb +77 -24
- data/spec/resources/vraptor-scaffold.properties +2 -0
- data/spec/spec_helper.rb +13 -1
- data/vraptor-scaffold.gemspec +82 -34
- metadata +86 -42
- data/README.rdoc +0 -104
- data/TODO.txt +0 -17
- data/lib/generators/app_generator/templates/main.ftl +0 -14
- data/lib/generators/app_generator/templates/web.xml +0 -61
data/.document
CHANGED
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
|
-
gem "thor", ">=0.14.
|
3
|
+
gem "thor", ">=0.14.3"
|
4
4
|
gem "rake", ">=0.8.7"
|
5
|
-
gem "activesupport", ">=3.0.0
|
5
|
+
gem "activesupport", ">=3.0.0"
|
6
6
|
|
7
7
|
gem "ruby-debug", :group => [:development, :test]
|
8
8
|
|
@@ -12,6 +12,6 @@ end
|
|
12
12
|
|
13
13
|
group :test do
|
14
14
|
gem "ZenTest", ">=4.3.3"
|
15
|
-
gem "rspec", ">=1.3.0"
|
15
|
+
gem "rspec", ">=1.3.0", :require => "spec"
|
16
16
|
gem "rcov", ">=0.9.8"
|
17
17
|
end
|
data/History.txt
CHANGED
data/README.textile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
h1. Documentation
|
2
|
+
|
3
|
+
Vraptor Scaffold website can be found at "http://vraptor.org":http://vraptor.org
|
4
|
+
RDocs can be found at "http://rdoc.info":http://rdoc.info/github/caelum/vraptor-scaffold
|
5
|
+
|
6
|
+
h1. Installation
|
7
|
+
|
8
|
+
gem install vraptor-scaffold
|
9
|
+
|
10
|
+
h1. Getting Started
|
11
|
+
|
12
|
+
At the command line client:
|
13
|
+
|
14
|
+
* vraptor new myapp
|
15
|
+
* Change directory into myapp
|
16
|
+
* vraptor scaffold product name:string value:double
|
17
|
+
* ant jetty.run
|
18
|
+
* Go http://localhost:8080/products
|
19
|
+
|
20
|
+
h2. Note on Patches/Pull Requests
|
21
|
+
|
22
|
+
* Fork the project.
|
23
|
+
* Make your feature addition or bug fix.
|
24
|
+
* Add tests for it. This is important so I don't break it in a
|
25
|
+
future version unintentionally.
|
26
|
+
* Commit, do not mess with rakefile, version, or history.
|
27
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
28
|
+
* Send me a pull request. Bonus points for topic branches.
|
29
|
+
|
30
|
+
h2. Authors
|
31
|
+
|
32
|
+
Vraptor Scaffold was created by Rodolfo Liviero and is maintained by Rodolfo Liviero and "Caelum":http://www.caelum.com.br/
|
data/Rakefile
CHANGED
@@ -5,16 +5,15 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "vraptor-scaffold"
|
8
|
-
gem.summary = "Scaffold
|
9
|
-
gem.description = "
|
8
|
+
gem.summary = "VRaptor Scaffold."
|
9
|
+
gem.description = "VRaptor scaffold extension to make it easier configuring new projects and plugins."
|
10
10
|
gem.email = "rodolfoliviero@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/
|
11
|
+
gem.homepage = "http://github.com/caelum/vraptor-scaffold"
|
12
12
|
gem.authors = ["Rodolfo Liviero"]
|
13
|
-
|
14
|
-
gem.add_dependency "thor", ">=0.14.0"
|
13
|
+
gem.add_dependency "thor", ">=0.14.3"
|
15
14
|
gem.add_dependency "rake", ">=0.8.7"
|
16
|
-
gem.add_dependency "activesupport", ">=3.0.0
|
17
|
-
gem.post_install_message = "Thank you for installing vraptor-scaffold. Please read http://github.com/
|
15
|
+
gem.add_dependency "activesupport", ">=3.0.0"
|
16
|
+
gem.post_install_message = "Thank you for installing vraptor-scaffold. Please read http://github.com/caelum/vraptor-scaffold/blob/master/README.rdoc for more information."
|
18
17
|
end
|
19
18
|
Jeweler::GemcutterTasks.new
|
20
19
|
rescue LoadError
|
data/VERSION.yml
CHANGED
data/bin/vraptor
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
class Configuration
|
2
|
+
MAIN_SRC="src/main/java"
|
3
|
+
MAIN_RESOURCES="src/main/resources"
|
4
|
+
TEST_SRC="src/test/java"
|
5
|
+
TEST_RESOURCES="src/test/resources"
|
6
|
+
WEB_APP="src/main/webapp"
|
7
|
+
WEB_INF="#{WEB_APP}/WEB-INF"
|
8
|
+
META_INF="#{WEB_APP}/META-INF"
|
9
|
+
FILENAME = "#{META_INF}/vraptor-scaffold.properties"
|
10
|
+
|
11
|
+
def self.config
|
12
|
+
YAML.load_file Configuration::FILENAME
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.template_engine
|
16
|
+
config["template_engine"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.package
|
20
|
+
config["package"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.main_class_path *path
|
24
|
+
File.join MAIN_SRC, package.gsub(".", File::Separator), path
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.test_class_path *path
|
28
|
+
File.join TEST_SRC, package.gsub(".", File::Separator), path
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -1,134 +1,83 @@
|
|
1
1
|
class AppGenerator < VraptorScaffold::Base
|
2
|
+
|
3
|
+
TEMPLATE_ENGINES = %w( jsp ftl )
|
4
|
+
BUILD_TOOLS = %w( ant mvn )
|
5
|
+
IVY_JAR = "ivy-2.2.0-rc1.jar"
|
6
|
+
|
7
|
+
argument :project_path
|
8
|
+
|
9
|
+
class_option :template_engine, :default => "jsp", :aliases => "-e",
|
10
|
+
:desc => "Template engine (options: #{TEMPLATE_ENGINES.join(', ')})"
|
11
|
+
|
12
|
+
class_option :package, :default => "app", :aliases => "-p",
|
13
|
+
:desc => "Base package"
|
14
|
+
|
15
|
+
class_option :build_tool, :default => "ant", :aliases => "-b",
|
16
|
+
:desc => "Build tools (options: #{BUILD_TOOLS.join(', ')})"
|
2
17
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
18
|
+
class_option :skip_eclipse, :type => :boolean, :aliases => "-E",
|
19
|
+
:desc => "Skip Eclipse files"
|
20
|
+
|
21
|
+
def self.source_root
|
22
|
+
File.join File.dirname(__FILE__), "templates"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.banner
|
26
|
+
"vraptor new #{self.arguments.map(&:usage).join(' ')} [options]"
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(args, opts=[])
|
30
|
+
super([args], opts)
|
9
31
|
self.destination_root=(project_path)
|
32
|
+
@project_name = project_path.split("/").last
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_root_folder
|
10
36
|
empty_directory "."
|
11
|
-
create_pom
|
12
|
-
create_main_java
|
13
|
-
create_main_resources
|
14
|
-
create_webapp
|
15
|
-
create_test
|
16
37
|
end
|
17
|
-
|
38
|
+
|
39
|
+
def configure_build_tool
|
40
|
+
template("pom.erb", "pom.xml") if options[:build_tool] == "mvn"
|
41
|
+
configure_ant if options[:build_tool] == "ant"
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_main_java
|
45
|
+
empty_directory Configuration::MAIN_SRC
|
46
|
+
directory("src", File.join(Configuration::MAIN_SRC, options[:package].gsub(".", File::Separator)))
|
47
|
+
end
|
48
|
+
|
49
|
+
def create_main_resources
|
50
|
+
directory("resources", Configuration::MAIN_RESOURCES)
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_webapp
|
54
|
+
directory("webapp", Configuration::WEB_APP)
|
55
|
+
end
|
56
|
+
|
57
|
+
def configure_template_engine
|
58
|
+
template("vraptor-scaffold.erb", Configuration::FILENAME)
|
59
|
+
templates = {"jsp" => JspTemplateEngine, "ftl" => FreemarkerTemplateEngine}
|
60
|
+
templates[options[:template_engine]].new(project_path).configure
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_test
|
64
|
+
empty_directory Configuration::TEST_SRC
|
65
|
+
directory("src-test", File.join(Configuration::TEST_SRC, options[:package].gsub(".", File::Separator)))
|
66
|
+
directory("resources-test", Configuration::TEST_RESOURCES)
|
67
|
+
end
|
68
|
+
|
18
69
|
private
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
empty_directory "src/test/java/app/controllers"
|
27
|
-
empty_directory "src/test/java/app/models"
|
28
|
-
empty_directory "src/test/resources"
|
29
|
-
end
|
70
|
+
def configure_ant
|
71
|
+
copy_file("build.xml")
|
72
|
+
template("build.properties.erb", "build.properties")
|
73
|
+
template("ivy.erb", "ivy.xml")
|
74
|
+
copy_file(IVY_JAR)
|
75
|
+
create_eclipse_wtp unless options[:skip_eclipse]
|
76
|
+
end
|
30
77
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def create_app
|
40
|
-
empty_directory "app"
|
41
|
-
inside "app" do
|
42
|
-
empty_directory "controllers"
|
43
|
-
create_app_models
|
44
|
-
create_app_infra
|
45
|
-
create_app_repository
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def create_app_models
|
50
|
-
models_path = empty_directory "models"
|
51
|
-
template = "Entity.java"
|
52
|
-
template_from_root(template, "#{models_path}/#{template}")
|
53
|
-
end
|
54
|
-
|
55
|
-
def create_app_infra
|
56
|
-
infra_path = empty_directory "infrastructure"
|
57
|
-
template = "FreemarkerPathResolver.java"
|
58
|
-
template_from_root(template, "#{infra_path}/#{template}")
|
59
|
-
end
|
60
|
-
|
61
|
-
def create_app_repository
|
62
|
-
repository_path = empty_directory "repositories"
|
63
|
-
template = "Repository.java"
|
64
|
-
template_from_root(template, "#{repository_path}/#{template}")
|
65
|
-
end
|
66
|
-
|
67
|
-
def create_main_resources
|
68
|
-
main_resources = "src/main/resources"
|
69
|
-
empty_directory main_resources
|
70
|
-
inside main_resources do
|
71
|
-
template_from_root("log4j.properties", "#{main_resources}/log4j.properties")
|
72
|
-
template_from_root("messages.properties", "#{main_resources}/messages.properties")
|
73
|
-
meta_inf = empty_directory "META-INF"
|
74
|
-
template_from_root("persistence.xml", "#{meta_inf}/persistence.xml")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def create_webapp
|
79
|
-
webapp = "src/main/webapp"
|
80
|
-
empty_directory webapp
|
81
|
-
inside webapp do
|
82
|
-
template_from_root("index.jsp", "#{webapp}/index.jsp")
|
83
|
-
create_decorators
|
84
|
-
empty_directory "images"
|
85
|
-
create_js
|
86
|
-
create_css
|
87
|
-
create_macros
|
88
|
-
create_web_inf
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def create_macros
|
93
|
-
macros = empty_directory "macros"
|
94
|
-
inside "macros" do
|
95
|
-
template_from_root("macros/html.ftl", "#{macros}/html.ftl")
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def create_css
|
100
|
-
css = empty_directory "stylesheets"
|
101
|
-
inside "stylesheets" do
|
102
|
-
template_from_root("stylesheets/scaffold.css", "#{css}/scaffold.css")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def create_js
|
107
|
-
js = empty_directory "javascripts"
|
108
|
-
inside "javascripts" do
|
109
|
-
template_from_root("javascripts/jquery-1.4.2.min.js", "#{js}/jquery-1.4.2.min.js")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def create_decorators
|
114
|
-
decorators = empty_directory "decorators"
|
115
|
-
inside decorators do
|
116
|
-
template_from_root("main.ftl", "#{decorators}/main.ftl")
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def create_web_inf
|
121
|
-
web_inf = empty_directory "WEB-INF"
|
122
|
-
inside "WEB-INF" do
|
123
|
-
template_from_root("decorators.xml", "#{web_inf}/decorators.xml")
|
124
|
-
template_from_root("web.xml", "#{web_inf}/web.xml")
|
125
|
-
empty_directory "views"
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
def template_from_root(template, to)
|
130
|
-
in_root do
|
131
|
-
template("templates/#{template}", to)
|
132
|
-
end
|
133
|
-
end
|
78
|
+
def create_eclipse_wtp
|
79
|
+
template("eclipse/project.erb", ".project")
|
80
|
+
copy_file("eclipse/classpath", ".classpath")
|
81
|
+
directory("eclipse/settings", ".settings")
|
82
|
+
end
|
134
83
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class FreemarkerTemplateEngine < VraptorScaffold::Base
|
2
|
+
|
3
|
+
def self.source_root
|
4
|
+
File.join(File.dirname(__FILE__), "templates", "freemarker")
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(project_path)
|
8
|
+
super
|
9
|
+
self.destination_root=(project_path)
|
10
|
+
@project_path = project_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def configure
|
14
|
+
directory("macros", File.join(Configuration::WEB_APP, "macros"))
|
15
|
+
template("../decorators.erb", File.join(Configuration::WEB_INF, "decorators.xml"))
|
16
|
+
copy_file("main.ftl", File.join(Configuration::WEB_INF, "decorators", "main.ftl"))
|
17
|
+
directory("infrastructure", infra_path)
|
18
|
+
empty_directory File.join(Configuration::WEB_INF, "views")
|
19
|
+
append_freemarker_dependencies
|
20
|
+
append_freemarker_servlet
|
21
|
+
end
|
22
|
+
|
23
|
+
def extension
|
24
|
+
"ftl"
|
25
|
+
end
|
26
|
+
|
27
|
+
def package
|
28
|
+
file = File.join(@project_path, Configuration::FILENAME)
|
29
|
+
package = YAML.load_file(file)['package']
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def append_freemarker_servlet
|
34
|
+
file = File.join(Configuration::WEB_INF, "web.xml")
|
35
|
+
template = File.join FreemarkerTemplateEngine.source_root, "freemarker-web.xml"
|
36
|
+
inject_into_file(file, File.read(template), :before => "</web-app>", :verbose => false)
|
37
|
+
end
|
38
|
+
|
39
|
+
def infra_path
|
40
|
+
File.join Configuration::MAIN_SRC, package.gsub(".", File::Separator), "infrastructure"
|
41
|
+
end
|
42
|
+
|
43
|
+
def append_freemarker_dependencies
|
44
|
+
file = "pom.xml" if File.exist?("#{@project_path}/pom.xml")
|
45
|
+
file = "ivy.xml" if File.exist?("#{@project_path}/ivy.xml")
|
46
|
+
template = File.join FreemarkerTemplateEngine.source_root, "freemarker-#{file}"
|
47
|
+
inject_into_file(file, File.read(template), :after => "<dependencies>", :verbose => false)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class JspTemplateEngine < VraptorScaffold::Base
|
2
|
+
|
3
|
+
def self.source_root
|
4
|
+
File.join(File.dirname(__FILE__), "templates", "jsp")
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(project_path)
|
8
|
+
super
|
9
|
+
self.destination_root=(project_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def configure
|
13
|
+
template("../decorators.erb", File.join(Configuration::WEB_INF, "decorators.xml"))
|
14
|
+
copy_file("main.jsp", File.join(Configuration::WEB_INF, "decorators", "main.jsp"))
|
15
|
+
empty_directory File.join(Configuration::WEB_INF, "jsp")
|
16
|
+
end
|
17
|
+
|
18
|
+
def extension
|
19
|
+
"jsp"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
project.name=<%= @project_name %>
|
2
|
+
|
3
|
+
output.dir=target
|
4
|
+
test.build.dir=target/test-classes
|
5
|
+
|
6
|
+
webapp.dir=<%= Configuration::WEB_APP %>
|
7
|
+
lib.dir=<%= Configuration::WEB_INF %>/lib
|
8
|
+
build.dir=<%= Configuration::WEB_INF %>/classes
|
9
|
+
|
10
|
+
src.dir=<%= Configuration::MAIN_SRC %>
|
11
|
+
resources.dir=<%= Configuration::MAIN_RESOURCES %>
|
12
|
+
|
13
|
+
test.src.dir=<%= Configuration::TEST_SRC %>
|
14
|
+
test.resources.dir=<%= Configuration::TEST_RESOURCES %>
|
15
|
+
|
16
|
+
ivy.jar.file=<%= AppGenerator::IVY_JAR %>
|