vraptor-scaffold 1.2.3 → 1.3.0.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/Gemfile.lock +1 -1
  3. data/README.textile +1 -0
  4. data/lib/vraptor-scaffold/execution.rb +9 -8
  5. data/lib/vraptor-scaffold/generators/app/app_generator.rb +51 -9
  6. data/lib/vraptor-scaffold/generators/app/dependency_manager.rb +38 -9
  7. data/lib/vraptor-scaffold/generators/app/templates/build.xml +146 -146
  8. data/lib/vraptor-scaffold/generators/app/templates/eclipse/classpath-gae.erb +15 -0
  9. data/lib/vraptor-scaffold/generators/app/templates/eclipse/project-gae.erb +47 -0
  10. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/com.google.gdt.eclipse.core.prefs +5 -0
  11. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.jdt.core.prefs +8 -0
  12. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.common.component.tt +10 -0
  13. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.common.project.facet.core.xml +9 -0
  14. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.jsdt.ui.superType.container +1 -0
  15. data/lib/vraptor-scaffold/generators/app/templates/eclipse/settings-gae/org.eclipse.wst.jsdt.ui.superType.name +1 -0
  16. data/lib/vraptor-scaffold/generators/app/templates/gae/ObjectifyFactory.java.tt +30 -0
  17. data/lib/vraptor-scaffold/generators/app/templates/gae/appengine-web.xml.tt +13 -0
  18. data/lib/vraptor-scaffold/generators/app/templates/gae/ivysettings.xml +10 -0
  19. data/lib/vraptor-scaffold/generators/app/templates/gae/logging.properties +28 -0
  20. data/lib/vraptor-scaffold/generators/app/templates/orm/Repository-objectify.java.tt +41 -0
  21. data/lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold.erb +1 -1
  22. data/lib/vraptor-scaffold/generators/app/templates/webapp/WEB-INF/web.xml.tt +2 -2
  23. data/lib/vraptor-scaffold/generators/scaffold/attribute.rb +1 -1
  24. data/lib/vraptor-scaffold/generators/scaffold/base_scaffold.rb +7 -1
  25. data/lib/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator.rb +10 -5
  26. data/lib/vraptor-scaffold/generators/scaffold/model_generator/model_generator.rb +10 -4
  27. data/lib/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator.rb +20 -0
  28. data/lib/vraptor-scaffold/generators/scaffold/model_generator/templates/objectify_model.erb +33 -0
  29. data/lib/vraptor-scaffold/generators/scaffold/repository_generator/objectify_repository_generator.rb +25 -0
  30. data/lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb +9 -4
  31. data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/objectify_repository.erb +22 -0
  32. data/lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/objectify_repository_impl.erb +16 -0
  33. data/lib/vraptor-scaffold/generators/scaffold/scaffold_generator.rb +10 -3
  34. data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/freemarker_generator/freemarker_generator.rb +5 -4
  35. data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/jsp_generator/jsp_generator.rb +5 -4
  36. data/lib/vraptor-scaffold/generators/scaffold/template_engine_generator/template_engine_generator.rb +7 -1
  37. data/lib/vraptor-scaffold/load_paths.rb +3 -1
  38. data/lib/vraptor-scaffold/runner.rb +1 -0
  39. data/lib/vraptor-scaffold/runner/start.rb +29 -0
  40. data/lib/vraptor-scaffold/version.rb +1 -1
  41. data/maven/repo/br/com/caelum/vraptor-gae/1.0/vraptor-gae-1.0.jar +0 -0
  42. data/spec/resources/vraptor-scaffold-objectify.properties +7 -0
  43. data/spec/spec_helper.rb +5 -0
  44. data/spec/vraptor-scaffold/configuration_spec.rb +3 -0
  45. data/spec/vraptor-scaffold/execution_spec.rb +5 -1
  46. data/spec/vraptor-scaffold/generators/app/app_generator_spec.rb +77 -2
  47. data/spec/vraptor-scaffold/generators/app/dependency_manager_spec.rb +18 -3
  48. data/spec/vraptor-scaffold/generators/app/templates/ObjectifyFactory.java +30 -0
  49. data/spec/vraptor-scaffold/generators/app/templates/{Repository.java → RepositoryJPA.java} +0 -0
  50. data/spec/vraptor-scaffold/generators/app/templates/RepositoryObjectify.java +41 -0
  51. data/spec/vraptor-scaffold/generators/app/templates/build.gradle +1 -1
  52. data/spec/vraptor-scaffold/generators/app/templates/build.xml +146 -0
  53. data/spec/vraptor-scaffold/generators/app/templates/classpath-gae +18 -0
  54. data/spec/vraptor-scaffold/generators/app/templates/freemarker-web.xml +1 -1
  55. data/spec/vraptor-scaffold/generators/app/templates/gae-jsp-web.xml +45 -0
  56. data/spec/vraptor-scaffold/generators/app/templates/ivy-gae.xml +45 -0
  57. data/spec/vraptor-scaffold/generators/app/templates/ivy.xml +1 -1
  58. data/spec/vraptor-scaffold/generators/app/templates/jsp-web.xml +1 -1
  59. data/spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml +5 -5
  60. data/spec/vraptor-scaffold/generators/app/templates/pom.xml +5 -5
  61. data/spec/vraptor-scaffold/generators/app/templates/project-gae +47 -0
  62. data/spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle +1 -1
  63. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle +1 -1
  64. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml +1 -1
  65. data/spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml +5 -5
  66. data/spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml +1 -1
  67. data/spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml +5 -5
  68. data/spec/vraptor-scaffold/generators/scaffold/attribute_spec.rb +5 -1
  69. data/spec/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator_spec.rb +6 -2
  70. data/spec/vraptor-scaffold/generators/scaffold/freemarker_generator/freemarker_generator_spec.rb +4 -0
  71. data/spec/vraptor-scaffold/generators/scaffold/jsp_generator/jsp_generator_spec.rb +4 -0
  72. data/spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb +4 -0
  73. data/spec/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator_spec.rb +40 -0
  74. data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/ObjectifyFactory.java +33 -0
  75. data/spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Objectify_Product.java +38 -0
  76. data/spec/vraptor-scaffold/generators/scaffold/repository_generator/objectify_repository_generator_spec.rb +33 -0
  77. data/spec/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator_spec.rb +12 -4
  78. data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepository.java +22 -0
  79. data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepositoryImpl.java +16 -0
  80. data/spec/vraptor-scaffold/generators/scaffold/scaffold_generator_spec.rb +14 -1
  81. data/spec/vraptor-scaffold/runner/scaffold_spec.rb +5 -5
  82. data/spec/vraptor-scaffold/runner/start_spec.rb +51 -0
  83. metadata +54 -19
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <classpath>
3
+ <classpathentry kind="src" path="src/main/java"/>
4
+ <classpathentry kind="src" path="src/main/resources"/>
5
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
6
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
7
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
8
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
9
+ <% @dependency_manager.test_scope.each do |dependency| %>
10
+ <classpathentry kind="lib" path="lib/test/<%= "#{dependency.name}-#{dependency.version}.jar" %>"/>
11
+ <% end -%>
12
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
13
+ <classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
14
+ <classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/>
15
+ </classpath>
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name><%= @project_name %></name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.jdt.core.javabuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ <buildCommand>
19
+ <name>org.eclipse.wst.validation.validationbuilder</name>
20
+ <arguments>
21
+ </arguments>
22
+ </buildCommand>
23
+ <buildCommand>
24
+ <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
25
+ <arguments>
26
+ </arguments>
27
+ </buildCommand>
28
+ <buildCommand>
29
+ <name>com.google.appengine.eclipse.core.enhancerbuilder</name>
30
+ <arguments>
31
+ </arguments>
32
+ </buildCommand>
33
+ <buildCommand>
34
+ <name>com.google.appengine.eclipse.core.projectValidator</name>
35
+ <arguments>
36
+ </arguments>
37
+ </buildCommand>
38
+ </buildSpec>
39
+ <natures>
40
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
41
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
42
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
43
+ <nature>org.eclipse.jdt.core.javanature</nature>
44
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
45
+ <nature>com.google.appengine.eclipse.core.gaeNature</nature>
46
+ </natures>
47
+ </projectDescription>
@@ -0,0 +1,5 @@
1
+ #Sun Oct 23 00:00:26 BRST 2011
2
+ eclipse.preferences.version=1
3
+ jarsExcludedFromWebInfLib=
4
+ warSrcDir=src/main/webapp
5
+ warSrcDirIsOutput=false
@@ -0,0 +1,8 @@
1
+ #Sun Oct 03 01:41:37 BRT 2010
2
+ eclipse.preferences.version=1
3
+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5
+ org.eclipse.jdt.core.compiler.compliance=1.6
6
+ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
+ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8
+ org.eclipse.jdt.core.compiler.source=1.6
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project-modules id="moduleCoreId" project-version="1.5.0">
3
+ <wb-module deploy-name="<%= @project_name %>">
4
+ <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
5
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
6
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
7
+ <property name="context-root" value="/"/>
8
+ <property name="java-output-path" value="/src/main/webapp/WEB-INF/classes"/>
9
+ </wb-module>
10
+ </project-modules>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <faceted-project>
3
+ <fixed facet="jst.web"/>
4
+ <fixed facet="wst.jsdt.web"/>
5
+ <fixed facet="java"/>
6
+ <installed facet="java" version="1.6"/>
7
+ <installed facet="jst.web" version="2.5"/>
8
+ <installed facet="wst.jsdt.web" version="1.0"/>
9
+ </faceted-project>
@@ -0,0 +1 @@
1
+ org.eclipse.wst.jsdt.launching.baseBrowserLibrary
@@ -0,0 +1,30 @@
1
+ package <%= options[:package] %>.infra;
2
+
3
+ import javax.annotation.PostConstruct;
4
+
5
+ import br.com.caelum.vraptor.ioc.Component;
6
+ import br.com.caelum.vraptor.ioc.ComponentFactory;
7
+ import br.com.caelum.vraptor.ioc.RequestScoped;
8
+
9
+ import com.googlecode.objectify.Objectify;
10
+ import com.googlecode.objectify.ObjectifyService;
11
+
12
+ @Component
13
+ @RequestScoped
14
+ public class ObjectifyFactory implements ComponentFactory<Objectify> {
15
+
16
+ private Objectify session;
17
+
18
+ static {
19
+ }
20
+
21
+ @PostConstruct
22
+ public void abreSession() {
23
+ session = ObjectifyService.begin();
24
+ }
25
+
26
+ @Override
27
+ public Objectify getInstance() {
28
+ return session;
29
+ }
30
+ }
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
3
+ <application><%= @project_name %></application>
4
+ <version>1</version>
5
+
6
+ <!-- Configure java.util.logging -->
7
+ <system-properties>
8
+ <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
9
+ </system-properties>
10
+
11
+ <sessions-enabled>true</sessions-enabled>
12
+
13
+ </appengine-web-app>
@@ -0,0 +1,10 @@
1
+ <ivysettings>
2
+ <settings defaultResolver="chain"/>
3
+ <resolvers>
4
+ <chain name="chain">
5
+ <ibiblio name="central" m2compatible="true"/>
6
+ <ibiblio name="objectify-appengine" m2compatible="true" root="http://objectify-appengine.googlecode.com/svn/maven"/>
7
+ <ibiblio name="vraptor-scaffold-repo" m2compatible="true" root="https://raw.github.com/caelum/vraptor-scaffold/master/maven/repo"/>
8
+ </chain>
9
+ </resolvers>
10
+ </ivysettings>
@@ -0,0 +1,28 @@
1
+ # A default java.util.logging configuration.
2
+ # (All App Engine logging is through java.util.logging by default).
3
+ #
4
+ # To use this configuration, copy it into your application's WEB-INF
5
+ # folder and add the following to your appengine-web.xml:
6
+ #
7
+ # <system-properties>
8
+ # <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
9
+ # </system-properties>
10
+ #
11
+
12
+ # Set the default logging level for all loggers to WARNING
13
+ .level=WARNING
14
+
15
+ # Set the default logging level for ORM, specifically, to WARNING
16
+ DataNucleus.JDO.level=WARNING
17
+ DataNucleus.Persistence.level=WARNING
18
+ DataNucleus.Cache.level=WARNING
19
+ DataNucleus.MetaData.level=WARNING
20
+ DataNucleus.General.level=WARNING
21
+ DataNucleus.Utility.level=WARNING
22
+ DataNucleus.Transaction.level=WARNING
23
+ DataNucleus.Datastore.level=WARNING
24
+ DataNucleus.ClassLoading.level=WARNING
25
+ DataNucleus.Plugin.level=WARNING
26
+ DataNucleus.ValueGeneration.level=WARNING
27
+ DataNucleus.Enhancer.level=WARNING
28
+ DataNucleus.SchemaTool.level=WARNING
@@ -0,0 +1,41 @@
1
+ package <%= options[:package] %>.<%= options[:repositories_package] %>;
2
+
3
+ import java.lang.reflect.ParameterizedType;
4
+ import java.util.List;
5
+
6
+ import com.googlecode.objectify.Objectify;
7
+
8
+ class Repository<T> {
9
+
10
+ protected final Objectify objectify;
11
+
12
+ public Repository(Objectify objectify) {
13
+ this.objectify = objectify;
14
+ }
15
+
16
+ public void create(T entity) {
17
+ objectify.put(entity);
18
+ }
19
+
20
+ public void update(T entity) {
21
+ objectify.put(entity);
22
+ }
23
+
24
+ public void destroy(T entity) {
25
+ objectify.delete(entity);
26
+ }
27
+
28
+ public T find(Long id) {
29
+ return objectify.get(getParameterizedClass(), id);
30
+ }
31
+
32
+ public List<T> findAll() {
33
+ return objectify.query(getParameterizedClass()).list();
34
+ }
35
+
36
+ @SuppressWarnings("unchecked")
37
+ private Class<T> getParameterizedClass() {
38
+ ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
39
+ return (Class<T>) parameterizedType.getActualTypeArguments()[0];
40
+ }
41
+ }
@@ -1,7 +1,7 @@
1
1
  build_tool: <%= options[:build_tool] %>
2
2
  package: <%= options[:package] %>
3
3
  template_engine: <%= options[:template_engine] %>
4
- orm: <%= options[:orm] %>
4
+ orm: <%= orm %>
5
5
  models_package: <%= options[:models_package] %>
6
6
  controllers_package: <%= options[:controllers_package] %>
7
7
  repositories_package: <%= options[:repositories_package] %>
@@ -7,7 +7,7 @@
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.<%= options[:orm] %></param-value>
10
+ <param-value><%= @vraptor_packages * "," %></param-value>
11
11
  </context-param>
12
12
 
13
13
  <context-param>
@@ -35,4 +35,4 @@
35
35
  <url-pattern>/*</url-pattern>
36
36
  </filter-mapping>
37
37
 
38
- </web-app>
38
+ </web-app>
@@ -32,7 +32,7 @@ class Attribute
32
32
  def boolean?
33
33
  type.eql? "boolean"
34
34
  end
35
-
35
+
36
36
  def getter_prefix
37
37
  return "is" if boolean?
38
38
  "get"
@@ -5,7 +5,7 @@ class BaseScaffold < VraptorScaffold::Base
5
5
  @model = model
6
6
  @attributes = attributes
7
7
  end
8
-
8
+
9
9
  def model_parameter_name
10
10
  @model.camelize(:lower)
11
11
  end
@@ -41,4 +41,10 @@ class BaseScaffold < VraptorScaffold::Base
41
41
  def base_path
42
42
  model_parameter_name.pluralize
43
43
  end
44
+
45
+ protected
46
+ def define_source_paths
47
+ source_paths << File.expand_path(template_path) if File.exists?(template_path)
48
+ source_paths << source_root
49
+ end
44
50
  end
@@ -1,13 +1,18 @@
1
1
  class ControllerGenerator < BaseScaffold
2
-
3
- def self.source_root
4
- File.join File.dirname(__FILE__), "templates"
5
- end
6
-
2
+
7
3
  def build
4
+ define_source_paths
8
5
  template("controller.erb", Configuration.main_class_path(Configuration.controllers_package, "#{controller_class_name}.java"))
9
6
  template("controller_test.erb", Configuration.test_class_path(Configuration.controllers_package, "#{controller_test_class_name}.java"))
10
7
  end
8
+
9
+ def template_path
10
+ "src/templates/controllers"
11
+ end
12
+
13
+ def source_root
14
+ File.join File.dirname(__FILE__), "templates"
15
+ end
11
16
 
12
17
  def path
13
18
  "/#{base_path}"
@@ -1,15 +1,20 @@
1
1
  class ModelGenerator < BaseScaffold
2
2
 
3
- def self.source_root
4
- File.join File.dirname(__FILE__), "templates"
5
- end
6
-
7
3
  def build
4
+ define_source_paths
8
5
  template("model.erb", Configuration.main_class_path(Configuration.models_package, "#{class_name}.java"))
9
6
  template("model_test.erb", Configuration.test_class_path(Configuration.models_package, "#{test_class_name}.java"))
10
7
  map_orm_class if Configuration.hibernate?
11
8
  end
12
9
 
10
+ def template_path
11
+ "src/templates/models"
12
+ end
13
+
14
+ def source_root
15
+ File.join File.dirname(__FILE__), "templates"
16
+ end
17
+
13
18
  private
14
19
  def map_orm_class
15
20
  file = File.join Configuration::MAIN_RESOURCES, "hibernate.cfg.xml"
@@ -17,4 +22,5 @@ class ModelGenerator < BaseScaffold
17
22
  line_break = "\n "
18
23
  inject_into_file(file, " <mapping class='#{model}'/>#{line_break}", :before => "</session-factory>")
19
24
  end
25
+
20
26
  end
@@ -0,0 +1,20 @@
1
+ class ObjectifyModelGenerator < BaseScaffold
2
+
3
+ def self.source_root
4
+ File.join File.dirname(__FILE__), "templates"
5
+ end
6
+
7
+ def build
8
+ template("objectify_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_model_class
11
+ end
12
+
13
+ private
14
+ def map_model_class
15
+ file = File.join Configuration::main_class_path, "infra", "ObjectifyFactory.java"
16
+ model = "#{Configuration.full_models_package}.#{class_name}"
17
+ inject_into_file(file, "import #{model};\n\n", :before => "@Component")
18
+ inject_into_file(file, "\t\tObjectifyService.register(#{class_name}.class);\n", :after => "\tstatic {\n")
19
+ end
20
+ end
@@ -0,0 +1,33 @@
1
+ package <%= Configuration.full_models_package %>;
2
+
3
+ import javax.persistence.Entity;
4
+ import javax.persistence.Id;
5
+
6
+ @Entity
7
+ public class <%= class_name %> {
8
+
9
+ @Id
10
+ private Long id;
11
+ <% @attributes.each do |att| -%>
12
+ private <%= att.java_type %> <%= att.name %>;
13
+ <% end -%>
14
+
15
+ public void setId(Long id) {
16
+ this.id = id;
17
+ }
18
+
19
+ public Long getId() {
20
+ return id;
21
+ }
22
+
23
+ <% @attributes.each do |att| -%>
24
+ public void set<%= att.name.camelize %>(<%= att.java_type %> <%= att.name %>) {
25
+ this.<%= att.name %> = <%= att.name %>;
26
+ }
27
+
28
+ public <%= att.java_type %> <%= att.getter_prefix + att.name.camelize %>() {
29
+ return <%= att.name %>;
30
+ }
31
+
32
+ <% end -%>
33
+ }
@@ -0,0 +1,25 @@
1
+ class ObjectifyRepositoryGenerator < BaseScaffold
2
+
3
+ def self.source_root
4
+ File.join File.dirname(__FILE__), "templates"
5
+ end
6
+
7
+ def build
8
+ template("objectify_repository.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_interface_name}.java"))
9
+ template("objectify_repository_impl.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_impl_name}.java"))
10
+ template("repository_test.erb", Configuration.test_class_path(Configuration.repositories_package, "#{repository_test_class_name}.java"))
11
+ end
12
+
13
+ def orm_import
14
+ "com.googlecode.objectify.Objectify"
15
+ end
16
+
17
+ def orm_parameter_name
18
+ "objectify"
19
+ end
20
+
21
+ def orm_class
22
+ orm_parameter_name.camelize
23
+ end
24
+
25
+ end
@@ -1,10 +1,7 @@
1
1
  class RepositoryGenerator < BaseScaffold
2
2
 
3
- def self.source_root
4
- File.join File.dirname(__FILE__), "templates"
5
- end
6
-
7
3
  def build
4
+ define_source_paths
8
5
  template("repository.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_interface_name}.java"))
9
6
  template("repository_impl.erb", Configuration.main_class_path(Configuration.repositories_package, "#{repository_impl_name}.java"))
10
7
  template("repository_test.erb", Configuration.test_class_path(Configuration.repositories_package, "#{repository_test_class_name}.java"))
@@ -24,4 +21,12 @@ class RepositoryGenerator < BaseScaffold
24
21
  orm_parameter_name.camelize
25
22
  end
26
23
 
24
+ def template_path
25
+ "src/templates/repositories"
26
+ end
27
+
28
+ def source_root
29
+ File.join File.dirname(__FILE__), "templates"
30
+ end
31
+
27
32
  end