mongoid_rails_migrations 0.0.14 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  .bundle
2
2
  .DS_Store
3
3
  .rvmrc
4
- log/
4
+ .idea
5
+ log/
6
+ .ruby-version
data/Gemfile.lock CHANGED
@@ -1,90 +1,104 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_rails_migrations (0.0.14)
5
- activesupport (>= 3.0.0)
4
+ mongoid_rails_migrations (1.0.0)
5
+ activesupport (>= 3.2.0)
6
6
  bundler (>= 1.0.0)
7
- rails (>= 3.0.0)
8
- railties (>= 3.0.0)
7
+ rails (>= 3.2.0)
8
+ railties (>= 3.2.0)
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- abstract (1.0.0)
14
- actionmailer (3.0.9)
15
- actionpack (= 3.0.9)
16
- mail (~> 2.2.19)
17
- actionpack (3.0.9)
18
- activemodel (= 3.0.9)
19
- activesupport (= 3.0.9)
20
- builder (~> 2.1.2)
21
- erubis (~> 2.6.6)
22
- i18n (~> 0.5.0)
23
- rack (~> 1.2.1)
24
- rack-mount (~> 0.6.14)
25
- rack-test (~> 0.5.7)
26
- tzinfo (~> 0.3.23)
27
- activemodel (3.0.9)
28
- activesupport (= 3.0.9)
29
- builder (~> 2.1.2)
30
- i18n (~> 0.5.0)
31
- activerecord (3.0.9)
32
- activemodel (= 3.0.9)
33
- activesupport (= 3.0.9)
34
- arel (~> 2.0.10)
35
- tzinfo (~> 0.3.23)
36
- activeresource (3.0.9)
37
- activemodel (= 3.0.9)
38
- activesupport (= 3.0.9)
39
- activesupport (3.0.9)
40
- arel (2.0.10)
41
- bson (1.3.1)
42
- builder (2.1.2)
43
- erubis (2.6.6)
44
- abstract (>= 1.0.0)
45
- i18n (0.5.0)
46
- mail (2.2.19)
47
- activesupport (>= 2.3.6)
13
+ actionmailer (3.2.8)
14
+ actionpack (= 3.2.8)
15
+ mail (~> 2.4.4)
16
+ actionpack (3.2.8)
17
+ activemodel (= 3.2.8)
18
+ activesupport (= 3.2.8)
19
+ builder (~> 3.0.0)
20
+ erubis (~> 2.7.0)
21
+ journey (~> 1.0.4)
22
+ rack (~> 1.4.0)
23
+ rack-cache (~> 1.2)
24
+ rack-test (~> 0.6.1)
25
+ sprockets (~> 2.1.3)
26
+ activemodel (3.2.8)
27
+ activesupport (= 3.2.8)
28
+ builder (~> 3.0.0)
29
+ activerecord (3.2.8)
30
+ activemodel (= 3.2.8)
31
+ activesupport (= 3.2.8)
32
+ arel (~> 3.0.2)
33
+ tzinfo (~> 0.3.29)
34
+ activeresource (3.2.8)
35
+ activemodel (= 3.2.8)
36
+ activesupport (= 3.2.8)
37
+ activesupport (3.2.8)
38
+ i18n (~> 0.6)
39
+ multi_json (~> 1.0)
40
+ arel (3.0.2)
41
+ builder (3.0.0)
42
+ erubis (2.7.0)
43
+ hike (1.2.1)
44
+ i18n (0.6.0)
45
+ journey (1.0.4)
46
+ json (1.7.5)
47
+ mail (2.4.4)
48
48
  i18n (>= 0.4.0)
49
49
  mime-types (~> 1.16)
50
50
  treetop (~> 1.4.8)
51
- mime-types (1.16)
52
- mongo (1.3.1)
53
- bson (>= 1.3.1)
54
- mongoid (2.0.2)
55
- activemodel (~> 3.0)
56
- mongo (~> 1.3)
51
+ mime-types (1.19)
52
+ mongoid (3.0.4)
53
+ activemodel (~> 3.1)
54
+ moped (~> 1.1)
55
+ origin (~> 1.0)
57
56
  tzinfo (~> 0.3.22)
58
- polyglot (0.3.1)
59
- rack (1.2.3)
60
- rack-mount (0.6.14)
61
- rack (>= 1.0.0)
62
- rack-test (0.5.7)
57
+ moped (1.2.0)
58
+ multi_json (1.3.6)
59
+ origin (1.0.6)
60
+ polyglot (0.3.3)
61
+ rack (1.4.1)
62
+ rack-cache (1.2)
63
+ rack (>= 0.4)
64
+ rack-ssl (1.3.2)
65
+ rack
66
+ rack-test (0.6.1)
63
67
  rack (>= 1.0)
64
- rails (3.0.9)
65
- actionmailer (= 3.0.9)
66
- actionpack (= 3.0.9)
67
- activerecord (= 3.0.9)
68
- activeresource (= 3.0.9)
69
- activesupport (= 3.0.9)
68
+ rails (3.2.8)
69
+ actionmailer (= 3.2.8)
70
+ actionpack (= 3.2.8)
71
+ activerecord (= 3.2.8)
72
+ activeresource (= 3.2.8)
73
+ activesupport (= 3.2.8)
70
74
  bundler (~> 1.0)
71
- railties (= 3.0.9)
72
- railties (3.0.9)
73
- actionpack (= 3.0.9)
74
- activesupport (= 3.0.9)
75
+ railties (= 3.2.8)
76
+ railties (3.2.8)
77
+ actionpack (= 3.2.8)
78
+ activesupport (= 3.2.8)
79
+ rack-ssl (~> 1.3.2)
75
80
  rake (>= 0.8.7)
76
81
  rdoc (~> 3.4)
77
- thor (~> 0.14.4)
78
- rake (0.9.2)
79
- rdoc (3.6.1)
80
- thor (0.14.6)
81
- treetop (1.4.9)
82
+ thor (>= 0.14.6, < 2.0)
83
+ rake (0.9.2.2)
84
+ rdoc (3.12)
85
+ json (~> 1.4)
86
+ sprockets (2.1.3)
87
+ hike (~> 1.2)
88
+ rack (~> 1.0)
89
+ tilt (~> 1.1, != 1.3.0)
90
+ test-unit (2.5.1)
91
+ thor (0.16.0)
92
+ tilt (1.3.3)
93
+ treetop (1.4.10)
94
+ polyglot
82
95
  polyglot (>= 0.3.1)
83
- tzinfo (0.3.28)
96
+ tzinfo (0.3.33)
84
97
 
85
98
  PLATFORMS
86
99
  ruby
87
100
 
88
101
  DEPENDENCIES
89
- mongoid (>= 2.0.0)
102
+ mongoid (>= 3.0.0)
90
103
  mongoid_rails_migrations!
104
+ test-unit (>= 2.5.0)
data/README.rdoc CHANGED
@@ -1,21 +1,20 @@
1
1
  == RELEASE NOTES
2
- * Rails 3.1 compatible
2
+ * Rails 3.2 compatible
3
3
 
4
4
  == SYNOPSIS
5
5
  * Data migrations for Mongoid.
6
6
 
7
7
  == MIGRATE WHEN ...
8
- * You need to rearrange data
9
8
  * The migrating is good
10
9
 
11
10
  == REQUIREMENTS
12
- * rails ~> 3.0.0
13
- * mongoid ~> 2.0.0 (this isn't currently enforced)
11
+ * rails ~> 3.2.0
12
+ * mongoid ~> 3.0.0
14
13
 
15
14
  == INSTALL
16
15
  * gem install mongoid_rails_migrations
17
16
  * In your Gemfile, include (after including mongoid):
18
- gem "mongoid_rails_migrations", "0.0.13"
17
+ gem "mongoid_rails_migrations", <current_version>
19
18
 
20
19
  == FEATURES AND HOW TO USE
21
20
  * generator:
@@ -31,19 +30,17 @@
31
30
  * db:reseed (handled by mongoid)
32
31
  * db:version
33
32
 
34
- == NOTES
35
- * Only tested with ruby 1.9.2
36
-
37
33
  == CREDITS TO
38
34
  * rails
39
35
  * mongoid
36
+ * contributions from the community (git log)
40
37
 
41
38
  Much of this gem simply modifies existing code from both projects.
42
39
  With that out of the way, on to the license.
43
40
 
44
41
  == LICENSE (MIT)
45
42
 
46
- Copyright © 2010: Alan Da Costa
43
+ Copyright © 2012: Alan Da Costa
47
44
 
48
45
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'),
49
46
  to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
@@ -144,7 +144,7 @@ module Mongoid #:nodoc
144
144
 
145
145
  def connection
146
146
  # ActiveRecord::Base.connection
147
- Mongoid.database
147
+ ::Mongoid.default_session
148
148
  end
149
149
 
150
150
  def method_missing(method, *arguments, &block)
@@ -0,0 +1,3 @@
1
+ module MongoidRailsMigrations #:nodoc:
2
+ VERSION = '1.0.0'
3
+ end
@@ -6,6 +6,7 @@ Bundler.require(:mongoid_rails_migrations)
6
6
  $:.unshift(File.dirname(__FILE__)) unless
7
7
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
8
8
 
9
+ require 'mongoid_rails_migrations/version'
9
10
  require 'mongoid_rails_migrations/models/data_migration'
10
11
  require 'mongoid_rails_migrations/mongoid_ext/mongoid'
11
12
  require 'mongoid_rails_migrations/mongoid_ext/railtie'
@@ -1,5 +1,4 @@
1
- require 'rails/generators/named_base'
2
- require 'rails/generators/migration'
1
+ require 'rails/generators'
3
2
 
4
3
  module Mongoid #:nodoc:
5
4
  module Generators #:nodoc:
@@ -11,17 +10,17 @@ module Mongoid #:nodoc:
11
10
  def self.source_root
12
11
  File.expand_path("../../#{base_name}/#{generator_name}/templates", __FILE__)
13
12
  end
14
-
13
+
15
14
  # Implement the required interface for Rails::Generators::Migration.
16
15
  def self.next_migration_number(dirname) #:nodoc:
17
16
  next_migration_number = current_migration_number(dirname) + 1
18
- if Mongoid.config.timestamped_migrations
17
+ if Mongoid.configure.timestamped_migrations
19
18
  [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
20
19
  else
21
20
  "%.3d" % next_migration_number
22
21
  end
23
22
  end
24
-
23
+
25
24
  end
26
- end
25
+ end
27
26
  end
@@ -1,29 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), 'lib', 'mongoid_rails_migrations', 'version')
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.platform = Gem::Platform::RUBY
3
5
  s.name = 'mongoid_rails_migrations'
4
- s.version = '0.0.14'
6
+ s.version = MongoidRailsMigrations::VERSION
5
7
  s.summary = 'Data migrations for Mongoid in Active Record style, minus column input.'
6
8
  s.description = 'Migrations for the migrator.'
7
9
 
8
10
  # only tested with 1.9.1, but let's go for it
9
11
  s.required_ruby_version = '>= 1.8.6'
10
- s.required_rubygems_version = ">= 1.3.6"
12
+ s.required_rubygems_version = '>= 1.3.6'
11
13
 
12
14
  s.author = 'Alan Da Costa'
13
15
  s.email = 'alandacosta@gmail.com.com'
14
- s.date = %q{2010-05-12}
16
+ s.date = %q{2012-09-04}
15
17
  s.homepage = 'http://github.com/adacosta/mongoid_rails_migrations'
16
-
17
- s.require_paths = ["lib"]
18
+
19
+ s.require_paths = ['lib']
18
20
  s.files = Dir['.gitignore', 'Gemfile', 'Gemfile.lock', 'Rakefile', 'README.rdoc', 'mongoid_rails_migrations.gemspec', 'lib/**/*']
19
21
  s.test_files = Dir['test/**/*']
20
22
  s.has_rdoc = false
21
-
22
- rails_version = '>= 3.0.0'
23
-
23
+
24
+ rails_version = '>= 3.2.0'
25
+
24
26
  s.add_dependency('bundler', '>= 1.0.0')
25
27
  s.add_dependency('rails', rails_version)
26
28
  s.add_dependency('railties', rails_version)
27
29
  s.add_dependency('activesupport', rails_version)
28
- s.add_development_dependency( "mongoid", ">= 2.0.0")
30
+ s.add_development_dependency('mongoid', '>= 3.0.0')
31
+ s.add_development_dependency('test-unit', '>= 2.5.0')
29
32
  end
data/test/config.rb CHANGED
@@ -1,13 +1,9 @@
1
1
  require File.join(File.dirname(__FILE__), '..', 'lib', 'mongoid_rails_migrations')
2
2
  require File.join(File.dirname(__FILE__), '..', 'lib', 'rails', 'generators', 'mongoid', 'mongoid_generator')
3
3
 
4
- Mongoid.configure do |config|
5
- name = "mongoid_test"
6
- host = "localhost"
7
- config.master = Mongo::Connection.new.db(name)
8
- end
4
+ Mongoid.configure.connect_to('mongoid_test')
9
5
 
10
6
  # require all models
11
- Dir[ File.join(File.dirname(__FILE__), 'models', '*.rb') ].each {|file| require file }
7
+ Dir[File.join(File.dirname(__FILE__), 'models', '*.rb')].each { |file| require file }
12
8
 
13
9
  MIGRATIONS_ROOT = File.join(File.dirname(__FILE__), 'migrations')
data/test/helper.rb CHANGED
@@ -31,6 +31,3 @@ end
31
31
 
32
32
  # TestMongoidRailsMigrations::Application.initialize!
33
33
  TestMongoidRailsMigrations::Application.load_tasks
34
-
35
- # test overrides (dummy path); Rails is really looking for the app environment.rb
36
- Rails.configuration.paths.config.environment = 'test/config.rb'
@@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/helper'
3
3
  class Mongoid::Migration
4
4
  class <<self
5
5
  attr_accessor :message_count
6
+
6
7
  def puts(text="")
7
8
  self.message_count ||= 0
8
9
  self.message_count += 1
@@ -16,7 +17,7 @@ module Mongoid
16
17
  def setup
17
18
  Mongoid::Migration.verbose = true
18
19
  # same as db:drop command in lib/mongoid_rails_migrations/mongoid_ext/railties/database.rake
19
- Mongoid.master.collections.each {|col| col.drop_indexes && col.drop unless ['system.indexes', 'system.users'].include?(col.name) }
20
+ Mongoid.default_session.drop
20
21
  end
21
22
 
22
23
  def teardown; end
@@ -122,7 +123,7 @@ module Mongoid
122
123
  end
123
124
 
124
125
  def test_default_state_of_timestamped_migrations
125
- assert Mongoid.config.timestamped_migrations, "Mongoid.config.timestamped_migrations should default to true"
126
+ assert Mongoid.configure.timestamped_migrations, "Mongoid.configure.timestamped_migrations should default to true"
126
127
  end
127
128
 
128
129
  def test_timestamped_migrations_generates_non_sequential_next_number
@@ -131,7 +132,7 @@ module Mongoid
131
132
  end
132
133
 
133
134
  def test_turning_off_timestamped_migrations
134
- Mongoid.config.timestamped_migrations = false
135
+ Mongoid.configure.timestamped_migrations = false
135
136
  next_number = Mongoid::Generators::Base.next_migration_number(MIGRATIONS_ROOT + "/valid")
136
137
  assert_equal "20100513063903", next_number
137
138
  end
metadata CHANGED
@@ -1,82 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mongoid_rails_migrations
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
4
5
  prerelease:
5
- version: 0.0.14
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Alan Da Costa
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2010-05-12 00:00:00 -07:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: bundler
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2160347300 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 1.0.0
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rails
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2160347300
25
+ - !ruby/object:Gem::Dependency
26
+ name: rails
27
+ requirement: &2160345860 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 3.0.0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 3.2.0
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: railties
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2160345860
36
+ - !ruby/object:Gem::Dependency
37
+ name: railties
38
+ requirement: &2160345040 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 3.0.0
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 3.2.0
47
44
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: activesupport
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *2160345040
47
+ - !ruby/object:Gem::Dependency
48
+ name: activesupport
49
+ requirement: &2160343960 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 3.0.0
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
58
55
  type: :runtime
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
56
+ prerelease: false
57
+ version_requirements: *2160343960
58
+ - !ruby/object:Gem::Dependency
61
59
  name: mongoid
60
+ requirement: &2160342880 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 3.0.0
66
+ type: :development
62
67
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
68
+ version_requirements: *2160342880
69
+ - !ruby/object:Gem::Dependency
70
+ name: test-unit
71
+ requirement: &2160341780 !ruby/object:Gem::Requirement
64
72
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: 2.0.0
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 2.5.0
69
77
  type: :development
70
- version_requirements: *id005
78
+ prerelease: false
79
+ version_requirements: *2160341780
71
80
  description: Migrations for the migrator.
72
81
  email: alandacosta@gmail.com.com
73
82
  executables: []
74
-
75
83
  extensions: []
76
-
77
84
  extra_rdoc_files: []
78
-
79
- files:
85
+ files:
80
86
  - .gitignore
81
87
  - Gemfile
82
88
  - Gemfile.lock
@@ -88,6 +94,7 @@ files:
88
94
  - lib/mongoid_rails_migrations/mongoid_ext/mongoid.rb
89
95
  - lib/mongoid_rails_migrations/mongoid_ext/railtie.rb
90
96
  - lib/mongoid_rails_migrations/mongoid_ext/railties/database.rake
97
+ - lib/mongoid_rails_migrations/version.rb
91
98
  - lib/mongoid_rails_migrations.rb
92
99
  - lib/rails/generators/mongoid/migration/migration_generator.rb
93
100
  - lib/rails/generators/mongoid/migration/templates/migration.rb
@@ -102,35 +109,31 @@ files:
102
109
  - test/migrations/valid/20100513054656_add_baseline_survey_schema.rb
103
110
  - test/migrations/valid/20100513063902_add_improvement_plan_survey_schema.rb
104
111
  - test/models/survey_schema.rb
105
- has_rdoc: true
106
112
  homepage: http://github.com/adacosta/mongoid_rails_migrations
107
113
  licenses: []
108
-
109
114
  post_install_message:
110
115
  rdoc_options: []
111
-
112
- require_paths:
116
+ require_paths:
113
117
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
118
+ required_ruby_version: !ruby/object:Gem::Requirement
115
119
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
119
123
  version: 1.8.6
120
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
125
  none: false
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
125
129
  version: 1.3.6
126
130
  requirements: []
127
-
128
131
  rubyforge_project:
129
- rubygems_version: 1.6.2
132
+ rubygems_version: 1.8.10
130
133
  signing_key:
131
134
  specification_version: 3
132
135
  summary: Data migrations for Mongoid in Active Record style, minus column input.
133
- test_files:
136
+ test_files:
134
137
  - test/config.rb
135
138
  - test/helper.rb
136
139
  - test/migration_test.rb