vraptor-scaffold 1.2.3 → 1.3.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile.lock +1 -1
- data/README.textile +1 -0
- data/lib/vraptor-scaffold/execution.rb +9 -8
- data/lib/vraptor-scaffold/generators/app/app_generator.rb +51 -9
- data/lib/vraptor-scaffold/generators/app/dependency_manager.rb +38 -9
- data/lib/vraptor-scaffold/generators/app/templates/build.xml +146 -146
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/classpath-gae.erb +15 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/project-gae.erb +47 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/com.google.gdt.eclipse.core.prefs +5 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.jdt.core.prefs +8 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.common.component.tt +10 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.common.project.facet.core.xml +9 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.jsdt.ui.superType.container +1 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.jsdt.ui.superType.name +1 -0
- data/lib/vraptor-scaffold/generators/app/templates/gae/ObjectifyFactory.java.tt +30 -0
- data/lib/vraptor-scaffold/generators/app/templates/gae/appengine-web.xml.tt +13 -0
- data/lib/vraptor-scaffold/generators/app/templates/gae/ivysettings.xml +10 -0
- data/lib/vraptor-scaffold/generators/app/templates/gae/logging.properties +28 -0
- data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-objectify.java.tt +41 -0
- data/lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold.erb +1 -1
- data/lib/vraptor-scaffold/generators/app/templates/webapp/WEB-INF/web.xml.tt +2 -2
- data/lib/vraptor-scaffold/generators/scaffold/attribute.rb +1 -1
- data/lib/vraptor-scaffold/generators/scaffold/base_scaffold.rb +7 -1
- data/lib/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator.rb +10 -5
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/model_generator.rb +10 -4
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator.rb +20 -0
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/objectify_model.erb +33 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/objectify_repository_generator.rb +25 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb +9 -4
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/objectify_repository.erb +22 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/objectify_repository_impl.erb +16 -0
- data/lib/vraptor-scaffold/generators/scaffold/scaffold_generator.rb +10 -3
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/freemarker_generator.rb +5 -4
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/jsp_generator/jsp_generator.rb +5 -4
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb +7 -1
- data/lib/vraptor-scaffold/load_paths.rb +3 -1
- data/lib/vraptor-scaffold/runner.rb +1 -0
- data/lib/vraptor-scaffold/runner/start.rb +29 -0
- data/lib/vraptor-scaffold/version.rb +1 -1
- data/maven/repo/br/com/caelum/vraptor-gae/1.0/vraptor-gae-1.0.jar +0 -0
- data/spec/resources/vraptor-scaffold-objectify.properties +7 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/vraptor-scaffold/configuration_spec.rb +3 -0
- data/spec/vraptor-scaffold/execution_spec.rb +5 -1
- data/spec/vraptor-scaffold/generators/app/app_generator_spec.rb +77 -2
- data/spec/vraptor-scaffold/generators/app/dependency_manager_spec.rb +18 -3
- data/spec/vraptor-scaffold/generators/app/templates/ObjectifyFactory.java +30 -0
- data/spec/vraptor-scaffold/generators/app/templates/{Repository.java → RepositoryJPA.java} +0 -0
- data/spec/vraptor-scaffold/generators/app/templates/RepositoryObjectify.java +41 -0
- data/spec/vraptor-scaffold/generators/app/templates/build.gradle +1 -1
- data/spec/vraptor-scaffold/generators/app/templates/build.xml +146 -0
- data/spec/vraptor-scaffold/generators/app/templates/classpath-gae +18 -0
- data/spec/vraptor-scaffold/generators/app/templates/freemarker-web.xml +1 -1
- data/spec/vraptor-scaffold/generators/app/templates/gae-jsp-web.xml +45 -0
- data/spec/vraptor-scaffold/generators/app/templates/ivy-gae.xml +45 -0
- data/spec/vraptor-scaffold/generators/app/templates/ivy.xml +1 -1
- data/spec/vraptor-scaffold/generators/app/templates/jsp-web.xml +1 -1
- data/spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml +5 -5
- data/spec/vraptor-scaffold/generators/app/templates/pom.xml +5 -5
- data/spec/vraptor-scaffold/generators/app/templates/project-gae +47 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle +1 -1
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle +1 -1
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml +1 -1
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml +5 -5
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml +1 -1
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml +5 -5
- data/spec/vraptor-scaffold/generators/scaffold/attribute_spec.rb +5 -1
- data/spec/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator_spec.rb +6 -2
- data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/freemarker_generator_spec.rb +4 -0
- data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/jsp_generator_spec.rb +4 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb +4 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator_spec.rb +40 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/ObjectifyFactory.java +33 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Objectify_Product.java +38 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/objectify_repository_generator_spec.rb +33 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator_spec.rb +12 -4
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepository.java +22 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepositoryImpl.java +16 -0
- data/spec/vraptor-scaffold/generators/scaffold/scaffold_generator_spec.rb +14 -1
- data/spec/vraptor-scaffold/runner/scaffold_spec.rb +5 -5
- data/spec/vraptor-scaffold/runner/start_spec.rb +51 -0
- metadata +54 -19
data/CHANGELOG.rdoc
CHANGED
data/Gemfile.lock
CHANGED
data/README.textile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module VraptorScaffold
|
2
2
|
|
3
3
|
class Execution
|
4
|
-
|
4
|
+
|
5
5
|
def run(args)
|
6
6
|
action = args.shift
|
7
7
|
runner_for(action).new.run(args)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def runner_for(action)
|
11
11
|
VraptorScaffold::COMMANDS.fetch(action, Runner::CommandsHelp)
|
12
12
|
end
|
@@ -14,11 +14,12 @@ module VraptorScaffold
|
|
14
14
|
end
|
15
15
|
|
16
16
|
COMMANDS = {"--help" => Runner::Generator,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
"-h" => Runner::Generator,
|
18
|
+
"new" => Runner::Generator,
|
19
|
+
"scaffold" => Runner::Scaffold,
|
20
|
+
"plugin" => Runner::Plugin,
|
21
|
+
"start" => Runner::Start
|
22
|
+
#"configure" => Runner::Configure
|
22
23
|
}
|
23
|
-
|
24
|
+
|
24
25
|
end
|
@@ -2,7 +2,7 @@ class AppGenerator < VraptorScaffold::Base
|
|
2
2
|
|
3
3
|
TEMPLATE_ENGINES = %w( jsp ftl )
|
4
4
|
BUILD_TOOLS = %w( ant mvn gradle )
|
5
|
-
ORMS = %w( jpa hibernate )
|
5
|
+
ORMS = %w( jpa hibernate objectify )
|
6
6
|
IVY_JAR = "ivy-2.2.0.jar"
|
7
7
|
|
8
8
|
argument :project_path
|
@@ -22,6 +22,9 @@ class AppGenerator < VraptorScaffold::Base
|
|
22
22
|
class_option :heroku, :type => :boolean, :aliases => "-h",
|
23
23
|
:desc => "heroku project"
|
24
24
|
|
25
|
+
class_option :gae, :type => :boolean, :aliases => "-g",
|
26
|
+
:desc => "google app engine project"
|
27
|
+
|
25
28
|
class_option :repositories_package, :aliases => "-r", :default => "repositories",
|
26
29
|
:desc => "Define repositories package"
|
27
30
|
|
@@ -72,12 +75,22 @@ class AppGenerator < VraptorScaffold::Base
|
|
72
75
|
template("ivy.erb", "ivy.xml")
|
73
76
|
copy_file(IVY_JAR)
|
74
77
|
end
|
78
|
+
if options[:gae]
|
79
|
+
copy_file("gae/ivysettings.xml", "ivysettings.xml")
|
80
|
+
end
|
75
81
|
end
|
76
82
|
|
77
83
|
def configure_gradle
|
78
84
|
template("build.gradle.erb", "build.gradle") if build_tool == "gradle"
|
79
85
|
end
|
80
86
|
|
87
|
+
def configure_vraptor_packages
|
88
|
+
vraptor_util_package = "br.com.caelum.vraptor.util"
|
89
|
+
@vraptor_packages = []
|
90
|
+
@vraptor_packages += ["#{vraptor_util_package}.#{orm}"] if orm == "jpa" or orm == "hibernate"
|
91
|
+
@vraptor_packages += ["#{vraptor_util_package}.gae"] if options[:gae]
|
92
|
+
end
|
93
|
+
|
81
94
|
def create_main_java
|
82
95
|
empty_directory Configuration::MAIN_SRC
|
83
96
|
@src = File.join(Configuration::MAIN_SRC, options[:package].gsub(".", File::Separator))
|
@@ -93,13 +106,17 @@ class AppGenerator < VraptorScaffold::Base
|
|
93
106
|
def create_models_directory
|
94
107
|
models_folder = File.join @src, options[:models_package]
|
95
108
|
empty_directory models_folder
|
96
|
-
template("models/Entity.erb", "#{models_folder}/Entity.java")
|
109
|
+
template("models/Entity.erb", "#{models_folder}/Entity.java") unless options[:gae]
|
97
110
|
end
|
98
111
|
|
99
112
|
def create_repositories_directory
|
100
113
|
repositories_folder = File.join @src, options[:repositories_package]
|
101
114
|
empty_directory repositories_folder
|
102
|
-
|
115
|
+
if options[:gae]
|
116
|
+
template("orm/Repository-objectify.java.tt", "#{repositories_folder}/Repository.java")
|
117
|
+
else
|
118
|
+
template("orm/Repository-#{orm}.java.tt", "#{repositories_folder}/Repository.java")
|
119
|
+
end
|
103
120
|
end
|
104
121
|
|
105
122
|
def create_main_resources
|
@@ -107,8 +124,12 @@ class AppGenerator < VraptorScaffold::Base
|
|
107
124
|
end
|
108
125
|
|
109
126
|
def configure_orm
|
110
|
-
if (
|
127
|
+
if (orm == "hibernate")
|
111
128
|
copy_file("orm/hibernate.cfg.xml", (File.join Configuration::MAIN_RESOURCES, "hibernate.cfg.xml"))
|
129
|
+
elsif orm == "objectify"
|
130
|
+
infra_folder = File.join @src, "infra"
|
131
|
+
empty_directory infra_folder
|
132
|
+
template("gae/ObjectifyFactory.java.tt", "#{@src}/infra/ObjectifyFactory.java")
|
112
133
|
else
|
113
134
|
metainf = File.join Configuration::MAIN_RESOURCES, 'META-INF'
|
114
135
|
empty_directory metainf
|
@@ -118,6 +139,10 @@ class AppGenerator < VraptorScaffold::Base
|
|
118
139
|
|
119
140
|
def create_webapp
|
120
141
|
directory("webapp", Configuration::WEB_APP)
|
142
|
+
if @options[:gae]
|
143
|
+
template("gae/appengine-web.xml.tt", "#{Configuration::WEB_INF}/appengine-web.xml")
|
144
|
+
copy_file("gae/logging.properties", "#{Configuration::WEB_INF}/logging.properties")
|
145
|
+
end
|
121
146
|
end
|
122
147
|
|
123
148
|
def create_javascripts
|
@@ -149,13 +174,25 @@ class AppGenerator < VraptorScaffold::Base
|
|
149
174
|
private
|
150
175
|
def build_tool
|
151
176
|
return "mvn" if options[:heroku]
|
177
|
+
return "ant" if options[:gae]
|
152
178
|
options[:build_tool]
|
153
179
|
end
|
154
180
|
|
181
|
+
def orm
|
182
|
+
return "objectify" if options[:gae]
|
183
|
+
options[:orm]
|
184
|
+
end
|
185
|
+
|
155
186
|
def create_eclipse_files
|
156
|
-
|
157
|
-
|
158
|
-
|
187
|
+
if options[:gae]
|
188
|
+
template("eclipse/classpath-gae.erb", ".classpath")
|
189
|
+
template("eclipse/project-gae.erb", ".project")
|
190
|
+
directory("eclipse/settings-gae", ".settings")
|
191
|
+
else
|
192
|
+
template("eclipse/classpath.erb", ".classpath")
|
193
|
+
template("eclipse/project.erb", ".project")
|
194
|
+
directory("eclipse/settings", ".settings")
|
195
|
+
end
|
159
196
|
end
|
160
197
|
|
161
198
|
def validate
|
@@ -167,8 +204,13 @@ class AppGenerator < VraptorScaffold::Base
|
|
167
204
|
puts "Template engine #{options[:template_engine]} is not supported. The supported template engines are: #{TEMPLATE_ENGINES.join(", ")}"
|
168
205
|
Kernel::exit
|
169
206
|
end
|
170
|
-
unless ORMS.include?
|
171
|
-
puts "ORM #{
|
207
|
+
unless ORMS.include? orm
|
208
|
+
puts "ORM #{orm} is not supported. The supported object-relational mapping are: #{ORMS.join(", ")}"
|
209
|
+
Kernel::exit
|
210
|
+
end
|
211
|
+
|
212
|
+
if options[:heroku] and options[:gae]
|
213
|
+
puts "You cannot create gae and heroku template project together"
|
172
214
|
Kernel::exit
|
173
215
|
end
|
174
216
|
|
@@ -9,6 +9,7 @@ class DependencyManager
|
|
9
9
|
def compile_scope
|
10
10
|
dependencies = append_freemarker_dependency_if_necessary default_dependencies
|
11
11
|
dependencies = append_heroku_dependencies_if_necessary dependencies
|
12
|
+
dependencies = append_gae_dependencies_if_necessary dependencies
|
12
13
|
dependencies
|
13
14
|
end
|
14
15
|
|
@@ -27,15 +28,27 @@ class DependencyManager
|
|
27
28
|
|
28
29
|
private
|
29
30
|
def default_dependencies
|
30
|
-
|
31
|
-
[
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
dependencies = []
|
32
|
+
if options[:gae]
|
33
|
+
dependencies += [Dependency.new("br.com.caelum", "vraptor", "3.3.1")]
|
34
|
+
else
|
35
|
+
dependencies += [Dependency.new("br.com.caelum", "vraptor", "3.4.0")]
|
36
|
+
end
|
37
|
+
|
38
|
+
dependencies += [Dependency.new("opensymphony", "sitemesh", "2.4.2"),
|
39
|
+
Dependency.new("javax.servlet", "jstl", "1.2")]
|
40
|
+
|
41
|
+
unless @options[:gae]
|
42
|
+
hibernate_version = "3.6.7.Final"
|
43
|
+
dependencies += [Dependency.new("org.hsqldb", "hsqldb", "2.2.4"),
|
44
|
+
Dependency.new("org.hibernate", "hibernate-entitymanager", hibernate_version),
|
45
|
+
Dependency.new("org.hibernate", "hibernate-c3p0", hibernate_version)]
|
46
|
+
end
|
47
|
+
|
48
|
+
dependencies += [Dependency.new("org.hibernate", "hibernate-validator", "4.2.0.Final"),
|
49
|
+
Dependency.new("joda-time", "joda-time", "2.0"),
|
50
|
+
Dependency.new("com.thoughtworks.xstream", "xstream", "1.4.1")]
|
51
|
+
dependencies
|
39
52
|
end
|
40
53
|
|
41
54
|
def append_heroku_dependencies_if_necessary dependencies
|
@@ -47,6 +60,22 @@ class DependencyManager
|
|
47
60
|
dependencies
|
48
61
|
end
|
49
62
|
|
63
|
+
def append_gae_dependencies_if_necessary dependencies
|
64
|
+
if @options[:gae]
|
65
|
+
appengine_version = "1.6.0"
|
66
|
+
dependencies += [Dependency.new("com.googlecode.objectify", "objectify", "3.1"),
|
67
|
+
Dependency.new("br.com.caelum", "vraptor-gae", "1.0"),
|
68
|
+
Dependency.new("commons-fileupload", "commons-fileupload", "1.2.2"),
|
69
|
+
Dependency.new("com.google.appengine", "appengine-api-1.0-sdk", appengine_version),
|
70
|
+
Dependency.new("com.google.appengine", "appengine-api-labs", appengine_version),
|
71
|
+
Dependency.new("com.google.appengine", "appengine-jsr107cache", appengine_version),
|
72
|
+
Dependency.new("net.sf.jsr107cache", "jsr107cache", "1.1"),
|
73
|
+
Dependency.new("org.apache.geronimo.specs", "geronimo-jpa_3.0_spec", "1.1.1")]
|
74
|
+
end
|
75
|
+
|
76
|
+
dependencies
|
77
|
+
end
|
78
|
+
|
50
79
|
def append_freemarker_dependency_if_necessary dependencies
|
51
80
|
dependencies << Dependency.new("org.freemarker", "freemarker", "2.3.18") if @options[:template_engine] == 'ftl'
|
52
81
|
dependencies
|
@@ -1,146 +1,146 @@
|
|
1
|
-
<project name="vraptor-scaffold" default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
|
2
|
-
|
3
|
-
<property file="build.properties" />
|
4
|
-
|
5
|
-
<!-- paths -->
|
6
|
-
<path id="lib.path.id">
|
7
|
-
<fileset dir="${lib.dir}" />
|
8
|
-
<fileset dir="lib/provided" />
|
9
|
-
</path>
|
10
|
-
<path id="test.path.id">
|
11
|
-
<fileset dir="lib/test" />
|
12
|
-
<path refid="lib.path.id" />
|
13
|
-
<pathelement location="${test.build.dir}" />
|
14
|
-
<pathelement location="${build.dir}" />
|
15
|
-
</path>
|
16
|
-
|
17
|
-
<!-- =================================
|
18
|
-
target: resolve
|
19
|
-
================================= -->
|
20
|
-
<target name="resolve" description="--> retrieve dependencies with ivy">
|
21
|
-
<path id="ivy.lib.path">
|
22
|
-
<pathelement location="${ivy.jar.file}" />
|
23
|
-
</path>
|
24
|
-
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
|
25
|
-
|
26
|
-
<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" sync="true" />
|
27
|
-
<delete dir="${lib.dir}" includes="**/*.*" />
|
28
|
-
<copy todir="${lib.dir}">
|
29
|
-
<fileset dir="lib/default">
|
30
|
-
<include name="*.jar" />
|
31
|
-
</fileset>
|
32
|
-
</copy>
|
33
|
-
</target>
|
34
|
-
|
35
|
-
<!-- =================================
|
36
|
-
target: compile
|
37
|
-
================================= -->
|
38
|
-
<target name="compile" depends="resolve" description="--> compile">
|
39
|
-
<mkdir dir="${build.dir}" />
|
40
|
-
<delete dir="${build.dir}" includes="**/*.*" />
|
41
|
-
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" debug="on" />
|
42
|
-
<copy todir="${build.dir}">
|
43
|
-
<fileset dir="${resources.dir}">
|
44
|
-
<include name="**/*.*" />
|
45
|
-
</fileset>
|
46
|
-
</copy>
|
47
|
-
</target>
|
48
|
-
|
49
|
-
<!-- =================================
|
50
|
-
target: compile test
|
51
|
-
================================= -->
|
52
|
-
<target name="compile-test" depends="compile" description="--> compile test">
|
53
|
-
<mkdir dir="${test.build.dir}" />
|
54
|
-
<delete dir="${test.build.dir}" includes="**/*.*" />
|
55
|
-
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" classpathref="test.path.id" debug="on" />
|
56
|
-
<copy todir="${test.build.dir}">
|
57
|
-
<fileset dir="${test.resources.dir}">
|
58
|
-
<include name="**/*.*" />
|
59
|
-
</fileset>
|
60
|
-
</copy>
|
61
|
-
</target>
|
62
|
-
|
63
|
-
<!-- =================================
|
64
|
-
target: run tests
|
65
|
-
================================= -->
|
66
|
-
<target name="test" depends="compile-test" description="--> run all tests">
|
67
|
-
<mkdir dir="${output.dir}/test-results" />
|
68
|
-
<junit haltonfailure="yes">
|
69
|
-
<batchtest fork="yes" todir="${output.dir}/test-results">
|
70
|
-
<fileset dir="${test.src.dir}">
|
71
|
-
<include name="**/*Test.java" />
|
72
|
-
</fileset>
|
73
|
-
</batchtest>
|
74
|
-
<formatter type="brief" usefile="false" />
|
75
|
-
<formatter type="xml" />
|
76
|
-
<classpath refid="test.path.id" />
|
77
|
-
</junit>
|
78
|
-
</target>
|
79
|
-
|
80
|
-
<!-- =================================
|
81
|
-
target: war
|
82
|
-
================================= -->
|
83
|
-
<target name="war" description="--> generate war file" depends="test">
|
84
|
-
<war destfile="${output.dir}/${project.name}.war">
|
85
|
-
<zipfileset dir="${webapp.dir}" />
|
86
|
-
</war>
|
87
|
-
</target>
|
88
|
-
|
89
|
-
<!-- =================================
|
90
|
-
target: jetty.run
|
91
|
-
================================= -->
|
92
|
-
<target name="jetty.run" description="--> run jetty server" depends="compile">
|
93
|
-
<path id="jetty.path.id">
|
94
|
-
<fileset dir="lib/jetty" />
|
95
|
-
</path>
|
96
|
-
<taskdef classpathref="jetty.path.id" resource="tasks.properties" loaderref="jetty.loader" />
|
97
|
-
<jetty tempDirectory="${output.dir}/jetty-temp">
|
98
|
-
<webApp name="${project.name}" warfile="${webapp.dir}" contextpath="/" scanIntervalSeconds="3">
|
99
|
-
<scanTargets dir="${build.dir}">
|
100
|
-
<include name="**/*"/>
|
101
|
-
</scanTargets>
|
102
|
-
</webApp>
|
103
|
-
</jetty>
|
104
|
-
</target>
|
105
|
-
|
106
|
-
<!-- =================================
|
107
|
-
target: minify
|
108
|
-
================================= -->
|
109
|
-
<target name="minify" depends="resolve" description="minify js and css">
|
110
|
-
<property name="yuicompressor.jar" value="lib/minify/yuicompressor-2.3.6.jar" />
|
111
|
-
|
112
|
-
<fileset dir="${js.dir}" includes="*.js" excludes="all.min.js" id="alljs" />
|
113
|
-
<fileset dir="${css.dir}" includes="*.css" excludes="*.min.css" id="allcss" />
|
114
|
-
|
115
|
-
<delete file="${css.dir}/all.css" />
|
116
|
-
<concat destfile="${css.dir}/all.css" fixlastline="true">
|
117
|
-
<fileset refid="allcss" />
|
118
|
-
</concat>
|
119
|
-
|
120
|
-
<java jar="${yuicompressor.jar}" fork="true">
|
121
|
-
<arg value="${css.dir}/all.css" />
|
122
|
-
<arg value="-o" />
|
123
|
-
<arg value="${css.dir}/all.min.css" />
|
124
|
-
</java>
|
125
|
-
|
126
|
-
<delete file="${js.dir}/all.js" />
|
127
|
-
<concat destfile="${js.dir}/all.js" fixlastline="true">
|
128
|
-
<fileset refid="alljs" />
|
129
|
-
</concat>
|
130
|
-
|
131
|
-
<java jar="${yuicompressor.jar}" fork="true">
|
132
|
-
<arg value="${js.dir}/all.js" />
|
133
|
-
<arg value="-o" />
|
134
|
-
<arg value="${js.dir}/all.min.js" />
|
135
|
-
</java>
|
136
|
-
</target>
|
137
|
-
|
138
|
-
<!-- =================================
|
139
|
-
target: report
|
140
|
-
================================= -->
|
141
|
-
<target name="report" depends="resolve" description="--> generates a report of dependencies">
|
142
|
-
<mkdir dir="${output.dir}/reports" />
|
143
|
-
<ivy:report todir="${output.dir}/reports" />
|
144
|
-
</target>
|
145
|
-
|
146
|
-
</project>
|
1
|
+
<project name="vraptor-scaffold" default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
|
2
|
+
|
3
|
+
<property file="build.properties" />
|
4
|
+
|
5
|
+
<!-- paths -->
|
6
|
+
<path id="lib.path.id">
|
7
|
+
<fileset dir="${lib.dir}" />
|
8
|
+
<fileset dir="lib/provided" />
|
9
|
+
</path>
|
10
|
+
<path id="test.path.id">
|
11
|
+
<fileset dir="lib/test" />
|
12
|
+
<path refid="lib.path.id" />
|
13
|
+
<pathelement location="${test.build.dir}" />
|
14
|
+
<pathelement location="${build.dir}" />
|
15
|
+
</path>
|
16
|
+
|
17
|
+
<!-- =================================
|
18
|
+
target: resolve
|
19
|
+
================================= -->
|
20
|
+
<target name="resolve" description="--> retrieve dependencies with ivy">
|
21
|
+
<path id="ivy.lib.path">
|
22
|
+
<pathelement location="${ivy.jar.file}" />
|
23
|
+
</path>
|
24
|
+
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
|
25
|
+
|
26
|
+
<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" sync="true" />
|
27
|
+
<delete dir="${lib.dir}" includes="**/*.*" />
|
28
|
+
<copy todir="${lib.dir}">
|
29
|
+
<fileset dir="lib/default">
|
30
|
+
<include name="*.jar" />
|
31
|
+
</fileset>
|
32
|
+
</copy>
|
33
|
+
</target>
|
34
|
+
|
35
|
+
<!-- =================================
|
36
|
+
target: compile
|
37
|
+
================================= -->
|
38
|
+
<target name="compile" depends="resolve" description="--> compile">
|
39
|
+
<mkdir dir="${build.dir}" />
|
40
|
+
<delete dir="${build.dir}" includes="**/*.*" />
|
41
|
+
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" debug="on" />
|
42
|
+
<copy todir="${build.dir}">
|
43
|
+
<fileset dir="${resources.dir}">
|
44
|
+
<include name="**/*.*" />
|
45
|
+
</fileset>
|
46
|
+
</copy>
|
47
|
+
</target>
|
48
|
+
|
49
|
+
<!-- =================================
|
50
|
+
target: compile test
|
51
|
+
================================= -->
|
52
|
+
<target name="compile-test" depends="compile" description="--> compile test">
|
53
|
+
<mkdir dir="${test.build.dir}" />
|
54
|
+
<delete dir="${test.build.dir}" includes="**/*.*" />
|
55
|
+
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" classpathref="test.path.id" debug="on" />
|
56
|
+
<copy todir="${test.build.dir}">
|
57
|
+
<fileset dir="${test.resources.dir}">
|
58
|
+
<include name="**/*.*" />
|
59
|
+
</fileset>
|
60
|
+
</copy>
|
61
|
+
</target>
|
62
|
+
|
63
|
+
<!-- =================================
|
64
|
+
target: run tests
|
65
|
+
================================= -->
|
66
|
+
<target name="test" depends="compile-test" description="--> run all tests">
|
67
|
+
<mkdir dir="${output.dir}/test-results" />
|
68
|
+
<junit haltonfailure="yes">
|
69
|
+
<batchtest fork="yes" todir="${output.dir}/test-results">
|
70
|
+
<fileset dir="${test.src.dir}">
|
71
|
+
<include name="**/*Test.java" />
|
72
|
+
</fileset>
|
73
|
+
</batchtest>
|
74
|
+
<formatter type="brief" usefile="false" />
|
75
|
+
<formatter type="xml" />
|
76
|
+
<classpath refid="test.path.id" />
|
77
|
+
</junit>
|
78
|
+
</target>
|
79
|
+
|
80
|
+
<!-- =================================
|
81
|
+
target: war
|
82
|
+
================================= -->
|
83
|
+
<target name="war" description="--> generate war file" depends="test">
|
84
|
+
<war destfile="${output.dir}/${project.name}.war">
|
85
|
+
<zipfileset dir="${webapp.dir}" />
|
86
|
+
</war>
|
87
|
+
</target>
|
88
|
+
|
89
|
+
<!-- =================================
|
90
|
+
target: jetty.run
|
91
|
+
================================= -->
|
92
|
+
<target name="jetty.run" description="--> run jetty server" depends="compile">
|
93
|
+
<path id="jetty.path.id">
|
94
|
+
<fileset dir="lib/jetty" />
|
95
|
+
</path>
|
96
|
+
<taskdef classpathref="jetty.path.id" resource="tasks.properties" loaderref="jetty.loader" />
|
97
|
+
<jetty tempDirectory="${output.dir}/jetty-temp">
|
98
|
+
<webApp name="${project.name}" warfile="${webapp.dir}" contextpath="/" scanIntervalSeconds="3">
|
99
|
+
<scanTargets dir="${build.dir}">
|
100
|
+
<include name="**/*"/>
|
101
|
+
</scanTargets>
|
102
|
+
</webApp>
|
103
|
+
</jetty>
|
104
|
+
</target>
|
105
|
+
|
106
|
+
<!-- =================================
|
107
|
+
target: minify
|
108
|
+
================================= -->
|
109
|
+
<target name="minify" depends="resolve" description="minify js and css">
|
110
|
+
<property name="yuicompressor.jar" value="lib/minify/yuicompressor-2.3.6.jar" />
|
111
|
+
|
112
|
+
<fileset dir="${js.dir}" includes="*.js" excludes="all.min.js" id="alljs" />
|
113
|
+
<fileset dir="${css.dir}" includes="*.css" excludes="*.min.css" id="allcss" />
|
114
|
+
|
115
|
+
<delete file="${css.dir}/all.css" />
|
116
|
+
<concat destfile="${css.dir}/all.css" fixlastline="true">
|
117
|
+
<fileset refid="allcss" />
|
118
|
+
</concat>
|
119
|
+
|
120
|
+
<java jar="${yuicompressor.jar}" fork="true">
|
121
|
+
<arg value="${css.dir}/all.css" />
|
122
|
+
<arg value="-o" />
|
123
|
+
<arg value="${css.dir}/all.min.css" />
|
124
|
+
</java>
|
125
|
+
|
126
|
+
<delete file="${js.dir}/all.js" />
|
127
|
+
<concat destfile="${js.dir}/all.js" fixlastline="true">
|
128
|
+
<fileset refid="alljs" />
|
129
|
+
</concat>
|
130
|
+
|
131
|
+
<java jar="${yuicompressor.jar}" fork="true">
|
132
|
+
<arg value="${js.dir}/all.js" />
|
133
|
+
<arg value="-o" />
|
134
|
+
<arg value="${js.dir}/all.min.js" />
|
135
|
+
</java>
|
136
|
+
</target>
|
137
|
+
|
138
|
+
<!-- =================================
|
139
|
+
target: report
|
140
|
+
================================= -->
|
141
|
+
<target name="report" depends="resolve" description="--> generates a report of dependencies">
|
142
|
+
<mkdir dir="${output.dir}/reports" />
|
143
|
+
<ivy:report todir="${output.dir}/reports" />
|
144
|
+
</target>
|
145
|
+
|
146
|
+
</project>
|