migration_assist 0.1.2 → 0.1.3

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/.document CHANGED
File without changes
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.markdown CHANGED
File without changes
data/Rakefile CHANGED
File without changes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
File without changes
File without changes
@@ -3,11 +3,17 @@
3
3
  # which provides the #next_migration_number class method that lets #migration_template work as expected
4
4
  #
5
5
  module Rails::Migration::Assist
6
+ class << self
7
+ attr_accessor :rails_root_dir
8
+ attr_accessor :orm
9
+ end
10
+
6
11
  def self.included(base) #:nodoc:
7
- base.extend ClassMethods
12
+ base.extend ClassMethods
8
13
  end
9
14
 
10
15
  module ClassMethods
16
+
11
17
  def migration_lookup_at(dirname) #:nodoc:
12
18
  Dir.glob("#{dirname}/[0-9]*_*.rb")
13
19
  end
@@ -28,7 +34,7 @@ module Rails::Migration::Assist
28
34
  end
29
35
 
30
36
  def next_migration_number(dirname) #:nodoc:
31
- orm = Rails.configuration.generators.options[:rails][:orm]
37
+ orm = Rails::Migration::Assist.orm || Rails.configuration.generators.options[:rails][:orm]
32
38
  require "rails/generators/#{orm}"
33
39
  "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname)
34
40
  rescue
@@ -1,8 +1,4 @@
1
- module Rails::Migration::Assist
2
- class << self
3
- attr_accessor :rails_root_dir
4
- end
5
-
1
+ module Rails::Migration::Assist
6
2
  module FileNameHelper
7
3
  def artifact_path name, type, dir=nil
8
4
  dir ||= send :"#{type}_dir"
@@ -40,7 +36,7 @@ module Rails::Migration::Assist
40
36
  end
41
37
 
42
38
  def root_dir
43
- dir = Migration::Assist.rails_root_dir
39
+ dir = Rails::Migration::Assist.rails_root_dir || Rails.root
44
40
  raise "You must set the Rails app root dir: Rails::Migration::Assist.rails_root_dir = '/my/root/dir'" if !dir
45
41
  dir
46
42
  end
File without changes
@@ -0,0 +1,6 @@
1
+ module Rails
2
+ module Migration
3
+ module Assist
4
+ end
5
+ end
6
+ end
@@ -1,10 +1,3 @@
1
1
  require 'require_all'
2
-
3
- module Rails
4
- module Migration
5
- module Assist
6
- end
7
- end
8
- end
9
-
2
+ require 'migration_assist/namespaces'
10
3
  require_all File.dirname(__FILE__) + '/migration_assist'
@@ -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.2"
8
+ s.version = "0.1.3"
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-08-19}
12
+ s.date = %q{2010-09-11}
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 = [
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/migration_assist/class_methods.rb",
31
31
  "lib/migration_assist/helper/file_name.rb",
32
32
  "lib/migration_assist/implementation.rb",
33
+ "lib/migration_assist/namespaces.rb",
33
34
  "migration_assist.gemspec",
34
35
  "spec/generators/migration_generator_spec.rb",
35
36
  "spec/load_spec.rb",
File without changes
data/spec/load_spec.rb CHANGED
File without changes
@@ -1,10 +1,11 @@
1
1
  require 'spec_helper'
2
- require 'rails'
3
2
 
4
3
  class TestGenerator
5
4
  include Rails::Migration::Assist
6
5
  end
7
6
 
7
+ Rails::Migration::Assist.orm = :active_record
8
+
8
9
  describe 'Migration Assist' do
9
10
  let(:dir) { fixtures_dir }
10
11
  let(:generator) { TestGenerator.new }
@@ -54,7 +55,8 @@ describe 'Migration Assist' do
54
55
  end
55
56
 
56
57
  describe '#next_migration_number' do
57
- it "should find next migration number 5" do
58
+ it "should find next migration number > 4" do
59
+ generator.class.next_migration_number(dir).to_i.should be > 4
58
60
  end
59
61
  end
60
62
  end
File without changes
File without changes
File without changes
File without changes
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
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-08-19 00:00:00 +02:00
17
+ date: 2010-09-11 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,7 @@ files:
72
72
  - lib/migration_assist/class_methods.rb
73
73
  - lib/migration_assist/helper/file_name.rb
74
74
  - lib/migration_assist/implementation.rb
75
+ - lib/migration_assist/namespaces.rb
75
76
  - migration_assist.gemspec
76
77
  - spec/generators/migration_generator_spec.rb
77
78
  - spec/load_spec.rb