padrino-gen 0.10.6 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/padrino-gen/generators/components/orms/datamapper.rb +1 -1
- data/lib/padrino-gen/generators/project/config/boot.rb +19 -3
- data/lib/padrino-gen/generators/runner.rb +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +5 -5
- data/test/helper.rb +1 -16
- data/test/test_project_generator.rb +8 -0
- metadata +50 -42
@@ -32,7 +32,7 @@ def setup_orm
|
|
32
32
|
dm-validations
|
33
33
|
).each { |dep| require_dependencies dep }
|
34
34
|
require_dependencies case options[:adapter]
|
35
|
-
when 'mysql'
|
35
|
+
when 'mysql', 'mysql2'
|
36
36
|
dm.gsub!(/!DB_DEVELOPMENT!/,"\"mysql://root@localhost/#{db}_development\"")
|
37
37
|
dm.gsub!(/!DB_PRODUCTION!/,"\"mysql://root@localhost/#{db}_production\"")
|
38
38
|
dm.gsub!(/!DB_TEST!/,"\"mysql://root@localhost/#{db}_test\"")
|
@@ -8,20 +8,36 @@ require 'bundler/setup'
|
|
8
8
|
Bundler.require(:default, PADRINO_ENV)
|
9
9
|
|
10
10
|
##
|
11
|
-
# Enable devel logging
|
11
|
+
# ## Enable devel logging
|
12
12
|
#
|
13
13
|
# Padrino::Logger::Config[:development][:log_level] = :devel
|
14
14
|
# Padrino::Logger::Config[:development][:log_static] = true
|
15
15
|
#
|
16
|
+
# ## Configure your I18n
|
17
|
+
#
|
18
|
+
# I18n.default_locale = :en
|
19
|
+
#
|
20
|
+
# ## Configure your HTML5 data helpers
|
21
|
+
#
|
22
|
+
# Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog)
|
23
|
+
# text_field :foo, :dialog => true
|
24
|
+
# Generates: <input type="text" data-dialog="true" name="foo" />
|
25
|
+
#
|
26
|
+
# ## Add helpers to mailer
|
27
|
+
#
|
28
|
+
# Mail::Message.class_eval do
|
29
|
+
# include Padrino::Helpers::NumberHelpers
|
30
|
+
# include Padrino::Helpers::TranslationHelpers
|
31
|
+
# end
|
16
32
|
|
17
33
|
##
|
18
|
-
# Add your before load hooks here
|
34
|
+
# Add your before (RE)load hooks here
|
19
35
|
#
|
20
36
|
Padrino.before_load do
|
21
37
|
end
|
22
38
|
|
23
39
|
##
|
24
|
-
# Add your after load hooks here
|
40
|
+
# Add your after (RE)load hooks here
|
25
41
|
#
|
26
42
|
Padrino.after_load do
|
27
43
|
end
|
@@ -55,7 +55,7 @@ if defined?(ActiveRecord)
|
|
55
55
|
end
|
56
56
|
rescue
|
57
57
|
case config[:adapter]
|
58
|
-
when 'mysql', 'mysql2'
|
58
|
+
when 'mysql', 'mysql2', 'jdbcmysql'
|
59
59
|
@charset = ENV['CHARSET'] || 'utf8'
|
60
60
|
@collation = ENV['COLLATION'] || 'utf8_unicode_ci'
|
61
61
|
creation_options = {:charset => (config[:charset] || @charset), :collation => (config[:collation] || @collation)}
|
@@ -184,7 +184,7 @@ if defined?(ActiveRecord)
|
|
184
184
|
task :charset => :environment do
|
185
185
|
config = ActiveRecord::Base.configurations[Padrino.env || :development]
|
186
186
|
case config[:adapter]
|
187
|
-
when 'mysql', 'mysql2'
|
187
|
+
when 'mysql', 'mysql2', 'jdbcmysql'
|
188
188
|
ActiveRecord::Base.establish_connection(config)
|
189
189
|
puts ActiveRecord::Base.connection.charset
|
190
190
|
when 'postgresql'
|
@@ -199,7 +199,7 @@ if defined?(ActiveRecord)
|
|
199
199
|
task :collation => :environment do
|
200
200
|
config = ActiveRecord::Base.configurations[Padrino.env || :development]
|
201
201
|
case config[:adapter]
|
202
|
-
when 'mysql', 'mysql2'
|
202
|
+
when 'mysql', 'mysql2', 'jdbcmysql'
|
203
203
|
ActiveRecord::Base.establish_connection(config)
|
204
204
|
puts ActiveRecord::Base.connection.collation
|
205
205
|
else
|
@@ -256,7 +256,7 @@ if defined?(ActiveRecord)
|
|
256
256
|
task :dump => :environment do
|
257
257
|
abcs = ActiveRecord::Base.configurations
|
258
258
|
case abcs[Padrino.env][:adapter]
|
259
|
-
when "mysql", "mysql2", "oci", "oracle"
|
259
|
+
when "mysql", "mysql2", "oci", "oracle", 'jdbcmysql'
|
260
260
|
ActiveRecord::Base.establish_connection(abcs[Padrino.env])
|
261
261
|
File.open("#{Padrino.root}/db/#{Padrino.env}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
|
262
262
|
when "postgresql"
|
@@ -337,7 +337,7 @@ if defined?(ActiveRecord)
|
|
337
337
|
|
338
338
|
def drop_database(config)
|
339
339
|
case config[:adapter]
|
340
|
-
when 'mysql', 'mysql2'
|
340
|
+
when 'mysql', 'mysql2', 'jdbcmysql'
|
341
341
|
ActiveRecord::Base.establish_connection(config)
|
342
342
|
ActiveRecord::Base.connection.drop_database config[:database]
|
343
343
|
when /^sqlite/
|
data/test/helper.rb
CHANGED
@@ -4,9 +4,8 @@ require 'rack/test'
|
|
4
4
|
require 'rack'
|
5
5
|
require 'uuid'
|
6
6
|
require 'webrat'
|
7
|
-
require 'grit'
|
8
|
-
require 'thor/group'
|
9
7
|
require 'fakeweb'
|
8
|
+
require 'thor/group'
|
10
9
|
require 'padrino-gen'
|
11
10
|
require 'padrino-core/support_lite' unless defined?(SupportLite)
|
12
11
|
|
@@ -111,20 +110,6 @@ class MiniTest::Spec
|
|
111
110
|
#options.reverse_merge!(:root => '/tmp')
|
112
111
|
Padrino.expects(:bin).with("rake", command, "-c=#{options[:root]}").returns(true)
|
113
112
|
end
|
114
|
-
|
115
|
-
# expects_git :commit, "hello world"
|
116
|
-
def expects_git(command,options={})
|
117
|
-
FileUtils.mkdir_p(options[:root])
|
118
|
-
if command.to_s == 'init'
|
119
|
-
args = options[:arguments] || options[:root]
|
120
|
-
::Grit::Repo.expects(:init).with(args).returns(true)
|
121
|
-
else
|
122
|
-
base = ::Grit::Git.new(options[:root])
|
123
|
-
::Grit::Repo.stubs(:new).with(options[:root]).returns(base)
|
124
|
-
::Grit::Git.any_instance.expects(command.to_sym).with(options[:arguments]).returns(true)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
113
|
end
|
129
114
|
|
130
115
|
module Webrat
|
@@ -263,6 +263,14 @@ describe "ProjectGenerator" do
|
|
263
263
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
264
264
|
end
|
265
265
|
|
266
|
+
# DataMapper has do_mysql that is the version of MySQL driver.
|
267
|
+
should "properly generate for mysql2" do
|
268
|
+
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=mysql2') }
|
269
|
+
assert_match_in_file(/gem 'dm-mysql-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
270
|
+
assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
|
271
|
+
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
272
|
+
end
|
273
|
+
|
266
274
|
should "properly generate for sqlite" do
|
267
275
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=sqlite') }
|
268
276
|
assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-gen
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.7
|
4
5
|
prerelease:
|
5
|
-
version: 0.10.6
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Padrino Team
|
9
9
|
- Nathan Esquenazi
|
10
10
|
- Davide D'Agostino
|
@@ -12,40 +12,49 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
date: 2012-06-20 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
19
18
|
name: padrino-core
|
20
|
-
|
21
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
22
20
|
none: false
|
23
|
-
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.10.
|
21
|
+
requirements:
|
22
|
+
- - '='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.10.7
|
27
25
|
type: :runtime
|
28
|
-
version_requirements: *id001
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: bundler
|
31
26
|
prerelease: false
|
32
|
-
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - '='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.10.7
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
33
36
|
none: false
|
34
|
-
requirements:
|
37
|
+
requirements:
|
35
38
|
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version:
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
38
41
|
type: :runtime
|
39
|
-
|
40
|
-
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
description: Generators for easily creating and building padrino applications from
|
50
|
+
the console
|
41
51
|
email: padrinorb@gmail.com
|
42
|
-
executables:
|
52
|
+
executables:
|
43
53
|
- padrino-gen
|
44
54
|
extensions: []
|
45
|
-
|
46
|
-
extra_rdoc_files:
|
55
|
+
extra_rdoc_files:
|
47
56
|
- README.rdoc
|
48
|
-
files:
|
57
|
+
files:
|
49
58
|
- .document
|
50
59
|
- .gitignore
|
51
60
|
- .yardopts
|
@@ -150,32 +159,30 @@ files:
|
|
150
159
|
- lib/padrino-gen/generators/templates/static/ujs/right.js
|
151
160
|
homepage: http://www.padrinorb.com
|
152
161
|
licenses: []
|
153
|
-
|
154
162
|
post_install_message:
|
155
|
-
rdoc_options:
|
163
|
+
rdoc_options:
|
156
164
|
- --charset=UTF-8
|
157
|
-
require_paths:
|
165
|
+
require_paths:
|
158
166
|
- lib
|
159
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
168
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version:
|
165
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ! '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
174
|
none: false
|
167
|
-
requirements:
|
168
|
-
- -
|
169
|
-
- !ruby/object:Gem::Version
|
175
|
+
requirements:
|
176
|
+
- - ! '>='
|
177
|
+
- !ruby/object:Gem::Version
|
170
178
|
version: 1.3.6
|
171
179
|
requirements: []
|
172
|
-
|
173
180
|
rubyforge_project: padrino-gen
|
174
|
-
rubygems_version: 1.8.
|
181
|
+
rubygems_version: 1.8.21
|
175
182
|
signing_key:
|
176
183
|
specification_version: 3
|
177
184
|
summary: Generators for easily creating and building padrino applications
|
178
|
-
test_files:
|
185
|
+
test_files:
|
179
186
|
- test/fixtures/admin_template.rb
|
180
187
|
- test/fixtures/example_template.rb
|
181
188
|
- test/fixtures/git_template.rb
|
@@ -191,3 +198,4 @@ test_files:
|
|
191
198
|
- test/test_model_generator.rb
|
192
199
|
- test/test_plugin_generator.rb
|
193
200
|
- test/test_project_generator.rb
|
201
|
+
has_rdoc:
|