activerecord-compatible_legacy_migration 0.1.0 → 0.1.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: c20db8f64d5f935c8eb0697e021166e45ed2f466
4
- data.tar.gz: c84c6e3eec65de8482dccc81857cc72049333b2a
3
+ metadata.gz: 45fa2ddc38dc64b7b0e45adaa5e5482c0af8d7ab
4
+ data.tar.gz: 9b8a00afc7a04d6f37f0a6abc764badb0807aae4
5
5
  SHA512:
6
- metadata.gz: 3ca65d0b9678a7209026c647ddd2b6d681e1e727ccf7708834f55c21fa993ab1add7670b0edb0f34eddad115b2e73cb92824dd14b4fc579449bbea93ef516906
7
- data.tar.gz: fc25ccc5697bda66010fa73f20c0380d42d2e22163aa6392ef01e0d0f43e4fbda97ca812f1d7e7ad8d1d37709e6a619653afe8bf40a311fbbcac98ccffbe6704
6
+ metadata.gz: 59192be9d497c2e40bd6322d5f970013ed10796b6a9f04ed007403c92fe5ae40dcc91191a4131b4ff63199bcdd7da847c3b3e0becd77cef8de5cb89c1f1d35b9
7
+ data.tar.gz: eae36152f416a2937e2a80e7b7d7d2c75fabbb60cca08e4d57e132d915feade62a4eb216d9aa81dbf28a7aac90b94dcd440df6456027a581a2352cd868b58bda
@@ -1,5 +1,11 @@
1
1
  ## unreleased
2
- [full changelog](http://github.com/sue445/rubicure/compare/v0.1.0...master)
2
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.1.1...master)
3
+
4
+ ## v0.1.1
5
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.1.0...v0.1.1)
6
+
7
+ * Add default_version to configuration
8
+ * https://github.com/sue445/activerecord-compatible_legacy_migration/pull/4
3
9
 
4
10
  ## v0.1.0
5
11
  * first release
data/README.md CHANGED
@@ -42,8 +42,27 @@ class CreateUsers < ActiveRecord::CompatibleLegacyMigration.migration_class
42
42
  end
43
43
  ```
44
44
 
45
+ `ActiveRecord::CompatibleLegacyMigration.migration_class` returns `ActiveRecord::Migration` when `activerecord` 4.x
46
+ and returns `ActiveRecord::Migration[4.2]` when `activerecord` 5.0+
47
+
45
48
  see [ActiveRecord::CompatibleLegacyMigration](lib/active_record/compatible_legacy_migration.rb)
46
49
 
50
+ ## Configurations
51
+ ### Usage
52
+ ```ruby
53
+ ActiveRecord::CompatibleLegacyMigration.config.default_version = 4.2
54
+ ```
55
+
56
+ or
57
+
58
+ ```ruby
59
+ ActiveRecord::CompatibleLegacyMigration.configure do |config|
60
+ config.default_version = 4.2
61
+ end
62
+ ```
63
+
64
+ * `default_version` : default migration version for `activerecord` 5.0+ (default: `4.2`)
65
+
47
66
  ## Development
48
67
 
49
68
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,11 +1,20 @@
1
1
  require "active_record/compatible_legacy_migration/version"
2
+ require "active_record/compatible_legacy_migration/configuration"
2
3
  require "active_record"
3
4
 
4
5
  module ActiveRecord
5
6
  module CompatibleLegacyMigration
7
+ def self.config
8
+ @config ||= Configuration.new
9
+ end
10
+
11
+ def self.configure
12
+ yield config if block_given?
13
+ end
14
+
6
15
  def self.migration_class
7
16
  if ActiveRecord::VERSION::MAJOR >= 5
8
- ActiveRecord::Migration[4.2]
17
+ ActiveRecord::Migration[config.default_version]
9
18
  else
10
19
  ActiveRecord::Migration
11
20
  end
@@ -0,0 +1,17 @@
1
+ module ActiveRecord
2
+ module CompatibleLegacyMigration
3
+ require "active_support/configurable"
4
+
5
+ class Configuration
6
+ DEFAULT_VERSION = 4.2
7
+
8
+ include ActiveSupport::Configurable
9
+
10
+ config_accessor :default_version
11
+
12
+ configure do |config|
13
+ config.default_version = DEFAULT_VERSION
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module CompatibleLegacyMigration
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-compatible_legacy_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-04 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -146,6 +146,7 @@ files:
146
146
  - gemfiles/activerecord_4_2.gemfile
147
147
  - gemfiles/activerecord_5_0.gemfile
148
148
  - lib/active_record/compatible_legacy_migration.rb
149
+ - lib/active_record/compatible_legacy_migration/configuration.rb
149
150
  - lib/active_record/compatible_legacy_migration/version.rb
150
151
  - lib/activerecord-compatible_legacy_migration.rb
151
152
  homepage: https://github.com/sue445/activerecord-compatible_legacy_migration