migration_assist 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source :rubygems
2
+
3
+ gem "require_all", "~> 1.2.0"
4
+ gem "rails", ">= 3.0.1"
5
+ gem 'sugar-high', "~> 0.5.0"
6
+ gem 'rails_assist', "~> 0.5.0"
7
+ gem 'rails_artifactor', "~> 0.4.0"
8
+
9
+ group :development do
10
+ gem "rspec", ">= 2.4.1"
11
+ gem "mocha", ">= 0.9.8"
12
+ gem "generator-spec", "~> 0.7.5"
13
+ end
14
+
15
+
data/Rakefile CHANGED
@@ -9,13 +9,7 @@ begin
9
9
  gem.email = "kmandrup@gmail.com"
10
10
  gem.homepage = "http://github.com/kristianmandrup/migration_assist"
11
11
  gem.authors = ["Kristian Mandrup"]
12
- gem.add_development_dependency "rspec", ">= 2.4.1"
13
- gem.add_development_dependency "mocha", ">= 0.9.8"
14
- gem.add_development_dependency "generator-spec", ">= 0.7.3"
15
-
16
- gem.add_dependency "require_all", "~> 1.2.0"
17
- gem.add_dependency "rails", ">= 3.0.1"
18
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
13
  end
20
14
  Jeweler::GemcutterTasks.new
21
15
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -1,3 +1,6 @@
1
+ require 'rails_assist'
2
+ require 'migration_assist/helper/migration'
3
+
1
4
  module RailsAssist::Migration
2
5
  module FileNameHelper
3
6
  def artifact_path name, type, dir=nil
@@ -0,0 +1,58 @@
1
+ require 'sugar-high/regexp'
2
+ require 'rails_artifactor'
3
+
4
+ module RailsAssist::Artifact
5
+ module Migration
6
+ module FileName
7
+ include RailsAssist::BaseHelper
8
+ include RailsAssist::Migration::ClassMethods
9
+ include RailsAssist::Artifact::FileName
10
+
11
+ class FindError
12
+ attr_accessor :find_expr
13
+
14
+ def initialize find_expr
15
+ self.find_expr = find_expr
16
+ end
17
+ end
18
+
19
+ def migration_file_name name, options={}
20
+ number = options[:number]
21
+
22
+ migration_dir_name = File.expand_path(RailsAssist::Artifact::Directory.migration_dirpath(options))
23
+
24
+ number = next_migration_number(migration_dir_name) if !number
25
+ File.join(migration_dir_name, "#{number}_#{name}.rb")
26
+ end
27
+
28
+ def find_migration name, options={}
29
+ root_path = options[:root_path]
30
+
31
+ migration_dir_name = File.expand_path(RailsAssist::Artifact::Directory.migration_dirpath options)
32
+
33
+ migration_find_expr = "#{migration_dir_name}/[0-9]*_*.rb"
34
+ migrations = Dir.glob(migration_find_expr)
35
+
36
+ find_err = FindError.new migration_find_expr
37
+
38
+ return find_err if migrations.empty?
39
+
40
+ migration_find_expr = /\d+_#{name}\.rb$/
41
+ find_err.find_expr = migration_find_expr
42
+
43
+ matching_migrations = migrations.grep_it(migration_find_expr)
44
+
45
+ return find_err if matching_migrations.empty?
46
+
47
+ migration_file = (options[:last]) ? matching_migrations.last : matching_migrations.first
48
+ end
49
+ end
50
+
51
+ include FileName
52
+ extend FileName
53
+ end
54
+
55
+ rails_root_dir = RailsAssist::Directory.rails_root
56
+ end
57
+
58
+
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{migration_assist}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
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{2011-03-04}
12
+ s.date = %q{2011-07-21}
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 = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
+ "Gemfile",
22
23
  "LICENSE",
23
24
  "README.markdown",
24
25
  "Rakefile",
@@ -26,6 +27,7 @@ Gem::Specification.new do |s|
26
27
  "lib/migration_assist.rb",
27
28
  "lib/migration_assist/class_methods.rb",
28
29
  "lib/migration_assist/helper/file_name.rb",
30
+ "lib/migration_assist/helper/migration.rb",
29
31
  "lib/migration_assist/implementation.rb",
30
32
  "lib/migration_assist/namespaces.rb",
31
33
  "migration_assist.gemspec",
@@ -43,42 +45,40 @@ Gem::Specification.new do |s|
43
45
  ]
44
46
  s.homepage = %q{http://github.com/kristianmandrup/migration_assist}
45
47
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.6.1}
48
+ s.rubygems_version = %q{1.6.2}
47
49
  s.summary = %q{Assists in handling migrations}
48
- s.test_files = [
49
- "spec/generators/migration/migration_generator.rb",
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"
58
- ]
59
50
 
60
51
  if s.respond_to? :specification_version then
61
52
  s.specification_version = 3
62
53
 
63
54
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
- s.add_development_dependency(%q<rspec>, [">= 2.4.1"])
65
- s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
66
- s.add_development_dependency(%q<generator-spec>, [">= 0.7.3"])
67
55
  s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
68
56
  s.add_runtime_dependency(%q<rails>, [">= 3.0.1"])
57
+ s.add_runtime_dependency(%q<sugar-high>, ["~> 0.5.0"])
58
+ s.add_runtime_dependency(%q<rails_assist>, ["~> 0.5.0"])
59
+ s.add_runtime_dependency(%q<rails_artifactor>, ["~> 0.4.0"])
60
+ s.add_development_dependency(%q<rspec>, [">= 2.4.1"])
61
+ s.add_development_dependency(%q<mocha>, [">= 0.9.8"])
62
+ s.add_development_dependency(%q<generator-spec>, ["~> 0.7.5"])
69
63
  else
70
- s.add_dependency(%q<rspec>, [">= 2.4.1"])
71
- s.add_dependency(%q<mocha>, [">= 0.9.8"])
72
- s.add_dependency(%q<generator-spec>, [">= 0.7.3"])
73
64
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
74
65
  s.add_dependency(%q<rails>, [">= 3.0.1"])
66
+ s.add_dependency(%q<sugar-high>, ["~> 0.5.0"])
67
+ s.add_dependency(%q<rails_assist>, ["~> 0.5.0"])
68
+ s.add_dependency(%q<rails_artifactor>, ["~> 0.4.0"])
69
+ s.add_dependency(%q<rspec>, [">= 2.4.1"])
70
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
71
+ s.add_dependency(%q<generator-spec>, ["~> 0.7.5"])
75
72
  end
76
73
  else
77
- s.add_dependency(%q<rspec>, [">= 2.4.1"])
78
- s.add_dependency(%q<mocha>, [">= 0.9.8"])
79
- s.add_dependency(%q<generator-spec>, [">= 0.7.3"])
80
74
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
81
75
  s.add_dependency(%q<rails>, [">= 3.0.1"])
76
+ s.add_dependency(%q<sugar-high>, ["~> 0.5.0"])
77
+ s.add_dependency(%q<rails_assist>, ["~> 0.5.0"])
78
+ s.add_dependency(%q<rails_artifactor>, ["~> 0.4.0"])
79
+ s.add_dependency(%q<rspec>, [">= 2.4.1"])
80
+ s.add_dependency(%q<mocha>, [">= 0.9.8"])
81
+ s.add_dependency(%q<generator-spec>, ["~> 0.7.5"])
82
82
  end
83
83
  end
84
84
 
@@ -1,9 +1,9 @@
1
1
  require 'rails/generators'
2
2
  require 'rails/generators/migration'
3
- require 'rails3_assist'
3
+ require 'rails_assist'
4
4
 
5
5
  class MigrationGenerator < Rails::Generators::NamedBase
6
- include Rails3::Migration::Assist
6
+ include RailsAssist::Migration
7
7
 
8
8
  desc "Creates a migration"
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migration_assist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,64 +9,97 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-03-04 00:00:00.000000000 +01:00
12
+ date: 2011-07-21 00:00:00.000000000 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rspec
17
- requirement: &2158573420 !ruby/object:Gem::Requirement
16
+ name: require_all
17
+ requirement: &2151833040 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 2.4.1
23
- type: :development
22
+ version: 1.2.0
23
+ type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2158573420
25
+ version_requirements: *2151833040
26
26
  - !ruby/object:Gem::Dependency
27
- name: mocha
28
- requirement: &2158572840 !ruby/object:Gem::Requirement
27
+ name: rails
28
+ requirement: &2151831540 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.8
34
- type: :development
33
+ version: 3.0.1
34
+ type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2158572840
36
+ version_requirements: *2151831540
37
37
  - !ruby/object:Gem::Dependency
38
- name: generator-spec
39
- requirement: &2158572280 !ruby/object:Gem::Requirement
38
+ name: sugar-high
39
+ requirement: &2151830380 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - ! '>='
42
+ - - ~>
43
43
  - !ruby/object:Gem::Version
44
- version: 0.7.3
45
- type: :development
44
+ version: 0.5.0
45
+ type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2158572280
47
+ version_requirements: *2151830380
48
48
  - !ruby/object:Gem::Dependency
49
- name: require_all
50
- requirement: &2158571780 !ruby/object:Gem::Requirement
49
+ name: rails_assist
50
+ requirement: &2151828880 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: 1.2.0
55
+ version: 0.5.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2158571780
58
+ version_requirements: *2151828880
59
59
  - !ruby/object:Gem::Dependency
60
- name: rails
61
- requirement: &2158571300 !ruby/object:Gem::Requirement
60
+ name: rails_artifactor
61
+ requirement: &2151827880 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
- - - ! '>='
64
+ - - ~>
65
65
  - !ruby/object:Gem::Version
66
- version: 3.0.1
66
+ version: 0.4.0
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2158571300
69
+ version_requirements: *2151827880
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: &2151827020 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 2.4.1
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *2151827020
81
+ - !ruby/object:Gem::Dependency
82
+ name: mocha
83
+ requirement: &2151825960 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: 0.9.8
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *2151825960
92
+ - !ruby/object:Gem::Dependency
93
+ name: generator-spec
94
+ requirement: &2151825280 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: 0.7.5
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *2151825280
70
103
  description: Assists in handling migrations, including generating migration files
71
104
  from a Thor Generator
72
105
  email: kmandrup@gmail.com
@@ -78,6 +111,7 @@ extra_rdoc_files:
78
111
  files:
79
112
  - .document
80
113
  - .rspec
114
+ - Gemfile
81
115
  - LICENSE
82
116
  - README.markdown
83
117
  - Rakefile
@@ -85,6 +119,7 @@ files:
85
119
  - lib/migration_assist.rb
86
120
  - lib/migration_assist/class_methods.rb
87
121
  - lib/migration_assist/helper/file_name.rb
122
+ - lib/migration_assist/helper/migration.rb
88
123
  - lib/migration_assist/implementation.rb
89
124
  - lib/migration_assist/namespaces.rb
90
125
  - migration_assist.gemspec
@@ -120,17 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
155
  version: '0'
121
156
  requirements: []
122
157
  rubyforge_project:
123
- rubygems_version: 1.6.1
158
+ rubygems_version: 1.6.2
124
159
  signing_key:
125
160
  specification_version: 3
126
161
  summary: Assists in handling migrations
127
- test_files:
128
- - spec/generators/migration/migration_generator.rb
129
- - spec/load_spec.rb
130
- - spec/migration_assist/class_methods_spec.rb
131
- - spec/migration_assist/fixtures/001_migration_a.rb
132
- - spec/migration_assist/fixtures/002_migration_b.rb
133
- - spec/migration_assist/fixtures/003_migration_a.rb
134
- - spec/migration_assist/fixtures/004_migration_c.rb
135
- - spec/migration_assist/implementation_spec.rb
136
- - spec/spec_helper.rb
162
+ test_files: []