hairtrigger 0.2.25 → 1.0.0

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
  SHA256:
3
- metadata.gz: 0537ad012af8bad34a62b81241c8517ac38fabeae279954e3e27ecc86e89cc9a
4
- data.tar.gz: fe75190bc7fb5b8d2956929f5e72d2b48b0dbc81b5bdd27eac6fd48ccedf81cb
3
+ metadata.gz: d99ce209cb3572d2bcc2987758e5887b203f3fdf50ef295b18169a9f030d0d3a
4
+ data.tar.gz: 8e79c7bf238ebb1339bdefce635eb47050d509faad270c4af88d39a7ba89a8a3
5
5
  SHA512:
6
- metadata.gz: f8df4419131442b648d2ed1a8315281e5d289638a228cf112882faacbcc27ebf5ca136474d1bf34d2b84e920187b23ec42365de67d1856112aa2449413571b52
7
- data.tar.gz: 97193387286d4ed659612eca3d4d4a3266965f259a95c15494a627e494904d7a48c3b40a705455400aa5fb65bb90219a1485fd5494d8f006b472e8ac690eca6e
6
+ metadata.gz: ffee9a6cac525abb8d0d7e49ec3f78877b54cdbfcaa77a2e2c5b6ac86d4b87401e02f0b54da8a62ebd8029d35ad7d0e798cdbcae34c9db429a4dea5d05aa8e51
7
+ data.tar.gz: d0c6a189591d1e0722fcbd72b51392efacd222734ae7da513f2f8da651f9c9ed5cf035174d6af04cb1206913873329cf3d8ec645d722810df86889030586ab96
@@ -1,5 +1,5 @@
1
1
  module HairTrigger
2
- VERSION = "0.2.25"
2
+ VERSION = "1.0.0"
3
3
 
4
4
  def VERSION.<=>(other)
5
5
  split(/\./).map(&:to_i) <=> other.split(/\./).map(&:to_i)
data/lib/hair_trigger.rb CHANGED
@@ -39,19 +39,14 @@ module HairTrigger
39
39
  end
40
40
 
41
41
  def migrator
42
- version = ActiveRecord::VERSION::STRING
43
- if version >= "6.0."
42
+ if ActiveRecord::VERSION::STRING >= "7.1."
43
+ connection = ActiveRecord::Tasks::DatabaseTasks.migration_connection
44
+ schema_migration = connection.schema_migration
45
+ migrations = ActiveRecord::MigrationContext.new(migration_path, schema_migration).migrations
46
+ ActiveRecord::Migrator.new(:up, migrations, schema_migration, ActiveRecord::InternalMetadata.new(connection))
47
+ else
44
48
  migrations = ActiveRecord::MigrationContext.new(migration_path, ActiveRecord::SchemaMigration).migrations
45
- elsif version >= "5.2."
46
- migrations = ActiveRecord::MigrationContext.new(migration_path).migrations
47
- else # version >= "4.0."
48
- migrations = ActiveRecord::Migrator.migrations(migration_path)
49
- end
50
-
51
- if version >= "6.0."
52
49
  ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration)
53
- else
54
- ActiveRecord::Migrator.new(:up, migrations)
55
50
  end
56
51
  end
57
52
 
@@ -82,7 +77,7 @@ module HairTrigger
82
77
  if previous_schema = (options.has_key?(:previous_schema) ? options[:previous_schema] : File.exist?(schema_rb_path) && File.read(schema_rb_path))
83
78
  base_triggers = MigrationReader.get_triggers(previous_schema, options)
84
79
  unless base_triggers.empty?
85
- version = (previous_schema =~ /ActiveRecord::Schema\.define\(.*?(\d+)\)/) && $1.to_i
80
+ version = (previous_schema =~ /ActiveRecord::Schema(\[\d\.\d\])?\.define\(version\: (.*)\)/) && $2.to_i
86
81
  migrations.unshift [OpenStruct.new({:version => version}), base_triggers]
87
82
  end
88
83
  end
@@ -200,8 +195,16 @@ end
200
195
  "#{migration_base_name}#{name_version}"
201
196
  end
202
197
 
198
+ def timestamped_migrations
199
+ if ActiveRecord::VERSION::STRING >= "7.0."
200
+ ActiveRecord.timestamped_migrations
201
+ else
202
+ ActiveRecord::Base.timestamped_migrations
203
+ end
204
+ end
205
+
203
206
  def infer_migration_version(migration_name)
204
- ActiveRecord::Base.timestamped_migrations ?
207
+ timestamped_migrations ?
205
208
  Time.now.getutc.strftime("%Y%m%d%H%M%S") :
206
209
  Dir.glob(migration_path + '/*rb').
207
210
  map{ |f| f.gsub(/.*\/(\d+)_.*/, '\1').to_i}.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hairtrigger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.25
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
11
+ date: 2022-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.0'
29
+ version: '6.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -83,7 +83,7 @@ homepage: http://github.com/jenseng/hair_trigger
83
83
  licenses:
84
84
  - MIT
85
85
  metadata: {}
86
- post_install_message:
86
+ post_install_message:
87
87
  rdoc_options: []
88
88
  require_paths:
89
89
  - lib
@@ -91,15 +91,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 2.3.0
94
+ version: 2.5.0
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.0.3
102
- signing_key:
101
+ rubygems_version: 3.3.3
102
+ signing_key:
103
103
  specification_version: 4
104
104
  summary: easy database triggers for active record
105
105
  test_files: []