safer_initialize 0.2.0 → 0.3.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: 31eb1c05500e2d20207203e3d4d65a29507920d6f0da6b0cadaef0d87df81b12
4
- data.tar.gz: 9d8f0360e41cb13a56314c79c3bb64e46ba892ffcc40351d1ec241ab96f53b0e
3
+ metadata.gz: 694a0d7be3f9f98f8aa73266721d365569df168a2dcbbbe57c981a719fdcc866
4
+ data.tar.gz: f86b2ed4f9acac56500add6d1ec4d9e9b3795a04fba216534037798d4186fb93
5
5
  SHA512:
6
- metadata.gz: f1cb3bbc1654debbf28f5e336bd46bc7f03ad9ed3e65d1e651f41e3a83bff1591a3e5e4418f41027cc557e78796e299c40537a590cbb5ebc34b762e14df0a8c0
7
- data.tar.gz: 5dd462b38e4b9058de7eccf5853aa788133d2374282f3af2297b02cdacef1b20e22a77600f7546e0cb6ca4c9785f17d92e0ffea4c171dbd46710c31e30a38482
6
+ metadata.gz: 95419eb57f195b3a3c146a63ecfcf7600034303349f3050db3645a5ce179ccd9a5a69d16322532e15606d521f0a438c1d6d1a4089bedcee03a9a0c1da7a5420e
7
+ data.tar.gz: 6352804808c5fef2698531550aff7c8adbdf0c5b20879d2e3ae2a5430bda081c3249c986ac9d4e3b8be929747608c607ff157791804de255c88298bf1ea8f0a1
@@ -0,0 +1,45 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+
8
+ jobs:
9
+ rspec:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ BUNDLE_JOBS: 4
13
+ BUNDLE_RETRY: 3
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby: [2.6, 2.7]
18
+ gemfile: [
19
+ "gemfiles/6.1.gemfile",
20
+ ]
21
+ steps:
22
+ - name: Install packages
23
+ run: |
24
+ sudo apt update -y
25
+ sudo apt install -y libsqlite3-dev
26
+ - uses: actions/checkout@v2
27
+ - uses: actions/cache@v2
28
+ with:
29
+ path: /home/runner/bundle
30
+ key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
31
+ restore-keys: |
32
+ bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ - name: Install dependencies
38
+ run: |
39
+ bundle config path /home/runner/bundle
40
+ bundle config --global gemfile ${{ matrix.gemfile }}
41
+ bundle install
42
+ bundle update
43
+ bundle clean
44
+ - name: Run rspec
45
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  Gemfile.lock
13
+ test.sqlite3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.0
2
+
3
+ - Support message option with Proc (#3)
4
+
1
5
  ## 0.2.0
2
6
 
3
7
  - Add `error_handle` config
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
+ gem "sqlite3"
data/README.md CHANGED
@@ -26,7 +26,7 @@ In `config/initializers/safer_initialize.rb`:
26
26
  SaferInitialize::Globals.attribute :tenant
27
27
 
28
28
  SaferInitialize.configure do |config|
29
- config.error_handle = -> (e) { Rails.env.production? ? Bugsnag.notify(e) : raise e } # default: -> (e) { raise e }
29
+ config.error_handle = -> (e) { Rails.env.production? ? Bugsnag.notify(e) : raise(e) } # default: -> (e) { raise e }
30
30
  end
31
31
  ```
32
32
 
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "6.1.3.2"
4
+ gem "rake", "~> 12.0"
5
+ gem "rspec", "~> 3.0"
6
+ gem "sqlite3"
7
+
8
+ gemspec :path => "../"
@@ -9,7 +9,8 @@ module SaferInitialize
9
9
  unless SaferInitialize::Globals.safe?
10
10
  result = filter ? object.send(filter) : object.instance_exec(object, &block)
11
11
  unless result
12
- SaferInitialize.configuration.error_handle.call(SaferInitialize::Error.new(message))
12
+ message_text = message.respond_to?(:call) ? message.call(object) : message
13
+ SaferInitialize.configuration.error_handle.call(SaferInitialize::Error.new(message_text))
13
14
  end
14
15
  end
15
16
  end
@@ -1,3 +1,3 @@
1
1
  module SaferInitialize
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safer_initialize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -31,6 +31,7 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".github/workflows/rspec.yml"
34
35
  - ".gitignore"
35
36
  - ".rspec"
36
37
  - ".travis.yml"
@@ -42,6 +43,7 @@ files:
42
43
  - Rakefile
43
44
  - bin/console
44
45
  - bin/setup
46
+ - gemfiles/6.1.gemfile
45
47
  - lib/safer_initialize.rb
46
48
  - lib/safer_initialize/active_record/extensions.rb
47
49
  - lib/safer_initialize/configuration.rb