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
data/spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ProductRepository.java
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
package app.repository;
|
2
|
+
|
3
|
+
import java.util.List;
|
4
|
+
|
5
|
+
import app.model.Product;
|
6
|
+
|
7
|
+
public interface ProductRepository {
|
8
|
+
/*
|
9
|
+
* Delete the methods you don't want to expose
|
10
|
+
*/
|
11
|
+
|
12
|
+
void create(Product entity);
|
13
|
+
|
14
|
+
Product update(Product entity);
|
15
|
+
|
16
|
+
void destroy(Product entity);
|
17
|
+
|
18
|
+
Product find(Long id);
|
19
|
+
|
20
|
+
List<Product> findAll();
|
21
|
+
|
22
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
package app.repository;
|
2
|
+
|
3
|
+
import javax.persistence.EntityManager;
|
4
|
+
|
5
|
+
import br.com.caelum.vraptor.ioc.Component;
|
6
|
+
import app.model.Product;
|
7
|
+
|
8
|
+
@Component
|
9
|
+
public class ProductRepositoryImpl
|
10
|
+
extends Repository<Product, Long>
|
11
|
+
implements ProductRepository {
|
12
|
+
|
13
|
+
ProductRepositoryImpl(EntityManager entityManager) {
|
14
|
+
super(entityManager);
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../../spec_helper")
|
2
|
+
|
3
|
+
describe ScaffoldGenerator do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@model = "product"
|
7
|
+
args = [@model, {"name" => "string", "value" => "double"}]
|
8
|
+
@generator = ScaffoldGenerator.new(args)
|
9
|
+
@attributes = @generator.generated_attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
context "generated attributes" do
|
13
|
+
it "should generate name attribute" do
|
14
|
+
att = @attributes.first
|
15
|
+
att.name.should == "name"
|
16
|
+
att.type.should == "string"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should generate value attribute" do
|
20
|
+
att = @attributes.last
|
21
|
+
att.name.should == "value"
|
22
|
+
att.type.should == "double"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should call model generator" do
|
27
|
+
config = {}
|
28
|
+
YAML.stub!(:load_file).with(Configuration::FILENAME).and_return(config)
|
29
|
+
@model_generator = mock(ModelGenerator)
|
30
|
+
ModelGenerator.stub!(:new).with(@model, @attributes).and_return(@model_generator)
|
31
|
+
@model_generator.should_receive(:build)
|
32
|
+
@generator.model_generator
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should call objectify model generator" do
|
36
|
+
config = {"orm" => "objectify"}
|
37
|
+
YAML.stub!(:load_file).with(Configuration::FILENAME).and_return(config)
|
38
|
+
@model_generator = mock(ObjectifyModelGenerator)
|
39
|
+
ObjectifyModelGenerator.stub!(:new).with(@model, @attributes).and_return(@model_generator)
|
40
|
+
@model_generator.should_receive(:build)
|
41
|
+
@generator.model_generator
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should call controller generator" do
|
45
|
+
@controller_generator = mock(ControllerGenerator)
|
46
|
+
ControllerGenerator.stub!(:new).with(@model, @attributes).and_return(@controller_generator)
|
47
|
+
@controller_generator.should_receive(:build)
|
48
|
+
@generator.controller_generator
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call freemarker generator" do
|
52
|
+
Configuration.stub!(:template_engine).and_return("ftl")
|
53
|
+
@freemarker_generator = mock(FreemarkerGenerator)
|
54
|
+
FreemarkerGenerator.stub!(:new).with(@model, @attributes).and_return(@freemarker_generator)
|
55
|
+
@freemarker_generator.should_receive(:build)
|
56
|
+
@generator.template_engine_generator
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should call jsp generator" do
|
60
|
+
Configuration.stub!(:template_engine).and_return("jsp")
|
61
|
+
@jsp_generator = mock(JspGenerator)
|
62
|
+
JspGenerator.stub!(:new).with(@model, @attributes).and_return(@jsp_generator)
|
63
|
+
@jsp_generator.should_receive(:build)
|
64
|
+
@generator.template_engine_generator
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should call repository generator" do
|
68
|
+
config = {"orm" => "jpa"}
|
69
|
+
YAML.stub!(:load_file).with(Configuration::FILENAME).and_return(config)
|
70
|
+
@repository_generator = mock(RepositoryGenerator)
|
71
|
+
RepositoryGenerator.stub!(:new).with(@model, @attributes).and_return(@repository_generator)
|
72
|
+
@repository_generator.should_receive(:build)
|
73
|
+
@generator.repository_generator
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should configure banner" do
|
77
|
+
ScaffoldGenerator.banner.should == "vraptor scaffold MODEL [field:type field:type]"
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::HttpRequest do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@http_proxy = ENV['http_proxy']
|
7
|
+
end
|
8
|
+
|
9
|
+
after :all do
|
10
|
+
ENV['http_proxy'] = @http_proxy
|
11
|
+
end
|
12
|
+
|
13
|
+
context "http proxy" do
|
14
|
+
before :each do
|
15
|
+
ENV['http_proxy'] = "http://google.com"
|
16
|
+
end
|
17
|
+
|
18
|
+
after :each do
|
19
|
+
ENV.delete 'http_proxy'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should use 'http_proxy' env when it is present" do
|
23
|
+
http = VraptorScaffold::HttpRequest.http
|
24
|
+
http.should be_true http.proxy_class?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "no proxy" do
|
29
|
+
|
30
|
+
before :each do
|
31
|
+
ENV.delete 'http_proxy'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not use proxy settings when no http_proxy env exists" do
|
35
|
+
http = VraptorScaffold::HttpRequest.http
|
36
|
+
http.should be_true !http.proxy_class?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::CommandsHelp do
|
4
|
+
|
5
|
+
it "should print commands help" do
|
6
|
+
Kernel.should_receive(:puts).with("Available runners for vraptor are: #{VraptorScaffold::COMMANDS.keys.join(', ')}")
|
7
|
+
Kernel.should_receive(:puts).with("Usage:")
|
8
|
+
Kernel.should_receive(:puts).with(" vraptor runner")
|
9
|
+
VraptorScaffold::Runner::CommandsHelp.new.run('')
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::Configure do
|
4
|
+
|
5
|
+
xit "should print commands help" do
|
6
|
+
args = ['simple_custom_plugin', 'extra_config']
|
7
|
+
plugin = VraptorScaffold::Runner::Configure.new.run(args)
|
8
|
+
plugin.invoked.should be == true
|
9
|
+
plugin.args.should be == args
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::Generator do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@help = VraptorScaffold::Runner::Help
|
7
|
+
@generator_runner = VraptorScaffold::Runner::Generator
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should print help command" do
|
11
|
+
@help.stub!(:help).with("--help").and_return true
|
12
|
+
AppGenerator.should_receive(:start).with(["-h"])
|
13
|
+
@generator_runner.new.run(["--help"])
|
14
|
+
end
|
15
|
+
|
16
|
+
context "app generator" do
|
17
|
+
before(:each) do
|
18
|
+
@generator = mock(AppGenerator)
|
19
|
+
project_name = "vraptor-scaffold"
|
20
|
+
option = "--package=br.com.caelum"
|
21
|
+
@args = [project_name, option]
|
22
|
+
AppGenerator.stub!(:new).with(project_name, [option]).and_return(@generator)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should invoke all app generator tasks when typed new" do
|
26
|
+
@help.stub!(:help).and_return false
|
27
|
+
@generator.should_receive(:invoke_all)
|
28
|
+
@generator_runner.new.run(@args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::Help do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@help = VraptorScaffold::Runner::Help
|
7
|
+
end
|
8
|
+
|
9
|
+
context "user asking to see vraptor help" do
|
10
|
+
|
11
|
+
it "should be true when nil" do
|
12
|
+
@help.help?(nil).should be_true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be true when -h" do
|
16
|
+
@help.help?('-h').should be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be true when --help" do
|
20
|
+
@help.help?('--help').should be_true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be false otherwise" do
|
24
|
+
@help.help?('scaffold').should be_false
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::Scaffold do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@help = VraptorScaffold::Runner::Help
|
7
|
+
@runner_scaffold = VraptorScaffold::Runner::Scaffold
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should print help command" do
|
11
|
+
@help.stub!(:help).with("--help").and_return true
|
12
|
+
ScaffoldGenerator.should_receive(:start).with(["-h"])
|
13
|
+
@runner_scaffold.new.run(["--help"])
|
14
|
+
end
|
15
|
+
|
16
|
+
context "scaffold generator" do
|
17
|
+
before(:each) do
|
18
|
+
@generator = mock(ScaffoldGenerator)
|
19
|
+
@args = ["product", "name:string", "value:double"]
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should invoke all scaffold generator tasks" do
|
23
|
+
File.stub!(:exist?).and_return(true)
|
24
|
+
ScaffoldGenerator.stub!(:new).with(@args).and_return(@generator)
|
25
|
+
@generator.should_receive(:invoke_all)
|
26
|
+
@runner_scaffold.new.run(@args)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "cannot invoke scaffold generator outsite root folder" do
|
30
|
+
File.stub!(:exist?).and_return(false)
|
31
|
+
ScaffoldGenerator.should_not_receive(:new)
|
32
|
+
@runner_scaffold.new.run(@args)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe VraptorScaffold::Runner::Start do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@start = VraptorScaffold::Runner::Start
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should call 'start' runner" do
|
10
|
+
File.stub!(:exist?).and_return(true)
|
11
|
+
Configuration.stub!(:orm).and_return("objectify")
|
12
|
+
ENV['APPENGINE_SDK_HOME'] = "any_local" unless ENV['APPENGINE_SDK_HOME']
|
13
|
+
Kernel.should_receive(:system).twice
|
14
|
+
@start.new.run nil
|
15
|
+
end
|
16
|
+
|
17
|
+
context "validate" do
|
18
|
+
|
19
|
+
it "cannot run start outside root folder" do
|
20
|
+
File.stub!(:exist?).and_return(false)
|
21
|
+
Kernel.should_receive(:puts).with("To run vraptor start please go to the project root folder.")
|
22
|
+
lambda { @start.new.run nil }.should raise_error(SystemExit)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should start only gae apps" do
|
26
|
+
File.stub!(:exist?).and_return(true)
|
27
|
+
Configuration.stub!(:orm).and_return("hibernate")
|
28
|
+
Kernel.should_receive(:puts).with("vraptor start command is available only for gae apps.")
|
29
|
+
lambda { @start.new.run nil }.should raise_error(SystemExit)
|
30
|
+
end
|
31
|
+
|
32
|
+
context "without an APPENGINE_SDK_HOME" do
|
33
|
+
|
34
|
+
before(:all) do
|
35
|
+
@appengine_sdk_home = ENV['APPENGINE_SDK_HOME']
|
36
|
+
ENV.delete 'APPENGINE_SDK_HOME'
|
37
|
+
end
|
38
|
+
|
39
|
+
after :all do
|
40
|
+
ENV['APPENGINE_SDK_HOME'] = @appengine_sdk_home
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should not run vraptor start" do
|
44
|
+
File.stub!(:exist?).and_return(true)
|
45
|
+
Configuration.stub!(:orm).and_return("objectify")
|
46
|
+
Kernel.should_receive(:puts).with("To run vraptor start, configure environment variable APPENGINE_SDK_HOME.")
|
47
|
+
lambda { @start.new.run nil }.should raise_error(SystemExit)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heroku-vraptor-scaffold
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Filipe Esperandio
|
9
|
+
- Rodolfo Liviero
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-01-07 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thor
|
17
|
+
requirement: &70249395737120 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - =
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.14.6
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70249395737120
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activesupport
|
28
|
+
requirement: &70249395736600 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70249395736600
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: &70249395735920 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - =
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.9.2
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70249395735920
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
requirement: &70249395735200 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - =
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.3.2
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70249395735200
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: ZenTest
|
61
|
+
requirement: &70249395734540 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - =
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 4.4.0
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70249395734540
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: &70249395733840 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - =
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.5.4
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70249395733840
|
81
|
+
description: Extending VRaptor's default scaffold to make it easier configuring new
|
82
|
+
projects for heroku deployment using Angular+Bootstrap in the fron end
|
83
|
+
email: filipesperandio@gmail.com
|
84
|
+
executables:
|
85
|
+
- heroku-vraptor
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- .gitignore
|
90
|
+
- .travis.yml
|
91
|
+
- CHANGELOG.rdoc
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- README.textile
|
97
|
+
- Rakefile
|
98
|
+
- bin/heroku-vraptor
|
99
|
+
- heroku-vraptor-scaffold.gemspec
|
100
|
+
- index.sample.html
|
101
|
+
- lib/vraptor-scaffold.rb
|
102
|
+
- lib/vraptor-scaffold/configuration.rb
|
103
|
+
- lib/vraptor-scaffold/execution.rb
|
104
|
+
- lib/vraptor-scaffold/generators/app/app_generator.rb
|
105
|
+
- lib/vraptor-scaffold/generators/app/dependency.rb
|
106
|
+
- lib/vraptor-scaffold/generators/app/dependency_manager.rb
|
107
|
+
- lib/vraptor-scaffold/generators/app/templates/angular/angular.js
|
108
|
+
- lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap-responsive.css
|
109
|
+
- lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap.css
|
110
|
+
- lib/vraptor-scaffold/generators/app/templates/bootstrap/bootstrap.js
|
111
|
+
- lib/vraptor-scaffold/generators/app/templates/bootstrap/glyphicons-halflings-white.png
|
112
|
+
- lib/vraptor-scaffold/generators/app/templates/bootstrap/glyphicons-halflings.png
|
113
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/classpath.erb
|
114
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/project.erb
|
115
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.jdt.core.prefs
|
116
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.common.component.tt
|
117
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.common.project.facet.core.xml
|
118
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.container
|
119
|
+
- lib/vraptor-scaffold/generators/app/templates/eclipse/settings/org.eclipse.wst.jsdt.ui.superType.name
|
120
|
+
- lib/vraptor-scaffold/generators/app/templates/heroku/Main.java
|
121
|
+
- lib/vraptor-scaffold/generators/app/templates/heroku/Procfile
|
122
|
+
- lib/vraptor-scaffold/generators/app/templates/jquery/jquery.min.js
|
123
|
+
- lib/vraptor-scaffold/generators/app/templates/models/Entity.erb
|
124
|
+
- lib/vraptor-scaffold/generators/app/templates/orm/Repository-hibernate.java.tt
|
125
|
+
- lib/vraptor-scaffold/generators/app/templates/orm/Repository-jpa.java.tt
|
126
|
+
- lib/vraptor-scaffold/generators/app/templates/orm/Repository-objectify.java.tt
|
127
|
+
- lib/vraptor-scaffold/generators/app/templates/orm/hibernate.cfg.xml
|
128
|
+
- lib/vraptor-scaffold/generators/app/templates/orm/persistence.xml
|
129
|
+
- lib/vraptor-scaffold/generators/app/templates/pom.erb
|
130
|
+
- lib/vraptor-scaffold/generators/app/templates/resources-test/.empty_directory
|
131
|
+
- lib/vraptor-scaffold/generators/app/templates/resources/hibernate.properties
|
132
|
+
- lib/vraptor-scaffold/generators/app/templates/resources/log4j.properties
|
133
|
+
- lib/vraptor-scaffold/generators/app/templates/resources/messages.properties
|
134
|
+
- lib/vraptor-scaffold/generators/app/templates/underscore/underscore.min.js
|
135
|
+
- lib/vraptor-scaffold/generators/app/templates/vraptor-scaffold.erb
|
136
|
+
- lib/vraptor-scaffold/generators/app/templates/webapp/WEB-INF/web.xml.tt
|
137
|
+
- lib/vraptor-scaffold/generators/app/templates/webapp/images/.empty_directory
|
138
|
+
- lib/vraptor-scaffold/generators/app/templates/webapp/index.html
|
139
|
+
- lib/vraptor-scaffold/generators/app/templates/webapp/javascripts/utils.js
|
140
|
+
- lib/vraptor-scaffold/generators/base.rb
|
141
|
+
- lib/vraptor-scaffold/generators/scaffold/attribute.rb
|
142
|
+
- lib/vraptor-scaffold/generators/scaffold/base_scaffold.rb
|
143
|
+
- lib/vraptor-scaffold/generators/scaffold/client_generator/client_generator.rb
|
144
|
+
- lib/vraptor-scaffold/generators/scaffold/client_generator/templates/controller.erb
|
145
|
+
- lib/vraptor-scaffold/generators/scaffold/client_generator/templates/details.erb
|
146
|
+
- lib/vraptor-scaffold/generators/scaffold/client_generator/templates/form.erb
|
147
|
+
- lib/vraptor-scaffold/generators/scaffold/client_generator/templates/list.erb
|
148
|
+
- lib/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator.rb
|
149
|
+
- lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller.erb
|
150
|
+
- lib/vraptor-scaffold/generators/scaffold/controller_generator/templates/controller_test.erb
|
151
|
+
- lib/vraptor-scaffold/generators/scaffold/model_generator/model_generator.rb
|
152
|
+
- lib/vraptor-scaffold/generators/scaffold/model_generator/templates/model.erb
|
153
|
+
- lib/vraptor-scaffold/generators/scaffold/model_generator/templates/model_test.erb
|
154
|
+
- lib/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator.rb
|
155
|
+
- lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository.erb
|
156
|
+
- lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository_impl.erb
|
157
|
+
- lib/vraptor-scaffold/generators/scaffold/repository_generator/templates/repository_test.erb
|
158
|
+
- lib/vraptor-scaffold/generators/scaffold/scaffold_generator.rb
|
159
|
+
- lib/vraptor-scaffold/runner.rb
|
160
|
+
- lib/vraptor-scaffold/runner/commands_help.rb
|
161
|
+
- lib/vraptor-scaffold/runner/generator.rb
|
162
|
+
- lib/vraptor-scaffold/runner/help.rb
|
163
|
+
- lib/vraptor-scaffold/runner/scaffold.rb
|
164
|
+
- lib/vraptor-scaffold/version.rb
|
165
|
+
- maven/repo/br/com/caelum/vraptor-gae/1.0/vraptor-gae-1.0.jar
|
166
|
+
- spec/resources/vraptor-scaffold-objectify.properties
|
167
|
+
- spec/resources/vraptor-scaffold.properties
|
168
|
+
- spec/spec.opts
|
169
|
+
- spec/spec_helper.rb
|
170
|
+
- spec/vraptor-scaffold/configuration_spec.rb
|
171
|
+
- spec/vraptor-scaffold/execution_spec.rb
|
172
|
+
- spec/vraptor-scaffold/generators/app/app_generator_spec.rb
|
173
|
+
- spec/vraptor-scaffold/generators/app/dependency_manager_spec.rb
|
174
|
+
- spec/vraptor-scaffold/generators/app/dependency_spec.rb
|
175
|
+
- spec/vraptor-scaffold/generators/app/freemarker_template_engine_spec.rb
|
176
|
+
- spec/vraptor-scaffold/generators/app/jsp_template_engine_spec.rb
|
177
|
+
- spec/vraptor-scaffold/generators/app/templates/Entity.java
|
178
|
+
- spec/vraptor-scaffold/generators/app/templates/FreemarkerPathResolver.java
|
179
|
+
- spec/vraptor-scaffold/generators/app/templates/ObjectifyFactory.java
|
180
|
+
- spec/vraptor-scaffold/generators/app/templates/RepositoryJPA.java
|
181
|
+
- spec/vraptor-scaffold/generators/app/templates/RepositoryObjectify.java
|
182
|
+
- spec/vraptor-scaffold/generators/app/templates/build.gradle
|
183
|
+
- spec/vraptor-scaffold/generators/app/templates/build.properties
|
184
|
+
- spec/vraptor-scaffold/generators/app/templates/build.xml
|
185
|
+
- spec/vraptor-scaffold/generators/app/templates/classpath-gae
|
186
|
+
- spec/vraptor-scaffold/generators/app/templates/decorators-jsp.xml
|
187
|
+
- spec/vraptor-scaffold/generators/app/templates/decorators.xml
|
188
|
+
- spec/vraptor-scaffold/generators/app/templates/freemarker-web.xml
|
189
|
+
- spec/vraptor-scaffold/generators/app/templates/gae-jsp-web.xml
|
190
|
+
- spec/vraptor-scaffold/generators/app/templates/ivy-gae.xml
|
191
|
+
- spec/vraptor-scaffold/generators/app/templates/ivy.xml
|
192
|
+
- spec/vraptor-scaffold/generators/app/templates/jsp-web.xml
|
193
|
+
- spec/vraptor-scaffold/generators/app/templates/pom-heroku.xml
|
194
|
+
- spec/vraptor-scaffold/generators/app/templates/pom.xml
|
195
|
+
- spec/vraptor-scaffold/generators/app/templates/project-gae
|
196
|
+
- spec/vraptor-scaffold/generators/app/templates/vraptor-scaffold.properties
|
197
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/build.gradle
|
198
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_build.gradle
|
199
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_ivy.xml
|
200
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/default_org_pom.xml
|
201
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/ivy.xml
|
202
|
+
- spec/vraptor-scaffold/generators/plugin/expected_configs/pom.xml
|
203
|
+
- spec/vraptor-scaffold/generators/scaffold/attribute_spec.rb
|
204
|
+
- spec/vraptor-scaffold/generators/scaffold/base_scaffold_spec.rb
|
205
|
+
- spec/vraptor-scaffold/generators/scaffold/client_controller_generator/controller_generator_spec.rb
|
206
|
+
- spec/vraptor-scaffold/generators/scaffold/client_controller_generator/templates/ProductController.java
|
207
|
+
- spec/vraptor-scaffold/generators/scaffold/controller_generator/controller_generator_spec.rb
|
208
|
+
- spec/vraptor-scaffold/generators/scaffold/controller_generator/templates/ProductController.java
|
209
|
+
- spec/vraptor-scaffold/generators/scaffold/freemarker_generator/freemarker_generator_spec.rb
|
210
|
+
- spec/vraptor-scaffold/generators/scaffold/freemarker_generator/templates/form.ftl
|
211
|
+
- spec/vraptor-scaffold/generators/scaffold/jsp_generator/jsp_generator_spec.rb
|
212
|
+
- spec/vraptor-scaffold/generators/scaffold/jsp_generator/templates/form.jsp
|
213
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/model_generator_spec.rb
|
214
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/objectify_model_generator_spec.rb
|
215
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/templates/ObjectifyFactory.java
|
216
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Objectify_Product.java
|
217
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/templates/Product.java
|
218
|
+
- spec/vraptor-scaffold/generators/scaffold/model_generator/templates/hibernate.cfg.xml
|
219
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/objectify_repository_generator_spec.rb
|
220
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/repository_generator_spec.rb
|
221
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ClientRepository.java
|
222
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ClientRepositoryImpl.java
|
223
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepository.java
|
224
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/Objectify_ProductRepositoryImpl.java
|
225
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ProductRepository.java
|
226
|
+
- spec/vraptor-scaffold/generators/scaffold/repository_generator/templates/ProductRepositoryImpl.java
|
227
|
+
- spec/vraptor-scaffold/generators/scaffold/scaffold_generator_spec.rb
|
228
|
+
- spec/vraptor-scaffold/http_request_spec.rb
|
229
|
+
- spec/vraptor-scaffold/runner/commands_help_spec.rb
|
230
|
+
- spec/vraptor-scaffold/runner/configure_spec.rb
|
231
|
+
- spec/vraptor-scaffold/runner/generator_spec.rb
|
232
|
+
- spec/vraptor-scaffold/runner/help_spec.rb
|
233
|
+
- spec/vraptor-scaffold/runner/scaffold_spec.rb
|
234
|
+
- spec/vraptor-scaffold/runner/start_spec.rb
|
235
|
+
- spec/vraptor-scaffold_spec.rb
|
236
|
+
homepage: http://github.com/filipesperandio/vraptor-scaffold
|
237
|
+
licenses: []
|
238
|
+
post_install_message: Thank you for installing vraptor-scaffold. Please read http://github.com/caelum/vraptor-scaffold/blob/master/README.textile
|
239
|
+
for more information.
|
240
|
+
rdoc_options: []
|
241
|
+
require_paths:
|
242
|
+
- lib
|
243
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
244
|
+
none: false
|
245
|
+
requirements:
|
246
|
+
- - ! '>='
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '0'
|
249
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
|
+
none: false
|
251
|
+
requirements:
|
252
|
+
- - ! '>='
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
requirements: []
|
256
|
+
rubyforge_project:
|
257
|
+
rubygems_version: 1.8.10
|
258
|
+
signing_key:
|
259
|
+
specification_version: 3
|
260
|
+
summary: Heroku Ready VRaptor Scaffold + Angular + Bootstrap
|
261
|
+
test_files: []
|