migration_assist 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/generators/migration/migration_generator.rb +1 -1
- data/lib/migration_assist/class_methods.rb +8 -0
- data/lib/migration_assist/implementation.rb +1 -1
- data/migration_assist.gemspec +43 -45
- data/spec/migration_assist/implementation_spec.rb +51 -41
- data/spec/spec_helper.rb +5 -1
- metadata +13 -12
- data/.gitignore +0 -21
data/Rakefile
CHANGED
@@ -7,12 +7,12 @@ begin
|
|
7
7
|
gem.email = "kmandrup@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/kristianmandrup/migration_assist"
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec", ">= 2.0.
|
10
|
+
gem.add_development_dependency "rspec", ">= 2.0.1"
|
11
11
|
gem.add_development_dependency "mocha", ">= 0.9.8"
|
12
|
-
gem.add_development_dependency "
|
12
|
+
gem.add_development_dependency "generator-spec", ">= 0.7.1"
|
13
13
|
|
14
14
|
gem.add_dependency "require_all", "~> 1.2.0"
|
15
|
-
gem.add_dependency "rails", ">= 3.0"
|
15
|
+
gem.add_dependency "rails", ">= 3.0.1"
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
@@ -12,6 +12,14 @@ module Rails3::Migration::Assist
|
|
12
12
|
base.extend ClassMethods
|
13
13
|
end
|
14
14
|
|
15
|
+
def next_migration_number(dirname) #:nodoc:
|
16
|
+
orm = Rails3::Migration::Assist.orm || Rails.configuration.generators.options[:rails][:orm]
|
17
|
+
require "rails/generators/#{orm}"
|
18
|
+
"#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
|
19
|
+
rescue
|
20
|
+
raise NotImplementedError
|
21
|
+
end
|
22
|
+
|
15
23
|
module ClassMethods
|
16
24
|
|
17
25
|
def migration_lookup_at(dirname) #:nodoc:
|
data/migration_assist.gemspec
CHANGED
@@ -1,62 +1,60 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{migration_assist}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-12-20}
|
13
13
|
s.description = %q{Assists in handling migrations, including generating migration files from a Thor Generator}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.markdown"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"spec/spec_helper.rb"
|
21
|
+
".rspec",
|
22
|
+
"LICENSE",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/generators/migration/migration_generator.rb",
|
27
|
+
"lib/generators/migration/templates/create_users.erb",
|
28
|
+
"lib/migration_assist.rb",
|
29
|
+
"lib/migration_assist/class_methods.rb",
|
30
|
+
"lib/migration_assist/helper/file_name.rb",
|
31
|
+
"lib/migration_assist/implementation.rb",
|
32
|
+
"lib/migration_assist/namespaces.rb",
|
33
|
+
"migration_assist.gemspec",
|
34
|
+
"spec/generators/migration_generator_spec.rb",
|
35
|
+
"spec/load_spec.rb",
|
36
|
+
"spec/migration_assist/class_methods_spec.rb",
|
37
|
+
"spec/migration_assist/fixtures/001_migration_a.rb",
|
38
|
+
"spec/migration_assist/fixtures/002_migration_b.rb",
|
39
|
+
"spec/migration_assist/fixtures/003_migration_a.rb",
|
40
|
+
"spec/migration_assist/fixtures/004_migration_c.rb",
|
41
|
+
"spec/migration_assist/implementation_spec.rb",
|
42
|
+
"spec/spec_helper.rb"
|
44
43
|
]
|
45
44
|
s.homepage = %q{http://github.com/kristianmandrup/migration_assist}
|
46
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
47
45
|
s.require_paths = ["lib"]
|
48
46
|
s.rubygems_version = %q{1.3.7}
|
49
47
|
s.summary = %q{Assists in handling migrations}
|
50
48
|
s.test_files = [
|
51
49
|
"spec/generators/migration_generator_spec.rb",
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
"spec/load_spec.rb",
|
51
|
+
"spec/migration_assist/class_methods_spec.rb",
|
52
|
+
"spec/migration_assist/fixtures/001_migration_a.rb",
|
53
|
+
"spec/migration_assist/fixtures/002_migration_b.rb",
|
54
|
+
"spec/migration_assist/fixtures/003_migration_a.rb",
|
55
|
+
"spec/migration_assist/fixtures/004_migration_c.rb",
|
56
|
+
"spec/migration_assist/implementation_spec.rb",
|
57
|
+
"spec/spec_helper.rb"
|
60
58
|
]
|
61
59
|
|
62
60
|
if s.respond_to? :specification_version then
|
@@ -64,24 +62,24 @@ Gem::Specification.new do |s|
|
|
64
62
|
s.specification_version = 3
|
65
63
|
|
66
64
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
67
|
-
s.add_development_dependency(%q<rspec>, [">= 2.0.
|
65
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.1"])
|
68
66
|
s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
|
69
|
-
s.add_development_dependency(%q<
|
67
|
+
s.add_development_dependency(%q<generator-spec>, [">= 0.7.1"])
|
70
68
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
|
71
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.0"])
|
69
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.1"])
|
72
70
|
else
|
73
|
-
s.add_dependency(%q<rspec>, [">= 2.0.
|
71
|
+
s.add_dependency(%q<rspec>, [">= 2.0.1"])
|
74
72
|
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
75
|
-
s.add_dependency(%q<
|
73
|
+
s.add_dependency(%q<generator-spec>, [">= 0.7.1"])
|
76
74
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
77
|
-
s.add_dependency(%q<rails>, [">= 3.0"])
|
75
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
78
76
|
end
|
79
77
|
else
|
80
|
-
s.add_dependency(%q<rspec>, [">= 2.0.
|
78
|
+
s.add_dependency(%q<rspec>, [">= 2.0.1"])
|
81
79
|
s.add_dependency(%q<mocha>, [">= 0.9.8"])
|
82
|
-
s.add_dependency(%q<
|
80
|
+
s.add_dependency(%q<generator-spec>, [">= 0.7.1"])
|
83
81
|
s.add_dependency(%q<require_all>, ["~> 1.2.0"])
|
84
|
-
s.add_dependency(%q<rails>, [">= 3.0"])
|
82
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
@@ -1,43 +1,53 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'generator-spec'
|
3
|
+
|
4
|
+
RSpec::Generator.configure do |config|
|
5
|
+
config.debug = true
|
6
|
+
config.remove_temp_dir = true #false
|
7
|
+
config.default_rails_root(__FILE__)
|
8
|
+
config.lib = File.dirname(__FILE__) + '/../lib'
|
9
|
+
config.logger = :file
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
Rails3::Migration::Assist.orm = :active_record
|
14
|
+
|
15
|
+
require_generator :migration
|
16
|
+
|
17
|
+
# root_dir = File.join(spec_dir, 'tmp', 'rails_app')
|
18
|
+
|
19
|
+
describe 'migration_generator' do
|
20
|
+
use_orm :active_record
|
21
|
+
use_helpers :migration, :helper
|
22
|
+
|
23
|
+
before :each do
|
24
|
+
setup_generator 'migration_generator' do
|
25
|
+
tests MigrationGenerator
|
26
|
+
end
|
27
|
+
remove_migration :create_users
|
28
|
+
end
|
29
|
+
|
30
|
+
after :each do
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should generate create_user migration" do
|
34
|
+
with_generator do |g|
|
35
|
+
g.run_generator :create_users.args
|
36
|
+
g.should have_migration :create_users do |content|
|
37
|
+
content.should have_up do |up|
|
38
|
+
up.should have_create_table :users do |user_tbl|
|
39
|
+
user_tbl.should have_columns :name => :string, :age => :integer, :admin => :boolean
|
40
|
+
user_tbl.should_not have_timestamps
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
content.should have_down do |up|
|
45
|
+
up.should have_drop_table :users
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
2
53
|
|
3
|
-
# RSpec::Generator.debug = true
|
4
|
-
#
|
5
|
-
# require_generator :migration
|
6
|
-
#
|
7
|
-
# describe 'migration_generator' do
|
8
|
-
# use_orm :active_record
|
9
|
-
# use_helpers :migration, :helper
|
10
|
-
#
|
11
|
-
# before :each do
|
12
|
-
# setup_generator 'migration_generator' do
|
13
|
-
# tests MigrationGenerator
|
14
|
-
# end
|
15
|
-
# remove_migration :create_users
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# after :each do
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# it "should generate create_user migration" do
|
22
|
-
# with_generator do |g|
|
23
|
-
# g.run_generator :create_users.args
|
24
|
-
# g.should generate_migration :create_users do |content|
|
25
|
-
# content.should have_migration :create_users do |klass|
|
26
|
-
# klass.should have_up do |up|
|
27
|
-
# up.should have_create_table :users do |user_tbl|
|
28
|
-
# user_tbl.should have_columns :name => :string, :age => :integer, :admin => :boolean
|
29
|
-
# user_tbl.should_not have_timestamps
|
30
|
-
# end
|
31
|
-
# end
|
32
|
-
#
|
33
|
-
# klass.should have_down do |up|
|
34
|
-
# up.should have_drop_table :users
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
# end
|
38
|
-
# end
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,10 @@ RSpec.configure do |config|
|
|
5
5
|
config.mock_with :mocha
|
6
6
|
end
|
7
7
|
|
8
|
+
def spec_dir
|
9
|
+
File.dirname(__FILE__)
|
10
|
+
end
|
11
|
+
|
8
12
|
def fixtures_dir
|
9
|
-
File.expand_path(
|
13
|
+
File.expand_path(spec_dir + '/migration_assist/fixtures')
|
10
14
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-20 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -28,8 +28,8 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 2
|
30
30
|
- 0
|
31
|
-
-
|
32
|
-
version: 2.0.
|
31
|
+
- 1
|
32
|
+
version: 2.0.1
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
|
-
name:
|
51
|
+
name: generator-spec
|
52
52
|
prerelease: false
|
53
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
@@ -56,9 +56,10 @@ dependencies:
|
|
56
56
|
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
segments:
|
59
|
-
- 3
|
60
59
|
- 0
|
61
|
-
|
60
|
+
- 7
|
61
|
+
- 1
|
62
|
+
version: 0.7.1
|
62
63
|
type: :development
|
63
64
|
version_requirements: *id003
|
64
65
|
- !ruby/object:Gem::Dependency
|
@@ -87,7 +88,8 @@ dependencies:
|
|
87
88
|
segments:
|
88
89
|
- 3
|
89
90
|
- 0
|
90
|
-
|
91
|
+
- 1
|
92
|
+
version: 3.0.1
|
91
93
|
type: :runtime
|
92
94
|
version_requirements: *id005
|
93
95
|
description: Assists in handling migrations, including generating migration files from a Thor Generator
|
@@ -101,7 +103,6 @@ extra_rdoc_files:
|
|
101
103
|
- README.markdown
|
102
104
|
files:
|
103
105
|
- .document
|
104
|
-
- .gitignore
|
105
106
|
- .rspec
|
106
107
|
- LICENSE
|
107
108
|
- README.markdown
|
@@ -129,8 +130,8 @@ homepage: http://github.com/kristianmandrup/migration_assist
|
|
129
130
|
licenses: []
|
130
131
|
|
131
132
|
post_install_message:
|
132
|
-
rdoc_options:
|
133
|
-
|
133
|
+
rdoc_options: []
|
134
|
+
|
134
135
|
require_paths:
|
135
136
|
- lib
|
136
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|