migration_signature 0.2.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aa4f1083e48de2aaa45a2639d9d8729856744028729cfe7d44dbd915e124931
4
- data.tar.gz: 93a74936010c03f4a0b8457c712818bd9ca639be9dd4d2388b05dfbcbd9f5c75
3
+ metadata.gz: 2edd749990c5f6c301d5f85eedb68615d75680aef18f98e074857719e2cd4a1a
4
+ data.tar.gz: 3fb0a330f129afceb689f9908e96d158d3b45c1ed045a285dc6993abcab3336a
5
5
  SHA512:
6
- metadata.gz: 972796d9e80b429fde40c72dda06ab77d519f3559b23c0a6d14602b90f88382b3eb3c5fc2b64626b3140d18d9d96a3d30f0001eabdb748c3ec7645cd413f8cfa
7
- data.tar.gz: 70d28e646946b9004a1f60d69d00f2fc83363963c589e062ac47ff38a31df39f5f016ec7678a17cb827c7693bea152249dd38127b60fc6c086b5c33ded68df54
6
+ metadata.gz: 4959e4fce7a4089331c4eae6e4f2a4626e68203412fe75c71375df86a795e1eab875a2720ee03694848d8fb531a5cb6773da630f6c194761cd83a15121dbe61f
7
+ data.tar.gz: 8f311af665af2d4c590da3cbad8bf38d1b6879a4390e5ee2d2f5417a4da064ba42fbb238dbe4f510bd21e12125db46f1ce36614170acff8a1fc90c61bd8cd497
@@ -6,11 +6,9 @@ require 'optparse'
6
6
 
7
7
  OptionParser.new do |parser|
8
8
  parser.banner = <<~BANNER
9
- Usage: migration_signature {check|buildall|build <file>}
9
+ Usage: migration_signature {check}
10
10
 
11
11
  check - Check all your migration files for present and correct migration signatures
12
- buildall - Rebuild all migration signatures for all files (should only be used in setup)
13
- build <file> - Rebuild a migration signature for a single migration
14
12
 
15
13
  BANNER
16
14
 
@@ -22,7 +20,7 @@ end.parse!
22
20
 
23
21
  action = ARGV[0]
24
22
  unless action
25
- warn 'You must supply one of {check|buildall|build <file>}'
23
+ warn 'You must supply one of {check}'
26
24
  exit 1
27
25
  end
28
26
 
@@ -33,18 +31,7 @@ if action == 'check'
33
31
  warn e.message
34
32
  exit 1
35
33
  end
36
- elsif action == 'buildall'
37
- MigrationSignature.build_all
38
- elsif action == 'build'
39
- file = ARGV[1]
40
-
41
- unless file
42
- warn 'You must supply a file to build a signature for'
43
- exit 1
44
- end
45
-
46
- MigrationSignature.build_file(file)
47
34
  else
48
- warn 'You must supply one of {check|buildall|build <file>}'
35
+ warn 'You must supply one of {check}'
49
36
  exit 1
50
37
  end
@@ -72,7 +72,7 @@ module MigrationSignature
72
72
  end
73
73
 
74
74
  def source_signature
75
- Digest::MD5.hexdigest(Parser::CurrentRuby.parse(lines.join).inspect)
75
+ Digest::MD5.hexdigest(SourceParser.parse(lines.join).inspect)
76
76
  end
77
77
 
78
78
  def signature?
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MigrationSignature
4
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.4')
5
+ require 'prism'
6
+
7
+ SourceParser = Prism::Translation::ParserCurrent
8
+ else
9
+ require 'parser/current'
10
+
11
+ SourceParser = Parser::CurrentRuby
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MigrationSignature
4
- VERSION = '0.2.0'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'parser/current'
4
3
  require 'digest/md5'
4
+ require_relative './migration_signature/source_parser'
5
5
  require_relative './migration_signature/config'
6
6
  require_relative './migration_signature/migration_file'
7
7
  require_relative './migration_signature/railtie' if defined?(Rails)
@@ -21,12 +21,6 @@ module MigrationSignature
21
21
  true
22
22
  end
23
23
 
24
- def self.build_all
25
- config.all_runnable_files.each do |path|
26
- MigrationSignature::MigrationFile.new(path).update_signature!
27
- end
28
- end
29
-
30
24
  def self.build_file(file)
31
25
  mf = MigrationSignature::MigrationFile.new(file)
32
26
 
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_dependency 'parser', '>= 2'
28
+ spec.add_dependency 'prism', '>= 1.5'
28
29
 
29
30
  spec.add_development_dependency 'bundler', '~> 2.0'
30
31
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migration_signature
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Allie
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-08-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: parser
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '2'
26
+ - !ruby/object:Gem::Dependency
27
+ name: prism
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.5'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.5'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: bundler
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -67,13 +80,13 @@ files:
67
80
  - lib/migration_signature/config.rb
68
81
  - lib/migration_signature/migration_file.rb
69
82
  - lib/migration_signature/railtie.rb
83
+ - lib/migration_signature/source_parser.rb
70
84
  - lib/migration_signature/version.rb
71
85
  - migration_signature.gemspec
72
86
  homepage: https://github.com/TandaHQ/migration_signature
73
87
  licenses:
74
88
  - MIT
75
89
  metadata: {}
76
- post_install_message:
77
90
  rdoc_options: []
78
91
  require_paths:
79
92
  - lib
@@ -88,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
101
  - !ruby/object:Gem::Version
89
102
  version: '0'
90
103
  requirements: []
91
- rubygems_version: 3.4.1
92
- signing_key:
104
+ rubygems_version: 4.0.20
93
105
  specification_version: 4
94
106
  summary: Generate signatures for migration files when they are run and check them
95
107
  in CI.