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
@@ -1,83 +0,0 @@
1
- class DependencyManager
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 = append_heroku_dependencies_if_necessary dependencies
12
- dependencies = append_gae_dependencies_if_necessary dependencies
13
- dependencies
14
- end
15
-
16
- def test_scope
17
- [Dependency.new("junit", "junit", "4.10"),
18
- Dependency.new("org.hamcrest", "hamcrest-all", "1.1"),
19
- Dependency.new("org.mockito", "mockito-all", "1.8.5")]
20
- end
21
-
22
- def provided_scope
23
- if @options[:heroku]
24
- return []
25
- end
26
- [Dependency.new("javax.servlet", "servlet-api", "2.5"), Dependency.new("javax.servlet.jsp", "jsp-api", "2.1")]
27
- end
28
-
29
- private
30
- def default_dependencies
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
52
- end
53
-
54
- def append_heroku_dependencies_if_necessary dependencies
55
- if @options[:heroku]
56
- dependencies += [Dependency.new("org.eclipse.jetty", "jetty-webapp", "7.4.4.v20110707"),
57
- Dependency.new("org.mortbay.jetty", "jsp-2.1-glassfish", "2.1.v20100127"),
58
- Dependency.new("javax.servlet", "servlet-api", "2.5")]
59
- end
60
- dependencies
61
- end
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
-
79
- def append_freemarker_dependency_if_necessary dependencies
80
- dependencies << Dependency.new("org.freemarker", "freemarker", "2.3.18") if @options[:template_engine] == 'ftl'
81
- dependencies
82
- end
83
- end
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
2
-
3
- describe DependencyManager do
4
-
5
- before(:each) do
6
- others_dependency = mock(Dependency)
7
- others_dependency.stub!(:exclusions).and_return([])
8
- Dependency.stub!(:new).and_return(others_dependency)
9
- @dependency = mock(Dependency)
10
- end
11
-
12
- context "compile scope" do
13
- it "should include freemarker dependency when template is freemarker" do
14
- options = {:template_engine => "ftl"}
15
- Dependency.stub!(:new).with("org.freemarker", "freemarker", "2.3.18").and_return(@dependency)
16
- DependencyManager.new(options).compile_scope.include?(@dependency).should be_true
17
- end
18
-
19
- context "dependencies for a gae app" do
20
- it "should include gae dependencies when gae project option is selected" do
21
- options = {:gae => true}
22
- Dependency.stub!(:new).with("com.googlecode.objectify", "objectify", "3.1").and_return(@dependency)
23
- DependencyManager.new(options).compile_scope.include?(@dependency).should be_true
24
- end
25
-
26
- it "should not have hibernate persistence dependencies when gae project option is selected" do
27
- options = {:gae => true}
28
- Dependency.stub!(:new).with("org.hibernate", "hibernate-entitymanager", "3.6.7.Final").and_return(@dependency)
29
- DependencyManager.new(options).compile_scope.include?(@dependency).should be_false
30
- end
31
- end
32
- end
33
-
34
- end