active_record_migrations 4.0.0.0.pre.optimistic → 4.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5c8a81eb9fe55bd7b1ef8e4af6126cd8d7771f4
4
- data.tar.gz: af1237a86da35f8cb2b7fcafe41040a2a10713d7
3
+ metadata.gz: cf33226909efd3e751235683e135cb4be1e21429
4
+ data.tar.gz: 7b53898aeb54800aa143b2aeb87b382b8332a9cf
5
5
  SHA512:
6
- metadata.gz: 8e613099dcb5eebd5b023188da866fb01260422d938d62646c29cab8a9354d963a1e934074c1f7910ae4df0bb1c40aee21a3fb0d9527c082a744617ba694f45d
7
- data.tar.gz: 9c291428efabd3596a3d507b5b8571b29eb22d9ff797c67996b299275fb70d2f98c4fb5f5443c322cf196b4b6a62e13a28d1f8f11d13519c90d45b6b27873ae4
6
+ metadata.gz: 484d935fd8708ab1d067f376e6b0c8a03d30ae641f3abdde7505b67bd635622c5cf0985d3b865c24f7d1ca2fccbdde826aa337064f4594ec04f4e1fbca4dbc2c
7
+ data.tar.gz: 4d9523e66f9190c893ce5aa5df2bcda2caa648a39a123d04fdb26cb1b673f2f9339609e981b6525d957648d7b47e1ceb4a5e775a266b22f60bc3cfce2524dcae
data/README.md CHANGED
@@ -2,19 +2,11 @@
2
2
 
3
3
  Allows you to use ActiveRecord migrations in non-Rails projects.
4
4
 
5
- This branch is for the _optimistic_ version, assuming the internals of AR migrations we rely on
6
- won't change until the next major version. However, we can't really promiss the related AR
7
- migrations code won't change in minor or patch versions of AR. That's why we can't release this
8
- branch as a final version.
9
-
10
- But at least you should be able to try it with basically any AR version in case you have to deal
11
- with conflicts.
12
-
13
5
  ## Installation
14
6
 
15
7
  Add this line to your application's Gemfile (run `bundle init` if you don't have one):
16
8
 
17
- gem 'active_record_migrations', '4.0.0.0.pre.optimistic'
9
+ gem 'active_record_migrations'
18
10
  gem 'sqlite3' # or 'pg', 'mysql2', ...
19
11
 
20
12
  And then execute:
@@ -31,7 +23,6 @@ Create a Rakefile:
31
23
  By default, your database configurations will be read from `db/config.yml` and your migration files
32
24
  will be created under `db/migrate`. If you want to keep with the defaults, create your `db/config.yml`:
33
25
 
34
- ```yaml
35
26
  development:
36
27
  adapter: postgresql
37
28
  database: my_db
@@ -45,24 +36,21 @@ will be created under `db/migrate`. If you want to keep with the defaults, creat
45
36
  database: db/test.sqlite3
46
37
  pool: 5
47
38
  timeout: 5000
48
- ```
49
-
50
- If you prefer to specify your settings in plain Ruby, add this to your Rakefile,
51
- before calling `ActiveRecordMigrations.load_taks`:
52
-
53
- ```ruby
54
- ActiveRecordMigrations.configure do |c|
55
- c.database_configuration = {
56
- 'development' => {'adapter' => 'sqlite3', 'database' => 'db/custom.sqlite3'},
57
- }
58
- # Other settings:
59
- c.schema_format = :sql # default is :ruby
60
- # c.yaml_config = 'db/config.yml'
61
- # c.environment = ENV['db']
62
- # c.db_dir = 'db'
63
- # c.migrations_paths = ['db/migrate'] # the first entry will be used by the generator
64
- end
65
- ```
39
+
40
+ If you prefer to specify your settings in plain Ruby, add this to your Rakefile:
41
+
42
+ ```ruby
43
+ ActiveRecordMigrations.configure do |c|
44
+ c.database_configuration = {
45
+ 'development' => {'adapter' => 'sqlite3', 'database' => 'db/custom.sqlite3'},
46
+ }
47
+ # Other settings:
48
+ c.schema_format = :sql # default is :ruby
49
+ # c.yaml_config = 'db/config.yml'
50
+ # c.environment = ENV['db']
51
+ # c.db_dir = 'db'
52
+ end
53
+ ```
66
54
 
67
55
  Take a look at the [Migrations Guide](http://guides.rubyonrails.org/migrations.html) for more details.
68
56
 
@@ -77,13 +65,6 @@ You can specify the environment by setting the `db` environment variable:
77
65
 
78
66
  rake db:migrate db=production
79
67
 
80
- ## Versioning
81
-
82
- For final releases, the version follows ActiveRecord versions plus a patch version from our own.
83
- For instance, if AR version is 4.0.1, this gem will be versioned 4.0.1.x with x starting in 0.
84
-
85
- This branch however won't use pessimistic locking so that you have some flexibility if you need.
86
-
87
68
  ## Contributing
88
69
 
89
70
  1. Fork it
@@ -91,3 +72,4 @@ This branch however won't use pessimistic locking so that you have some flexibil
91
72
  3. Commit your changes (`git commit -am 'Add some feature'`)
92
73
  4. Push to the branch (`git push origin my-new-feature`)
93
74
  5. Create new Pull Request
75
+
@@ -18,16 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler"
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_dependency "rake"
23
- # We rely on a kind of monkey patch for allowing us to override the migrations path.
24
- # The final releases fix on an specific version of AR and check if the override of
25
- # ActiveRecord::Generators::MigrationGenerator#create_migration_file is correct
26
- # before upgrading AR dependency. See ARM::Generators::MigrationGenerator impl.
27
- # The "optimistic" versions allow more flexibility to support other AR versions but
28
- # on the other side we can't really guarantee that it will actually work since it depends
29
- # on internal implementation of AR migrations that could change any time.
30
- spec.add_dependency "railties", "~> 4.0"
31
- spec.add_dependency "activerecord", "~> 4.0"
23
+ spec.add_dependency "railties", "~> 4.0.0"
24
+ spec.add_dependency "activerecord", "~> 4.0.0"
32
25
  end
33
26
 
@@ -1,9 +1,9 @@
1
1
  require "active_record_migrations/version"
2
2
  require 'active_record'
3
3
  require 'active_record/tasks/database_tasks'
4
- require 'rails'
4
+ require 'active_record/railtie'
5
5
  require 'rails/application'
6
- require 'active_record_migrations/configurations'
6
+ require_relative 'active_record_migrations/configurations'
7
7
 
8
8
  module ActiveRecordMigrations
9
9
  include ActiveRecord::Tasks
@@ -16,7 +16,7 @@ module ActiveRecordMigrations
16
16
  def self.load_tasks
17
17
  create_rails_app_if_not_exists
18
18
 
19
- load "active_record/railties/databases.rake"
19
+ ActiveRecord::Railtie.run_tasks_blocks Rails.application
20
20
  load 'active_record_migrations/tasks/new_migration.rake'
21
21
 
22
22
  ActiveRecord::Base.schema_format = configurations.schema_format
@@ -26,8 +26,6 @@ module ActiveRecordMigrations
26
26
  configurations.database_configuration
27
27
  DatabaseTasks.current_config = configurations.database_configuration[configurations.environment]
28
28
  DatabaseTasks.db_dir = configurations.db_dir
29
- DatabaseTasks.migrations_paths = configurations.migrations_paths
30
- DatabaseTasks.root = Rails.root
31
29
  end
32
30
 
33
31
  private
@@ -1,18 +1,16 @@
1
1
  require 'singleton'
2
2
  require 'yaml'
3
- require 'erb'
4
3
 
5
4
  module ActiveRecordMigrations
6
5
  class Configurations
7
6
  include Singleton
8
7
 
9
- attr_accessor :yaml_config, :database_configuration, :environment, :db_dir, :migrations_paths, :schema_format, :seed_loader
8
+ attr_accessor :yaml_config, :database_configuration, :environment, :db_dir, :schema_format, :seed_loader
10
9
 
11
10
  def initialize
12
11
  @yaml_config = 'db/config.yml'
13
12
  @environment = ENV['db'] || Rails.env
14
13
  @db_dir = 'db'
15
- @migrations_paths = ['db/migrate']
16
14
  @schema_format = :ruby # or :sql
17
15
  @seed_loader = Rails.application
18
16
  end
@@ -20,7 +18,7 @@ module ActiveRecordMigrations
20
18
  alias configure instance_eval
21
19
 
22
20
  def database_configuration
23
- @database_configuration ||= YAML.load(ERB.new(File.read @yaml_config).result)
21
+ @database_configuration ||= YAML.load(File.read @yaml_config)
24
22
  end
25
23
  end
26
24
  end
@@ -2,13 +2,16 @@ require 'rails/generators'
2
2
  require 'active_record'
3
3
  require 'active_record/tasks/database_tasks'
4
4
  require 'active_record_migrations/configurations'
5
- require 'active_record_migrations/generators/migration'
5
+
6
+ Rake::Task['db:load_config'].clear
6
7
 
7
8
  task environment: 'db:load_config' do
8
9
  ActiveRecord::Base.establish_connection ActiveRecord::Tasks::DatabaseTasks.current_config
9
10
  end
10
11
 
11
12
  namespace :db do
13
+ task(:load_config){} # db tasks depend on load_config
14
+
12
15
  desc "Creates a new migration file with the specified name"
13
16
  task :new_migration, :name, :options do |t, args|
14
17
  name = args[:name] || ENV['name']
@@ -26,9 +29,7 @@ namespace :db do
26
29
  end
27
30
  params = [name]
28
31
  params.concat options.split(' ') if options
29
- #Rails::Generators.invoke "active_record:migration", params,
30
- Rails::Generators.invoke "active_record_migrations:migration", params,
31
- behavior: :invoke, destination_root: Rails.root
32
+ Rails::Generators.invoke "active_record:migration", params, behavior: :invoke, destination_root: Rails.root
32
33
  end
33
34
  end
34
35
 
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordMigrations
2
- VERSION = "4.0.0.0-optimistic"
2
+ VERSION = "4.0.0.1"
3
3
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.0.pre.optimistic
4
+ version: 4.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Rosenfeld Rosas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2013-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: railties
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: 4.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: 4.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activerecord
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '4.0'
61
+ version: 4.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '4.0'
68
+ version: 4.0.0
69
69
  description: ActiveRecord Stand-alone migrations
70
70
  email:
71
71
  - rr.rosas@gmail.com
@@ -73,7 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
76
+ - .gitignore
77
77
  - Gemfile
78
78
  - LICENSE.txt
79
79
  - README.md
@@ -81,7 +81,6 @@ files:
81
81
  - active_record_migrations.gemspec
82
82
  - lib/active_record_migrations.rb
83
83
  - lib/active_record_migrations/configurations.rb
84
- - lib/active_record_migrations/generators/migration.rb
85
84
  - lib/active_record_migrations/tasks/new_migration.rake
86
85
  - lib/active_record_migrations/version.rb
87
86
  homepage: http://github.com/rosenfeld/active_record_migrations
@@ -94,19 +93,18 @@ require_paths:
94
93
  - lib
95
94
  required_ruby_version: !ruby/object:Gem::Requirement
96
95
  requirements:
97
- - - ">="
96
+ - - '>='
98
97
  - !ruby/object:Gem::Version
99
98
  version: '0'
100
99
  required_rubygems_version: !ruby/object:Gem::Requirement
101
100
  requirements:
102
- - - ">"
101
+ - - '>='
103
102
  - !ruby/object:Gem::Version
104
- version: 1.3.1
103
+ version: '0'
105
104
  requirements: []
106
105
  rubyforge_project:
107
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.0.3
108
107
  signing_key:
109
108
  specification_version: 4
110
109
  summary: Use AR migrations from outside of a Rails project
111
110
  test_files: []
112
- has_rdoc:
@@ -1,18 +0,0 @@
1
- require 'rails/generators/active_record/migration/migration_generator'
2
- require 'active_record/tasks/database_tasks'
3
-
4
- module ActiveRecordMigrations
5
- module Generators
6
- class MigrationGenerator < ::ActiveRecord::Generators::MigrationGenerator
7
- source_root ::ActiveRecord::Generators::MigrationGenerator.source_root
8
-
9
- def create_migration_file
10
- set_local_assigns!
11
- validate_file_name!
12
- dir = ::ActiveRecord::Tasks::DatabaseTasks.migrations_paths.first
13
- migration_template @migration_template, "#{dir}/#{file_name}.rb"
14
- end
15
- end
16
- end
17
- end
18
-