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.
Files changed (103) hide show
  1. data/.document +1 -1
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -3
  4. data/History.txt +10 -0
  5. data/README.textile +32 -0
  6. data/Rakefile +6 -7
  7. data/VERSION.yml +1 -1
  8. data/bin/vraptor +1 -1
  9. data/lib/configuration.rb +31 -0
  10. data/lib/generators/app_generator/app_generator.rb +75 -126
  11. data/lib/generators/app_generator/freemarker_template_engine.rb +50 -0
  12. data/lib/generators/app_generator/jsp_template_engine.rb +21 -0
  13. data/lib/generators/app_generator/templates/build.properties.erb +16 -0
  14. data/lib/generators/app_generator/templates/build.xml +109 -0
  15. data/lib/generators/app_generator/templates/decorators.erb +7 -0
  16. data/lib/generators/app_generator/templates/eclipse/classpath +23 -0
  17. data/lib/generators/app_generator/templates/eclipse/project.erb +36 -0
  18. data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.jdt.core.prefs +8 -0
  19. data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.component.tt +10 -0
  20. data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml +10 -0
  21. data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container +1 -0
  22. data/lib/generators/app_generator/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name +1 -0
  23. data/lib/generators/app_generator/templates/freemarker/freemarker-ivy.xml +2 -0
  24. data/lib/generators/app_generator/templates/freemarker/freemarker-pom.xml +6 -0
  25. data/lib/generators/app_generator/templates/freemarker/freemarker-web.xml +23 -0
  26. data/lib/generators/app_generator/templates/freemarker/infrastructure/FreemarkerPathResolver.java.tt +21 -0
  27. data/lib/generators/app_generator/templates/{macros → freemarker/macros}/html.ftl +0 -0
  28. data/lib/generators/app_generator/templates/freemarker/main.ftl +14 -0
  29. data/lib/generators/app_generator/templates/ivy-2.2.0-rc1.jar +0 -0
  30. data/lib/generators/app_generator/templates/ivy.erb +35 -0
  31. data/lib/generators/app_generator/templates/jsp/main.jsp +16 -0
  32. data/lib/generators/app_generator/templates/pom.erb +24 -3
  33. data/lib/generators/app_generator/templates/{messages.properties → resources-test/.empty_directory} +0 -0
  34. data/lib/generators/app_generator/templates/{persistence.xml → resources/META-INF/persistence.xml} +0 -0
  35. data/lib/generators/app_generator/templates/{log4j.properties → resources/log4j.properties} +0 -0
  36. data/lib/generators/app_generator/templates/resources/messages.properties +0 -0
  37. data/lib/generators/app_generator/templates/src-test/controllers/.empty_directory +0 -0
  38. data/lib/generators/app_generator/templates/src-test/models/.empty_directory +0 -0
  39. data/lib/generators/app_generator/templates/src-test/repositories/.empty_directory +0 -0
  40. data/lib/generators/app_generator/templates/src/controllers/.empty_directory +0 -0
  41. data/lib/generators/app_generator/templates/src/models/Entity.java.tt +45 -0
  42. data/lib/generators/app_generator/templates/src/repositories/Repository.java.tt +43 -0
  43. data/lib/generators/app_generator/templates/vraptor-scaffold.erb +2 -0
  44. data/lib/generators/app_generator/templates/webapp/WEB-INF/web.xml +38 -0
  45. data/lib/generators/app_generator/templates/webapp/images/.empty_directory +0 -0
  46. data/lib/generators/app_generator/templates/{index.jsp → webapp/index.jsp} +0 -0
  47. data/lib/generators/app_generator/templates/{javascripts → webapp/javascripts}/jquery-1.4.2.min.js +0 -0
  48. data/lib/generators/app_generator/templates/{stylesheets → webapp/stylesheets}/scaffold.css +0 -0
  49. data/lib/generators/scaffold_generator/attribute.rb +14 -6
  50. data/lib/generators/scaffold_generator/base_scaffold.rb +14 -10
  51. data/lib/generators/scaffold_generator/controller_generator/controller_generator.rb +6 -6
  52. data/lib/generators/scaffold_generator/controller_generator/templates/controller.erb +7 -7
  53. data/lib/generators/scaffold_generator/controller_generator/templates/controller_test.erb +1 -1
  54. data/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator.rb +5 -5
  55. data/lib/generators/scaffold_generator/freemarker_generator/templates/index.erb +2 -3
  56. data/lib/generators/scaffold_generator/jsp_generator/jsp_generator.rb +22 -0
  57. data/lib/generators/scaffold_generator/jsp_generator/templates/edit.erb +3 -0
  58. data/lib/generators/scaffold_generator/jsp_generator/templates/form.erb +27 -0
  59. data/lib/generators/scaffold_generator/jsp_generator/templates/index.erb +36 -0
  60. data/lib/generators/scaffold_generator/jsp_generator/templates/new.erb +3 -0
  61. data/lib/generators/scaffold_generator/jsp_generator/templates/show.erb +14 -0
  62. data/lib/generators/scaffold_generator/model_generator/model_generator.rb +5 -5
  63. data/lib/generators/scaffold_generator/model_generator/templates/model.erb +1 -1
  64. data/lib/generators/scaffold_generator/model_generator/templates/model_test.erb +1 -1
  65. data/lib/generators/scaffold_generator/repository_generator/repository_generator.rb +6 -5
  66. data/lib/generators/scaffold_generator/repository_generator/templates/repository.erb +17 -9
  67. data/lib/generators/scaffold_generator/repository_generator/templates/repository_impl.erb +16 -0
  68. data/lib/generators/scaffold_generator/repository_generator/templates/repository_test.erb +2 -2
  69. data/lib/generators/scaffold_generator/scaffold_generator.rb +31 -38
  70. data/lib/load_paths.rb +6 -2
  71. data/lib/vraptor-scaffold.rb +29 -5
  72. data/spec/lib/configuration_spec.rb +60 -0
  73. data/spec/lib/generators/app_generator/app_generator_spec.rb +237 -116
  74. data/spec/lib/generators/app_generator/freemarker_template_engine_spec.rb +92 -0
  75. data/spec/lib/generators/app_generator/jsp_template_engine_spec.rb +44 -0
  76. data/{lib → spec/lib}/generators/app_generator/templates/Entity.java +5 -2
  77. data/{lib → spec/lib}/generators/app_generator/templates/FreemarkerPathResolver.java +1 -1
  78. data/{lib → spec/lib}/generators/app_generator/templates/Repository.java +6 -6
  79. data/spec/lib/generators/app_generator/templates/build.properties +16 -0
  80. data/spec/lib/generators/app_generator/templates/decorators-jsp.xml +7 -0
  81. data/{lib → spec/lib}/generators/app_generator/templates/decorators.xml +2 -2
  82. data/spec/lib/generators/app_generator/templates/ivy.xml +35 -0
  83. data/spec/lib/generators/app_generator/templates/pom.xml +24 -3
  84. data/spec/lib/generators/scaffold_generator/attribute_spec.rb +47 -27
  85. data/spec/lib/generators/scaffold_generator/base_scaffold_spec.rb +31 -27
  86. data/spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb +11 -9
  87. data/spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java +2 -2
  88. data/spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb +16 -14
  89. data/spec/lib/generators/scaffold_generator/jsp_generator/jsp_generator_spec.rb +34 -0
  90. data/spec/lib/generators/scaffold_generator/model_generator/model_generator_spec.rb +11 -9
  91. data/spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb +17 -9
  92. data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepository.java +15 -7
  93. data/spec/lib/generators/scaffold_generator/repository_generator/templates/ProductRepositoryImpl.java +16 -0
  94. data/spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb +55 -57
  95. data/spec/lib/vraptor-scaffold_spec.rb +77 -24
  96. data/spec/resources/vraptor-scaffold.properties +2 -0
  97. data/spec/spec_helper.rb +13 -1
  98. data/vraptor-scaffold.gemspec +82 -34
  99. metadata +86 -42
  100. data/README.rdoc +0 -104
  101. data/TODO.txt +0 -17
  102. data/lib/generators/app_generator/templates/main.ftl +0 -14
  103. data/lib/generators/app_generator/templates/web.xml +0 -61
@@ -1,104 +0,0 @@
1
- = Vraptor Scaffold
2
- Scaffold for vraptor 3.
3
-
4
- == Installation
5
- gem install vraptor-scaffold --pre
6
-
7
- == Dependencies
8
- Ensures that you already have installed:
9
-
10
- - Java 6
11
- - Maven 2
12
-
13
- == Getting Started
14
- At the command line client:
15
-
16
- - vraptor new myapp
17
- - Change directory into myapp
18
- - vraptor scaffold product name:string value:double
19
- - vraptor start
20
- - Go http://localhost:8080/products
21
-
22
- == Tests
23
- At the command line client:
24
-
25
- - Running: mvn clean test
26
- - Code coverage: mvn clean cobertura:cobertura
27
-
28
- == Web Server
29
- The default web server is jetty but you can import the project in your favorite ide
30
- and run your project with tomcat or jboss as for example.
31
-
32
- == Supported Java Types
33
- The only supported types for now are: boolean, double, float, short, integer, long, string and text.
34
-
35
- == Architecture Overview
36
- When you run vraptor new command will be created a java web application with:
37
-
38
- - Vraptor3 = Controller
39
- - Jpa(Hibernate and Hibernate Validator) = ORM
40
- - Freemarker = Template Engine
41
- - Sitemesh = Decorator
42
- - Maven2 = Project Management
43
- - jQuery = JavaScript
44
- - Junit
45
- - Hamcrest
46
- - Mockito
47
-
48
- == Description of Contents
49
-
50
- src/main/java/app/controllers
51
- Controllers will be placed here.
52
-
53
- src/main/java/app/models
54
- Models will be placed here.
55
-
56
- src/main/java/app/repositories
57
- Repositories will be placed here.
58
-
59
- src/main/webapp
60
- Web root folder.
61
-
62
- src/main/webapp/decorators
63
- Decorators will be placed here.
64
-
65
- src/main/webapp/javascripts
66
- JavaScripts will be placed here.
67
-
68
- src/main/webapp/stylesheets
69
- CSS will be placed here.
70
-
71
- src/main/webapp/WEB-INF/views
72
- Views will be placed here. Ex: product/index.ftl
73
-
74
- src/test/java/app/controllers
75
- Tests to controllers will be placed here.
76
-
77
- src/test/java/app/models
78
- Testes to models will be placed here.
79
-
80
- src/test/java/app/repositories
81
- Tests to repositories will be placed here.
82
-
83
- == Where next?
84
- - Anothers build framework like ant, gradle and ivy.
85
- - More views generators like velocity, jsp and scaml.
86
- - More ORM generators with openJPA and TopLink.
87
- - Relationship(ManyToOne, OneToMany, etc) and date(LocalDate, LocalDateTime, LocalTime) support.
88
- - JPA2 support.
89
-
90
- == Note on Patches/Pull Requests
91
-
92
- * Fork the project.
93
- * Make your feature addition or bug fix.
94
- * Add tests for it. This is important so I don't break it in a
95
- future version unintentionally.
96
- * Commit, do not mess with rakefile, version, or history.
97
- (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)
98
- * Send me a pull request. Bonus points for topic branches.
99
-
100
- == Author
101
- -- Rodolfo Liviero [mailto:rodolfoliviero@gmail.com]
102
-
103
- == Copyright
104
- Copyright (c) 2010 Rodolfo Liviero. See LICENSE for details.
data/TODO.txt DELETED
@@ -1,17 +0,0 @@
1
- better unit tests to generated code
2
- datetime, date and time support.(jquery-ui?)
3
- relationship support(many-to-one, one-to-many, many-to-many)
4
-
5
- generators help
6
- usage file to each generator
7
- create others persistence unit(maven profile?)
8
- update jpa to jpa2(hibernate 3.5.?-FINAL)
9
-
10
- put all html input in macros
11
- i18n messages
12
- hibernate joda-time support
13
- top leval package
14
- scaml support
15
- jetty goal
16
- support to change default encondig when create new app like --enconding=ISO-8859-1
17
- cuke for duke
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <@html.css "scaffold"/>
6
- <title>Vraptor Scaffold</title>
7
- ${head}
8
- </head>
9
-
10
- <body>
11
- ${body}
12
- <@html.js "jquery-1.4.2.min"/>
13
- </body>
14
- </html>
@@ -1,61 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
4
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5
- id="WebApp_ID" version="2.5">
6
-
7
- <display-name>vraptor-scaffold-project</display-name>
8
-
9
- <context-param>
10
- <param-name>br.com.caelum.vraptor.provider</param-name>
11
- <param-value>br.com.caelum.vraptor.util.jpa.JPACustomProvider</param-value>
12
- </context-param>
13
-
14
- <context-param>
15
- <param-name>br.com.caelum.vraptor.encoding</param-name>
16
- <param-value>UTF-8</param-value>
17
- </context-param>
18
-
19
- <filter>
20
- <filter-name>sitemesh</filter-name>
21
- <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
22
- </filter>
23
-
24
- <filter>
25
- <filter-name>vraptor</filter-name>
26
- <filter-class>br.com.caelum.vraptor.VRaptor</filter-class>
27
- </filter>
28
-
29
- <filter-mapping>
30
- <filter-name>sitemesh</filter-name>
31
- <url-pattern>/*</url-pattern>
32
- </filter-mapping>
33
-
34
- <filter-mapping>
35
- <filter-name>vraptor</filter-name>
36
- <url-pattern>/*</url-pattern>
37
- </filter-mapping>
38
-
39
- <servlet>
40
- <servlet-name>sitemesh-freemarker</servlet-name>
41
- <servlet-class>com.opensymphony.module.sitemesh.freemarker.FreemarkerDecoratorServlet</servlet-class>
42
- <init-param>
43
- <param-name>TemplatePath</param-name>
44
- <param-value>/</param-value>
45
- </init-param>
46
- <init-param>
47
- <param-name>default_encoding</param-name>
48
- <param-value>UTF-8</param-value>
49
- </init-param>
50
- <init-param>
51
- <param-name>auto_import</param-name>
52
- <param-value>macros/html.ftl as html</param-value>
53
- </init-param>
54
- <load-on-startup>1</load-on-startup>
55
- </servlet>
56
-
57
- <servlet-mapping>
58
- <servlet-name>sitemesh-freemarker</servlet-name>
59
- <url-pattern>*.ftl</url-pattern>
60
- </servlet-mapping>
61
- </web-app>