nxt_error_registry 0.1.1 → 0.1.6

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: 14378b65ba8a35439c7e61f30ff29dc3c61380bd34e3dcb8483f1c1c288c0702
4
- data.tar.gz: b1ec6d66506ac1a5291e534aa457f212a84e49a83b4b34d1560da8a0c63ccd12
3
+ metadata.gz: e90b9c5755bebb707489b4b5c270bcf26c8703f721279a923e4042a448e8c758
4
+ data.tar.gz: bd0a76e88555845710bc574d3e2a5dada933762749e2b07c1f27abef477d282e
5
5
  SHA512:
6
- metadata.gz: a18195bcbc5f49999acae19eaa291309e23a13ea5183cc81f27a1a1c58f329ec7f773a4c1f600e5f841ce88b7394b642e85e9c7e35da39f8b5448d8d7c8b1c6e
7
- data.tar.gz: dad3e3938ab2da06d975280eee4791d9abd5f3bcfbbf2977307763252ec6c27ad29866b478e5532c89ad8d15c4e4e5bd90d4a3070fbfc11e416fbe50a3fdb0ee
6
+ metadata.gz: 0605b0b3be701bddc74c2c7ab06a69fb9c99d6ec34fdc4e31ef631111a03677d732eaa414ec098213f3287a2a7ef153d901dfbe51cd3bb6e55837ea36695e794
7
+ data.tar.gz: 8519e511e66c6708d040b38c237061d6864f2afe80486135d35b0b3d06f8d7d320575beded9b360a76a0cb03d60c88886c26d550314f0b9215d062f500305479
@@ -0,0 +1,55 @@
1
+ version: 2
2
+
3
+ jobs:
4
+ build:
5
+ working_directory: /home/circleci/app
6
+ docker:
7
+ - image: circleci/ruby:2.6.2-node
8
+ environment:
9
+ RACK_ENV: test
10
+ RAILS_ENV: test
11
+ COVERAGE: true
12
+ # CC_TEST_REPORTER_ID: YOUR_REPO_CC_TEST_REPORTER_ID # ENV var set in CircleCI user interface
13
+ steps:
14
+ - checkout
15
+ # libpq-dev: required for compiling the `pg` gem
16
+ # nodejs: required for asset compilation (see https://github.com/rails/execjs)
17
+ - run:
18
+ name: Install apt dependencies
19
+ command: |
20
+ sudo apt update -q \
21
+ && sudo apt upgrade -q
22
+ - restore_cache:
23
+ key: v3-bundler-{{ checksum "Gemfile.lock" }}-{{ arch }}
24
+ - run: gem install bundler
25
+ - run: bundle config build.nokogiri --use-system-libraries
26
+ - run: bundle install --without staging:production --path=vendor/bundle --jobs=4 --retry=3
27
+ - save_cache:
28
+ key: v3-bundler-{{ checksum "Gemfile.lock" }}-{{ arch }}
29
+ paths:
30
+ - vendor/bundle
31
+ - run:
32
+ name: Collect and filter specs
33
+ command: |
34
+ mkdir -p tmp/circleci
35
+ circleci tests glob "spec/**/*_spec.rb" > tmp/circleci/all_tests.txt
36
+ circleci tests split --split-by=timings < tmp/circleci/all_tests.txt > tmp/circleci/tests_to_run.txt
37
+ echo "These specs will be run:"
38
+ cat tmp/circleci/tests_to_run.txt
39
+ - run:
40
+ name: Parallel RSpec
41
+ command: |
42
+ bundle exec rspec \
43
+ --color \
44
+ --format progress \
45
+ --require spec_helper \
46
+ --format RspecJunitFormatter --out /tmp/rspec/junit.xml \
47
+ $(cat tmp/circleci/tests_to_run.txt)
48
+ # actually not necessary for test results to be collected, but these files
49
+ # won't show up in the web UI otherwise
50
+ - store_artifacts:
51
+ path: /tmp/rspec/
52
+ destination: rspec
53
+
54
+ - store_test_results:
55
+ path: /tmp/rspec/
@@ -0,0 +1 @@
1
+ 2.6.5
@@ -1,138 +1,156 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nxt_error_registry (0.1.0)
5
- activesupport (~> 5.2)
6
- rails (~> 5.2)
4
+ nxt_error_registry (0.1.6)
5
+ activesupport (< 6.1)
6
+ rails (< 6.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.2.1)
12
- actionpack (= 5.2.2.1)
11
+ actioncable (6.0.3.2)
12
+ actionpack (= 6.0.3.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.2.1)
16
- actionpack (= 5.2.2.1)
17
- actionview (= 5.2.2.1)
18
- activejob (= 5.2.2.1)
15
+ actionmailbox (6.0.3.2)
16
+ actionpack (= 6.0.3.2)
17
+ activejob (= 6.0.3.2)
18
+ activerecord (= 6.0.3.2)
19
+ activestorage (= 6.0.3.2)
20
+ activesupport (= 6.0.3.2)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.0.3.2)
23
+ actionpack (= 6.0.3.2)
24
+ actionview (= 6.0.3.2)
25
+ activejob (= 6.0.3.2)
19
26
  mail (~> 2.5, >= 2.5.4)
20
27
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.2.1)
22
- actionview (= 5.2.2.1)
23
- activesupport (= 5.2.2.1)
24
- rack (~> 2.0)
28
+ actionpack (6.0.3.2)
29
+ actionview (= 6.0.3.2)
30
+ activesupport (= 6.0.3.2)
31
+ rack (~> 2.0, >= 2.0.8)
25
32
  rack-test (>= 0.6.3)
26
33
  rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.2.1)
29
- activesupport (= 5.2.2.1)
34
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
+ actiontext (6.0.3.2)
36
+ actionpack (= 6.0.3.2)
37
+ activerecord (= 6.0.3.2)
38
+ activestorage (= 6.0.3.2)
39
+ activesupport (= 6.0.3.2)
40
+ nokogiri (>= 1.8.5)
41
+ actionview (6.0.3.2)
42
+ activesupport (= 6.0.3.2)
30
43
  builder (~> 3.1)
31
44
  erubi (~> 1.4)
32
45
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.2.1)
35
- activesupport (= 5.2.2.1)
46
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
+ activejob (6.0.3.2)
48
+ activesupport (= 6.0.3.2)
36
49
  globalid (>= 0.3.6)
37
- activemodel (5.2.2.1)
38
- activesupport (= 5.2.2.1)
39
- activerecord (5.2.2.1)
40
- activemodel (= 5.2.2.1)
41
- activesupport (= 5.2.2.1)
42
- arel (>= 9.0)
43
- activestorage (5.2.2.1)
44
- actionpack (= 5.2.2.1)
45
- activerecord (= 5.2.2.1)
50
+ activemodel (6.0.3.2)
51
+ activesupport (= 6.0.3.2)
52
+ activerecord (6.0.3.2)
53
+ activemodel (= 6.0.3.2)
54
+ activesupport (= 6.0.3.2)
55
+ activestorage (6.0.3.2)
56
+ actionpack (= 6.0.3.2)
57
+ activejob (= 6.0.3.2)
58
+ activerecord (= 6.0.3.2)
46
59
  marcel (~> 0.3.1)
47
- activesupport (5.2.2.1)
60
+ activesupport (6.0.3.2)
48
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
62
  i18n (>= 0.7, < 2)
50
63
  minitest (~> 5.1)
51
64
  tzinfo (~> 1.1)
52
- arel (9.0.0)
53
- builder (3.2.3)
65
+ zeitwerk (~> 2.2, >= 2.2.2)
66
+ builder (3.2.4)
54
67
  coderay (1.1.2)
55
- concurrent-ruby (1.1.5)
56
- crass (1.0.4)
68
+ concurrent-ruby (1.1.6)
69
+ crass (1.0.6)
57
70
  diff-lcs (1.3)
58
- erubi (1.8.0)
71
+ erubi (1.9.0)
59
72
  globalid (0.4.2)
60
73
  activesupport (>= 4.2.0)
61
- i18n (1.6.0)
74
+ i18n (1.8.3)
62
75
  concurrent-ruby (~> 1.0)
63
- loofah (2.2.3)
76
+ loofah (2.6.0)
64
77
  crass (~> 1.0.2)
65
78
  nokogiri (>= 1.5.9)
66
79
  mail (2.7.1)
67
80
  mini_mime (>= 0.1.1)
68
81
  marcel (0.3.3)
69
82
  mimemagic (~> 0.3.2)
70
- method_source (0.9.2)
71
- mimemagic (0.3.3)
72
- mini_mime (1.0.1)
83
+ method_source (1.0.0)
84
+ mimemagic (0.3.5)
85
+ mini_mime (1.0.2)
73
86
  mini_portile2 (2.4.0)
74
- minitest (5.11.3)
75
- nio4r (2.3.1)
76
- nokogiri (1.10.1)
87
+ minitest (5.14.1)
88
+ nio4r (2.5.2)
89
+ nokogiri (1.10.10)
77
90
  mini_portile2 (~> 2.4.0)
78
- pry (0.12.2)
79
- coderay (~> 1.1.0)
80
- method_source (~> 0.9.0)
81
- rack (2.0.6)
91
+ pry (0.13.1)
92
+ coderay (~> 1.1)
93
+ method_source (~> 1.0)
94
+ rack (2.2.3)
82
95
  rack-test (1.1.0)
83
96
  rack (>= 1.0, < 3)
84
- rails (5.2.2.1)
85
- actioncable (= 5.2.2.1)
86
- actionmailer (= 5.2.2.1)
87
- actionpack (= 5.2.2.1)
88
- actionview (= 5.2.2.1)
89
- activejob (= 5.2.2.1)
90
- activemodel (= 5.2.2.1)
91
- activerecord (= 5.2.2.1)
92
- activestorage (= 5.2.2.1)
93
- activesupport (= 5.2.2.1)
97
+ rails (6.0.3.2)
98
+ actioncable (= 6.0.3.2)
99
+ actionmailbox (= 6.0.3.2)
100
+ actionmailer (= 6.0.3.2)
101
+ actionpack (= 6.0.3.2)
102
+ actiontext (= 6.0.3.2)
103
+ actionview (= 6.0.3.2)
104
+ activejob (= 6.0.3.2)
105
+ activemodel (= 6.0.3.2)
106
+ activerecord (= 6.0.3.2)
107
+ activestorage (= 6.0.3.2)
108
+ activesupport (= 6.0.3.2)
94
109
  bundler (>= 1.3.0)
95
- railties (= 5.2.2.1)
110
+ railties (= 6.0.3.2)
96
111
  sprockets-rails (>= 2.0.0)
97
112
  rails-dom-testing (2.0.3)
98
113
  activesupport (>= 4.2.0)
99
114
  nokogiri (>= 1.6)
100
- rails-html-sanitizer (1.0.4)
101
- loofah (~> 2.2, >= 2.2.2)
102
- railties (5.2.2.1)
103
- actionpack (= 5.2.2.1)
104
- activesupport (= 5.2.2.1)
115
+ rails-html-sanitizer (1.3.0)
116
+ loofah (~> 2.3)
117
+ railties (6.0.3.2)
118
+ actionpack (= 6.0.3.2)
119
+ activesupport (= 6.0.3.2)
105
120
  method_source
106
121
  rake (>= 0.8.7)
107
- thor (>= 0.19.0, < 2.0)
108
- rake (10.5.0)
109
- rspec (3.8.0)
110
- rspec-core (~> 3.8.0)
111
- rspec-expectations (~> 3.8.0)
112
- rspec-mocks (~> 3.8.0)
113
- rspec-core (3.8.0)
114
- rspec-support (~> 3.8.0)
115
- rspec-expectations (3.8.2)
122
+ thor (>= 0.20.3, < 2.0)
123
+ rake (13.0.1)
124
+ rspec (3.9.0)
125
+ rspec-core (~> 3.9.0)
126
+ rspec-expectations (~> 3.9.0)
127
+ rspec-mocks (~> 3.9.0)
128
+ rspec-core (3.9.0)
129
+ rspec-support (~> 3.9.0)
130
+ rspec-expectations (3.9.0)
116
131
  diff-lcs (>= 1.2.0, < 2.0)
117
- rspec-support (~> 3.8.0)
118
- rspec-mocks (3.8.0)
132
+ rspec-support (~> 3.9.0)
133
+ rspec-mocks (3.9.0)
119
134
  diff-lcs (>= 1.2.0, < 2.0)
120
- rspec-support (~> 3.8.0)
121
- rspec-support (3.8.0)
122
- sprockets (3.7.2)
135
+ rspec-support (~> 3.9.0)
136
+ rspec-support (3.9.0)
137
+ rspec_junit_formatter (0.4.1)
138
+ rspec-core (>= 2, < 4, != 2.12.0)
139
+ sprockets (4.0.2)
123
140
  concurrent-ruby (~> 1.0)
124
141
  rack (> 1, < 3)
125
142
  sprockets-rails (3.2.1)
126
143
  actionpack (>= 4.0)
127
144
  activesupport (>= 4.0)
128
145
  sprockets (>= 3.0.0)
129
- thor (0.20.3)
146
+ thor (1.0.1)
130
147
  thread_safe (0.3.6)
131
- tzinfo (1.2.5)
148
+ tzinfo (1.2.7)
132
149
  thread_safe (~> 0.1)
133
- websocket-driver (0.7.0)
150
+ websocket-driver (0.7.2)
134
151
  websocket-extensions (>= 0.1.0)
135
- websocket-extensions (0.1.3)
152
+ websocket-extensions (0.1.5)
153
+ zeitwerk (2.3.1)
136
154
 
137
155
  PLATFORMS
138
156
  ruby
@@ -141,8 +159,9 @@ DEPENDENCIES
141
159
  bundler (~> 2.0)
142
160
  nxt_error_registry!
143
161
  pry
144
- rake (~> 10.0)
162
+ rake (~> 13.0)
145
163
  rspec (~> 3.0)
164
+ rspec_junit_formatter (~> 0.4.1)
146
165
 
147
166
  BUNDLED WITH
148
- 2.0.1
167
+ 2.1.4
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![CircleCI](https://circleci.com/gh/nxt-insurance/nxt_error_registry.svg?style=svg)](https://circleci.com/gh/nxt-insurance/nxt_error_registry)
2
+
1
3
  # NxtErrorRegistry
2
4
 
3
5
  Register all your errors in a sane way.
@@ -65,7 +67,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
65
67
 
66
68
  ## Contributing
67
69
 
68
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nxt_error_registry.
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nxt-insurance/nxt_error_registry.
69
71
 
70
72
  ## License
71
73
 
@@ -4,7 +4,7 @@ class RegisterErrorGenerator < Rails::Generators::Base
4
4
  class_option :type, type: :string, default: 'ParentClass'
5
5
 
6
6
  def register_error
7
- Rails.application.eager_load!
7
+ Zeitwerk::Loader.eager_load_all
8
8
  name = options['name'].camelcase
9
9
  type = options['type'].camelcase
10
10
  harness = NxtErrorRegistry::CodesHarness.instance
@@ -13,4 +13,4 @@ class RegisterErrorGenerator < Rails::Generators::Base
13
13
  puts "register_error :#{name}, type: #{type}, code: '#{code}'"
14
14
  puts '----------------------------------------------'
15
15
  end
16
- end
16
+ end
@@ -22,6 +22,10 @@ module NxtErrorRegistry
22
22
  end
23
23
 
24
24
  const_set(name, error_class)
25
+ # Calling `delegate` before `const_set` would rip off the modules from the error class.
26
+ # e.g. `Module1::Module2::MyError` would become `MyError`.
27
+ error_class.delegate :code, to: :class
28
+
25
29
  entry = { code: code, error_class: error_class, type: type, name: name, namespace: self.to_s, opts: opts }
26
30
  error_registry[name.to_s] = entry
27
31
 
@@ -1,3 +1,3 @@
1
1
  module NxtErrorRegistry
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.6".freeze
3
3
  end
@@ -1,7 +1,7 @@
1
1
  namespace :nxt_error_registry do
2
2
  desc 'Generate a unique error code'
3
3
  task :generate_code, [:name, :type] => [:environment] do |_, args|
4
- Rails.application.eager_load!
4
+ Zeitwerk::Loader.eager_load_all
5
5
  name = args.fetch(:name, 'ErrorName').camelcase
6
6
  type = args.fetch(:type, 'ParentClass').camelcase
7
7
 
@@ -1,4 +1,3 @@
1
-
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "nxt_error_registry/version"
@@ -36,9 +35,10 @@ Gem::Specification.new do |spec|
36
35
  spec.require_paths = ["lib"]
37
36
 
38
37
  spec.add_development_dependency "bundler", "~> 2.0"
39
- spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rake", "~> 13.0"
40
39
  spec.add_development_dependency "rspec", "~> 3.0"
40
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
41
41
  spec.add_development_dependency "pry"
42
- spec.add_dependency "activesupport", "~> 5.2"
43
- spec.add_dependency "rails", "~> 5.2"
42
+ spec.add_dependency "activesupport", "< 6.1"
43
+ spec.add_dependency "rails", "< 6.1"
44
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nxt_error_registry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Robecke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-03-29 00:00:00.000000000 Z
13
+ date: 2020-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '10.0'
35
+ version: '13.0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '10.0'
42
+ version: '13.0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -54,6 +54,20 @@ dependencies:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '3.0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rspec_junit_formatter
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: 0.4.1
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: 0.4.1
57
71
  - !ruby/object:Gem::Dependency
58
72
  name: pry
59
73
  requirement: !ruby/object:Gem::Requirement
@@ -72,30 +86,30 @@ dependencies:
72
86
  name: activesupport
73
87
  requirement: !ruby/object:Gem::Requirement
74
88
  requirements:
75
- - - "~>"
89
+ - - "<"
76
90
  - !ruby/object:Gem::Version
77
- version: '5.2'
91
+ version: '6.1'
78
92
  type: :runtime
79
93
  prerelease: false
80
94
  version_requirements: !ruby/object:Gem::Requirement
81
95
  requirements:
82
- - - "~>"
96
+ - - "<"
83
97
  - !ruby/object:Gem::Version
84
- version: '5.2'
98
+ version: '6.1'
85
99
  - !ruby/object:Gem::Dependency
86
100
  name: rails
87
101
  requirement: !ruby/object:Gem::Requirement
88
102
  requirements:
89
- - - "~>"
103
+ - - "<"
90
104
  - !ruby/object:Gem::Version
91
- version: '5.2'
105
+ version: '6.1'
92
106
  type: :runtime
93
107
  prerelease: false
94
108
  version_requirements: !ruby/object:Gem::Requirement
95
109
  requirements:
96
- - - "~>"
110
+ - - "<"
97
111
  - !ruby/object:Gem::Version
98
- version: '5.2'
112
+ version: '6.1'
99
113
  description: Write a longer description or delete this line.
100
114
  email:
101
115
  - a.robecke@getsafe.de
@@ -103,9 +117,10 @@ executables: []
103
117
  extensions: []
104
118
  extra_rdoc_files: []
105
119
  files:
120
+ - ".circleci/config.yml"
106
121
  - ".gitignore"
107
122
  - ".rspec"
108
- - ".travis.yml"
123
+ - ".ruby-version"
109
124
  - Gemfile
110
125
  - Gemfile.lock
111
126
  - LICENSE.txt
@@ -144,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
159
  - !ruby/object:Gem::Version
145
160
  version: '0'
146
161
  requirements: []
147
- rubygems_version: 3.0.1
162
+ rubygems_version: 3.0.3
148
163
  signing_key:
149
164
  specification_version: 4
150
165
  summary: Write a short summary, because RubyGems requires one.
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.1
7
- before_install: gem install bundler -v 2.0.1