migration_assist 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -4
- data/Rakefile +5 -2
- data/VERSION +1 -1
- data/lib/generators/migration/migration_generator.rb +1 -1
- data/lib/migration_assist/class_methods.rb +2 -2
- data/lib/migration_assist/helper/file_name.rb +3 -3
- data/lib/migration_assist/implementation.rb +1 -2
- data/lib/migration_assist/namespaces.rb +1 -1
- data/migration_assist.gemspec +17 -8
- data/spec/load_spec.rb +1 -2
- data/spec/migration_assist/class_methods_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -3
- metadata +54 -9
data/README.markdown
CHANGED
@@ -13,7 +13,7 @@ First you have to tell the gem where your Rails root directory is located so it
|
|
13
13
|
|
14
14
|
Example:
|
15
15
|
<pre>
|
16
|
-
|
16
|
+
Rails3::Migration::Assist.rails_root_dir = Rails.root
|
17
17
|
</pre>
|
18
18
|
|
19
19
|
A common use case for using this gem, is when you are creating code Generators that create Active Record migrations.
|
@@ -24,12 +24,12 @@ require 'migration_assist'
|
|
24
24
|
require 'rails3_assist'
|
25
25
|
|
26
26
|
class MigrationGenerator < Rails::Generators::NamedBase
|
27
|
-
include
|
28
|
-
include
|
27
|
+
include Rails3::Migration::Assist
|
28
|
+
include Rails3::Assist::Migration # from rails3_assist
|
29
29
|
|
30
30
|
...
|
31
31
|
end
|
32
|
-
|
32
|
+
</pre>
|
33
33
|
|
34
34
|
In the above example we also included the migration helper from the *rails3_assist* gem, which adds some migration CRUD functionality to the mix.
|
35
35
|
|
data/Rakefile
CHANGED
@@ -7,9 +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",
|
10
|
+
gem.add_development_dependency "rspec", "~> 2.0.0.beta.22"
|
11
|
+
gem.add_development_dependency "mocha", "~> 0.9.8"
|
12
|
+
gem.add_development_dependency "rails", "~> 3.0.0"
|
11
13
|
|
12
|
-
gem.add_dependency "require_all", "
|
14
|
+
gem.add_dependency "require_all", "~> 1.1.0"
|
15
|
+
gem.add_dependency "rails", "~> 3.0.0"
|
13
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
17
|
end
|
15
18
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Alternative to use this helper is to inherit from ActiveRecord::Generators::Base
|
3
3
|
# which provides the #next_migration_number class method that lets #migration_template work as expected
|
4
4
|
#
|
5
|
-
module
|
5
|
+
module Rails3::Migration::Assist
|
6
6
|
class << self
|
7
7
|
attr_accessor :rails_root_dir
|
8
8
|
attr_accessor :orm
|
@@ -34,7 +34,7 @@ module Rails::Migration::Assist
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def next_migration_number(dirname) #:nodoc:
|
37
|
-
orm =
|
37
|
+
orm = Rails3::Migration::Assist.orm || Rails.configuration.generators.options[:rails][:orm]
|
38
38
|
require "rails/generators/#{orm}"
|
39
39
|
"#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
|
40
40
|
rescue
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Rails3::Migration::Assist
|
2
2
|
module FileNameHelper
|
3
3
|
def artifact_path name, type, dir=nil
|
4
4
|
dir ||= send :"#{type}_dir"
|
@@ -36,8 +36,8 @@ module Rails::Migration::Assist
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def root_dir
|
39
|
-
dir =
|
40
|
-
raise "You must set the Rails app root dir:
|
39
|
+
dir = Rails3::Migration::Assist.rails_root_dir || Rails.root
|
40
|
+
raise "You must set the Rails app root dir: Rails3::Migration::Assist.rails_root_dir = '/my/root/dir'" if !dir
|
41
41
|
dir
|
42
42
|
end
|
43
43
|
|
@@ -2,9 +2,8 @@ require 'rails/generators'
|
|
2
2
|
require 'rails/generators/migration'
|
3
3
|
require 'migration_assist/helper/file_name'
|
4
4
|
|
5
|
-
module
|
5
|
+
module Rails3::Migration::Assist
|
6
6
|
include Rails::Generators::Migration
|
7
|
-
# include Rails::Assist::Migration
|
8
7
|
include FileNameHelper
|
9
8
|
|
10
9
|
def reverse_migration_name name
|
data/migration_assist.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
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.4"
|
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-09-
|
12
|
+
s.date = %q{2010-09-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 = [
|
@@ -64,15 +64,24 @@ Gem::Specification.new do |s|
|
|
64
64
|
s.specification_version = 3
|
65
65
|
|
66
66
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
67
|
-
s.add_development_dependency(%q<rspec>, ["
|
68
|
-
s.
|
67
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
68
|
+
s.add_development_dependency(%q<mocha>, ["~> 0.9.8"])
|
69
|
+
s.add_development_dependency(%q<rails>, ["~> 3.0.0"])
|
70
|
+
s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
|
71
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
|
69
72
|
else
|
70
|
-
s.add_dependency(%q<rspec>, ["
|
71
|
-
s.add_dependency(%q<
|
73
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
74
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.8"])
|
75
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
76
|
+
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
77
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
72
78
|
end
|
73
79
|
else
|
74
|
-
s.add_dependency(%q<rspec>, ["
|
75
|
-
s.add_dependency(%q<
|
80
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
|
81
|
+
s.add_dependency(%q<mocha>, ["~> 0.9.8"])
|
82
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
83
|
+
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
84
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
76
85
|
end
|
77
86
|
end
|
78
87
|
|
data/spec/load_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
class TestGenerator
|
4
|
-
include
|
4
|
+
include Rails3::Migration::Assist
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
Rails3::Migration::Assist.orm = :active_record
|
8
8
|
|
9
9
|
describe 'Migration Assist' do
|
10
10
|
let(:dir) { fixtures_dir }
|
data/spec/spec_helper.rb
CHANGED
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
|
+
- 4
|
9
|
+
version: 0.1.4
|
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-09-
|
17
|
+
date: 2010-09-20 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -23,24 +23,54 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
29
|
- 2
|
30
30
|
- 0
|
31
31
|
- 0
|
32
32
|
- beta
|
33
|
-
-
|
34
|
-
version: 2.0.0.beta.
|
33
|
+
- 22
|
34
|
+
version: 2.0.0.beta.22
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: mocha
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 9
|
48
|
+
- 8
|
49
|
+
version: 0.9.8
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rails
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 3
|
62
|
+
- 0
|
63
|
+
- 0
|
64
|
+
version: 3.0.0
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: require_all
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
44
74
|
- !ruby/object:Gem::Version
|
45
75
|
segments:
|
46
76
|
- 1
|
@@ -48,7 +78,22 @@ dependencies:
|
|
48
78
|
- 0
|
49
79
|
version: 1.1.0
|
50
80
|
type: :runtime
|
51
|
-
version_requirements: *
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rails
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 3
|
92
|
+
- 0
|
93
|
+
- 0
|
94
|
+
version: 3.0.0
|
95
|
+
type: :runtime
|
96
|
+
version_requirements: *id005
|
52
97
|
description: Assists in handling migrations, including generating migration files from a Thor Generator
|
53
98
|
email: kmandrup@gmail.com
|
54
99
|
executables: []
|