padrino-gen 0.9.29 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/bin/padrino-gen +1 -0
- data/lib/padrino-gen/generators/app/app.rb.tt +1 -0
- data/lib/padrino-gen/generators/cli.rb +3 -0
- data/lib/padrino-gen/generators/components/orms/couchrest.rb +2 -3
- data/lib/padrino-gen/generators/components/orms/datamapper.rb +9 -2
- data/lib/padrino-gen/generators/components/orms/mongoid.rb +1 -1
- data/lib/padrino-gen/generators/components/orms/ripple.rb +76 -0
- data/lib/padrino-gen/generators/components/tests/cucumber.rb +1 -1
- data/lib/padrino-gen/generators/model.rb +2 -2
- data/lib/padrino-gen/generators/project/config.ru +9 -2
- data/lib/padrino-gen/generators/project.rb +1 -1
- data/lib/padrino-gen/generators/templates/Gemfile.tt +11 -2
- data/lib/padrino-gen/generators/templates/static/ujs/jquery.js +3 -2
- data/lib/padrino-gen.rb +1 -0
- data/padrino-gen.gemspec +5 -3
- data/test/test_model_generator.rb +87 -66
- data/test/test_project_generator.rb +14 -4
- metadata +10 -7
data/README.rdoc
CHANGED
@@ -43,7 +43,7 @@ renderer:: haml (default), erb, erubis, liquid, slim
|
|
43
43
|
stylesheet:: sass (default), less, compass
|
44
44
|
mock:: none (default), mocha, rr
|
45
45
|
script:: none (default), jquery, prototype, mootools, rightjs, extcore, dojo
|
46
|
-
orm:: none (default), datamapper, mongomapper, mongoid, activerecord, sequel, couchrest, ohm, mongomatic
|
46
|
+
orm:: none (default), datamapper, mongomapper, mongoid, activerecord, sequel, couchrest, ohm, mongomatic, ripple
|
47
47
|
|
48
48
|
In addition, you can generate projects based on existing templates:
|
49
49
|
|
data/bin/padrino-gen
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems' unless defined?(Gem) # Useful only on --dev mode
|
3
|
+
require 'bundler/setup' if %w(Gemfile .components).all? { |f| File.exist?(f) }
|
3
4
|
|
4
5
|
padrino_gen_path = File.expand_path('../../lib', __FILE__)
|
5
6
|
$:.unshift(padrino_gen_path) if File.directory?(padrino_gen_path) && !$:.include?(padrino_gen_path)
|
@@ -8,8 +8,7 @@ end
|
|
8
8
|
CouchRest::Model::Base.configure do |conf|
|
9
9
|
conf.model_type_key = 'type' # compatibility with CouchModel 1.1
|
10
10
|
conf.database = CouchRest.database!(db_name)
|
11
|
-
|
12
|
-
# conf.environment = Padrino.env
|
11
|
+
conf.environment = Padrino.env
|
13
12
|
# conf.connection = {
|
14
13
|
# :protocol => 'http',
|
15
14
|
# :host => 'localhost',
|
@@ -24,7 +23,7 @@ end
|
|
24
23
|
COUCHREST
|
25
24
|
|
26
25
|
def setup_orm
|
27
|
-
require_dependencies 'couchrest_model'
|
26
|
+
require_dependencies 'couchrest_model', :version => '~>1.1.0'
|
28
27
|
require_dependencies 'json_pure'
|
29
28
|
create_file("config/database.rb", COUCHREST.gsub(/!NAME!/, @app_name.underscore))
|
30
29
|
empty_directory('app/models')
|
@@ -23,7 +23,14 @@ DM
|
|
23
23
|
def setup_orm
|
24
24
|
dm = DM
|
25
25
|
db = @app_name.underscore
|
26
|
-
|
26
|
+
%w(
|
27
|
+
dm-core
|
28
|
+
dm-aggregates
|
29
|
+
dm-constraints
|
30
|
+
dm-migrations
|
31
|
+
dm-timestamps
|
32
|
+
dm-validations
|
33
|
+
).each { |dep| require_dependencies dep }
|
27
34
|
require_dependencies case options[:adapter]
|
28
35
|
when 'mysql'
|
29
36
|
dm.gsub!(/!DB_DEVELOPMENT!/,"\"mysql://root@localhost/#{db}_development\"")
|
@@ -93,7 +100,7 @@ MIGRATION
|
|
93
100
|
|
94
101
|
def create_model_migration(migration_name, name, columns)
|
95
102
|
output_model_migration(migration_name, name, columns,
|
96
|
-
:column_format => Proc.new { |field, kind| "column :#{field}, #{kind.classify}" },
|
103
|
+
:column_format => Proc.new { |field, kind| "column :#{field}, #{kind.classify}#{', :length => 255' if kind =~ /string/i}" },
|
97
104
|
:base => DM_MIGRATION, :up => DM_MODEL_UP_MG, :down => DM_MODEL_DOWN_MG)
|
98
105
|
end
|
99
106
|
|
@@ -0,0 +1,76 @@
|
|
1
|
+
RIPPLE_DB = (<<-RIAK) unless defined?(RIPPLE_DB)
|
2
|
+
development:
|
3
|
+
http_port: 8098
|
4
|
+
pb_port: 8087
|
5
|
+
host: localhost
|
6
|
+
|
7
|
+
# The test environment has additional keys for configuring the
|
8
|
+
# Riak::TestServer for your test/spec suite:
|
9
|
+
#
|
10
|
+
# * bin_dir specifies the path to the "riak" script that you use to
|
11
|
+
# start Riak (just the directory)
|
12
|
+
# * js_source_dir specifies where your custom Javascript functions for
|
13
|
+
# MapReduce should be loaded from. Usually app/mapreduce.
|
14
|
+
test:
|
15
|
+
http_port: 9000
|
16
|
+
pb_port: 9002
|
17
|
+
host: localhost
|
18
|
+
bin_dir: /usr/local/bin # Default for Homebrew.
|
19
|
+
js_source_dir: <%%= Padrino.root + "app/mapreduce" %>
|
20
|
+
|
21
|
+
production:
|
22
|
+
http_port: 8098
|
23
|
+
pb_port: 8087
|
24
|
+
host: localhost
|
25
|
+
RIAK
|
26
|
+
RIPPLE_CFG = (<<RIAK) unless defined?(RIPPLE_CFG)
|
27
|
+
# encoding: utf-8
|
28
|
+
|
29
|
+
require 'ripple'
|
30
|
+
|
31
|
+
if File.exist?(Padrino.root + "config/riak.yml")
|
32
|
+
Ripple.load_configuration Padrino.root.join('config', 'riak.yml'), [Padrino.env]
|
33
|
+
end
|
34
|
+
RIAK
|
35
|
+
|
36
|
+
def setup_orm
|
37
|
+
require_dependencies 'ripple'
|
38
|
+
create_file("config/riak.yml", RIPPLE_DB.gsub(/!NAME!/, @app_name.underscore))
|
39
|
+
create_file("config/database.rb", RIPPLE_CFG)
|
40
|
+
empty_directory('app/models')
|
41
|
+
end
|
42
|
+
|
43
|
+
RIPPLE_MODEL = (<<-MODEL) unless defined?(RIPPLE_MODEL)
|
44
|
+
# encoding: utf-8
|
45
|
+
|
46
|
+
class !NAME!
|
47
|
+
include Ripple::Document
|
48
|
+
|
49
|
+
# Standart properties
|
50
|
+
# property :name, String
|
51
|
+
!FIELDS!
|
52
|
+
|
53
|
+
# Relations
|
54
|
+
# many :addresses
|
55
|
+
# many :friends, :class_name => "Person"
|
56
|
+
# one :account
|
57
|
+
end
|
58
|
+
|
59
|
+
MODEL
|
60
|
+
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
61
|
+
def create_model_file(name, options={})
|
62
|
+
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
63
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
64
|
+
column_declarations = field_tuples.map { |field, kind| "property :#{field}, #{kind.camelize}" }.join("\n ")
|
65
|
+
model_contents = RIPPLE_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
66
|
+
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
67
|
+
create_file(model_path, model_contents)
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_model_migration(filename, name, fields)
|
71
|
+
# NO MIGRATION NEEDED
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_migration_file(migration_name, name, columns)
|
75
|
+
# NO MIGRATION NEEDED
|
76
|
+
end
|
@@ -20,7 +20,7 @@ module Padrino
|
|
20
20
|
argument :name, :desc => "The name of your padrino model"
|
21
21
|
argument :fields, :desc => "The fields for the model", :type => :array, :default => []
|
22
22
|
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
23
|
-
class_option :app, :desc => "The application destination path", :aliases => '-a', :default => "
|
23
|
+
class_option :app, :desc => "The application destination path", :aliases => '-a', :default => ".", :type => :string
|
24
24
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
25
25
|
class_option :skip_migration, :aliases => "-s", :default => false, :type => :boolean
|
26
26
|
|
@@ -53,4 +53,4 @@ module Padrino
|
|
53
53
|
end
|
54
54
|
end # Model
|
55
55
|
end # Generators
|
56
|
-
end # Padrino
|
56
|
+
end # Padrino
|
@@ -1,2 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#!/usr/bin/env rackup
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
# This file can be used to start Padrino,
|
5
|
+
# just execute it from the command line.
|
6
|
+
|
7
|
+
require File.expand_path("../config/boot.rb", __FILE__)
|
8
|
+
|
9
|
+
run Padrino.application
|
@@ -31,7 +31,7 @@ module Padrino
|
|
31
31
|
class_option :template, :desc => "Generate project from template", :aliases => '-p', :default => nil, :type => :string
|
32
32
|
|
33
33
|
# Definitions for the available customizable components
|
34
|
-
component_option :orm, "database engine", :aliases => '-d', :choices => [:activerecord, :datamapper, :mongomapper, :mongoid, :sequel, :couchrest, :ohm, :mongomatic], :default => :none
|
34
|
+
component_option :orm, "database engine", :aliases => '-d', :choices => [:activerecord, :datamapper, :mongomapper, :mongoid, :sequel, :couchrest, :ohm, :mongomatic, :ripple], :default => :none
|
35
35
|
component_option :test, "testing framework", :aliases => '-t', :choices => [:rspec, :shoulda, :cucumber, :bacon, :testspec, :riot], :default => :none
|
36
36
|
component_option :mock, "mocking library", :aliases => '-m', :choices => [:mocha, :rr], :default => :none
|
37
37
|
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs, :mootools, :extcore, :dojo], :default => :none
|
@@ -19,7 +19,16 @@ gem 'rack-flash'
|
|
19
19
|
end
|
20
20
|
<%- else -%>
|
21
21
|
# Padrino
|
22
|
-
gem 'padrino',
|
22
|
+
gem 'padrino', '<%= Padrino.version %>'
|
23
23
|
<%- end -%>
|
24
24
|
# Padrino EDGE
|
25
|
-
# gem 'padrino', :git =>
|
25
|
+
# gem 'padrino', :git => 'git://github.com/padrino/padrino-framework.git'
|
26
|
+
#
|
27
|
+
# Individual GEMS
|
28
|
+
# gem 'padrino-core', '<%= Padrino.version %>'
|
29
|
+
# gem 'padrino-admin', '<%= Padrino.version %>'
|
30
|
+
# gem 'padrino-cache', '<%= Padrino.version %>'
|
31
|
+
# gem 'padrino-core', '<%= Padrino.version %>'
|
32
|
+
# gem 'padrino-gen', '<%= Padrino.version %>'
|
33
|
+
# gem 'padrino-helpers', '<%= Padrino.version %>'
|
34
|
+
# gem 'padrino-mailer', '<%= Padrino.version %>'
|
@@ -15,6 +15,7 @@ $("form[data-remote=true]").live('submit', function(e) {
|
|
15
15
|
JSAdapter.sendRequest(element, {
|
16
16
|
verb: element.data('method') || element.attr('method') || 'post',
|
17
17
|
url: element.attr('action'),
|
18
|
+
dataType: element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType) || 'script',
|
18
19
|
params: element.serializeArray()
|
19
20
|
});
|
20
21
|
});
|
@@ -59,14 +60,14 @@ var JSAdapter = {
|
|
59
60
|
// Sends an xhr request to the specified url with given verb and params
|
60
61
|
// JSAdapter.sendRequest(element, { verb: 'put', url : '...', params: {} });
|
61
62
|
sendRequest : function(element, options) {
|
62
|
-
var verb = options.verb, url = options.url, params = options.params;
|
63
|
+
var verb = options.verb, url = options.url, params = options.params, dataType = options.dataType;
|
63
64
|
var event = element.trigger("ajax:before");
|
64
65
|
if (event.stopped) return false;
|
65
66
|
$.ajax({
|
66
67
|
url: url,
|
67
68
|
type: verb.toUpperCase() || 'POST',
|
68
69
|
data: params || [],
|
69
|
-
dataType:
|
70
|
+
dataType: dataType,
|
70
71
|
|
71
72
|
beforeSend: function(request) { element.trigger("ajax:loading", [ request ]); },
|
72
73
|
complete: function(request) { element.trigger("ajax:complete", [ request ]); },
|
data/lib/padrino-gen.rb
CHANGED
data/padrino-gen.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env gem build
|
2
|
+
# encoding: utf-8
|
3
|
+
|
2
4
|
require File.expand_path("../../padrino-core/lib/padrino-core/version.rb", __FILE__)
|
3
5
|
|
4
6
|
Gem::Specification.new do |s|
|
@@ -21,6 +23,6 @@ Gem::Specification.new do |s|
|
|
21
23
|
s.rdoc_options = ["--charset=UTF-8"]
|
22
24
|
|
23
25
|
s.add_dependency("padrino-core", Padrino.version)
|
24
|
-
s.add_dependency("bundler", "
|
25
|
-
s.add_dependency("grit")
|
26
|
+
s.add_dependency("bundler", "~> 1.0.2")
|
27
|
+
s.add_dependency("grit", "~> 2.4.1")
|
26
28
|
end
|
@@ -14,13 +14,13 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
14
14
|
should "fail outside app root" do
|
15
15
|
output = silence_logger { generate(:model, 'user', "-r=#{@apptmp}") }
|
16
16
|
assert_match(/not at the root/, output)
|
17
|
-
assert_no_file_exists('/tmp/
|
17
|
+
assert_no_file_exists('/tmp/models/user.rb')
|
18
18
|
end
|
19
19
|
|
20
20
|
should "generate filename properly" do
|
21
21
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=couchrest') }
|
22
22
|
silence_logger { generate(:model, 'DemoItem', "name:string", "age", "email:string", "-r=#{@apptmp}/sample_project") }
|
23
|
-
assert_file_exists("#{@apptmp}/sample_project/
|
23
|
+
assert_file_exists("#{@apptmp}/sample_project/models/demo_item.rb")
|
24
24
|
end
|
25
25
|
|
26
26
|
should "fail if field name is not acceptable" do
|
@@ -32,7 +32,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
32
32
|
assert_match(/re@l\$ly:string/, output)
|
33
33
|
assert_no_match(/email_two:string/, output)
|
34
34
|
assert_no_match(/apply/, output)
|
35
|
-
assert_no_file_exists("#{@apptmp}/sample_project/
|
35
|
+
assert_no_file_exists("#{@apptmp}/sample_project/models/demo_item.rb")
|
36
36
|
end
|
37
37
|
|
38
38
|
should "fail if we don't use an adapter" do
|
@@ -43,7 +43,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
43
43
|
should "not fail if we don't have test component" do
|
44
44
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=none', '-d=activerecord') }
|
45
45
|
response_success = silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
|
46
|
-
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/
|
46
|
+
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/models/user.rb")
|
47
47
|
assert_no_file_exists("#{@apptmp}/sample_project/test")
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
54
54
|
assert_match_in_file(/class Post\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/subby/models/post.rb")
|
55
55
|
assert_match_in_file(/property :body, String/m, "#{@apptmp}/sample_project/subby/models/post.rb")
|
56
56
|
assert_match_in_file(/migration 1, :create_posts do/m, "#{@apptmp}/sample_project/db/migrate/001_create_posts.rb")
|
57
|
-
assert_match_in_file(/gem '
|
57
|
+
assert_match_in_file(/gem 'dm-core'/m,"#{@apptmp}/sample_project/Gemfile")
|
58
58
|
assert_match_in_file(/DataMapper.finalize/m,"#{@apptmp}/sample_project/config/boot.rb")
|
59
59
|
end
|
60
60
|
|
@@ -62,9 +62,9 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
62
62
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
63
63
|
response_success = silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
|
64
64
|
response_duplicate = silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
|
65
|
-
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/
|
66
|
-
assert_match "identical\e[0m
|
67
|
-
assert_match "identical\e[0m test/
|
65
|
+
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/models/user.rb")
|
66
|
+
assert_match "identical\e[0m models/user.rb", response_duplicate
|
67
|
+
assert_match "identical\e[0m test/models/user_test.rb", response_duplicate
|
68
68
|
end
|
69
69
|
|
70
70
|
should "generate migration file versions properly" do
|
@@ -83,14 +83,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
83
83
|
should "generate model file" do
|
84
84
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
85
85
|
silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
|
86
|
-
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/
|
86
|
+
assert_match_in_file(/class User < ActiveRecord::Base/m, "#{@apptmp}/sample_project/models/user.rb")
|
87
87
|
end
|
88
88
|
|
89
89
|
should "generate model file with camelized name" do
|
90
90
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
91
91
|
silence_logger { generate(:model, 'ChunkyBacon', "-r=#{@apptmp}/sample_project") }
|
92
|
-
assert_match_in_file(/class ChunkyBacon < ActiveRecord::Base/m, "#{@apptmp}/sample_project/
|
93
|
-
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/
|
92
|
+
assert_match_in_file(/class ChunkyBacon < ActiveRecord::Base/m, "#{@apptmp}/sample_project/models/chunky_bacon.rb")
|
93
|
+
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/models/chunky_bacon_test.rb")
|
94
94
|
end
|
95
95
|
|
96
96
|
should "generate migration file with no fields" do
|
@@ -122,17 +122,17 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
122
122
|
should "generate model file with no properties" do
|
123
123
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=couchrest') }
|
124
124
|
silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
|
125
|
-
assert_match_in_file(/class User < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/
|
126
|
-
assert_match_in_file(/# property <name>[\s\n]+?end/m, "#{@apptmp}/sample_project/
|
125
|
+
assert_match_in_file(/class User < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/models/user.rb")
|
126
|
+
assert_match_in_file(/# property <name>[\s\n]+?end/m, "#{@apptmp}/sample_project/models/user.rb")
|
127
127
|
end
|
128
128
|
|
129
129
|
should "generate model file with given fields" do
|
130
130
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=couchrest') }
|
131
131
|
silence_logger { generate(:model, 'person', "name:string", "age", "email:string", "-r=#{@apptmp}/sample_project") }
|
132
|
-
assert_match_in_file(/class Person < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/
|
133
|
-
assert_match_in_file(/property :name/m, "#{@apptmp}/sample_project/
|
134
|
-
assert_match_in_file(/property :age/m, "#{@apptmp}/sample_project/
|
135
|
-
assert_match_in_file(/property :email/m, "#{@apptmp}/sample_project/
|
132
|
+
assert_match_in_file(/class Person < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/models/person.rb")
|
133
|
+
assert_match_in_file(/property :name/m, "#{@apptmp}/sample_project/models/person.rb")
|
134
|
+
assert_match_in_file(/property :age/m, "#{@apptmp}/sample_project/models/person.rb")
|
135
|
+
assert_match_in_file(/property :email/m, "#{@apptmp}/sample_project/models/person.rb")
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -142,23 +142,23 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
142
142
|
should "generate gemfile gem" do
|
143
143
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
|
144
144
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
|
145
|
-
assert_match_in_file(/gem '
|
145
|
+
assert_match_in_file(/gem 'dm-core'/m,"#{@apptmp}/sample_project/Gemfile")
|
146
146
|
end
|
147
147
|
|
148
148
|
should "generate model file with camelized name" do
|
149
149
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=datamapper') }
|
150
150
|
silence_logger { generate(:model, 'ChunkyBacon', "-r=#{@apptmp}/sample_project") }
|
151
|
-
assert_match_in_file(/class ChunkyBacon\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
152
|
-
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/
|
151
|
+
assert_match_in_file(/class ChunkyBacon\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/chunky_bacon.rb")
|
152
|
+
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/models/chunky_bacon_test.rb")
|
153
153
|
end
|
154
154
|
|
155
155
|
should "generate model file with fields" do
|
156
156
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
|
157
157
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
|
158
|
-
assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
159
|
-
assert_match_in_file(/property :name, String/m, "#{@apptmp}/sample_project/
|
160
|
-
assert_match_in_file(/property :age, Integer/m, "#{@apptmp}/sample_project/
|
161
|
-
assert_match_in_file(/property :created_at, DateTime/m, "#{@apptmp}/sample_project/
|
158
|
+
assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/user.rb")
|
159
|
+
assert_match_in_file(/property :name, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
160
|
+
assert_match_in_file(/property :age, Integer/m, "#{@apptmp}/sample_project/models/user.rb")
|
161
|
+
assert_match_in_file(/property :created_at, DateTime/m, "#{@apptmp}/sample_project/models/user.rb")
|
162
162
|
end
|
163
163
|
|
164
164
|
should "properly generate version numbers" do
|
@@ -166,11 +166,11 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
166
166
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
|
167
167
|
silence_logger { generate(:model, 'person', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
|
168
168
|
silence_logger { generate(:model, 'account', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
|
169
|
-
assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
169
|
+
assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/user.rb")
|
170
170
|
assert_match_in_file(/migration 1, :create_users do/m, "#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
|
171
|
-
assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
171
|
+
assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/person.rb")
|
172
172
|
assert_match_in_file(/migration 2, :create_people do/m, "#{@apptmp}/sample_project/db/migrate/002_create_people.rb")
|
173
|
-
assert_match_in_file(/class Account\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
173
|
+
assert_match_in_file(/class Account\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/account.rb")
|
174
174
|
assert_match_in_file(/migration 3, :create_accounts do/m, "#{@apptmp}/sample_project/db/migrate/003_create_accounts.rb")
|
175
175
|
end
|
176
176
|
|
@@ -178,7 +178,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
178
178
|
current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
|
179
179
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
|
180
180
|
silence_logger { generate(:model, 'person', "name:string", "created_at:date_time", "email:string", "-r=#{@apptmp}/sample_project") }
|
181
|
-
assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/
|
181
|
+
assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/person.rb")
|
182
182
|
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
|
183
183
|
assert_match_in_file(/migration 1, :create_people do/m, migration_file_path)
|
184
184
|
assert_match_in_file(/create_table :people do/m, migration_file_path)
|
@@ -194,14 +194,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
194
194
|
should "generate model file with given properties" do
|
195
195
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=sequel') }
|
196
196
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "created:datetime", "-r=#{@apptmp}/sample_project") }
|
197
|
-
assert_match_in_file(/class User < Sequel::Model/m, "#{@apptmp}/sample_project/
|
197
|
+
assert_match_in_file(/class User < Sequel::Model/m, "#{@apptmp}/sample_project/models/user.rb")
|
198
198
|
end
|
199
199
|
|
200
200
|
should "generate model file with camelized name" do
|
201
201
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=sequel') }
|
202
202
|
silence_logger { generate(:model, 'ChunkyBacon', "-r=#{@apptmp}/sample_project") }
|
203
|
-
assert_match_in_file(/class ChunkyBacon < Sequel::Model/m, "#{@apptmp}/sample_project/
|
204
|
-
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/
|
203
|
+
assert_match_in_file(/class ChunkyBacon < Sequel::Model/m, "#{@apptmp}/sample_project/models/chunky_bacon.rb")
|
204
|
+
assert_match_in_file(/ChunkyBacon Model/, "#{@apptmp}/sample_project/test/models/chunky_bacon_test.rb")
|
205
205
|
end
|
206
206
|
|
207
207
|
should "generate migration file with given properties" do
|
@@ -209,7 +209,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
209
209
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=sequel') }
|
210
210
|
silence_logger { generate(:model, 'person', "name:string", "age:integer", "created:datetime", "-r=#{@apptmp}/sample_project") }
|
211
211
|
migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
|
212
|
-
assert_match_in_file(/class Person < Sequel::Model/m, "#{@apptmp}/sample_project/
|
212
|
+
assert_match_in_file(/class Person < Sequel::Model/m, "#{@apptmp}/sample_project/models/person.rb")
|
213
213
|
assert_match_in_file(/class CreatePeople < Sequel::Migration/m, migration_file_path)
|
214
214
|
assert_match_in_file(/create_table :people/m, migration_file_path)
|
215
215
|
assert_match_in_file(/String :name/m, migration_file_path)
|
@@ -224,19 +224,19 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
224
224
|
should "generate model file with no properties" do
|
225
225
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongomapper') }
|
226
226
|
silence_logger { generate(:model, 'person', "-r=#{@apptmp}/sample_project") }
|
227
|
-
assert_match_in_file(/class Person\n\s+include MongoMapper::Document/m, "#{@apptmp}/sample_project/
|
228
|
-
assert_match_in_file(/# key <name>, <type>/m, "#{@apptmp}/sample_project/
|
229
|
-
assert_match_in_file(/timestamps![\n\s]+end/m, "#{@apptmp}/sample_project/
|
227
|
+
assert_match_in_file(/class Person\n\s+include MongoMapper::Document/m, "#{@apptmp}/sample_project/models/person.rb")
|
228
|
+
assert_match_in_file(/# key <name>, <type>/m, "#{@apptmp}/sample_project/models/person.rb")
|
229
|
+
assert_match_in_file(/timestamps![\n\s]+end/m, "#{@apptmp}/sample_project/models/person.rb")
|
230
230
|
end
|
231
231
|
|
232
232
|
should "generate model file with given fields" do
|
233
233
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongomapper') }
|
234
234
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
|
235
|
-
assert_match_in_file(/class User\n\s+include MongoMapper::Document/m, "#{@apptmp}/sample_project/
|
236
|
-
assert_match_in_file(/key :name, String/m, "#{@apptmp}/sample_project/
|
237
|
-
assert_match_in_file(/key :age, Integer/m, "#{@apptmp}/sample_project/
|
238
|
-
assert_match_in_file(/key :email, String/m, "#{@apptmp}/sample_project/
|
239
|
-
assert_match_in_file(/timestamps!/m, "#{@apptmp}/sample_project/
|
235
|
+
assert_match_in_file(/class User\n\s+include MongoMapper::Document/m, "#{@apptmp}/sample_project/models/user.rb")
|
236
|
+
assert_match_in_file(/key :name, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
237
|
+
assert_match_in_file(/key :age, Integer/m, "#{@apptmp}/sample_project/models/user.rb")
|
238
|
+
assert_match_in_file(/key :email, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
239
|
+
assert_match_in_file(/timestamps!/m, "#{@apptmp}/sample_project/models/user.rb")
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
@@ -244,17 +244,17 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
244
244
|
should "generate model file with no properties" do
|
245
245
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongoid') }
|
246
246
|
silence_logger { generate(:model, 'person', "-r=#{@apptmp}/sample_project") }
|
247
|
-
assert_match_in_file(/class Person\n\s+include Mongoid::Document/m, "#{@apptmp}/sample_project/
|
248
|
-
assert_match_in_file(/# field <name>, :type => <type>, :default => <value>/m, "#{@apptmp}/sample_project/
|
247
|
+
assert_match_in_file(/class Person\n\s+include Mongoid::Document/m, "#{@apptmp}/sample_project/models/person.rb")
|
248
|
+
assert_match_in_file(/# field <name>, :type => <type>, :default => <value>/m, "#{@apptmp}/sample_project/models/person.rb")
|
249
249
|
end
|
250
250
|
|
251
251
|
should "generate model file with given fields" do
|
252
252
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongoid') }
|
253
253
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
|
254
|
-
assert_match_in_file(/class User\n\s+include Mongoid::Document/m, "#{@apptmp}/sample_project/
|
255
|
-
assert_match_in_file(/field :name, :type => String/m, "#{@apptmp}/sample_project/
|
256
|
-
assert_match_in_file(/field :age, :type => Integer/m, "#{@apptmp}/sample_project/
|
257
|
-
assert_match_in_file(/field :email, :type => String/m, "#{@apptmp}/sample_project/
|
254
|
+
assert_match_in_file(/class User\n\s+include Mongoid::Document/m, "#{@apptmp}/sample_project/models/user.rb")
|
255
|
+
assert_match_in_file(/field :name, :type => String/m, "#{@apptmp}/sample_project/models/user.rb")
|
256
|
+
assert_match_in_file(/field :age, :type => Integer/m, "#{@apptmp}/sample_project/models/user.rb")
|
257
|
+
assert_match_in_file(/field :email, :type => String/m, "#{@apptmp}/sample_project/models/user.rb")
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
@@ -263,20 +263,20 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
263
263
|
should "generate model file with no properties" do
|
264
264
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=ohm') }
|
265
265
|
silence_logger { generate(:model, 'person', "-r=#{@apptmp}/sample_project") }
|
266
|
-
assert_match_in_file(/class Person < Ohm::Model/, "#{@apptmp}/sample_project/
|
267
|
-
assert_match_in_file(/include Ohm::Timestamping/, "#{@apptmp}/sample_project/
|
268
|
-
assert_match_in_file(/include Ohm::Typecast/, "#{@apptmp}/sample_project/
|
269
|
-
assert_match_in_file(/# attribute :name/m, "#{@apptmp}/sample_project/
|
270
|
-
assert_match_in_file(/# reference :venue, Venue/m, "#{@apptmp}/sample_project/
|
266
|
+
assert_match_in_file(/class Person < Ohm::Model/, "#{@apptmp}/sample_project/models/person.rb")
|
267
|
+
assert_match_in_file(/include Ohm::Timestamping/, "#{@apptmp}/sample_project/models/person.rb")
|
268
|
+
assert_match_in_file(/include Ohm::Typecast/, "#{@apptmp}/sample_project/models/person.rb")
|
269
|
+
assert_match_in_file(/# attribute :name/m, "#{@apptmp}/sample_project/models/person.rb")
|
270
|
+
assert_match_in_file(/# reference :venue, Venue/m, "#{@apptmp}/sample_project/models/person.rb")
|
271
271
|
end
|
272
272
|
|
273
273
|
should "generate model file with given fields" do
|
274
274
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=ohm') }
|
275
275
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
|
276
|
-
assert_match_in_file(/class User < Ohm::Model/, "#{@apptmp}/sample_project/
|
277
|
-
assert_match_in_file(/attribute :name, String/m, "#{@apptmp}/sample_project/
|
278
|
-
assert_match_in_file(/attribute :age, Integer/m, "#{@apptmp}/sample_project/
|
279
|
-
assert_match_in_file(/attribute :email, String/m, "#{@apptmp}/sample_project/
|
276
|
+
assert_match_in_file(/class User < Ohm::Model/, "#{@apptmp}/sample_project/models/user.rb")
|
277
|
+
assert_match_in_file(/attribute :name, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
278
|
+
assert_match_in_file(/attribute :age, Integer/m, "#{@apptmp}/sample_project/models/user.rb")
|
279
|
+
assert_match_in_file(/attribute :email, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
@@ -285,19 +285,40 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
285
285
|
should "generate model file with no properties" do
|
286
286
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongomatic') }
|
287
287
|
silence_logger { generate(:model, 'person', "-r=#{@apptmp}/sample_project") }
|
288
|
-
assert_match_in_file(/class Person < Mongomatic::Base/, "#{@apptmp}/sample_project/
|
289
|
-
assert_match_in_file(/include Mongomatic::Expectations::Helper/m, "#{@apptmp}/sample_project/
|
288
|
+
assert_match_in_file(/class Person < Mongomatic::Base/, "#{@apptmp}/sample_project/models/person.rb")
|
289
|
+
assert_match_in_file(/include Mongomatic::Expectations::Helper/m, "#{@apptmp}/sample_project/models/person.rb")
|
290
290
|
end
|
291
291
|
|
292
292
|
should "generate model file with given fields" do
|
293
293
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=mongomatic') }
|
294
294
|
silence_logger { generate(:model, 'user', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
|
295
|
-
assert_match_in_file(/class User < Mongomatic::Base/, "#{@apptmp}/sample_project/
|
296
|
-
assert_match_in_file(/include Mongomatic::Expectations::Helper/, "#{@apptmp}/sample_project/
|
297
|
-
assert_match_in_file(/be_present self\['name'\]/m, "#{@apptmp}/sample_project/
|
298
|
-
assert_match_in_file(/be_present self\['age'\]/m, "#{@apptmp}/sample_project/
|
299
|
-
assert_match_in_file(/be_present self\['email'\]/m, "#{@apptmp}/sample_project/
|
300
|
-
assert_match_in_file(/be_a_number self\['age'\]/m, "#{@apptmp}/sample_project/
|
295
|
+
assert_match_in_file(/class User < Mongomatic::Base/, "#{@apptmp}/sample_project/models/user.rb")
|
296
|
+
assert_match_in_file(/include Mongomatic::Expectations::Helper/, "#{@apptmp}/sample_project/models/user.rb")
|
297
|
+
assert_match_in_file(/be_present self\['name'\]/m, "#{@apptmp}/sample_project/models/user.rb")
|
298
|
+
assert_match_in_file(/be_present self\['age'\]/m, "#{@apptmp}/sample_project/models/user.rb")
|
299
|
+
assert_match_in_file(/be_present self\['email'\]/m, "#{@apptmp}/sample_project/models/user.rb")
|
300
|
+
assert_match_in_file(/be_a_number self\['age'\]/m, "#{@apptmp}/sample_project/models/user.rb")
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
# RIPPLE
|
305
|
+
context "model generator using ripple" do
|
306
|
+
should "generate model file with no properties" do
|
307
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=ripple') }
|
308
|
+
silence_logger { generate(:model, 'person', "name:string", "-r=#{@apptmp}/sample_project") }
|
309
|
+
assert_match_in_file(/class Person\n\s+include Ripple::Document/m, "#{@apptmp}/sample_project/models/person.rb")
|
310
|
+
assert_match_in_file(/# property :name, String/m, "#{@apptmp}/sample_project/models/person.rb")
|
311
|
+
assert_match_in_file(/# many :addresses/m, "#{@apptmp}/sample_project/models/person.rb")
|
312
|
+
assert_match_in_file(/# one :account/m, "#{@apptmp}/sample_project/models/person.rb")
|
313
|
+
end
|
314
|
+
|
315
|
+
should "generate model file with given fields" do
|
316
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=ripple') }
|
317
|
+
silence_logger { generate(:model, 'user', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
|
318
|
+
assert_match_in_file(/class User\n\s+include Ripple::Document/m, "#{@apptmp}/sample_project/models/user.rb")
|
319
|
+
assert_match_in_file(/property :name, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
320
|
+
assert_match_in_file(/property :age, Integer/m, "#{@apptmp}/sample_project/models/user.rb")
|
321
|
+
assert_match_in_file(/property :email, String/m, "#{@apptmp}/sample_project/models/user.rb")
|
301
322
|
end
|
302
323
|
end
|
303
324
|
|
@@ -360,8 +381,8 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
360
381
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
361
382
|
silence_logger { generate(:model, 'User', "-r=#{@apptmp}/sample_project") }
|
362
383
|
silence_logger { generate(:model, 'User', "-r=#{@apptmp}/sample_project", '-d') }
|
363
|
-
assert_no_file_exists("#{@apptmp}/sample_project/
|
364
|
-
assert_no_file_exists("#{@apptmp}/sample_project/test/
|
384
|
+
assert_no_file_exists("#{@apptmp}/sample_project/models/user.rb")
|
385
|
+
assert_no_file_exists("#{@apptmp}/sample_project/test/models/user_test.rb")
|
365
386
|
assert_no_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
|
366
387
|
end
|
367
388
|
|
@@ -369,7 +390,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
369
390
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec', '-d=activerecord') }
|
370
391
|
silence_logger { generate(:model, 'User', "-r=#{@apptmp}/sample_project") }
|
371
392
|
silence_logger { generate(:model, 'User', "-r=#{@apptmp}/sample_project", '-d') }
|
372
|
-
assert_no_file_exists("#{@apptmp}/sample_project/spec/
|
393
|
+
assert_no_file_exists("#{@apptmp}/sample_project/spec/models/user_spec.rb")
|
373
394
|
end
|
374
395
|
|
375
396
|
should "destroy the model test file in a sub app" do
|
@@ -246,7 +246,7 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
246
246
|
should "properly generate default" do
|
247
247
|
buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=datamapper', '--script=none') }
|
248
248
|
assert_match(/Applying.*?datamapper.*?orm/, buffer)
|
249
|
-
assert_match_in_file(/gem '
|
249
|
+
assert_match_in_file(/gem 'dm-core'/, "#{@apptmp}/project.com/Gemfile")
|
250
250
|
assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/project.com/Gemfile")
|
251
251
|
assert_match_in_file(/DataMapper.setup/, "#{@apptmp}/project.com/config/database.rb")
|
252
252
|
assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
|
@@ -322,6 +322,15 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
322
322
|
assert_match_in_file(/Mongomatic.db = Mongo::Connection.new.db/, "#{@apptmp}/sample_project/config/database.rb")
|
323
323
|
assert_dir_exists("#{@apptmp}/sample_project/app/models")
|
324
324
|
end
|
325
|
+
|
326
|
+
should "properly generate for ripple" do
|
327
|
+
buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=ripple', '--script=none') }
|
328
|
+
assert_match(/Applying.*?ripple.*?orm/, buffer)
|
329
|
+
assert_match_in_file(/gem 'ripple'/, "#{@apptmp}/sample_project/Gemfile")
|
330
|
+
assert_match_in_file(/Ripple.load_configuration/, "#{@apptmp}/sample_project/config/database.rb")
|
331
|
+
assert_match_in_file(/http_port: 8098/, "#{@apptmp}/sample_project/config/riak.yml")
|
332
|
+
assert_dir_exists("#{@apptmp}/sample_project/app/models")
|
333
|
+
end
|
325
334
|
end
|
326
335
|
|
327
336
|
|
@@ -410,8 +419,8 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
410
419
|
assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
|
411
420
|
assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
|
412
421
|
assert_match_in_file(/gem 'bacon'/, "#{@apptmp}/sample_project/Gemfile")
|
413
|
-
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
|
414
422
|
assert_match_in_file(/Bacon::Context/, "#{@apptmp}/sample_project/test/test_config.rb")
|
423
|
+
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
|
415
424
|
assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
|
416
425
|
assert_match_in_file(/Rake::TestTask.new\("test:\#/,"#{@apptmp}/sample_project/test/test.rake")
|
417
426
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
@@ -471,6 +480,7 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
471
480
|
assert_match_in_file(/gem 'test-spec'.*?:require => "test\/spec"/, "#{@apptmp}/sample_project/Gemfile")
|
472
481
|
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
|
473
482
|
assert_match_in_file(/Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/test_config.rb")
|
483
|
+
assert_match_in_file(/gem 'test-spec'.*?:require => "test\/spec"/, "#{@apptmp}/sample_project/Gemfile")
|
474
484
|
assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
|
475
485
|
assert_match_in_file(/Rake::TestTask\.new\("test:\#/,"#{@apptmp}/sample_project/test/test.rake")
|
476
486
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
@@ -484,9 +494,9 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
484
494
|
assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
|
485
495
|
assert_match_in_file(/gem 'rspec'/, "#{@apptmp}/sample_project/Gemfile")
|
486
496
|
assert_match_in_file(/gem 'cucumber'/, "#{@apptmp}/sample_project/Gemfile")
|
487
|
-
assert_match_in_file(/gem 'capybara'/, "#{@apptmp}/sample_project/Gemfile")
|
488
497
|
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
|
489
498
|
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/features/support/env.rb")
|
499
|
+
assert_match_in_file(/gem 'capybara'/, "#{@apptmp}/sample_project/Gemfile")
|
490
500
|
assert_match_in_file(/RSpec.configure/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
|
491
501
|
assert_match_in_file(/Capybara.app = /, "#{@apptmp}/sample_project/features/support/env.rb")
|
492
502
|
assert_match_in_file(/World\(Cucumber::Web::URLs\)/, "#{@apptmp}/sample_project/features/support/url.rb")
|
@@ -537,4 +547,4 @@ class TestProjectGenerator < Test::Unit::TestCase
|
|
537
547
|
assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
|
538
548
|
end
|
539
549
|
end
|
540
|
-
end
|
550
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: padrino-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.10.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Padrino Team
|
@@ -13,7 +13,8 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2011-
|
16
|
+
date: 2011-07-07 00:00:00 -07:00
|
17
|
+
default_executable:
|
17
18
|
dependencies:
|
18
19
|
- !ruby/object:Gem::Dependency
|
19
20
|
name: padrino-core
|
@@ -23,7 +24,7 @@ dependencies:
|
|
23
24
|
requirements:
|
24
25
|
- - "="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
27
|
+
version: 0.10.0
|
27
28
|
type: :runtime
|
28
29
|
version_requirements: *id001
|
29
30
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +33,7 @@ dependencies:
|
|
32
33
|
requirement: &id002 !ruby/object:Gem::Requirement
|
33
34
|
none: false
|
34
35
|
requirements:
|
35
|
-
- -
|
36
|
+
- - ~>
|
36
37
|
- !ruby/object:Gem::Version
|
37
38
|
version: 1.0.2
|
38
39
|
type: :runtime
|
@@ -43,9 +44,9 @@ dependencies:
|
|
43
44
|
requirement: &id003 !ruby/object:Gem::Requirement
|
44
45
|
none: false
|
45
46
|
requirements:
|
46
|
-
- -
|
47
|
+
- - ~>
|
47
48
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
+
version: 2.4.1
|
49
50
|
type: :runtime
|
50
51
|
version_requirements: *id003
|
51
52
|
description: Generators for easily creating and building padrino applications from the console
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- lib/padrino-gen/generators/components/orms/mongomapper.rb
|
80
81
|
- lib/padrino-gen/generators/components/orms/mongomatic.rb
|
81
82
|
- lib/padrino-gen/generators/components/orms/ohm.rb
|
83
|
+
- lib/padrino-gen/generators/components/orms/ripple.rb
|
82
84
|
- lib/padrino-gen/generators/components/orms/sequel.rb
|
83
85
|
- lib/padrino-gen/generators/components/renderers/erb.rb
|
84
86
|
- lib/padrino-gen/generators/components/renderers/haml.rb
|
@@ -155,6 +157,7 @@ files:
|
|
155
157
|
- lib/padrino-gen/generators/templates/static/ujs/mootools.js
|
156
158
|
- lib/padrino-gen/generators/templates/static/ujs/prototype.js
|
157
159
|
- lib/padrino-gen/generators/templates/static/ujs/right.js
|
160
|
+
has_rdoc: true
|
158
161
|
homepage: http://www.padrinorb.com
|
159
162
|
licenses: []
|
160
163
|
|
@@ -178,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
181
|
requirements: []
|
179
182
|
|
180
183
|
rubyforge_project: padrino-gen
|
181
|
-
rubygems_version: 1.
|
184
|
+
rubygems_version: 1.6.2
|
182
185
|
signing_key:
|
183
186
|
specification_version: 3
|
184
187
|
summary: Generators for easily creating and building padrino applications
|