padrino-gen 0.12.0.rc1 → 0.12.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +1 -1
- data/lib/padrino-gen/padrino-tasks/sequel.rb +6 -6
- data/padrino-gen.gemspec +2 -0
- data/test/helper.rb +1 -1
- data/test/test_controller_generator.rb +0 -8
- data/test/test_model_generator.rb +0 -21
- data/test/test_project_generator.rb +0 -15
- metadata +32 -5
- data/lib/padrino-gen/generators/components/tests/testspec.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb758a8b5d177651269c465fbd6f8500897d56db
|
4
|
+
data.tar.gz: f68899fefea730d134b4e743751456a9103ea8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5d6894a90e300df8269b1e0a285142328cffc178ec49f06b639f4184623635afb5742f4483929a731e92214c0cdb00db97448a0ef73d1a0cf4815b10dd7869
|
7
|
+
data.tar.gz: bc3ccddb22ad86f32befb5f3edf5724eb9972762e767bf846870bc8df3c44138d7608311650071bd446d26119876a4ecce909c3f63cbe6cbbe373c0830f5dc3b
|
data/README.rdoc
CHANGED
@@ -38,7 +38,7 @@ You can also instruct the generator to skip a certain component to avoid using o
|
|
38
38
|
|
39
39
|
The available components and their default options are listed below:
|
40
40
|
|
41
|
-
test:: none (default), bacon, shoulda, cucumber,
|
41
|
+
test:: none (default), bacon, shoulda, cucumber, riot, rspec, minitest, steak
|
42
42
|
renderer:: slim (default), erb, erubis, liquid, haml
|
43
43
|
stylesheet:: none (default), less, compass, sass, scss
|
44
44
|
mock:: none (default), mocha, rr
|
@@ -240,7 +240,7 @@ if PadrinoTasks.load?(:activerecord, defined?(ActiveRecord))
|
|
240
240
|
desc "Load a schema.rb file into the database"
|
241
241
|
task :load => :environment do
|
242
242
|
file = ENV['SCHEMA'] || Padrino.root("db", "schema.rb")
|
243
|
-
if File.
|
243
|
+
if File.exist?(file)
|
244
244
|
load(file)
|
245
245
|
else
|
246
246
|
raise %{#{file} doesn't exist yet. Run "rake ar:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{Padrino.root}/config/boot.rb to limit the frameworks that will be loaded}
|
@@ -2,7 +2,7 @@ if PadrinoTasks.load?(:sequel, defined?(Sequel))
|
|
2
2
|
namespace :sq do
|
3
3
|
namespace :migrate do
|
4
4
|
desc "Perform automigration (reset your db data)"
|
5
|
-
task :auto => :
|
5
|
+
task :auto => :skeleton do
|
6
6
|
::Sequel.extension :migration
|
7
7
|
::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
|
8
8
|
::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
|
@@ -10,7 +10,7 @@ if PadrinoTasks.load?(:sequel, defined?(Sequel))
|
|
10
10
|
end
|
11
11
|
|
12
12
|
desc "Perform migration up/down to VERSION"
|
13
|
-
task :to, [:version] => :
|
13
|
+
task :to, [:version] => :skeleton do |t, args|
|
14
14
|
version = (args[:version] || ENV['VERSION']).to_s.strip
|
15
15
|
::Sequel.extension :migration
|
16
16
|
raise "No VERSION was provided" if version.empty?
|
@@ -19,14 +19,14 @@ if PadrinoTasks.load?(:sequel, defined?(Sequel))
|
|
19
19
|
end
|
20
20
|
|
21
21
|
desc "Perform migration up to latest migration available"
|
22
|
-
task :up => :
|
22
|
+
task :up => :skeleton do
|
23
23
|
::Sequel.extension :migration
|
24
24
|
::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
|
25
25
|
puts "<= sq:migrate:up executed"
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "Perform migration down (erase all data)"
|
29
|
-
task :down => :
|
29
|
+
task :down => :skeleton do
|
30
30
|
::Sequel.extension :migration
|
31
31
|
::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
|
32
32
|
puts "<= sq:migrate:down executed"
|
@@ -37,7 +37,7 @@ if PadrinoTasks.load?(:sequel, defined?(Sequel))
|
|
37
37
|
task :migrate => 'sq:migrate:up'
|
38
38
|
|
39
39
|
desc "Create the database"
|
40
|
-
task :create => :
|
40
|
+
task :create => :skeleton do
|
41
41
|
config = Sequel::Model.db.opts
|
42
42
|
user, password, host = config[:user], config[:password], config[:host]
|
43
43
|
database = config[:database]
|
@@ -55,7 +55,7 @@ if PadrinoTasks.load?(:sequel, defined?(Sequel))
|
|
55
55
|
end
|
56
56
|
|
57
57
|
desc "Drop the database (postgres and mysql only)"
|
58
|
-
task :drop => :
|
58
|
+
task :drop => :skeleton do
|
59
59
|
config = ::Sequel::Model.db.opts
|
60
60
|
user, password, host, database = config[:user], config[:password], config[:host], config[:database]
|
61
61
|
|
data/padrino-gen.gemspec
CHANGED
@@ -25,4 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
|
26
26
|
s.add_dependency("padrino-core", Padrino.version)
|
27
27
|
s.add_dependency("bundler", "~> 1.0")
|
28
|
+
s.add_development_dependency("padrino-helpers", Padrino.version)
|
29
|
+
s.add_development_dependency("padrino-mailer", Padrino.version)
|
28
30
|
end
|
data/test/helper.rb
CHANGED
@@ -87,7 +87,7 @@ class MiniTest::Spec
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def assert_no_match_in_file(pattern, file)
|
90
|
-
File.
|
90
|
+
File.exist?(file) ? assert_no_match(pattern, File.read(file)) : assert_file_exists(file)
|
91
91
|
end
|
92
92
|
|
93
93
|
# expects_generated :model, "post title:string body:text"
|
@@ -115,14 +115,6 @@ describe "ControllerGenerator" do
|
|
115
115
|
assert_match_in_file(/describe "DemoItemsController" do/m, @controller_test_path.gsub('app', 'subby'))
|
116
116
|
end
|
117
117
|
|
118
|
-
should "generate controller test for testspec" do
|
119
|
-
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec') }
|
120
|
-
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
121
|
-
capture_io { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
|
122
|
-
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
|
123
|
-
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path.gsub('app','subby'))
|
124
|
-
end
|
125
|
-
|
126
118
|
should "generate controller test for rspec" do
|
127
119
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec') }
|
128
120
|
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
@@ -489,27 +489,6 @@ describe "ModelGenerator" do
|
|
489
489
|
assert_match_in_file(/assert_not_nil @some_person/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
490
490
|
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
491
491
|
end
|
492
|
-
|
493
|
-
# TESTSPEC
|
494
|
-
should "generate test file for testspec" do
|
495
|
-
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
|
496
|
-
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
497
|
-
capture_io { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
|
498
|
-
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
499
|
-
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
500
|
-
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
501
|
-
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
502
|
-
end
|
503
|
-
|
504
|
-
should "generate test file for testspec in specified app" do
|
505
|
-
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
|
506
|
-
capture_io { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
507
|
-
capture_io { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
508
|
-
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
509
|
-
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
510
|
-
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
511
|
-
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
512
|
-
end
|
513
492
|
end
|
514
493
|
|
515
494
|
context "the model destroy option" do
|
@@ -582,21 +582,6 @@ describe "ProjectGenerator" do
|
|
582
582
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
583
583
|
end # minitest
|
584
584
|
|
585
|
-
should "properly generate for testspec" do
|
586
|
-
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=testspec', '--script=none') }
|
587
|
-
assert_match(/applying.*?testspec.*?test/, out)
|
588
|
-
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
589
|
-
assert_match_in_file(/:require => 'rack\/test'/, "#{@apptmp}/sample_project/Gemfile")
|
590
|
-
assert_match_in_file(/:group => 'test'/, "#{@apptmp}/sample_project/Gemfile")
|
591
|
-
assert_match_in_file(/gem 'test-spec'.*?:require => 'test\/spec'/, "#{@apptmp}/sample_project/Gemfile")
|
592
|
-
assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
|
593
|
-
assert_match_in_file(/Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/test_config.rb")
|
594
|
-
assert_match_in_file(/gem 'test-spec'.*?:require => 'test\/spec'/, "#{@apptmp}/sample_project/Gemfile")
|
595
|
-
assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
|
596
|
-
assert_match_in_file(/Rake::TestTask\.new\("test:\#/,"#{@apptmp}/sample_project/test/test.rake")
|
597
|
-
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
598
|
-
end
|
599
|
-
|
600
585
|
should "properly generate for cucumber" do
|
601
586
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=cucumber', '--script=none') }
|
602
587
|
assert_match(/applying.*?cucumber.*?test/, out)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.0.
|
4
|
+
version: 0.12.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2014-01-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-core
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.12.0.
|
22
|
+
version: 0.12.0.rc2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.12.0.
|
29
|
+
version: 0.12.0.rc2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bundler
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,6 +41,34 @@ dependencies:
|
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '1.0'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: padrino-helpers
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.12.0.rc2
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.12.0.rc2
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: padrino-mailer
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - '='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.12.0.rc2
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.12.0.rc2
|
44
72
|
description: Generators for easily creating and building padrino applications from
|
45
73
|
the console
|
46
74
|
email: padrinorb@gmail.com
|
@@ -100,7 +128,6 @@ files:
|
|
100
128
|
- lib/padrino-gen/generators/components/tests/rspec.rb
|
101
129
|
- lib/padrino-gen/generators/components/tests/shoulda.rb
|
102
130
|
- lib/padrino-gen/generators/components/tests/steak.rb
|
103
|
-
- lib/padrino-gen/generators/components/tests/testspec.rb
|
104
131
|
- lib/padrino-gen/generators/controller.rb
|
105
132
|
- lib/padrino-gen/generators/mailer.rb
|
106
133
|
- lib/padrino-gen/generators/migration.rb
|
@@ -1,81 +0,0 @@
|
|
1
|
-
TESTSPEC_SETUP = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_SETUP)
|
2
|
-
PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/boot")
|
4
|
-
|
5
|
-
class Test::Unit::TestCase
|
6
|
-
include Rack::Test::Methods
|
7
|
-
|
8
|
-
# You can use this method to custom specify a Rack app
|
9
|
-
# you want rack-test to invoke:
|
10
|
-
#
|
11
|
-
# app CLASS_NAME
|
12
|
-
# app CLASS_NAME.tap { |a| }
|
13
|
-
# app(CLASS_NAME) do
|
14
|
-
# set :foo, :bar
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
def app(app = nil, &blk)
|
18
|
-
@app ||= block_given? ? app.instance_eval(&blk) : app
|
19
|
-
@app ||= Padrino.application
|
20
|
-
end
|
21
|
-
end
|
22
|
-
TEST
|
23
|
-
|
24
|
-
TESTSPEC_CONTROLLER_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_CONTROLLER_TEST)
|
25
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../test_config.rb')
|
26
|
-
|
27
|
-
context "!NAME!Controller" do
|
28
|
-
setup { get('/') }
|
29
|
-
specify "returns hello world" do
|
30
|
-
last_response.body.should.equal "Hello World"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
TEST
|
34
|
-
|
35
|
-
TESTSPEC_RAKE = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_RAKE)
|
36
|
-
require 'rake/testtask'
|
37
|
-
|
38
|
-
test_tasks = Dir['test/*/'].map { |d| File.basename(d) }
|
39
|
-
|
40
|
-
test_tasks.each do |folder|
|
41
|
-
Rake::TestTask.new("test:\#{folder}") do |test|
|
42
|
-
test.pattern = "test/\#{folder}/**/*_test.rb"
|
43
|
-
test.verbose = true
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Run application test suite"
|
48
|
-
task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
49
|
-
TEST
|
50
|
-
|
51
|
-
TESTSPEC_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_MODEL_TEST)
|
52
|
-
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
53
|
-
|
54
|
-
context "!NAME! Model" do
|
55
|
-
specify 'can be created' do
|
56
|
-
@!DNAME! = !NAME!.new
|
57
|
-
@!DNAME!.should.not.be.nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
TEST
|
61
|
-
|
62
|
-
def setup_test
|
63
|
-
require_dependencies 'rack-test', :require => 'rack/test', :group => 'test'
|
64
|
-
require_dependencies 'test-spec', :require => 'test/spec', :group => 'test'
|
65
|
-
insert_test_suite_setup TESTSPEC_SETUP
|
66
|
-
create_file destination_root("test/test.rake"), TESTSPEC_RAKE
|
67
|
-
end
|
68
|
-
|
69
|
-
def generate_controller_test(name)
|
70
|
-
testspec_contents = TESTSPEC_CONTROLLER_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
71
|
-
controller_test_path = File.join('test',options[:app],'controllers',"#{name.to_s.underscore}_controller_test.rb")
|
72
|
-
create_file destination_root(controller_test_path), testspec_contents, :skip => true
|
73
|
-
end
|
74
|
-
|
75
|
-
def generate_model_test(name)
|
76
|
-
tests_contents = TESTSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
77
|
-
path = options[:app] == '.' ? '/..' : '/../..'
|
78
|
-
tests_contents.gsub!(/!PATH!/,path)
|
79
|
-
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
80
|
-
create_file destination_root(model_test_path), tests_contents, :skip => true
|
81
|
-
end
|