hecks 3.0.0 → 3.0.1

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: c04beedd84550f06db74d93d28c907eee4a0a913f6dfb619d84a1844faefeb13
4
- data.tar.gz: 7b3cf71a37bbc83fa80c14eace35831f4b9bceaa789affbda6e2b1158e1ef39e
3
+ metadata.gz: 9d36051842e6b18aa1f52af8b4c4a3b8e4d36cf69b66b62cf4d9119a8a160f68
4
+ data.tar.gz: ad1ed152aafd1c09c7aadd890ce80aa2690fda9e51fdbb9a231fdd7c97dfcb55
5
5
  SHA512:
6
- metadata.gz: fdf38f7f5ece37807699026ff6166408f948a827aa59d4cec712ad48a686a90d932ec49ac083853a141654a50bfbc1ade18a0c3538126821ecb187128966c155
7
- data.tar.gz: 03ccb78bc4b99292abc6e39ae74b35179254583fb41f735f116da2cacec4709971c8eb36c02fdc0e0ebe13b742b58311fe8e01dd1731e2c40efcaa0a430dcbf4
6
+ metadata.gz: f711d13656e8af3eb9a3023436979beff389ba3e07804b49031631e114d1063ac983657757a3fce5f67c55f91d12bac1c2e99b7c8e4e239e25bf37f5f5e506b4
7
+ data.tar.gz: bf9daee0b3e0b4b8e1660bd2143fdbac674a8b59a65cf2f2ca6b0958c4e9c1bf5c6b7a1f55aac9d5bcdde09154c7937aa445fb9036c9e10c7ced434e864434f7
@@ -49,7 +49,11 @@ module Hecks
49
49
  # **Lazy, on purpose** — same reasoning as PostgresEra's own
50
50
  # connect_for: a domain that never wires Postgres should never
51
51
  # need the gem installed.
52
- require "pg"
52
+ begin
53
+ require "pg"
54
+ rescue LoadError
55
+ raise LoadError, "#{name} binds Postgres, which needs the pg gem: add `gem \"pg\"` to the Gemfile"
56
+ end
53
57
 
54
58
  declared = settings.key?(:database) ? settings[:database] : settings["database"]
55
59
  if declared.to_s.empty?
@@ -75,7 +79,10 @@ module Hecks
75
79
  # boot after the first, not news.
76
80
  connection.exec("SET client_min_messages = warning")
77
81
  connection
78
- rescue PG::Error => e
82
+ rescue StandardError => e
83
+ # PG is only defined once the gem loads, so the clause cannot name it.
84
+ raise unless defined?(PG::Error) && e.is_a?(PG::Error)
85
+
79
86
  raise Runtime::WiringError,
80
87
  "cannot bind Postgres at #{declared} for #{name}: #{e.message.strip}"
81
88
  end
@@ -43,10 +43,14 @@ module Hecks
43
43
  end
44
44
 
45
45
  options = Options.new(strict, profile, root && File.join(root, "rust"))
46
- ok = if argv.any? then check_domains(argv, options)
47
- elsif root then check_corpus(root, options)
48
- else abort "usage: #{program} [--strict] [--profile client] <domain> [<domain> …]"
49
- end
46
+ ok = begin
47
+ if argv.any? then check_domains(argv, options)
48
+ elsif root then check_corpus(root, options)
49
+ else abort "usage: #{program} [--strict] [--profile client] <domain> [<domain> …]"
50
+ end
51
+ rescue Bluebook::DSL::Malformed => e
52
+ abort "#{program}: #{e.message}"
53
+ end
50
54
 
51
55
  puts
52
56
  puts ok ? "No dead states, no unreachable protocol steps." : "THE MODEL HAS FINDINGS."
@@ -115,7 +115,7 @@ module Hecks
115
115
  end
116
116
  puts " #{label} -> #{name}"
117
117
  :current
118
- rescue StandardError => e
118
+ rescue StandardError, LoadError => e
119
119
  refuse(path, "cannot boot — #{e.message.lines.first.to_s.strip}")
120
120
  end
121
121
 
@@ -85,7 +85,11 @@ module Hecks
85
85
  # @raise [Runtime::WiringError] if `database` is missing or Postgres refuses a statement
86
86
  def self.connect_for(name, settings)
87
87
  # Lazy so a domain that never wires PostgresEra does not need the pg gem.
88
- require "pg"
88
+ begin
89
+ require "pg"
90
+ rescue LoadError
91
+ raise LoadError, "#{name} binds PostgresEra, which needs the pg gem: add `gem \"pg\"` to the Gemfile"
92
+ end
89
93
 
90
94
  declared = setting(settings, :database)
91
95
  if declared.to_s.empty?
@@ -114,7 +118,10 @@ module Hecks
114
118
  # Warnings and above still surface.
115
119
  connection.exec("SET client_min_messages = warning")
116
120
  connection
117
- rescue PG::Error => e
121
+ rescue StandardError => e
122
+ # PG is only defined once the gem loads, so the clause cannot name it.
123
+ raise unless defined?(PG::Error) && e.is_a?(PG::Error)
124
+
118
125
  raise Runtime::WiringError,
119
126
  "cannot bind PostgresEra at #{declared} for #{name}: #{e.message.strip}"
120
127
  end
data/lib/hecks/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Hecks
2
2
  # Read directly by the gemspec, so this file must never require the
3
3
  # rest of the gem (its dependencies aren't resolved yet at that point).
4
- VERSION = "3.0.0".freeze
4
+ VERSION = "3.0.1".freeze
5
5
  end
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.0.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hecks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Young