vraptor-scaffold 1.3.0.rc → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.rvmrc.example +1 -0
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.rdoc +22 -3
  4. data/Rakefile +2 -2
  5. data/lib/vraptor-scaffold.rb +1 -1
  6. data/lib/vraptor-scaffold/generators/app/app_generator.rb +23 -56
  7. data/lib/vraptor-scaffold/generators/app/dependency/default_dependencies.rb +44 -0
  8. data/lib/vraptor-scaffold/generators/app/{dependency.rb → dependency/dependency.rb} +0 -0
  9. data/lib/vraptor-scaffold/generators/app/dependency/dependency_manager.rb +25 -0
  10. data/lib/vraptor-scaffold/generators/app/dependency/gae_dependencies.rb +49 -0
  11. data/lib/vraptor-scaffold/generators/app/dependency/heroku_dependencies.rb +48 -0
  12. data/lib/vraptor-scaffold/generators/app/freemarker_template_engine.rb +7 -5
  13. data/lib/vraptor-scaffold/generators/app/gae_app_generator.rb +145 -0
  14. data/lib/vraptor-scaffold/generators/app/jsp_template_engine.rb +6 -5
  15. data/lib/vraptor-scaffold/generators/app/templates/build-gae.xml +144 -0
  16. data/lib/vraptor-scaffold/generators/app/templates/build.gradle.erb +4 -4
  17. data/lib/vraptor-scaffold/generators/app/templates/eclipse/classpath-gae.erb +1 -3
  18. data/lib/vraptor-scaffold/generators/app/templates/eclipse/classpath.erb +1 -1
  19. data/lib/vraptor-scaffold/generators/app/templates/eclipse/project-gae.erb +2 -2
  20. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/com.google.appengine.eclipse.core.prefs +4 -0
  21. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/com.google.gdt.eclipse.core.prefs +1 -2
  22. data/lib/vraptor-scaffold/generators/app/templates/freemarker/macros/html.ftl +12 -0
  23. data/lib/vraptor-scaffold/generators/app/templates/freemarker/main.ftl.erb +18 -0
  24. data/lib/vraptor-scaffold/generators/app/templates/gae/appengine-web.xml.tt +1 -0
  25. data/lib/vraptor-scaffold/generators/app/templates/gae/ivysettings.xml +1 -1
  26. data/lib/vraptor-scaffold/generators/app/templates/gitignore-gae +4 -0
  27. data/lib/vraptor-scaffold/generators/app/templates/ivy.erb +3 -3
  28. data/lib/vraptor-scaffold/generators/app/templates/jsp/main.jsp.erb +20 -0
  29. data/lib/vraptor-scaffold/generators/app/templates/pom.erb +3 -3
  30. data/lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold-gae.erb +7 -0
  31. data/lib/vraptor-scaffold/generators/base.rb +21 -0
  32. data/lib/vraptor-scaffold/generators/scaffold/attribute.rb +7 -1
  33. data/lib/vraptor-scaffold/generators/scaffold/base_scaffold.rb +18 -0
  34. data/lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller.erb +26 -1
  35. data/lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller_test.erb +1 -1
  36. data/lib/vraptor-scaffold/generators/scaffold/import_manager.rb +20 -0
  37. data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/model.erb +7 -4
  38. data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/objectify_model.erb +3 -3
  39. data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/templates/form.erb +8 -0
  40. data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/jsp_generator/templates/form.erb +13 -3
  41. data/lib/vraptor-scaffold/load_paths.rb +3 -3
  42. data/lib/vraptor-scaffold/runner/generator.rb +11 -1
  43. data/lib/vraptor-scaffold/runner/start.rb +1 -1
  44. data/lib/vraptor-scaffold/version.rb +1 -1
  45. data/maven/repo/br/com/caelum/vraptor3.4-compatible-gae/1.1/vraptor3.4-compatible-gae-1.1.jar +0 -0
  46. data/spec/spec_helper.rb +9 -1
  47. data/spec/vraptor-scaffold/generators/app/app_generator_spec.rb +47 -99
  48. data/spec/vraptor-scaffold/generators/app/dependency/dependency_manager_spec.rb +21 -0
  49. data/spec/vraptor-scaffold/generators/app/{dependency_spec.rb → dependency/dependency_spec.rb} +4 -4
  50. data/spec/vraptor-scaffold/generators/app/dependency/gae_dependencies_spec.rb +20 -0
  51. data/spec/vraptor-scaffold/generators/app/dependency/heroku_dependencies_spec.rb +20 -0
  52. data/spec/vraptor-scaffold/generators/app/freemarker_template_engine_spec.rb +49 -7
  53. data/spec/vraptor-scaffold/generators/app/gae_app_generator_spec.rb +286 -0
  54. data/spec/vraptor-scaffold/generators/app/jsp_template_engine_spec.rb +49 -7
  55. data/spec/vraptor-scaffold/generators/app/templates/build.gradle +6 -6
  56. data/spec/vraptor-scaffold/generators/app/templates/classpath-gae +1 -3
  57. data/spec/vraptor-scaffold/generators/app/templates/gae-jsp-web.xml +1 -1
  58. data/spec/vraptor-scaffold/generators/app/templates/ivy-gae.xml +8 -6
  59. data/spec/vraptor-scaffold/generators/app/templates/ivy.xml +5 -5
  60. data/{lib/vraptor-scaffold/generators/app/templates/freemarker/main.ftl → spec/vraptor-scaffold/generators/app/templates/main-with-jquery.ftl} +0 -0
  61. data/{lib/vraptor-scaffold/generators/app/templates/jsp/main.jsp → spec/vraptor-scaffold/generators/app/templates/main-with-jquery.jsp} +0 -0
  62. data/spec/vraptor-scaffold/generators/app/templates/main-without-jquery.ftl +14 -0
  63. data/spec/vraptor-scaffold/generators/app/templates/main-without-jquery.jsp +16 -0
  64. data/spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml +5 -5
  65. data/spec/vraptor-scaffold/generators/app/templates/pom.xml +5 -5
  66. data/spec/vraptor-scaffold/generators/app/templates/project-gae +2 -2
  67. data/spec/vraptor-scaffold/generators/app/templates/vraptor-scaffold-gae.properties +7 -0
  68. data/spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle +7 -7
  69. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle +6 -6
  70. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml +5 -5
  71. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml +5 -5
  72. data/spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml +6 -6
  73. data/spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml +6 -6
  74. data/spec/vraptor-scaffold/generators/plugin/plugin_generator_spec.rb +7 -7
  75. data/spec/vraptor-scaffold/generators/scaffold/attribute_spec.rb +198 -181
  76. data/spec/vraptor-scaffold/generators/scaffold/base_scaffold_spec.rb +7 -1
  77. data/spec/vraptor-scaffold/generators/scaffold/controller_generator/templates/ProductController.java +9 -1
  78. data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/templates/form.ftl +15 -0
  79. data/spec/vraptor-scaffold/generators/scaffold/import_manager_spec.rb +9 -0
  80. data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/templates/form.jsp +23 -3
  81. data/spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb +2 -2
  82. data/spec/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator_spec.rb +6 -6
  83. data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Objectify_Product.java +23 -5
  84. data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Product.java +24 -6
  85. data/spec/vraptor-scaffold/http_request_spec.rb +10 -0
  86. data/spec/vraptor-scaffold/runner/generator_spec.rb +18 -2
  87. metadata +86 -30
  88. data/lib/vraptor-scaffold/generators/app/dependency_manager.rb +0 -83
  89. data/spec/vraptor-scaffold/generators/app/dependency_manager_spec.rb +0 -34
@@ -0,0 +1 @@
1
+ rvm 1.9.3@vraptor-scaffold
@@ -3,4 +3,5 @@ notifications:
3
3
  - rodolfo.liviero@gmail.com
4
4
 
5
5
  rvm:
6
- - 1.9.2
6
+ - 1.9.2
7
+ - 1.9.3
@@ -1,10 +1,29 @@
1
- == 1.3.0 / 2011-??-??
1
+ == 1.3.1 / 2012-??-??
2
+
3
+ * New Features
4
+ * Support entity relationship on scaffold (vraptor scaffold student pencil:references).
5
+ * Skip jquery download (vraptor new app --skip-jquery)
6
+ * vraptor-scanning ant task for appengine projects. Fast bootstrap for apps.
7
+
8
+ * Improvements
9
+ * Update vraptor to 3.4.1.
10
+ * Update gae to 1.7.2.1 sdk.
11
+ * Replaced http requisitions by mocks on specs. Specs running so fast.
12
+ * Refactoring on app generators.
13
+ * Refactoring on dependency manager.
14
+
15
+ == 1.3.0 / 2012-??-??
2
16
 
3
17
  * New Features
4
18
  * GAE support (vraptor new app --gae).
5
19
  * Customizing templates.
6
20
  * Added start command (vraptor start).
7
21
 
22
+ * Improvements
23
+ * updated mockito to 1.9.0.
24
+ * updated hibernte to 4.0.1.Final.
25
+ * updated hsqldb to 2.2.8.
26
+
8
27
  == 1.2.3 / 2011-11-15
9
28
 
10
29
  * Bugfixes
@@ -157,7 +176,7 @@
157
176
  * Redirect to form when occur validation erros.
158
177
  * Added joda time dependency.
159
178
  * Create messages.properties(i18n).
160
-
179
+
161
180
  * Bugfixes
162
181
  * Fixed i.e problems.
163
182
 
@@ -172,7 +191,7 @@
172
191
  * Change log4j.xml to log4j.properties.
173
192
  * Change views directory from WEB-INF/freemarker to WEB-INF/views.
174
193
  * Change hsqldb to use file instead of memory.
175
-
194
+
176
195
  * Bugfixes
177
196
  * Fixed pom when creating project with path like /home/rodolfo/project.
178
197
  * Fixed runtime dependencies.
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
3
 
4
4
  require 'spec/rake/spectask'
5
5
  Spec::Rake::SpecTask.new(:spec) do |spec|
@@ -12,4 +12,4 @@ require 'vraptor-scaffold/configuration'
12
12
  require 'vraptor-scaffold/runner'
13
13
  require 'vraptor-scaffold/execution'
14
14
  require 'vraptor-scaffold/http_request'
15
- require 'vraptor-scaffold/load_paths'
15
+ require 'vraptor-scaffold/generators/base'
@@ -22,8 +22,8 @@ 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"
25
+ class_option :gae, :type => :boolean,
26
+ :desc => "gae project"
27
27
 
28
28
  class_option :repositories_package, :aliases => "-r", :default => "repositories",
29
29
  :desc => "Define repositories package"
@@ -34,8 +34,8 @@ class AppGenerator < VraptorScaffold::Base
34
34
  class_option :orm, :default => "jpa", :aliases => "-o",
35
35
  :desc => "Object-relational mapping (options: #{ORMS.join(', ')})"
36
36
 
37
- class_option :jquery, :aliases => "-j", :default => "latest version",
38
- :desc => "jQuery version"
37
+ class_option :skip_jquery, :type => :boolean, :aliases => "-j",
38
+ :desc => "Skip jQuery download file"
39
39
 
40
40
  class_option :skip_eclipse, :type => :boolean, :aliases => "-E",
41
41
  :desc => "Skip Eclipse files"
@@ -53,7 +53,7 @@ class AppGenerator < VraptorScaffold::Base
53
53
  validate
54
54
  self.destination_root=(project_path)
55
55
  @project_name = project_path.split("/").last
56
- @dependency_manager = DependencyManager.new(options)
56
+ @dependencies = DependencyManager.new(options).dependencies
57
57
  end
58
58
 
59
59
  def create_root_folder
@@ -75,9 +75,6 @@ class AppGenerator < VraptorScaffold::Base
75
75
  template("ivy.erb", "ivy.xml")
76
76
  copy_file(IVY_JAR)
77
77
  end
78
- if options[:gae]
79
- copy_file("gae/ivysettings.xml", "ivysettings.xml")
80
- end
81
78
  end
82
79
 
83
80
  def configure_gradle
@@ -85,10 +82,9 @@ class AppGenerator < VraptorScaffold::Base
85
82
  end
86
83
 
87
84
  def configure_vraptor_packages
88
- vraptor_util_package = "br.com.caelum.vraptor.util"
85
+ vraptor_util_package = "br.com.caelum.vraptor"
89
86
  @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]
87
+ @vraptor_packages += ["#{vraptor_util_package}.util.#{orm}"] if orm == "jpa" or orm == "hibernate"
92
88
  end
93
89
 
94
90
  def create_main_java
@@ -106,17 +102,13 @@ class AppGenerator < VraptorScaffold::Base
106
102
  def create_models_directory
107
103
  models_folder = File.join @src, options[:models_package]
108
104
  empty_directory models_folder
109
- template("models/Entity.erb", "#{models_folder}/Entity.java") unless options[:gae]
105
+ template("models/Entity.erb", "#{models_folder}/Entity.java")
110
106
  end
111
107
 
112
108
  def create_repositories_directory
113
109
  repositories_folder = File.join @src, options[:repositories_package]
114
110
  empty_directory repositories_folder
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
111
+ template("orm/Repository-#{orm}.java.tt", "#{repositories_folder}/Repository.java")
120
112
  end
121
113
 
122
114
  def create_main_resources
@@ -126,10 +118,6 @@ class AppGenerator < VraptorScaffold::Base
126
118
  def configure_orm
127
119
  if (orm == "hibernate")
128
120
  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")
133
121
  else
134
122
  metainf = File.join Configuration::MAIN_RESOURCES, 'META-INF'
135
123
  empty_directory metainf
@@ -139,16 +127,15 @@ class AppGenerator < VraptorScaffold::Base
139
127
 
140
128
  def create_webapp
141
129
  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
146
130
  end
147
131
 
148
132
  def create_javascripts
149
133
  javascripts = File.join Configuration::WEB_APP, "javascripts"
150
134
  create_file File.join javascripts, "application.js"
151
- add_file (File.join javascripts, "jquery.min.js"), get_jquery.body
135
+ unless options[:skip_jquery]
136
+ jquery = get_jquery
137
+ add_file (File.join javascripts, "jquery.min.js"), jquery.body if jquery
138
+ end
152
139
  end
153
140
 
154
141
  def configure_scaffold_properties
@@ -157,7 +144,7 @@ class AppGenerator < VraptorScaffold::Base
157
144
 
158
145
  def configure_template_engine
159
146
  templates = {"jsp" => JspTemplateEngine, "ftl" => FreemarkerTemplateEngine}
160
- templates[options[:template_engine]].new(project_path).configure if templates[options[:template_engine]]
147
+ templates[options[:template_engine]].new(project_path, @options).configure if templates[options[:template_engine]]
161
148
  end
162
149
 
163
150
  def create_test
@@ -174,25 +161,17 @@ class AppGenerator < VraptorScaffold::Base
174
161
  private
175
162
  def build_tool
176
163
  return "mvn" if options[:heroku]
177
- return "ant" if options[:gae]
178
164
  options[:build_tool]
179
165
  end
180
166
 
181
167
  def orm
182
- return "objectify" if options[:gae]
183
168
  options[:orm]
184
169
  end
185
170
 
186
171
  def create_eclipse_files
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
172
+ template("eclipse/classpath.erb", ".classpath")
173
+ template("eclipse/project.erb", ".project")
174
+ directory("eclipse/settings", ".settings")
196
175
  end
197
176
 
198
177
  def validate
@@ -209,33 +188,21 @@ class AppGenerator < VraptorScaffold::Base
209
188
  Kernel::exit
210
189
  end
211
190
 
212
- if options[:heroku] and options[:gae]
213
- puts "You cannot create gae and heroku template project together"
214
- Kernel::exit
215
- end
216
-
217
191
  if File.directory? project_path
218
192
  puts "The project #{project_path} already exist"
219
193
  Kernel::exit
220
194
  end
221
-
222
- if options[:jquery] != 'latest version'
223
- case get_jquery
224
- when Net::HTTPClientError, Net::HTTPServerError
225
- download_url = "http://docs.jquery.com/Downloading_jQuery"
226
- puts "jQuery version #{options[:jquery]} was not found. Please visit the download page to see the versions available #{download_url}."
227
- Kernel::exit
228
- end
229
- end
230
195
  end
231
196
 
232
197
  def jquery_uri
233
- jquery_version = "1" #this mean get latest version
234
- jquery_version = options[:jquery] if options[:jquery] != 'latest version'
235
- "/ajax/libs/jquery/#{jquery_version}/jquery.min.js"
198
+ "/ajax/libs/jquery/1/jquery.min.js"
236
199
  end
237
200
 
238
201
  def get_jquery
239
- VraptorScaffold::HttpRequest.open_session("ajax.googleapis.com").get jquery_uri
202
+ begin
203
+ VraptorScaffold::HttpRequest.open_session("ajax.googleapis.com").get jquery_uri;
204
+ rescue
205
+ Kernel.puts "Was not possible to download jQuery."
206
+ end
240
207
  end
241
208
  end
@@ -0,0 +1,44 @@
1
+ class DefaultDependencies
2
+
3
+ attr_accessor :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def compile_scope
10
+ dependencies = append_freemarker_dependency_if_necessary default_dependencies
11
+ dependencies
12
+ end
13
+
14
+ def test_scope
15
+ [Dependency.new("junit", "junit", "4.10"),
16
+ Dependency.new("org.hamcrest", "hamcrest-all", "1.1"),
17
+ Dependency.new("org.mockito", "mockito-all", "1.9.0")]
18
+ end
19
+
20
+ def provided_scope
21
+ [Dependency.new("javax.servlet", "servlet-api", "2.5"), Dependency.new("javax.servlet.jsp", "jsp-api", "2.1")]
22
+ end
23
+
24
+ private
25
+ def default_dependencies
26
+ hibernate_version = "4.0.1.Final"
27
+ dependencies = [Dependency.new("br.com.caelum", "vraptor", "3.4.1"),
28
+ Dependency.new("opensymphony", "sitemesh", "2.4.2"),
29
+ Dependency.new("javax.servlet", "jstl", "1.2"),
30
+ Dependency.new("org.hsqldb", "hsqldb", "2.2.8"),
31
+ Dependency.new("org.hibernate", "hibernate-entitymanager", hibernate_version),
32
+ Dependency.new("org.hibernate", "hibernate-c3p0", hibernate_version),
33
+ Dependency.new("org.hibernate", "hibernate-validator", "4.2.0.Final"),
34
+ Dependency.new("joda-time", "joda-time", "2.0"),
35
+ Dependency.new("com.thoughtworks.xstream", "xstream", "1.4.1")]
36
+
37
+ dependencies
38
+ end
39
+
40
+ def append_freemarker_dependency_if_necessary dependencies
41
+ dependencies << Dependency.new("org.freemarker", "freemarker", "2.3.18") if @options[:template_engine] == 'ftl'
42
+ dependencies
43
+ end
44
+ end
@@ -0,0 +1,25 @@
1
+ class DependencyManager
2
+
3
+ attr_accessor :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def dependencies
10
+ dependencies_per_project = {"default" => DefaultDependencies,
11
+ "gae" => GaeDependencies,
12
+ "heroku" => HerokuDependencies}
13
+
14
+ dependencies_per_project.fetch(project_style).new(@options)
15
+ end
16
+
17
+ private
18
+ def project_style
19
+ return "heroku" if @options[:heroku]
20
+ return "gae" if @options[:gae]
21
+
22
+ "default"
23
+ end
24
+
25
+ end
@@ -0,0 +1,49 @@
1
+ class GaeDependencies
2
+
3
+ attr_accessor :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def compile_scope
10
+ dependencies = append_freemarker_dependency_if_necessary default_dependencies
11
+ dependencies
12
+ end
13
+
14
+ def test_scope
15
+ [Dependency.new("junit", "junit", "4.10"),
16
+ Dependency.new("org.hamcrest", "hamcrest-all", "1.1"),
17
+ Dependency.new("org.mockito", "mockito-all", "1.9.0")]
18
+ end
19
+
20
+ def provided_scope
21
+ [Dependency.new("javax.servlet", "servlet-api", "2.5"), Dependency.new("javax.servlet.jsp", "jsp-api", "2.1")]
22
+ end
23
+
24
+ def default_dependencies
25
+ dependencies = [Dependency.new("br.com.caelum", "vraptor", "3.4.1", [Dependency.new("org.objenesis", "objenesis")]),
26
+ Dependency.new("opensymphony", "sitemesh", "2.4.2"),
27
+ Dependency.new("javax.servlet", "jstl", "1.2"),
28
+ Dependency.new("org.hibernate", "hibernate-validator", "4.2.0.Final"),
29
+ Dependency.new("joda-time", "joda-time", "2.0"),
30
+ Dependency.new("com.thoughtworks.xstream", "xstream", "1.4.1")]
31
+
32
+ appengine_version = "1.7.2.1"
33
+ dependencies += [Dependency.new("com.googlecode.objectify", "objectify", "3.1"),
34
+ Dependency.new("br.com.caelum", "vraptor3.4-compatible-gae", "1.1"),
35
+ Dependency.new("commons-fileupload", "commons-fileupload", "1.2.2"),
36
+ Dependency.new("com.google.appengine", "appengine-api-1.0-sdk", appengine_version),
37
+ Dependency.new("com.google.appengine", "appengine-api-labs", appengine_version),
38
+ Dependency.new("com.google.appengine", "appengine-jsr107cache", appengine_version),
39
+ Dependency.new("net.sf.jsr107cache", "jsr107cache", "1.1"),
40
+ Dependency.new("org.apache.geronimo.specs", "geronimo-jpa_3.0_spec", "1.1.1")]
41
+
42
+ dependencies
43
+ end
44
+
45
+ def append_freemarker_dependency_if_necessary dependencies
46
+ dependencies << Dependency.new("org.freemarker", "freemarker", "2.3.18") if @options[:template_engine] == 'ftl'
47
+ dependencies
48
+ end
49
+ end
@@ -0,0 +1,48 @@
1
+ class HerokuDependencies
2
+
3
+ attr_accessor :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def compile_scope
10
+ dependencies = append_freemarker_dependency_if_necessary default_dependencies
11
+ dependencies
12
+ end
13
+
14
+ def test_scope
15
+ [Dependency.new("junit", "junit", "4.10"),
16
+ Dependency.new("org.hamcrest", "hamcrest-all", "1.1"),
17
+ Dependency.new("org.mockito", "mockito-all", "1.9.0")]
18
+ end
19
+
20
+ def provided_scope
21
+ return []
22
+ end
23
+
24
+ private
25
+ def default_dependencies
26
+ hibernate_version = "4.0.1.Final"
27
+ dependencies = [Dependency.new("br.com.caelum", "vraptor", "3.4.1"),
28
+ Dependency.new("opensymphony", "sitemesh", "2.4.2"),
29
+ Dependency.new("javax.servlet", "jstl", "1.2"),
30
+ Dependency.new("org.hsqldb", "hsqldb", "2.2.8"),
31
+ Dependency.new("org.hibernate", "hibernate-entitymanager", hibernate_version),
32
+ Dependency.new("org.hibernate", "hibernate-c3p0", hibernate_version),
33
+ Dependency.new("org.hibernate", "hibernate-validator", "4.2.0.Final"),
34
+ Dependency.new("joda-time", "joda-time", "2.0"),
35
+ Dependency.new("com.thoughtworks.xstream", "xstream", "1.4.1")]
36
+
37
+ #heroku
38
+ dependencies += [Dependency.new("org.eclipse.jetty", "jetty-webapp", "7.4.4.v20110707"),
39
+ Dependency.new("org.mortbay.jetty", "jsp-2.1-glassfish", "2.1.v20100127"),
40
+ Dependency.new("javax.servlet", "servlet-api", "2.5")]
41
+ dependencies
42
+ end
43
+
44
+ def append_freemarker_dependency_if_necessary dependencies
45
+ dependencies << Dependency.new("org.freemarker", "freemarker", "2.3.18") if @options[:template_engine] == 'ftl'
46
+ dependencies
47
+ end
48
+ end
@@ -4,16 +4,18 @@ class FreemarkerTemplateEngine < VraptorScaffold::Base
4
4
  File.join(File.dirname(__FILE__), "templates", "freemarker")
5
5
  end
6
6
 
7
- def initialize(project_path)
7
+ def initialize(project_path, options)
8
8
  super
9
9
  self.destination_root=(project_path)
10
10
  @project_path = project_path
11
+ @options = options
11
12
  end
12
13
 
13
14
  def configure
14
15
  directory("macros", File.join(Configuration::WEB_APP, "macros"))
15
16
  template("../decorators.erb", File.join(Configuration::WEB_INF, "decorators.xml"))
16
- copy_file("main.ftl", File.join(Configuration::WEB_INF, decorators_path, "main.ftl"))
17
+ template("main.ftl.erb", File.join(Configuration::WEB_INF, decorators_path, "main.ftl"))
18
+ #copy_file("main.ftl", File.join(Configuration::WEB_INF, decorators_path, "main.ftl"))
17
19
  directory("infrastructure", infra_path)
18
20
  append_freemarker_servlet
19
21
  end
@@ -21,7 +23,7 @@ class FreemarkerTemplateEngine < VraptorScaffold::Base
21
23
  def extension
22
24
  "ftl"
23
25
  end
24
-
26
+
25
27
  def decorators_path
26
28
  File.join "views", "decorators"
27
29
  end
@@ -36,9 +38,9 @@ class FreemarkerTemplateEngine < VraptorScaffold::Base
36
38
  file = File.join(Configuration::WEB_INF, "web.xml")
37
39
  template = File.join FreemarkerTemplateEngine.source_root, "freemarker-web.xml"
38
40
  inject_into_file(file, File.read(template), :before => "</web-app>", :verbose => false)
39
- end
41
+ end
40
42
 
41
43
  def infra_path
42
44
  File.join Configuration::MAIN_SRC, package.gsub(".", File::Separator), "infrastructure"
43
45
  end
44
- end
46
+ end