vraptor-scaffold 0.0.1.beta5 → 0.0.1.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/Gemfile +1 -1
  2. data/History.txt +13 -1
  3. data/README.rdoc +22 -13
  4. data/Rakefile +4 -6
  5. data/TODO.txt +1 -3
  6. data/VERSION.yml +1 -1
  7. data/lib/generators/app_generator/app_generator.rb +1 -0
  8. data/lib/generators/app_generator/templates/macros/html.ftl +15 -3
  9. data/lib/generators/app_generator/templates/main.ftl +4 -4
  10. data/lib/generators/app_generator/templates/pom.erb +6 -0
  11. data/lib/generators/{attribute.rb → scaffold_generator/attribute.rb} +11 -8
  12. data/lib/generators/scaffold_generator/base_scaffold.rb +21 -1
  13. data/lib/generators/scaffold_generator/controller_generator/controller_generator.rb +1 -5
  14. data/lib/generators/scaffold_generator/controller_generator/templates/controller.erb +3 -3
  15. data/lib/generators/scaffold_generator/controller_generator/templates/controller_test.erb +1 -1
  16. data/lib/generators/scaffold_generator/model_generator/model_generator.rb +1 -1
  17. data/lib/generators/scaffold_generator/model_generator/templates/model.erb +3 -3
  18. data/lib/generators/scaffold_generator/model_generator/templates/model_test.erb +1 -1
  19. data/lib/generators/scaffold_generator/repository_generator/repository_generator.rb +2 -6
  20. data/lib/generators/scaffold_generator/repository_generator/templates/repository_test.erb +1 -1
  21. data/lib/generators/scaffold_generator/scaffold_generator.rb +4 -4
  22. data/lib/load_paths.rb +1 -2
  23. data/lib/vraptor-scaffold.rb +1 -1
  24. data/spec/lib/generators/app_generator/app_generator_spec.rb +4 -0
  25. data/spec/lib/generators/app_generator/templates/pom.xml +6 -0
  26. data/spec/lib/generators/scaffold_generator/attribute_spec.rb +114 -0
  27. data/spec/lib/generators/scaffold_generator/base_scaffold_spec.rb +32 -0
  28. data/vraptor-scaffold.gemspec +15 -16
  29. metadata +17 -33
  30. data/spec/lib/generators/attribute_spec.rb +0 -82
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source :rubygems
2
2
 
3
3
  gem "thor", ">=0.14.0"
4
4
  gem "rake", ">=0.8.7"
5
- gem "activesupport", ">=3.0.0.beta4"
5
+ gem "activesupport", ">=3.0.0.rc"
6
6
 
7
7
  gem "ruby-debug", :group => [:development, :test]
8
8
 
@@ -1,4 +1,16 @@
1
- === 0.0.1.beta4 / 2010-07-?
1
+ === 0.0.1.rc / 2010-08-23
2
+
3
+ == New Features
4
+ * Added Hamcrest 1.1
5
+ * Added text support(textarea).
6
+
7
+ == Improvements
8
+ * Create forder to put images.
9
+
10
+ == Bugfixes
11
+ * Works on windows OS.
12
+
13
+ === 0.0.1.beta4 / 2010-08-04
2
14
 
3
15
  == New Features
4
16
  * Added generic repository.
@@ -4,6 +4,12 @@ Scaffold for vraptor 3.
4
4
  == Installation
5
5
  gem install vraptor-scaffold --pre
6
6
 
7
+ == Dependencies
8
+ Ensures that you already have installed:
9
+
10
+ - Java 6
11
+ - Maven 2
12
+
7
13
  == Getting Started
8
14
  At the command line client:
9
15
 
@@ -24,7 +30,7 @@ The default web server is jetty but you can import the project in your favorite
24
30
  and run your project with tomcat or jboss as for example.
25
31
 
26
32
  == Supported Java Types
27
- The only supported types for now are: boolean, double, float, short, integer, long and string.
33
+ The only supported types for now are: boolean, double, float, short, integer, long, string and text.
28
34
 
29
35
  == Architecture Overview
30
36
  When you run vraptor new command will be created a java web application with:
@@ -36,6 +42,7 @@ When you run vraptor new command will be created a java web application with:
36
42
  - Maven2 = Project Management
37
43
  - jQuery = JavaScript
38
44
  - Junit
45
+ - Hamcrest
39
46
  - Mockito
40
47
 
41
48
  == Description of Contents
@@ -55,9 +62,6 @@ src/main/webapp
55
62
  src/main/webapp/decorators
56
63
  Decorators will be placed here.
57
64
 
58
- src/main/webapp/macros
59
- Freemarker macros will be placed here.
60
-
61
65
  src/main/webapp/javascripts
62
66
  JavaScripts will be placed here.
63
67
 
@@ -76,17 +80,22 @@ src/test/java/app/models
76
80
  src/test/java/app/repositories
77
81
  Tests to repositories will be placed here.
78
82
 
79
- == Dependencies
80
- Ensures that you already have installed:
81
-
82
- - Java 6
83
- - Maven 2
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.
84
89
 
85
90
  == Note on Patches/Pull Requests
86
- - Fork the project.
87
- - Make your feature addition or bug fix.
88
- - Add tests for it.
89
- - Send me a pull request.
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.
90
99
 
91
100
  == Author
92
101
  -- Rodolfo Liviero [mailto:rodolfoliviero@gmail.com]
data/Rakefile CHANGED
@@ -6,17 +6,15 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "vraptor-scaffold"
8
8
  gem.summary = "Scaffold for vraptor 3."
9
- gem.description = ""
9
+ gem.description = "Scaffold for vraptor 3 with jpa, freemarker, maven, mockito, junit and jquery."
10
10
  gem.email = "rodolfoliviero@gmail.com"
11
11
  gem.homepage = "http://github.com/rodolfoliviero/vraptor-scaffold"
12
12
  gem.authors = ["Rodolfo Liviero"]
13
13
 
14
14
  gem.add_dependency "thor", ">=0.14.0"
15
- gem.add_dependency "rake", ">=0.8.7"
16
- gem.add_dependency "activesupport", ">=3.0.0.beta4"
17
- gem.add_dependency "bundler", ">=1.0.0.rc.2"
18
-
19
- gem.post_install_message = "Thank you for installing vraptor-scaffold. Please read http://github.com/rodolfoliviero/vraptor-scaffold/blob/master/README.rdoc for more information."
15
+ gem.add_dependency "rake", ">=0.8.7"
16
+ gem.add_dependency "activesupport", ">=3.0.0.rc"
17
+ gem.post_install_message = "Thank you for installing vraptor-scaffold. Please read http://github.com/rodolfoliviero/vraptor-scaffold/blob/master/README.rdoc for more information."
20
18
  end
21
19
  Jeweler::GemcutterTasks.new
22
20
  rescue LoadError
data/TODO.txt CHANGED
@@ -1,8 +1,7 @@
1
- unit tests to generated code
1
+ better unit tests to generated code
2
2
  datetime, date and time support.(jquery-ui?)
3
3
  relationship support(many-to-one, one-to-many, many-to-many)
4
4
 
5
- gem description
6
5
  generators help
7
6
  usage file to each generator
8
7
  create others persistence unit(maven profile?)
@@ -10,7 +9,6 @@ update jpa to jpa2(hibernate 3.5.?-FINAL)
10
9
 
11
10
  put all html input in macros
12
11
  i18n messages
13
- it works on windowns?
14
12
  hibernate joda-time support
15
13
  top leval package
16
14
  scaml support
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 0
3
3
  :patch: 1
4
- :build: beta5
4
+ :build: rc
5
5
  :major: 0
@@ -81,6 +81,7 @@ class AppGenerator < VraptorScaffold::Base
81
81
  inside webapp do
82
82
  template_from_root("index.jsp", "#{webapp}/index.jsp")
83
83
  create_decorators
84
+ empty_directory "images"
84
85
  create_js
85
86
  create_css
86
87
  create_macros
@@ -1,11 +1,23 @@
1
1
  <#macro checkbox name checked=false>
2
2
  <#if checked>
3
- <input type="checkbox" name="${name}" checked>
3
+ <input id="${name}" type="checkbox" name="${name}" checked/>
4
4
  <#else>
5
- <input type="checkbox" name="${name}">
5
+ <input id="${name}" type="checkbox" name="${name}"/>
6
6
  </#if>
7
7
  </#macro>
8
8
 
9
9
  <#macro text name value="">
10
- <input type="text" name="${name}" value="${value}">
10
+ <input type="text" id="${name}" name="${name}" value="${value}"/>
11
+ </#macro>
12
+
13
+ <#macro textarea name value="">
14
+ <textarea id="${name}" name="${name}" cols="40" rows="20">${value}</textarea>
15
+ </#macro>
16
+
17
+ <#macro css name>
18
+ <link rel="stylesheet" type="text/css" href="${base}/stylesheets/${name}.css" />
19
+ </#macro>
20
+
21
+ <#macro js name>
22
+ <script type="text/javascript" src="${base}/javascripts/${name}.js"></script>
11
23
  </#macro>
@@ -2,13 +2,13 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <link rel="stylesheet" type="text/css" href="${base}/stylesheets/scaffold.css" />
6
- <title>${title}</title>
7
- ${head}
5
+ <@html.css "scaffold"/>
6
+ <title>Vraptor Scaffold</title>
7
+ ${head}
8
8
  </head>
9
9
 
10
10
  <body>
11
11
  ${body}
12
- <script type="text/javascript" src="${base}/javascripts/jquery-1.4.2.min.js"></script>
12
+ <@html.js "jquery-1.4.2.min"/>
13
13
  </body>
14
14
  </html>
@@ -55,6 +55,12 @@
55
55
  <version>4.8.1</version>
56
56
  <scope>test</scope>
57
57
  </dependency>
58
+ <dependency>
59
+ <groupId>org.hamcrest</groupId>
60
+ <artifactId>hamcrest-all</artifactId>
61
+ <version>1.1</version>
62
+ <scope>test</scope>
63
+ </dependency>
58
64
  <dependency>
59
65
  <groupId>org.mockito</groupId>
60
66
  <artifactId>mockito-all</artifactId>
@@ -3,25 +3,28 @@ class Attribute
3
3
 
4
4
  def initialize(name, type)
5
5
  @name = name
6
- set_type(type)
7
- end
8
-
9
- def set_type(type)
10
6
  @type = type
11
- @type = @type.capitalize unless boolean?
12
7
  end
13
8
 
14
9
  def html_input
15
10
  input = "text"
16
11
  input = "checkbox" if boolean?
12
+ input = "textarea" if type.eql?("text")
17
13
  input
18
14
  end
19
15
 
20
- def boolean?
21
- type.eql? "boolean"
16
+ def java_type
17
+ java = type.capitalize
18
+ java = "boolean" if boolean?
19
+ java = "String" if type.eql?("text")
20
+ java
22
21
  end
23
22
 
24
23
  def self.valid_types
25
- %w(boolean double float short integer long string)
24
+ %w(boolean double float short integer long string text)
25
+ end
26
+
27
+ def boolean?
28
+ type.eql? "boolean"
26
29
  end
27
30
  end
@@ -1,6 +1,6 @@
1
1
  class BaseScaffold < VraptorScaffold::Base
2
2
 
3
- def initialize(model, attributes)
3
+ def initialize(model, attributes={})
4
4
  super
5
5
  @model = model
6
6
  @attributes = attributes
@@ -9,4 +9,24 @@ class BaseScaffold < VraptorScaffold::Base
9
9
  def class_name
10
10
  @model.capitalize
11
11
  end
12
+
13
+ def test_class_name
14
+ "#{class_name}Test"
15
+ end
16
+
17
+ def repository_class_name
18
+ "#{class_name}Repository"
19
+ end
20
+
21
+ def repository_test_class_name
22
+ "#{repository_class_name}Test"
23
+ end
24
+
25
+ def controller_class_name
26
+ "#{class_name}Controller"
27
+ end
28
+
29
+ def controller_test_class_name
30
+ "#{controller_class_name}Test"
31
+ end
12
32
  end
@@ -6,11 +6,7 @@ class ControllerGenerator < BaseScaffold
6
6
 
7
7
  def build
8
8
  template("templates/controller.erb", "src/main/java/app/controllers/#{controller_class_name}.java")
9
- template("templates/controller_test.erb", "src/test/java/app/controllers/#{controller_class_name}Test.java")
10
- end
11
-
12
- def controller_class_name
13
- "#{class_name}Controller"
9
+ template("templates/controller_test.erb", "src/test/java/app/controllers/#{controller_test_class_name}.java")
14
10
  end
15
11
 
16
12
  def path
@@ -3,7 +3,7 @@ package app.controllers;
3
3
  import java.util.List;
4
4
 
5
5
  import app.models.<%= class_name %>;
6
- import app.repositories.<%= class_name %>Repository;
6
+ import app.repositories.<%= repository_class_name %>;
7
7
  import br.com.caelum.vraptor.Delete;
8
8
  import br.com.caelum.vraptor.Get;
9
9
  import br.com.caelum.vraptor.Path;
@@ -17,10 +17,10 @@ import br.com.caelum.vraptor.Validator;
17
17
  public class <%= controller_class_name %> {
18
18
 
19
19
  private final Result result;
20
- private final <%= class_name %>Repository repository;
20
+ private final <%= repository_class_name %> repository;
21
21
  private final Validator validator;
22
22
 
23
- public <%= controller_class_name %>(Result result, <%= class_name %>Repository repository, Validator validator) {
23
+ public <%= controller_class_name %>(Result result, <%= repository_class_name %> repository, Validator validator) {
24
24
  this.result = result;
25
25
  this.repository = repository;
26
26
  this.validator = validator;
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertNotNull;
4
4
 
5
5
  import org.junit.Test;
6
6
 
7
- public class <%= controller_class_name %>Test {
7
+ public class <%= controller_test_class_name %> {
8
8
 
9
9
  @Test public void fakeTest() {
10
10
  assertNotNull("put something real.", new <%= controller_class_name %>(null, null, null));
@@ -6,6 +6,6 @@ class ModelGenerator < BaseScaffold
6
6
 
7
7
  def build
8
8
  template("templates/model.erb", "src/main/java/app/models/#{class_name}.java")
9
- template("templates/model_test.erb", "src/test/java/app/models/#{class_name}Test.java")
9
+ template("templates/model_test.erb", "src/test/java/app/models/#{test_class_name}.java")
10
10
  end
11
11
  end
@@ -4,15 +4,15 @@ package app.models;
4
4
  public class <%= class_name %> extends Entity {
5
5
 
6
6
  <% @attributes.each do |att| -%>
7
- private <%= att.type %> <%= att.name %>;
7
+ private <%= att.java_type %> <%= att.name %>;
8
8
  <% end -%>
9
9
 
10
10
  <% @attributes.each do |att| -%>
11
- public void set<%= att.name.capitalize %>(<%= att.type %> <%= att.name %>) {
11
+ public void set<%= att.name.capitalize %>(<%= att.java_type %> <%= att.name %>) {
12
12
  this.<%= att.name %> = <%= att.name %>;
13
13
  }
14
14
 
15
- public <%= att.type %> get<%= att.name.capitalize %>() {
15
+ public <%= att.java_type %> get<%= att.name.capitalize %>() {
16
16
  return <%= att.name %>;
17
17
  }
18
18
 
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertNotNull;
4
4
 
5
5
  import org.junit.Test;
6
6
 
7
- public class <%= class_name %>Test {
7
+ public class <%= test_class_name %> {
8
8
 
9
9
  @Test public void fakeTest() {
10
10
  assertNotNull("put something real.", new <%= class_name %>());
@@ -5,11 +5,7 @@ class RepositoryGenerator < BaseScaffold
5
5
  end
6
6
 
7
7
  def build
8
- template("templates/repository.erb", "src/main/java/app/repositories/#{class_name}Repository.java")
9
- template("templates/repository_test.erb", "src/test/java/app/repositories/#{repository_class_name}Test.java")
10
- end
11
-
12
- def repository_class_name
13
- "#{class_name}Repository"
8
+ template("templates/repository.erb", "src/main/java/app/repositories/#{repository_class_name}.java")
9
+ template("templates/repository_test.erb", "src/test/java/app/repositories/#{repository_test_class_name}.java")
14
10
  end
15
11
  end
@@ -4,7 +4,7 @@ import static org.junit.Assert.assertNotNull;
4
4
 
5
5
  import org.junit.Test;
6
6
 
7
- public class <%= repository_class_name %>Test {
7
+ public class <%= repository_test_class_name %> {
8
8
 
9
9
  @Test public void fakeTest() {
10
10
  assertNotNull("put something real.", new <%= repository_class_name %>(null));
@@ -21,17 +21,17 @@ class ScaffoldGenerator
21
21
  puts "To run scaffold please go to the project root folder."
22
22
  Kernel::exit
23
23
  end
24
- validate_parse_attributes(args)
24
+ validate_attributes(args)
25
25
  end
26
26
 
27
- def validate_parse_attributes(args)
27
+ def validate_attributes(args)
28
28
  args.each do |arg|
29
29
  parsedAttribute = arg.split(":")
30
- validate_parse_attribute(parsedAttribute)
30
+ parse_attribute(parsedAttribute)
31
31
  end
32
32
  end
33
33
 
34
- def validate_parse_attribute(parsedAttribute)
34
+ def parse_attribute(parsedAttribute)
35
35
  type = parsedAttribute.last.downcase
36
36
  unless Attribute.valid_types.include?(type)
37
37
  puts "Attribute #{type} is not supported. The supported attributes types are: #{Attribute.valid_types.join(" ")}"
@@ -1,12 +1,11 @@
1
1
  require 'rubygems'
2
- require "bundler/setup"
3
2
 
4
3
  require 'thor/actions'
5
4
  require 'thor/group'
6
5
  require 'active_support/inflector'
7
6
 
8
- require File.dirname(__FILE__) + '/../lib/generators/attribute'
9
7
  require File.dirname(__FILE__) + '/../lib/generators/base'
8
+ require File.dirname(__FILE__) + '/../lib/generators/scaffold_generator/attribute'
10
9
  require File.dirname(__FILE__) + '/../lib/generators/scaffold_generator/scaffold_generator'
11
10
  require File.dirname(__FILE__) + '/../lib/generators/scaffold_generator/base_scaffold'
12
11
  require File.dirname(__FILE__) + '/../lib/generators/scaffold_generator/model_generator/model_generator'
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/load_paths'
3
3
  module VraptorScaffold
4
4
  class Main
5
5
  def self.execute(args)
6
- action = args.shift
6
+ action = args.shift
7
7
  AppGenerator.new.build(args[0]) if action == "new"
8
8
  ScaffoldGenerator.new(args).build if action == "scaffold"
9
9
  exec("mvn compile war:inplace jetty:run") if action == "start"
@@ -163,6 +163,10 @@ describe AppGenerator do
163
163
  to = "#{@webapp}/javascripts/jquery-1.4.2.min.js"
164
164
  FileUtils.compare_file(from, to).should be_true
165
165
  end
166
+
167
+ it "should create images folder" do
168
+ File.exist?("#{@webapp}/images").should be_true
169
+ end
166
170
  end
167
171
  context "creating test" do
168
172
  before(:all) do
@@ -55,6 +55,12 @@
55
55
  <version>4.8.1</version>
56
56
  <scope>test</scope>
57
57
  </dependency>
58
+ <dependency>
59
+ <groupId>org.hamcrest</groupId>
60
+ <artifactId>hamcrest-all</artifactId>
61
+ <version>1.1</version>
62
+ <scope>test</scope>
63
+ </dependency>
58
64
  <dependency>
59
65
  <groupId>org.mockito</groupId>
60
66
  <artifactId>mockito-all</artifactId>
@@ -0,0 +1,114 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
2
+
3
+ describe Attribute do
4
+
5
+ context "supported types" do
6
+ it "should support boolean" do
7
+ Attribute.valid_types.include?("boolean").should be_true
8
+ end
9
+
10
+ it "should support double" do
11
+ Attribute.valid_types.include?("double").should be_true
12
+ end
13
+
14
+ it "should support string" do
15
+ Attribute.valid_types.include?("string").should be_true
16
+ end
17
+
18
+ it "should support float" do
19
+ Attribute.valid_types.include?("float").should be_true
20
+ end
21
+
22
+ it "should support short" do
23
+ Attribute.valid_types.include?("short").should be_true
24
+ end
25
+
26
+ it "should support integer" do
27
+ Attribute.valid_types.include?("integer").should be_true
28
+ end
29
+
30
+ it "should support long" do
31
+ Attribute.valid_types.include?("long").should be_true
32
+ end
33
+
34
+ it "should support text" do
35
+ Attribute.valid_types.include?("text").should be_true
36
+ end
37
+ end
38
+
39
+ context "html_input" do
40
+ it "should know html input to boolean" do
41
+ Attribute.new("flag", "boolean").html_input.should eql("checkbox")
42
+ end
43
+
44
+ it "should know html input to string" do
45
+ Attribute.new("name", "string").html_input.should eql("text")
46
+ end
47
+
48
+ it "should know html input to double" do
49
+ Attribute.new("name", "double").html_input.should eql("text")
50
+ end
51
+
52
+ it "should know html input to float" do
53
+ Attribute.new("name", "float").html_input.should eql("text")
54
+ end
55
+
56
+ it "should know html input to short" do
57
+ Attribute.new("name", "short").html_input.should eql("text")
58
+ end
59
+
60
+ it "should know html input to integer" do
61
+ Attribute.new("name", "integer").html_input.should eql("text")
62
+ end
63
+
64
+ it "should know html input to long" do
65
+ Attribute.new("name", "long").html_input.should eql("text")
66
+ end
67
+
68
+ it "should know html input to text" do
69
+ Attribute.new("name", "text").html_input.should eql("textarea")
70
+ end
71
+ end
72
+
73
+ context "java type" do
74
+ it "should know corret java type to boolean" do
75
+ Attribute.new("flag", "boolean").java_type.should eql("boolean")
76
+ end
77
+
78
+ it "should know corret java type to text" do
79
+ Attribute.new("description", "text").java_type.should eql("String")
80
+ end
81
+
82
+ it "should know corret java type to string" do
83
+ Attribute.new("name", "string").java_type.should eql("String")
84
+ end
85
+
86
+ it "should know corret java type to double" do
87
+ Attribute.new("name", "double").java_type.should eql("Double")
88
+ end
89
+
90
+ it "should know corret java type to float" do
91
+ Attribute.new("name", "float").java_type.should eql("Float")
92
+ end
93
+
94
+ it "should know corret java type to short" do
95
+ Attribute.new("name", "short").java_type.should eql("Short")
96
+ end
97
+
98
+ it "should know corret java type to integer" do
99
+ Attribute.new("name", "integer").java_type.should eql("Integer")
100
+ end
101
+
102
+ it "should know corret java type to long" do
103
+ Attribute.new("name", "long").java_type.should eql("Long")
104
+ end
105
+ end
106
+
107
+ it "should be boolean when type is boolean" do
108
+ Attribute.new("flag", "boolean").boolean?.should be_true
109
+ end
110
+
111
+ it "cannot be boolean otherwise" do
112
+ Attribute.new("flag", "short").boolean?.should be_false
113
+ end
114
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
2
+
3
+ describe BaseScaffold do
4
+
5
+ before(:each) do
6
+ @base = BaseScaffold.new("client")
7
+ end
8
+
9
+ it "should know model class name" do
10
+ @base.class_name.should eql("Client")
11
+ end
12
+
13
+ it "should know model test class name" do
14
+ @base.test_class_name.should eql("ClientTest")
15
+ end
16
+
17
+ it "should know repository class name" do
18
+ @base.repository_class_name.should eql("ClientRepository")
19
+ end
20
+
21
+ it "should know repository test class name" do
22
+ @base.repository_test_class_name.should eql("ClientRepositoryTest")
23
+ end
24
+
25
+ it "should know controller class name" do
26
+ @base.controller_class_name.should eql("ClientController")
27
+ end
28
+
29
+ it "should know controller test class name" do
30
+ @base.controller_test_class_name.should eql("ClientControllerTest")
31
+ end
32
+ end
@@ -5,13 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vraptor-scaffold}
8
- s.version = "0.0.1.beta5"
8
+ s.version = "0.0.1.rc"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rodolfo Liviero"]
12
- s.date = %q{2010-08-04}
12
+ s.date = %q{2010-08-24}
13
13
  s.default_executable = %q{vraptor}
14
- s.description = %q{}
14
+ s.description = %q{Scaffold for vraptor 3 with jpa, freemarker, maven, mockito, junit and jquery.}
15
15
  s.email = %q{rodolfoliviero@gmail.com}
16
16
  s.executables = ["vraptor"]
17
17
  s.extra_rdoc_files = [
@@ -44,8 +44,8 @@ Gem::Specification.new do |s|
44
44
  "lib/generators/app_generator/templates/pom.erb",
45
45
  "lib/generators/app_generator/templates/stylesheets/scaffold.css",
46
46
  "lib/generators/app_generator/templates/web.xml",
47
- "lib/generators/attribute.rb",
48
47
  "lib/generators/base.rb",
48
+ "lib/generators/scaffold_generator/attribute.rb",
49
49
  "lib/generators/scaffold_generator/base_scaffold.rb",
50
50
  "lib/generators/scaffold_generator/controller_generator/controller_generator.rb",
51
51
  "lib/generators/scaffold_generator/controller_generator/templates/controller.erb",
@@ -67,7 +67,8 @@ Gem::Specification.new do |s|
67
67
  "lib/vraptor-scaffold.rb",
68
68
  "spec/lib/generators/app_generator/app_generator_spec.rb",
69
69
  "spec/lib/generators/app_generator/templates/pom.xml",
70
- "spec/lib/generators/attribute_spec.rb",
70
+ "spec/lib/generators/scaffold_generator/attribute_spec.rb",
71
+ "spec/lib/generators/scaffold_generator/base_scaffold_spec.rb",
71
72
  "spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb",
72
73
  "spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java",
73
74
  "spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb",
@@ -88,15 +89,16 @@ Gem::Specification.new do |s|
88
89
  s.rubygems_version = %q{1.3.7}
89
90
  s.summary = %q{Scaffold for vraptor 3.}
90
91
  s.test_files = [
91
- "spec/lib/vraptor-scaffold_spec.rb",
92
+ "spec/spec_helper.rb",
92
93
  "spec/lib/generators/app_generator/app_generator_spec.rb",
93
- "spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb",
94
94
  "spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb",
95
- "spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb",
96
95
  "spec/lib/generators/scaffold_generator/model_generator/model_generator_spec.rb",
97
96
  "spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb",
98
- "spec/lib/generators/attribute_spec.rb",
99
- "spec/spec_helper.rb"
97
+ "spec/lib/generators/scaffold_generator/attribute_spec.rb",
98
+ "spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb",
99
+ "spec/lib/generators/scaffold_generator/base_scaffold_spec.rb",
100
+ "spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb",
101
+ "spec/lib/vraptor-scaffold_spec.rb"
100
102
  ]
101
103
 
102
104
  if s.respond_to? :specification_version then
@@ -106,19 +108,16 @@ Gem::Specification.new do |s|
106
108
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
107
109
  s.add_runtime_dependency(%q<thor>, [">= 0.14.0"])
108
110
  s.add_runtime_dependency(%q<rake>, [">= 0.8.7"])
109
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
110
- s.add_runtime_dependency(%q<bundler>, [">= 1.0.0.rc.2"])
111
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.rc"])
111
112
  else
112
113
  s.add_dependency(%q<thor>, [">= 0.14.0"])
113
114
  s.add_dependency(%q<rake>, [">= 0.8.7"])
114
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
115
- s.add_dependency(%q<bundler>, [">= 1.0.0.rc.2"])
115
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
116
116
  end
117
117
  else
118
118
  s.add_dependency(%q<thor>, [">= 0.14.0"])
119
119
  s.add_dependency(%q<rake>, [">= 0.8.7"])
120
- s.add_dependency(%q<activesupport>, [">= 3.0.0.beta4"])
121
- s.add_dependency(%q<bundler>, [">= 1.0.0.rc.2"])
120
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
122
121
  end
123
122
  end
124
123
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vraptor-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 299253581
4
+ hash: 7712030
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 1
10
- - beta5
11
- version: 0.0.1.beta5
10
+ - rc
11
+ version: 0.0.1.rc
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rodolfo Liviero
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-04 00:00:00 -03:00
19
+ date: 2010-08-24 00:00:00 -03:00
20
20
  default_executable: vraptor
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -59,34 +59,16 @@ dependencies:
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- hash: 299253624
62
+ hash: 7712042
63
63
  segments:
64
64
  - 3
65
65
  - 0
66
66
  - 0
67
- - beta4
68
- version: 3.0.0.beta4
69
- type: :runtime
70
- version_requirements: *id003
71
- - !ruby/object:Gem::Dependency
72
- name: bundler
73
- prerelease: false
74
- requirement: &id004 !ruby/object:Gem::Requirement
75
- none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 15424049
80
- segments:
81
- - 1
82
- - 0
83
- - 0
84
67
  - rc
85
- - 2
86
- version: 1.0.0.rc.2
68
+ version: 3.0.0.rc
87
69
  type: :runtime
88
- version_requirements: *id004
89
- description: ""
70
+ version_requirements: *id003
71
+ description: Scaffold for vraptor 3 with jpa, freemarker, maven, mockito, junit and jquery.
90
72
  email: rodolfoliviero@gmail.com
91
73
  executables:
92
74
  - vraptor
@@ -121,8 +103,8 @@ files:
121
103
  - lib/generators/app_generator/templates/pom.erb
122
104
  - lib/generators/app_generator/templates/stylesheets/scaffold.css
123
105
  - lib/generators/app_generator/templates/web.xml
124
- - lib/generators/attribute.rb
125
106
  - lib/generators/base.rb
107
+ - lib/generators/scaffold_generator/attribute.rb
126
108
  - lib/generators/scaffold_generator/base_scaffold.rb
127
109
  - lib/generators/scaffold_generator/controller_generator/controller_generator.rb
128
110
  - lib/generators/scaffold_generator/controller_generator/templates/controller.erb
@@ -144,7 +126,8 @@ files:
144
126
  - lib/vraptor-scaffold.rb
145
127
  - spec/lib/generators/app_generator/app_generator_spec.rb
146
128
  - spec/lib/generators/app_generator/templates/pom.xml
147
- - spec/lib/generators/attribute_spec.rb
129
+ - spec/lib/generators/scaffold_generator/attribute_spec.rb
130
+ - spec/lib/generators/scaffold_generator/base_scaffold_spec.rb
148
131
  - spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb
149
132
  - spec/lib/generators/scaffold_generator/controller_generator/templates/ProductController.java
150
133
  - spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb
@@ -194,12 +177,13 @@ signing_key:
194
177
  specification_version: 3
195
178
  summary: Scaffold for vraptor 3.
196
179
  test_files:
197
- - spec/lib/vraptor-scaffold_spec.rb
180
+ - spec/spec_helper.rb
198
181
  - spec/lib/generators/app_generator/app_generator_spec.rb
199
- - spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb
200
182
  - spec/lib/generators/scaffold_generator/repository_generator/repository_generator_spec.rb
201
- - spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb
202
183
  - spec/lib/generators/scaffold_generator/model_generator/model_generator_spec.rb
203
184
  - spec/lib/generators/scaffold_generator/freemarker_generator/freemarker_generator_spec.rb
204
- - spec/lib/generators/attribute_spec.rb
205
- - spec/spec_helper.rb
185
+ - spec/lib/generators/scaffold_generator/attribute_spec.rb
186
+ - spec/lib/generators/scaffold_generator/scaffold_generator_spec.rb
187
+ - spec/lib/generators/scaffold_generator/base_scaffold_spec.rb
188
+ - spec/lib/generators/scaffold_generator/controller_generator/controller_generator_spec.rb
189
+ - spec/lib/vraptor-scaffold_spec.rb
@@ -1,82 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
-
3
- describe Attribute do
4
-
5
- context "supported types" do
6
- it "should support boolean" do
7
- Attribute.valid_types.include?"boolean".should be_true
8
- end
9
-
10
- it "should support double" do
11
- Attribute.valid_types.include?"double".should be_true
12
- end
13
-
14
- it "should support string" do
15
- Attribute.valid_types.include?"string".should be_true
16
- end
17
-
18
- it "should support float" do
19
- Attribute.valid_types.include?"float".should be_true
20
- end
21
-
22
- it "should support short" do
23
- Attribute.valid_types.include?"short".should be_true
24
- end
25
-
26
- it "should support integer" do
27
- Attribute.valid_types.include?"integer".should be_true
28
- end
29
-
30
- it "should support long" do
31
- Attribute.valid_types.include?"long".should be_true
32
- end
33
- end
34
-
35
- context "html_input" do
36
- it "should know html input to boolean" do
37
- Attribute.new("flag", "boolean").html_input.should eql("checkbox")
38
- end
39
-
40
- it "should know html input to string" do
41
- Attribute.new("name", "string").html_input.should eql("text")
42
- end
43
-
44
- it "should know html input to double" do
45
- Attribute.new("name", "double").html_input.should eql("text")
46
- end
47
-
48
- it "should know html input to float" do
49
- Attribute.new("name", "float").html_input.should eql("text")
50
- end
51
-
52
- it "should know html input to short" do
53
- Attribute.new("name", "short").html_input.should eql("text")
54
- end
55
-
56
- it "should know html input to integer" do
57
- Attribute.new("name", "integer").html_input.should eql("text")
58
- end
59
-
60
- it "should know html input to long" do
61
- Attribute.new("name", "long").html_input.should eql("text")
62
- end
63
- end
64
-
65
- context "set type" do
66
- it "should set corret type to boolean" do
67
- Attribute.new("flag", "boolean").type.should eql("boolean")
68
- end
69
-
70
- it "should set corret type otherwise" do
71
- Attribute.new("id", "long").type.should eql("Long")
72
- end
73
- end
74
-
75
- it "should be boolean when type is boolean" do
76
- Attribute.new("flag", "boolean").boolean?.should be_true
77
- end
78
-
79
- it "cannot be boolean otherwise" do
80
- Attribute.new("flag", "short").boolean?.should be_false
81
- end
82
- end