vraptor-scaffold 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/CHANGELOG.rdoc +164 -0
- data/Gemfile.lock +5 -8
- data/README.textile +20 -7
- data/bin/vraptor +1 -1
- data/index.sample.html +169 -0
- data/lib/vraptor-scaffold.rb +10 -29
- data/lib/vraptor-scaffold/configuration.rb +27 -4
- data/lib/vraptor-scaffold/execution.rb +24 -0
- data/lib/vraptor-scaffold/generators/app/app_generator.rb +196 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/dependency.rb +0 -0
- data/lib/vraptor-scaffold/generators/app/dependency_manager.rb +53 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/freemarker_template_engine.rb +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/jsp_template_engine.rb +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/build.gradle.erb +19 -1
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/build.properties.erb +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/build.xml +6 -2
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/decorators.erb +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/classpath.erb +0 -5
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/project.erb +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/settings/org.eclipse.jdt.core.prefs +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/settings/org.eclipse.wst.common.component.tt +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/freemarker/freemarker-web.xml +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/freemarker/infrastructure/FreemarkerPathResolver.java.tt +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/freemarker/macros/html.ftl +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/freemarker/main.ftl +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/heroku/Main.java +21 -0
- data/lib/vraptor-scaffold/generators/app/templates/heroku/Procfile +1 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/ivy-2.2.0.jar +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/ivy.erb +1 -1
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/jsp/jsp-web.xml +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/jsp/main.jsp +2 -2
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/jsp/prelude.jspf +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator/templates/src/models/Entity.java.tt → app/templates/models/Entity.erb} +1 -1
- data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-hibernate.java.tt +50 -0
- data/lib/vraptor-scaffold/generators/{app_generator/templates/src/repositories/Repository.java.tt → app/templates/orm/Repository-jpa.java.tt} +3 -3
- data/lib/vraptor-scaffold/generators/app/templates/orm/hibernate.cfg.xml +7 -0
- data/lib/vraptor-scaffold/generators/app/templates/orm/persistence.xml +10 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/pom.erb +29 -13
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/resources-test/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/resources/hibernate.properties +16 -0
- data/lib/vraptor-scaffold/generators/app/templates/resources/log4j.properties +4 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/resources/messages.properties +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold.erb +7 -0
- data/lib/vraptor-scaffold/generators/{app_generator/templates/webapp/WEB-INF/web.xml → app/templates/webapp/WEB-INF/web.xml.tt} +2 -2
- data/lib/vraptor-scaffold/generators/{app_generator/templates/src-test/controllers → app/templates/webapp/images}/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/index.jsp +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/stylesheets/common.css +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/stylesheets/scaffold.css +0 -0
- data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/stylesheets/stylesheets.css +0 -0
- data/lib/vraptor-scaffold/generators/plugin/plugin_generator.rb +42 -0
- data/lib/vraptor-scaffold/generators/plugin/vraptor_gem.rb +36 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/attribute.rb +1 -1
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/base_scaffold.rb +6 -2
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/controller_generator/controller_generator.rb +3 -3
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/controller_generator/templates/controller.erb +3 -3
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/controller_generator/templates/controller_test.erb +1 -1
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/model_generator.rb +20 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/model_generator/templates/model.erb +3 -3
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/model_generator/templates/model_test.erb +1 -1
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb +27 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/repository_generator/templates/repository.erb +3 -3
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository_impl.erb +16 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/repository_generator/templates/repository_test.erb +1 -1
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold}/scaffold_generator.rb +0 -0
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/freemarker_generator.rb +18 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/freemarker_generator/templates/edit.erb +0 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/freemarker_generator/templates/form.erb +4 -4
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/templates/index.erb +36 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/freemarker_generator/templates/new.erb +0 -0
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/templates/show.erb +14 -0
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/jsp_generator/jsp_generator.rb +18 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/jsp_generator/templates/edit.erb +0 -0
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/jsp_generator/templates/form.erb +4 -4
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/jsp_generator/templates/index.erb +6 -6
- data/lib/vraptor-scaffold/generators/{scaffold_generator → scaffold/template_engine_generator}/jsp_generator/templates/new.erb +0 -0
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/jsp_generator/templates/show.erb +14 -0
- data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb +21 -0
- data/lib/vraptor-scaffold/load_paths.rb +13 -21
- data/lib/vraptor-scaffold/runner.rb +11 -0
- data/lib/vraptor-scaffold/runner/commands_help.rb +13 -0
- data/lib/vraptor-scaffold/runner/configure.rb +21 -0
- data/lib/vraptor-scaffold/runner/generator.rb +15 -0
- data/lib/vraptor-scaffold/runner/help.rb +12 -0
- data/lib/vraptor-scaffold/runner/plugin.rb +19 -0
- data/lib/vraptor-scaffold/runner/scaffold.rb +16 -0
- data/lib/vraptor-scaffold/version.rb +1 -1
- data/spec/resources/vraptor-scaffold.properties +5 -0
- data/spec/simple_custom_plugin.rb +10 -0
- data/spec/spec_helper.rb +5 -6
- data/spec/vraptor-scaffold/configuration_spec.rb +88 -4
- data/spec/vraptor-scaffold/execution_spec.rb +47 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/app_generator_spec.rb +136 -54
- data/spec/vraptor-scaffold/generators/{app_generator → app}/dependency_manager_spec.rb +1 -1
- data/spec/vraptor-scaffold/generators/{app_generator → app}/dependency_spec.rb +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/freemarker_template_engine_spec.rb +1 -1
- data/spec/vraptor-scaffold/generators/{app_generator → app}/jsp_template_engine_spec.rb +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/Entity.java +1 -1
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/FreemarkerPathResolver.java +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/Repository.java +3 -3
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/build.gradle +24 -5
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/build.properties +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/decorators-jsp.xml +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/decorators.xml +0 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/freemarker-web.xml +2 -2
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/ivy.xml +6 -5
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/jsp-web.xml +1 -1
- data/spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml +168 -0
- data/spec/vraptor-scaffold/generators/{app_generator → app}/templates/pom.xml +11 -14
- data/spec/vraptor-scaffold/generators/app/templates/vraptor-scaffold.properties +7 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle +61 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle +61 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml +40 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml +147 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml +40 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml +147 -0
- data/spec/vraptor-scaffold/generators/plugin/plugin_generator_spec.rb +130 -0
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/attribute_spec.rb +13 -9
- data/spec/vraptor-scaffold/generators/scaffold/base_scaffold_spec.rb +73 -0
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/controller_generator/controller_generator_spec.rb +18 -9
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/controller_generator/templates/ProductController.java +3 -3
- data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/freemarker_generator_spec.rb +74 -0
- data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/jsp_generator_spec.rb +75 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb +50 -0
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/model_generator/templates/Product.java +6 -6
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/hibernate.cfg.xml +8 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator_spec.rb +60 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ClientRepository.java +22 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ClientRepositoryImpl.java +16 -0
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/repository_generator/templates/ProductRepository.java +3 -3
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/repository_generator/templates/ProductRepositoryImpl.java +3 -3
- data/spec/vraptor-scaffold/generators/{scaffold_generator → scaffold}/scaffold_generator_spec.rb +0 -0
- data/spec/vraptor-scaffold/runner/commands_help_spec.rb +12 -0
- data/spec/vraptor-scaffold/runner/configure_spec.rb +12 -0
- data/spec/vraptor-scaffold/runner/generator_spec.rb +31 -0
- data/spec/vraptor-scaffold/runner/help_spec.rb +29 -0
- data/spec/vraptor-scaffold/runner/plugin_spec.rb +45 -0
- data/spec/vraptor-scaffold/runner/scaffold_spec.rb +35 -0
- data/spec/vraptor-scaffold_spec.rb +1 -94
- data/vraptor-scaffold.gemspec +3 -3
- metadata +137 -140
- data/History.txt +0 -128
- data/lib/vraptor-scaffold/generators/app_generator/app_generator.rb +0 -102
- data/lib/vraptor-scaffold/generators/app_generator/dependency_manager.rb +0 -37
- data/lib/vraptor-scaffold/generators/app_generator/templates/ivysettings.xml +0 -9
- data/lib/vraptor-scaffold/generators/app_generator/templates/resources/META-INF/persistence.xml +0 -20
- data/lib/vraptor-scaffold/generators/app_generator/templates/resources/log4j.properties +0 -4
- data/lib/vraptor-scaffold/generators/app_generator/templates/src-test/models/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app_generator/templates/src-test/repositories/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app_generator/templates/src/controllers/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app_generator/templates/vraptor-scaffold.erb +0 -2
- data/lib/vraptor-scaffold/generators/app_generator/templates/webapp/images/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app_generator/templates/webapp/javascripts/application.js +0 -0
- data/lib/vraptor-scaffold/generators/app_generator/templates/webapp/javascripts/jquery.min.js +0 -16
- data/lib/vraptor-scaffold/generators/scaffold_generator/freemarker_generator/freemarker_generator.rb +0 -22
- data/lib/vraptor-scaffold/generators/scaffold_generator/freemarker_generator/templates/index.erb +0 -36
- data/lib/vraptor-scaffold/generators/scaffold_generator/freemarker_generator/templates/show.erb +0 -14
- data/lib/vraptor-scaffold/generators/scaffold_generator/jsp_generator/jsp_generator.rb +0 -22
- data/lib/vraptor-scaffold/generators/scaffold_generator/jsp_generator/templates/show.erb +0 -14
- data/lib/vraptor-scaffold/generators/scaffold_generator/model_generator/model_generator.rb +0 -11
- data/lib/vraptor-scaffold/generators/scaffold_generator/repository_generator/repository_generator.rb +0 -12
- data/lib/vraptor-scaffold/generators/scaffold_generator/repository_generator/templates/repository_impl.erb +0 -16
- data/spec/vraptor-scaffold/generators/scaffold_generator/base_scaffold_spec.rb +0 -41
- data/spec/vraptor-scaffold/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb +0 -36
- data/spec/vraptor-scaffold/generators/scaffold_generator/jsp_generator/jsp_generator_spec.rb +0 -34
- data/spec/vraptor-scaffold/generators/scaffold_generator/model_generator/model_generator_spec.rb +0 -25
- data/spec/vraptor-scaffold/generators/scaffold_generator/repository_generator/repository_generator_spec.rb +0 -31
@@ -24,7 +24,7 @@
|
|
24
24
|
<dependency org="org.mortbay.jetty" name="jsp-api-2.1" rev="6.1.14" conf="jetty->default" />
|
25
25
|
<dependency org="org.mortbay.jetty" name="jsp-2.1" rev="6.1.14" conf="jetty->default" />
|
26
26
|
<dependency org="org.mortbay.jetty" name="jetty-ant" rev="6.1.14" conf="jetty->default" />
|
27
|
-
|
27
|
+
|
28
28
|
<!-- Minify dependencies -->
|
29
29
|
<dependency org="com.yahoo.platform.yui" name="yuicompressor" rev="2.3.6" conf="minify->default" />
|
30
30
|
</dependencies>
|
File without changes
|
@@ -11,7 +11,7 @@
|
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<decorator:body/>
|
14
|
-
<script type="text/javascript" src="${pageContext.request.contextPath}/javascripts/jquery.min.js"
|
15
|
-
<script type="text/javascript" src="${pageContext.request.contextPath}/javascripts/application.js"
|
14
|
+
<script type="text/javascript" src="${pageContext.request.contextPath}/javascripts/jquery.min.js"></script>
|
15
|
+
<script type="text/javascript" src="${pageContext.request.contextPath}/javascripts/application.js"></script>
|
16
16
|
</body>
|
17
17
|
</html>
|
File without changes
|
@@ -0,0 +1,50 @@
|
|
1
|
+
package <%= options[:package] %>.<%= options[:repositories_package] %>;
|
2
|
+
|
3
|
+
import java.io.Serializable;
|
4
|
+
import java.lang.reflect.ParameterizedType;
|
5
|
+
import java.util.List;
|
6
|
+
|
7
|
+
import org.hibernate.Query;
|
8
|
+
import org.hibernate.Session;
|
9
|
+
|
10
|
+
public abstract class Repository<T, I extends Serializable> {
|
11
|
+
|
12
|
+
protected final Session session;
|
13
|
+
protected final Class<T> clazz;
|
14
|
+
|
15
|
+
protected Repository(Session session) {
|
16
|
+
this.session = session;
|
17
|
+
|
18
|
+
@SuppressWarnings("unchecked")
|
19
|
+
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
20
|
+
|
21
|
+
this.clazz = clazz;
|
22
|
+
}
|
23
|
+
|
24
|
+
public void create(T entity) {
|
25
|
+
session.persist(entity);
|
26
|
+
}
|
27
|
+
|
28
|
+
@SuppressWarnings("unchecked")
|
29
|
+
public T update(T entity) {
|
30
|
+
return (T) session.merge(entity);
|
31
|
+
}
|
32
|
+
|
33
|
+
public void destroy(T entity) {
|
34
|
+
session.delete(entity);
|
35
|
+
}
|
36
|
+
|
37
|
+
@SuppressWarnings("unchecked")
|
38
|
+
public T find(I id) {
|
39
|
+
return (T) session.get(clazz, id);
|
40
|
+
}
|
41
|
+
|
42
|
+
public List<T> findAll() {
|
43
|
+
Query query = session.createQuery("from " + clazz.getName());
|
44
|
+
|
45
|
+
@SuppressWarnings("unchecked")
|
46
|
+
List<T> resultList = query.list();
|
47
|
+
|
48
|
+
return resultList;
|
49
|
+
}
|
50
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package <%= options[:package]
|
1
|
+
package <%= options[:package] %>.<%= options[:repositories_package] %>;
|
2
2
|
|
3
3
|
import java.io.Serializable;
|
4
4
|
import java.lang.reflect.ParameterizedType;
|
@@ -25,8 +25,8 @@ public abstract class Repository<T, I extends Serializable> {
|
|
25
25
|
entityManager.persist(entity);
|
26
26
|
}
|
27
27
|
|
28
|
-
public
|
29
|
-
entityManager.merge(entity);
|
28
|
+
public T update(T entity) {
|
29
|
+
return entityManager.merge(entity);
|
30
30
|
}
|
31
31
|
|
32
32
|
public void destroy(T entity) {
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
3
|
+
|
4
|
+
<hibernate-configuration>
|
5
|
+
<session-factory>
|
6
|
+
</session-factory>
|
7
|
+
</hibernate-configuration>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
+
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
5
|
+
version="2.0">
|
6
|
+
|
7
|
+
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
|
8
|
+
</persistence-unit>
|
9
|
+
|
10
|
+
</persistence>
|
@@ -2,19 +2,11 @@
|
|
2
2
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
3
3
|
<modelVersion>4.0.0</modelVersion>
|
4
4
|
<groupId><%= @project_name %></groupId>
|
5
|
-
<artifactId><%= @project_name %></artifactId
|
6
|
-
<packaging>war</packaging
|
5
|
+
<artifactId><%= @project_name %></artifactId><%- unless @options[:heroku] %>
|
6
|
+
<packaging>war</packaging><%- end %>
|
7
7
|
<version>0.0.1-SNAPSHOT</version>
|
8
8
|
<name><%= @project_name %></name>
|
9
9
|
|
10
|
-
<repositories>
|
11
|
-
<repository>
|
12
|
-
<id>JBoss</id>
|
13
|
-
<name>JBoss repository</name>
|
14
|
-
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
|
15
|
-
</repository>
|
16
|
-
</repositories>
|
17
|
-
|
18
10
|
<properties>
|
19
11
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
20
12
|
</properties>
|
@@ -43,7 +35,7 @@
|
|
43
35
|
<plugin>
|
44
36
|
<groupId>org.apache.maven.plugins</groupId>
|
45
37
|
<artifactId>maven-war-plugin</artifactId>
|
46
|
-
<version>2.1</version>
|
38
|
+
<version>2.1.1</version>
|
47
39
|
</plugin>
|
48
40
|
<plugin>
|
49
41
|
<groupId>org.mortbay.jetty</groupId>
|
@@ -57,7 +49,31 @@
|
|
57
49
|
<contextPath>/</contextPath>
|
58
50
|
</webAppConfig>
|
59
51
|
</configuration>
|
60
|
-
</plugin
|
52
|
+
</plugin><%- if @options[:heroku] %>
|
53
|
+
<plugin>
|
54
|
+
<groupId>org.codehaus.mojo</groupId>
|
55
|
+
<artifactId>appassembler-maven-plugin</artifactId>
|
56
|
+
<version>1.1.1</version>
|
57
|
+
<executions>
|
58
|
+
<execution>
|
59
|
+
<phase>package</phase>
|
60
|
+
<goals>
|
61
|
+
<goal>assemble</goal>
|
62
|
+
</goals>
|
63
|
+
<configuration>
|
64
|
+
<assembleDirectory>target</assembleDirectory>
|
65
|
+
<generateRepository>false</generateRepository>
|
66
|
+
<extraJvmArguments>-Xmx512m</extraJvmArguments>
|
67
|
+
<programs>
|
68
|
+
<program>
|
69
|
+
<mainClass>Main</mainClass>
|
70
|
+
<name>webapp</name>
|
71
|
+
</program>
|
72
|
+
</programs>
|
73
|
+
</configuration>
|
74
|
+
</execution>
|
75
|
+
</executions>
|
76
|
+
</plugin><%- end %>
|
61
77
|
</plugins>
|
62
78
|
</build>
|
63
79
|
|
@@ -96,7 +112,7 @@
|
|
96
112
|
<plugin>
|
97
113
|
<groupId>org.codehaus.mojo</groupId>
|
98
114
|
<artifactId>cobertura-maven-plugin</artifactId>
|
99
|
-
<version>2.
|
115
|
+
<version>2.5.1</version>
|
100
116
|
</plugin>
|
101
117
|
</plugins>
|
102
118
|
</reporting>
|
data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/resources-test/.empty_directory
RENAMED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
|
2
|
+
hibernate.connection.url=jdbc:hsqldb:file:tmp/devdb
|
3
|
+
hibernate.hbm2ddl.auto=update
|
4
|
+
hibernate.query.substitutions=true=1, false=0
|
5
|
+
hibernate.show_sql=true
|
6
|
+
hibernate.format_sql=true
|
7
|
+
|
8
|
+
#DATASOURCE POOL CONFIGURATIONS
|
9
|
+
hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
|
10
|
+
maxPoolSize=20
|
11
|
+
minPoolSize=3
|
12
|
+
initialPoolSize=3
|
13
|
+
timeout=25200
|
14
|
+
acquireIncrement=5
|
15
|
+
preferredTestQuery=select 1
|
16
|
+
idleConnectionTestPeriod=100
|
data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/resources/messages.properties
RENAMED
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
build_tool: <%= options[:build_tool] %>
|
2
|
+
package: <%= options[:package] %>
|
3
|
+
template_engine: <%= options[:template_engine] %>
|
4
|
+
orm: <%= options[:orm] %>
|
5
|
+
models_package: <%= options[:models_package] %>
|
6
|
+
controllers_package: <%= options[:controllers_package] %>
|
7
|
+
repositories_package: <%= options[:repositories_package] %>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
4
4
|
id="WebApp_ID" version="2.5">
|
5
5
|
|
6
|
-
<display-name
|
6
|
+
<display-name><%= @project_name %></display-name>
|
7
7
|
|
8
8
|
<context-param>
|
9
9
|
<param-name>br.com.caelum.vraptor.packages</param-name>
|
10
|
-
<param-value>br.com.caelum.vraptor.util
|
10
|
+
<param-value>br.com.caelum.vraptor.util.<%= options[:orm] %></param-value>
|
11
11
|
</context-param>
|
12
12
|
|
13
13
|
<context-param>
|
File without changes
|
File without changes
|
data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/stylesheets/common.css
RENAMED
File without changes
|
data/lib/vraptor-scaffold/generators/{app_generator → app}/templates/webapp/stylesheets/scaffold.css
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class PluginGenerator < VraptorScaffold::Base
|
2
|
+
|
3
|
+
argument :name
|
4
|
+
|
5
|
+
class_option :group, :default => "br.com.caelum.vraptor", :aliases => "-g",
|
6
|
+
:desc => "Plugin group"
|
7
|
+
|
8
|
+
class_option :version, :aliases => "-v",
|
9
|
+
:desc => "Plugin version"
|
10
|
+
|
11
|
+
def self.banner
|
12
|
+
"vraptor plugin #{self.arguments.map(&:usage).join(' ')} [options]"
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(args, opts=[])
|
16
|
+
super([args], opts)
|
17
|
+
@version = options[:version]
|
18
|
+
@group = options[:group]
|
19
|
+
end
|
20
|
+
|
21
|
+
def build
|
22
|
+
if is_ivy?
|
23
|
+
plugin = "\n\t\t<dependency org=\"#{@group}\" name=\"#{name}\" rev=\"#{@version}\" conf=\"default\" />"
|
24
|
+
inject_into_file("ivy.xml", plugin, :after => "<dependencies>")
|
25
|
+
elsif is_maven?
|
26
|
+
plugin = "\n\t\t<dependency>\n\t\t\t<groupId>#{@group}</groupId>\n\t\t\t<artifactId>#{name}</artifactId>\n\t\t\t<version>#{@version}</version>\n\t\t</dependency>"
|
27
|
+
inject_into_file("pom.xml", plugin, :after => "<dependencies>")
|
28
|
+
else
|
29
|
+
plugin = "\n compile group: '#{@group}', name: '#{name}', version: '#{@version}'\n"
|
30
|
+
inject_into_file("build.gradle", plugin, :after => "dependencies {")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def is_ivy?
|
35
|
+
File.exist?("ivy.xml")
|
36
|
+
end
|
37
|
+
|
38
|
+
def is_maven?
|
39
|
+
File.exist?("pom.xml")
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/gem_runner'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
class VRaptorGem
|
6
|
+
#def initialize(who)
|
7
|
+
# @who = who
|
8
|
+
#end
|
9
|
+
#def install_and_configure
|
10
|
+
# if is_installed?
|
11
|
+
# configure
|
12
|
+
# elsif exists?
|
13
|
+
# install
|
14
|
+
# configure
|
15
|
+
# end
|
16
|
+
#end
|
17
|
+
#
|
18
|
+
#private
|
19
|
+
#def is_installed?
|
20
|
+
# Gem::GemPathSearcher.new.find(@who)
|
21
|
+
#end
|
22
|
+
#def exists?
|
23
|
+
# url = URI.parse("http://rubygems.org/gems/#{@who}")
|
24
|
+
# req = Net::HTTP::Get.new(url.path)
|
25
|
+
# res = Net::HTTP.start(url.host, url.port) {|http|
|
26
|
+
# http.request(req)
|
27
|
+
# }
|
28
|
+
# res.code == '200'
|
29
|
+
#end
|
30
|
+
#def install
|
31
|
+
# Gem::GemRunner.new.run ["install", @who]
|
32
|
+
#end
|
33
|
+
#def configure
|
34
|
+
# VraptorScaffold::Execution.new.run(["configure", @who])
|
35
|
+
#end
|
36
|
+
end
|
@@ -7,11 +7,11 @@ class BaseScaffold < VraptorScaffold::Base
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def model_parameter_name
|
10
|
-
@model.
|
10
|
+
@model.camelize(:lower)
|
11
11
|
end
|
12
12
|
|
13
13
|
def class_name
|
14
|
-
@model.
|
14
|
+
@model.camelize
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_class_name
|
@@ -37,4 +37,8 @@ class BaseScaffold < VraptorScaffold::Base
|
|
37
37
|
def controller_test_class_name
|
38
38
|
"#{controller_class_name}Test"
|
39
39
|
end
|
40
|
+
|
41
|
+
def base_path
|
42
|
+
model_parameter_name.pluralize
|
43
|
+
end
|
40
44
|
end
|
@@ -5,11 +5,11 @@ class ControllerGenerator < BaseScaffold
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def build
|
8
|
-
template("controller.erb", Configuration.main_class_path(
|
9
|
-
template("controller_test.erb", Configuration.test_class_path(
|
8
|
+
template("controller.erb", Configuration.main_class_path(Configuration.controllers_package, "#{controller_class_name}.java"))
|
9
|
+
template("controller_test.erb", Configuration.test_class_path(Configuration.controllers_package, "#{controller_test_class_name}.java"))
|
10
10
|
end
|
11
11
|
|
12
12
|
def path
|
13
|
-
"/#{
|
13
|
+
"/#{base_path}"
|
14
14
|
end
|
15
15
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
package <%= Configuration.package
|
1
|
+
package <%= Configuration.package %>.<%= Configuration.controllers_package %>;
|
2
2
|
|
3
3
|
import java.util.List;
|
4
4
|
|
5
|
-
import <%= Configuration.
|
6
|
-
import <%= Configuration.package
|
5
|
+
import <%= Configuration.full_models_package %>.<%= class_name %>;
|
6
|
+
import <%= Configuration.package %>.<%= Configuration.repositories_package %>.<%= repository_interface_name %>;
|
7
7
|
import br.com.caelum.vraptor.Delete;
|
8
8
|
import br.com.caelum.vraptor.Get;
|
9
9
|
import br.com.caelum.vraptor.Post;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class ModelGenerator < BaseScaffold
|
2
|
+
|
3
|
+
def self.source_root
|
4
|
+
File.join File.dirname(__FILE__), "templates"
|
5
|
+
end
|
6
|
+
|
7
|
+
def build
|
8
|
+
template("model.erb", Configuration.main_class_path(Configuration.models_package, "#{class_name}.java"))
|
9
|
+
template("model_test.erb", Configuration.test_class_path(Configuration.models_package, "#{test_class_name}.java"))
|
10
|
+
map_orm_class if Configuration.hibernate?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def map_orm_class
|
15
|
+
file = File.join Configuration::MAIN_RESOURCES, "hibernate.cfg.xml"
|
16
|
+
model = "#{Configuration.full_models_package}.#{class_name}"
|
17
|
+
line_break = "\n "
|
18
|
+
inject_into_file(file, " <mapping class='#{model}'/>#{line_break}", :before => "</session-factory>")
|
19
|
+
end
|
20
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package <%= Configuration.
|
1
|
+
package <%= Configuration.full_models_package %>;
|
2
2
|
|
3
3
|
@javax.persistence.Entity
|
4
4
|
public class <%= class_name %> extends Entity {
|
@@ -8,11 +8,11 @@ public class <%= class_name %> extends Entity {
|
|
8
8
|
<% end -%>
|
9
9
|
|
10
10
|
<% @attributes.each do |att| -%>
|
11
|
-
public void set<%= att.name.
|
11
|
+
public void set<%= att.name.camelize %>(<%= att.java_type %> <%= att.name %>) {
|
12
12
|
this.<%= att.name %> = <%= att.name %>;
|
13
13
|
}
|
14
14
|
|
15
|
-
public <%= att.java_type %> <%= att.getter_prefix + att.name.
|
15
|
+
public <%= att.java_type %> <%= att.getter_prefix + att.name.camelize %>() {
|
16
16
|
return <%= att.name %>;
|
17
17
|
}
|
18
18
|
|