heroku-vraptor-scaffold 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.rdoc +188 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/LICENSE +22 -0
- data/README.md +23 -0
- data/README.textile +51 -0
- data/Rakefile +20 -0
- data/bin/heroku-vraptor +8 -0
- data/heroku-vraptor-scaffold.gemspec +28 -0
- data/index.sample.html +169 -0
- data/lib/vraptor-scaffold.rb +14 -0
- data/lib/vraptor-scaffold/configuration.rb +54 -0
- data/lib/vraptor-scaffold/execution.rb +22 -0
- data/lib/vraptor-scaffold/generators/app/app_generator.rb +161 -0
- data/lib/vraptor-scaffold/generators/app/dependency.rb +15 -0
- data/lib/vraptor-scaffold/generators/app/dependency_manager.rb +32 -0
- data/lib/vraptor-scaffold/generators/app/templates/angular/angular.js +14327 -0
- data/lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap-responsive.css +9 -0
- data/lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap.css +9 -0
- data/lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap.js +6 -0
- data/lib/vraptor-scaffold/generators/app/templates/bootstrap/glyphicons-halflings-white.png +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/bootstrap/glyphicons-halflings.png +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/classpath.erb +18 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/project.erb +36 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.jdt.core.prefs +8 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.common.component.tt +10 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml +10 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container +1 -0
- data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name +1 -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/templates/jquery/jquery.min.js +4 -0
- data/lib/vraptor-scaffold/generators/app/templates/models/Entity.erb +46 -0
- data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-hibernate.java.tt +50 -0
- data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-jpa.java.tt +48 -0
- data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-objectify.java.tt +41 -0
- 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/templates/pom.erb +110 -0
- data/lib/vraptor-scaffold/generators/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/templates/resources/messages.properties +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/underscore/underscore.min.js +32 -0
- data/lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold.erb +5 -0
- data/lib/vraptor-scaffold/generators/app/templates/webapp/WEB-INF/web.xml.tt +33 -0
- data/lib/vraptor-scaffold/generators/app/templates/webapp/images/.empty_directory +0 -0
- data/lib/vraptor-scaffold/generators/app/templates/webapp/index.html +24 -0
- data/lib/vraptor-scaffold/generators/app/templates/webapp/javascripts/utils.js +7 -0
- data/lib/vraptor-scaffold/generators/base.rb +16 -0
- data/lib/vraptor-scaffold/generators/scaffold/attribute.rb +51 -0
- data/lib/vraptor-scaffold/generators/scaffold/base_scaffold.rb +54 -0
- data/lib/vraptor-scaffold/generators/scaffold/client_generator/client_generator.rb +41 -0
- data/lib/vraptor-scaffold/generators/scaffold/client_generator/templates/controller.erb +75 -0
- data/lib/vraptor-scaffold/generators/scaffold/client_generator/templates/details.erb +16 -0
- data/lib/vraptor-scaffold/generators/scaffold/client_generator/templates/form.erb +39 -0
- data/lib/vraptor-scaffold/generators/scaffold/client_generator/templates/list.erb +40 -0
- data/lib/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator.rb +20 -0
- data/lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller.erb +77 -0
- data/lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller_test.erb +12 -0
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/model_generator.rb +26 -0
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/model.erb +32 -0
- data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/model_test.erb +13 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb +32 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository.erb +22 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository_impl.erb +16 -0
- data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository_test.erb +13 -0
- data/lib/vraptor-scaffold/generators/scaffold/scaffold_generator.rb +35 -0
- data/lib/vraptor-scaffold/runner.rb +9 -0
- data/lib/vraptor-scaffold/runner/commands_help.rb +13 -0
- data/lib/vraptor-scaffold/runner/generator.rb +15 -0
- data/lib/vraptor-scaffold/runner/help.rb +12 -0
- data/lib/vraptor-scaffold/runner/scaffold.rb +16 -0
- data/lib/vraptor-scaffold/version.rb +3 -0
- 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/resources/vraptor-scaffold.properties +7 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/vraptor-scaffold/configuration_spec.rb +146 -0
- data/spec/vraptor-scaffold/execution_spec.rb +51 -0
- data/spec/vraptor-scaffold/generators/app/app_generator_spec.rb +557 -0
- data/spec/vraptor-scaffold/generators/app/dependency_manager_spec.rb +34 -0
- data/spec/vraptor-scaffold/generators/app/dependency_spec.rb +14 -0
- data/spec/vraptor-scaffold/generators/app/freemarker_template_engine_spec.rb +80 -0
- data/spec/vraptor-scaffold/generators/app/jsp_template_engine_spec.rb +77 -0
- data/spec/vraptor-scaffold/generators/app/templates/Entity.java +45 -0
- data/spec/vraptor-scaffold/generators/app/templates/FreemarkerPathResolver.java +21 -0
- data/spec/vraptor-scaffold/generators/app/templates/ObjectifyFactory.java +30 -0
- data/spec/vraptor-scaffold/generators/app/templates/RepositoryJPA.java +48 -0
- data/spec/vraptor-scaffold/generators/app/templates/RepositoryObjectify.java +41 -0
- data/spec/vraptor-scaffold/generators/app/templates/build.gradle +60 -0
- data/spec/vraptor-scaffold/generators/app/templates/build.properties +18 -0
- 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/decorators-jsp.xml +7 -0
- data/spec/vraptor-scaffold/generators/app/templates/decorators.xml +7 -0
- data/spec/vraptor-scaffold/generators/app/templates/freemarker-web.xml +60 -0
- 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 +40 -0
- data/spec/vraptor-scaffold/generators/app/templates/jsp-web.xml +45 -0
- data/spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml +182 -0
- data/spec/vraptor-scaffold/generators/app/templates/pom.xml +157 -0
- data/spec/vraptor-scaffold/generators/app/templates/project-gae +47 -0
- data/spec/vraptor-scaffold/generators/app/templates/vraptor-scaffold.properties +7 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle +62 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle +62 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml +41 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml +152 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml +42 -0
- data/spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml +182 -0
- data/spec/vraptor-scaffold/generators/scaffold/attribute_spec.rb +186 -0
- data/spec/vraptor-scaffold/generators/scaffold/base_scaffold_spec.rb +73 -0
- data/spec/vraptor-scaffold/generators/scaffold/client_controller_generator/controller_generator_spec.rb +62 -0
- data/spec/vraptor-scaffold/generators/scaffold/client_controller_generator/templates/ProductController.java +95 -0
- data/spec/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator_spec.rb +62 -0
- data/spec/vraptor-scaffold/generators/scaffold/controller_generator/templates/ProductController.java +95 -0
- data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/freemarker_generator_spec.rb +81 -0
- data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/templates/form.ftl +28 -0
- data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/jsp_generator_spec.rb +81 -0
- data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/templates/form.jsp +61 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb +54 -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/model_generator/templates/Product.java +25 -0
- data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/hibernate.cfg.xml +8 -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 +68 -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/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/repository_generator/templates/ProductRepository.java +22 -0
- data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ProductRepositoryImpl.java +16 -0
- data/spec/vraptor-scaffold/generators/scaffold/scaffold_generator_spec.rb +79 -0
- data/spec/vraptor-scaffold/http_request_spec.rb +40 -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/scaffold_spec.rb +35 -0
- data/spec/vraptor-scaffold/runner/start_spec.rb +51 -0
- data/spec/vraptor-scaffold_spec.rb +4 -0
- metadata +261 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
<ivy-module version="2.0">
|
2
|
+
<info organisation="vraptor-scaffold" module="vraptor-scaffold" />
|
3
|
+
|
4
|
+
<configurations>
|
5
|
+
<conf name="default" description="dependencies used for compile" />
|
6
|
+
<conf name="provided" description="dependencies used for compile but is not packaged" visibility="public" />
|
7
|
+
<conf name="test" description="dependencies used for tests" visibility="public" />
|
8
|
+
<conf name="jetty" description="dependencies used for jetty" visibility="public" />
|
9
|
+
<conf name="minify" description="dependencies used to minify js and css" visibility="public" />
|
10
|
+
</configurations>
|
11
|
+
|
12
|
+
<dependencies>
|
13
|
+
<dependency org="br.com.caelum" name="vraptor" rev="3.4.0" conf="default" />
|
14
|
+
<dependency org="opensymphony" name="sitemesh" rev="2.4.2" conf="default" />
|
15
|
+
<dependency org="javax.servlet" name="jstl" rev="1.2" conf="default" />
|
16
|
+
<dependency org="org.hsqldb" name="hsqldb" rev="2.2.8" conf="default" />
|
17
|
+
<dependency org="org.hibernate" name="hibernate-entitymanager" rev="4.0.1.Final" conf="default" />
|
18
|
+
<dependency org="org.hibernate" name="hibernate-c3p0" rev="4.0.1.Final" conf="default" />
|
19
|
+
<dependency org="org.hibernate" name="hibernate-validator" rev="4.2.0.Final" conf="default" />
|
20
|
+
<dependency org="joda-time" name="joda-time" rev="2.0" conf="default" />
|
21
|
+
<dependency org="com.thoughtworks.xstream" name="xstream" rev="1.4.1" conf="default" />
|
22
|
+
<dependency org="com.google.code.gson" name="gson" rev="2.2.1" conf="default" />
|
23
|
+
<dependency org="com.github.filipesperandio.vraptor" name="vraptor-hypermedia" rev="3.4.0" conf="default" />
|
24
|
+
|
25
|
+
<!-- Provided dependencies -->
|
26
|
+
<dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="provided->default" />
|
27
|
+
<dependency org="javax.servlet.jsp" name="jsp-api" rev="2.1" conf="provided->default" />
|
28
|
+
|
29
|
+
<!-- Test dependencies -->
|
30
|
+
<dependency org="junit" name="junit" rev="4.10" conf="test->default" />
|
31
|
+
<dependency org="org.hamcrest" name="hamcrest-all" rev="1.1" conf="test->default" />
|
32
|
+
<dependency org="org.mockito" name="mockito-all" rev="1.9.0" conf="test->default" />
|
33
|
+
|
34
|
+
<!-- Jetty dependencies -->
|
35
|
+
<dependency org="org.mortbay.jetty" name="jsp-api-2.1" rev="6.1.14" conf="jetty->default" />
|
36
|
+
<dependency org="org.mortbay.jetty" name="jsp-2.1" rev="6.1.14" conf="jetty->default" />
|
37
|
+
<dependency org="org.mortbay.jetty" name="jetty-ant" rev="6.1.14" conf="jetty->default" />
|
38
|
+
|
39
|
+
<!-- Minify dependencies -->
|
40
|
+
<dependency org="com.yahoo.platform.yui" name="yuicompressor" rev="2.3.6" conf="minify->default" />
|
41
|
+
</dependencies>
|
42
|
+
</ivy-module>
|
@@ -0,0 +1,182 @@
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
4
|
+
<groupId>vraptor-scaffold</groupId>
|
5
|
+
<artifactId>vraptor-scaffold</artifactId>
|
6
|
+
<version>0.0.1-SNAPSHOT</version>
|
7
|
+
<name>vraptor-scaffold</name>
|
8
|
+
|
9
|
+
<properties>
|
10
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
11
|
+
</properties>
|
12
|
+
|
13
|
+
<build>
|
14
|
+
<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>
|
15
|
+
<plugins>
|
16
|
+
<plugin>
|
17
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
18
|
+
<version>2.3.2</version>
|
19
|
+
<configuration>
|
20
|
+
<source>1.6</source>
|
21
|
+
<target>1.6</target>
|
22
|
+
<encoding>UTF-8</encoding>
|
23
|
+
</configuration>
|
24
|
+
</plugin>
|
25
|
+
<plugin>
|
26
|
+
<artifactId>maven-eclipse-plugin</artifactId>
|
27
|
+
<version>2.8</version>
|
28
|
+
<configuration>
|
29
|
+
<downloadSources>true</downloadSources>
|
30
|
+
<downloadJavadocs>true</downloadJavadocs>
|
31
|
+
<wtpversion>2.0</wtpversion>
|
32
|
+
</configuration>
|
33
|
+
</plugin>
|
34
|
+
<plugin>
|
35
|
+
<groupId>org.apache.maven.plugins</groupId>
|
36
|
+
<artifactId>maven-war-plugin</artifactId>
|
37
|
+
<version>2.1.1</version>
|
38
|
+
</plugin>
|
39
|
+
<plugin>
|
40
|
+
<groupId>org.mortbay.jetty</groupId>
|
41
|
+
<artifactId>maven-jetty-plugin</artifactId>
|
42
|
+
<version>6.1.14</version>
|
43
|
+
<configuration>
|
44
|
+
<scanIntervalSeconds>3</scanIntervalSeconds>
|
45
|
+
<stopKey>foo</stopKey>
|
46
|
+
<stopPort>9999</stopPort>
|
47
|
+
<webAppConfig>
|
48
|
+
<contextPath>/</contextPath>
|
49
|
+
</webAppConfig>
|
50
|
+
</configuration>
|
51
|
+
</plugin>
|
52
|
+
<plugin>
|
53
|
+
<groupId>org.codehaus.mojo</groupId>
|
54
|
+
<artifactId>appassembler-maven-plugin</artifactId>
|
55
|
+
<version>1.1.1</version>
|
56
|
+
<executions>
|
57
|
+
<execution>
|
58
|
+
<phase>package</phase>
|
59
|
+
<goals>
|
60
|
+
<goal>assemble</goal>
|
61
|
+
</goals>
|
62
|
+
<configuration>
|
63
|
+
<assembleDirectory>target</assembleDirectory>
|
64
|
+
<extraJvmArguments>-Xmx512m</extraJvmArguments>
|
65
|
+
<programs>
|
66
|
+
<program>
|
67
|
+
<mainClass>Main</mainClass>
|
68
|
+
<name>webapp</name>
|
69
|
+
</program>
|
70
|
+
</programs>
|
71
|
+
</configuration>
|
72
|
+
</execution>
|
73
|
+
</executions>
|
74
|
+
</plugin>
|
75
|
+
</plugins>
|
76
|
+
</build>
|
77
|
+
|
78
|
+
<dependencies>
|
79
|
+
<dependency>
|
80
|
+
<groupId>br.com.caelum</groupId>
|
81
|
+
<artifactId>vraptor</artifactId>
|
82
|
+
<version>3.4.0</version>
|
83
|
+
</dependency>
|
84
|
+
<dependency>
|
85
|
+
<groupId>opensymphony</groupId>
|
86
|
+
<artifactId>sitemesh</artifactId>
|
87
|
+
<version>2.4.2</version>
|
88
|
+
</dependency>
|
89
|
+
<dependency>
|
90
|
+
<groupId>javax.servlet</groupId>
|
91
|
+
<artifactId>jstl</artifactId>
|
92
|
+
<version>1.2</version>
|
93
|
+
</dependency>
|
94
|
+
<dependency>
|
95
|
+
<groupId>org.hsqldb</groupId>
|
96
|
+
<artifactId>hsqldb</artifactId>
|
97
|
+
<version>2.2.8</version>
|
98
|
+
</dependency>
|
99
|
+
<dependency>
|
100
|
+
<groupId>org.hibernate</groupId>
|
101
|
+
<artifactId>hibernate-entitymanager</artifactId>
|
102
|
+
<version>4.0.1.Final</version>
|
103
|
+
</dependency>
|
104
|
+
<dependency>
|
105
|
+
<groupId>org.hibernate</groupId>
|
106
|
+
<artifactId>hibernate-c3p0</artifactId>
|
107
|
+
<version>4.0.1.Final</version>
|
108
|
+
</dependency>
|
109
|
+
<dependency>
|
110
|
+
<groupId>org.hibernate</groupId>
|
111
|
+
<artifactId>hibernate-validator</artifactId>
|
112
|
+
<version>4.2.0.Final</version>
|
113
|
+
</dependency>
|
114
|
+
<dependency>
|
115
|
+
<groupId>joda-time</groupId>
|
116
|
+
<artifactId>joda-time</artifactId>
|
117
|
+
<version>2.0</version>
|
118
|
+
</dependency>
|
119
|
+
<dependency>
|
120
|
+
<groupId>com.thoughtworks.xstream</groupId>
|
121
|
+
<artifactId>xstream</artifactId>
|
122
|
+
<version>1.4.1</version>
|
123
|
+
</dependency>
|
124
|
+
<dependency>
|
125
|
+
<groupId>com.google.code.gson</groupId>
|
126
|
+
<artifactId>gson</artifactId>
|
127
|
+
<version>2.2.1</version>
|
128
|
+
</dependency>
|
129
|
+
<dependency>
|
130
|
+
<groupId>com.github.filipesperandio.vraptor</groupId>
|
131
|
+
<artifactId>vraptor-hypermedia</artifactId>
|
132
|
+
<version>3.4.0</version>
|
133
|
+
</dependency>
|
134
|
+
<dependency>
|
135
|
+
<groupId>org.eclipse.jetty</groupId>
|
136
|
+
<artifactId>jetty-webapp</artifactId>
|
137
|
+
<version>7.4.4.v20110707</version>
|
138
|
+
</dependency>
|
139
|
+
<dependency>
|
140
|
+
<groupId>org.mortbay.jetty</groupId>
|
141
|
+
<artifactId>jsp-2.1-glassfish</artifactId>
|
142
|
+
<version>2.1.v20100127</version>
|
143
|
+
</dependency>
|
144
|
+
<dependency>
|
145
|
+
<groupId>javax.servlet</groupId>
|
146
|
+
<artifactId>servlet-api</artifactId>
|
147
|
+
<version>2.5</version>
|
148
|
+
</dependency>
|
149
|
+
|
150
|
+
<!-- Test dependencies -->
|
151
|
+
<dependency>
|
152
|
+
<groupId>junit</groupId>
|
153
|
+
<artifactId>junit</artifactId>
|
154
|
+
<version>4.10</version>
|
155
|
+
<scope>test</scope>
|
156
|
+
</dependency>
|
157
|
+
<dependency>
|
158
|
+
<groupId>org.hamcrest</groupId>
|
159
|
+
<artifactId>hamcrest-all</artifactId>
|
160
|
+
<version>1.1</version>
|
161
|
+
<scope>test</scope>
|
162
|
+
</dependency>
|
163
|
+
<dependency>
|
164
|
+
<groupId>org.mockito</groupId>
|
165
|
+
<artifactId>mockito-all</artifactId>
|
166
|
+
<version>1.9.0</version>
|
167
|
+
<scope>test</scope>
|
168
|
+
</dependency>
|
169
|
+
|
170
|
+
<!-- Provided dependencies -->
|
171
|
+
</dependencies>
|
172
|
+
|
173
|
+
<reporting>
|
174
|
+
<plugins>
|
175
|
+
<plugin>
|
176
|
+
<groupId>org.codehaus.mojo</groupId>
|
177
|
+
<artifactId>cobertura-maven-plugin</artifactId>
|
178
|
+
<version>2.5.1</version>
|
179
|
+
</plugin>
|
180
|
+
</plugins>
|
181
|
+
</reporting>
|
182
|
+
</project>
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
2
|
+
|
3
|
+
describe Attribute do
|
4
|
+
|
5
|
+
context "getter method prefix" do
|
6
|
+
it "should be 'is' to boolean attributes" do
|
7
|
+
Attribute.new("active", "boolean").getter_prefix.should == "is"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be 'get' otherwise" do
|
11
|
+
Attribute.new("description", "string").getter_prefix.should == "get"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "initialize attribute" do
|
16
|
+
context "downcase name" do
|
17
|
+
it "should downcase all words" do
|
18
|
+
Attribute.new("VALUE", "double").name.should == "value"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should camelize composed name" do
|
22
|
+
Attribute.new("MyItem", "double").name.should == "myItem"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should camelize composed name" do
|
26
|
+
Attribute.new("myItem", "double").name.should == "myItem"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should keep name in downcase" do
|
30
|
+
Attribute.new("value", "double").name.should == "value"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should downcase type" do
|
35
|
+
Attribute.new("value", "DoublE").type.should == "double"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "supported types" do
|
40
|
+
it "should support boolean" do
|
41
|
+
Attribute.valid_types.include?("boolean").should be_true
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should support double" do
|
45
|
+
Attribute.valid_types.include?("double").should be_true
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should support string" do
|
49
|
+
Attribute.valid_types.include?("string").should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should support float" do
|
53
|
+
Attribute.valid_types.include?("float").should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should support short" do
|
57
|
+
Attribute.valid_types.include?("short").should be_true
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should support integer" do
|
61
|
+
Attribute.valid_types.include?("integer").should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should support long" do
|
65
|
+
Attribute.valid_types.include?("long").should be_true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should support text" do
|
69
|
+
Attribute.valid_types.include?("text").should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should not support other" do
|
73
|
+
Attribute.valid_types.include?("other").should be_false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "html_input" do
|
78
|
+
it "should know html input to boolean" do
|
79
|
+
Attribute.new("flag", "boolean").html_input.should eql("checkbox")
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should know html input to string" do
|
83
|
+
Attribute.new("name", "string").html_input.should eql("text")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should know html input to double" do
|
87
|
+
Attribute.new("name", "double").html_input.should eql("text")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should know html input to float" do
|
91
|
+
Attribute.new("name", "float").html_input.should eql("text")
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should know html input to short" do
|
95
|
+
Attribute.new("name", "short").html_input.should eql("text")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should know html input to integer" do
|
99
|
+
Attribute.new("name", "integer").html_input.should eql("text")
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should know html input to long" do
|
103
|
+
Attribute.new("name", "long").html_input.should eql("text")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should know html input to text" do
|
107
|
+
Attribute.new("name", "text").html_input.should eql("textarea")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context "java type" do
|
112
|
+
it "should know correct java type to boolean" do
|
113
|
+
Attribute.new("flag", "boolean").java_type.should eql("boolean")
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should know correct java type to text" do
|
117
|
+
Attribute.new("description", "text").java_type.should eql("String")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should know correct java type to string" do
|
121
|
+
Attribute.new("name", "string").java_type.should eql("String")
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should know correct java type to double" do
|
125
|
+
Attribute.new("name", "double").java_type.should eql("Double")
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should know correct java type to float" do
|
129
|
+
Attribute.new("name", "float").java_type.should eql("Float")
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should know correct java type to short" do
|
133
|
+
Attribute.new("name", "short").java_type.should eql("Short")
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should know correct java type to integer" do
|
137
|
+
Attribute.new("name", "integer").java_type.should eql("Integer")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should know correct java type to long" do
|
141
|
+
Attribute.new("name", "long").java_type.should eql("Long")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "validate" do
|
146
|
+
|
147
|
+
it "should be valid when attribute is supported" do
|
148
|
+
Kernel.should_not_receive(:exit)
|
149
|
+
Attribute.valid_types.each do |type|
|
150
|
+
Attribute.new("name", type)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
it "cannot be valid when attribute is not supported" do
|
155
|
+
Kernel.should_receive(:exit)
|
156
|
+
Attribute.new("name", "char")
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should be valid when attribute is upper case" do
|
160
|
+
Kernel.should_not_receive(:exit)
|
161
|
+
Attribute.new("name", "String")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should be boolean when type is boolean" do
|
166
|
+
Attribute.new("flag", "boolean").boolean?.should be_true
|
167
|
+
end
|
168
|
+
|
169
|
+
it "cannot be boolean otherwise" do
|
170
|
+
Attribute.new("flag", "short").boolean?.should be_false
|
171
|
+
end
|
172
|
+
|
173
|
+
context "html label" do
|
174
|
+
it "should humanize composed name" do
|
175
|
+
Attribute.new("MyItem", "double").html_label.should == "My item"
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should humanize composed name" do
|
179
|
+
Attribute.new("myItem", "double").html_label.should == "My item"
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should humanize single name" do
|
183
|
+
Attribute.new("item", "double").html_label.should == "Item"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
2
|
+
|
3
|
+
describe BaseScaffold do
|
4
|
+
|
5
|
+
context "simple model name" do
|
6
|
+
before(:each) do
|
7
|
+
@base = BaseScaffold.new("client")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should know model class name" do
|
11
|
+
@base.class_name.should eql("Client")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should know model test class name" do
|
15
|
+
@base.test_class_name.should eql("ClientTest")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should know repository class name impl" do
|
19
|
+
@base.repository_impl_name.should eql("ClientRepositoryImpl")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should know repository interface name" do
|
23
|
+
@base.repository_interface_name.should eql("ClientRepository")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should know repository test class name" do
|
27
|
+
@base.repository_test_class_name.should eql("ClientRepositoryImplTest")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should know controller class name" do
|
31
|
+
@base.controller_class_name.should eql("ClientController")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should know controller test class name" do
|
35
|
+
@base.controller_test_class_name.should eql("ClientControllerTest")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should know path" do
|
39
|
+
@base.base_path.should eql("clients")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should know model parameter name with scaffold given with first letter uppercased" do
|
43
|
+
base = BaseScaffold.new("Client")
|
44
|
+
base.model_parameter_name.should eql("client")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "compound model name" do
|
49
|
+
it "should know class name to 'orderItem'" do
|
50
|
+
BaseScaffold.new("orderItem").class_name.should eql("OrderItem")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should know class name to 'OrderItem'" do
|
54
|
+
BaseScaffold.new("OrderItem").class_name.should eql("OrderItem")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should know parameter name to 'OrderItem'" do
|
58
|
+
BaseScaffold.new("OrderItem").model_parameter_name.should eql("orderItem")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should know parameter name to 'OrderItem'" do
|
62
|
+
BaseScaffold.new("orderItem").model_parameter_name.should eql("orderItem")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should know path to 'orderItem'" do
|
66
|
+
BaseScaffold.new("orderItem").base_path.should eql("orderItems")
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should know path to 'OrderItem'" do
|
70
|
+
BaseScaffold.new("OrderItem").base_path.should eql("orderItems")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|