yondu 0.1.0 → 0.2.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: d856399b91651f4f09f1f0b656ff6a9066f173c140d7064b3a49d966f2bc98b0
4
- data.tar.gz: 14dad44c30e3e2863d193507a9029b02c90913f2ecba52cb44ecb7d6569b8772
3
+ metadata.gz: 21f2156523ba226579991a5b9541609740c055aa53da8b188cd08755eae76e6a
4
+ data.tar.gz: 4be2bf38d8e06121868515a31cd8d2929d27bde78acc505815355b71d018abe1
5
5
  SHA512:
6
- metadata.gz: 7ef6d584d602e209b07d7ba8b9d75ba4256128fb450188d1c37ae0ad4bc48a07251a2858365344c60e3eedc77483e602373934466497ed5528108fd1198567d7
7
- data.tar.gz: 89a5a7512d64a3999fbbaf76811a7d505bcfa74db67a1dc9650311ec38bc885802ad13b7e0e4d9d3c438213f23610105522f55d28d3a406a2fae2cfba9b82037
6
+ metadata.gz: 88efeb21f8c354a4e91c321c2092c32f95b161a29941ecb67baaa13a688945348d262a6b8ab3c9c159b35f38ca20b4cf8344655685d87943f2819adacfea6e4f
7
+ data.tar.gz: dc3d9d810de45cf5f4c169fea24d23e7b240c28eeb97447dd21171553ab0c52c23921975437e96bdc8e72922c7b9d9251333ac12e285f998a0149768fa377c70
data/.rubocop.yml CHANGED
@@ -1,5 +1,8 @@
1
+ require: rubocop-rspec
2
+
1
3
  AllCops:
2
- TargetRubyVersion: 2.6
4
+ NewCops: enable
5
+ TargetRubyVersion: 2.7
3
6
 
4
7
  Style/StringLiterals:
5
8
  Enabled: true
@@ -11,3 +14,6 @@ Style/StringLiteralsInInterpolation:
11
14
 
12
15
  Layout/LineLength:
13
16
  Max: 120
17
+
18
+ Style/Documentation:
19
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## [Unreleased]
1
+ # Changelog
2
+
3
+ ## [0.2.0] - 2023-07-20
4
+
5
+ - Improve error handling for missing or invalid settings.
2
6
 
3
7
  ## [0.1.0] - 2022-10-19
4
8
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Alejandro Gutiérrez
3
+ Copyright (c) 2023 Alejandro Gutiérrez
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -47,7 +47,10 @@ Rails.configuration.settings.get(:app, :port)
47
47
  # => 443
48
48
 
49
49
  Rails.configuration.settings.get(:app, :use_ssl)
50
- # => Missing setting: app->use_ssl (Yondu::MissingSetting)
50
+ # => Missing setting: app->use_ssl (Yondu::MissingSettingError)
51
+
52
+ Rails.configuration.settings.get(:app, :port, :other)
53
+ # => No hash setting: app->port (Yondu::NoHashSettingError)
51
54
  ```
52
55
 
53
56
  ## Development
@@ -67,7 +70,7 @@ to [rubygems.org](https://rubygems.org).
67
70
  Bug reports and pull requests are welcome on GitHub at https://github.com/amco/yondu-rb.
68
71
  This project is intended to be a safe, welcoming space for collaboration, and
69
72
  contributors are expected to adhere to the
70
- [code of conduct](https://github.com/amco/yondu-rb/blob/master/CODE_OF_CONDUCT.md).
73
+ [code of conduct](https://github.com/amco/yondu-rb/blob/main/CODE_OF_CONDUCT.md).
71
74
 
72
75
  ## License
73
76
 
@@ -78,4 +81,4 @@ The gem is available as open source under the terms of the
78
81
 
79
82
  Everyone interacting in the Yondu project's codebases, issue trackers,
80
83
  chat rooms and mailing lists is expected to follow the
81
- [code of conduct](https://github.com/amco/yondu-rb/blob/master/CODE_OF_CONDUCT.md).
84
+ [code of conduct](https://github.com/amco/yondu-rb/blob/main/CODE_OF_CONDUCT.md).
data/lib/yondu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yondu
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/yondu.rb CHANGED
@@ -5,9 +5,15 @@ require_relative "yondu/version"
5
5
  module Yondu
6
6
  class Error < StandardError; end
7
7
 
8
- class MissingSetting < Error
9
- def initialize(keys)
10
- super("Missing setting: #{keys.join('->')}")
8
+ class MissingSettingError < Error
9
+ def initialize(scope)
10
+ super("Missing setting: #{scope.join("->")}")
11
+ end
12
+ end
13
+
14
+ class NoHashSettingError < Error
15
+ def initialize(scope)
16
+ super("No hash setting: #{scope.join("->")}")
11
17
  end
12
18
  end
13
19
 
@@ -21,8 +27,10 @@ module Yondu
21
27
  value = @config
22
28
 
23
29
  keys.each do |key|
30
+ raise NoHashSettingError, scope unless value.is_a?(Hash)
31
+
24
32
  scope << key
25
- value = value.fetch(key) { raise MissingSetting.new(keys) }
33
+ value = value.fetch(key) { raise MissingSettingError, scope }
26
34
  end
27
35
 
28
36
  value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yondu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Gutiérrez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-19 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Settings object for extending configuration
14
14
  email:
@@ -21,21 +21,19 @@ files:
21
21
  - ".rubocop.yml"
22
22
  - CHANGELOG.md
23
23
  - CODE_OF_CONDUCT.md
24
- - Gemfile
25
24
  - LICENSE.txt
26
25
  - README.md
27
26
  - Rakefile
28
27
  - lib/yondu.rb
29
28
  - lib/yondu/version.rb
30
29
  - sig/yondu.rbs
31
- - yondu.gemspec
32
30
  homepage: https://github.com/amco/yondu-rb
33
31
  licenses:
34
32
  - MIT
35
33
  metadata:
36
34
  homepage_uri: https://github.com/amco/yondu-rb
37
35
  source_code_uri: https://github.com/amco/yondu-rb
38
- changelog_uri: https://github.com/amco/yondu-rb/blob/master/CHANGELOG.md
36
+ changelog_uri: https://github.com/amco/yondu-rb/blob/main/CHANGELOG.md
39
37
  rubygems_mfa_required: 'true'
40
38
  post_install_message:
41
39
  rdoc_options: []
@@ -52,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
50
  - !ruby/object:Gem::Version
53
51
  version: '0'
54
52
  requirements: []
55
- rubygems_version: 3.3.7
53
+ rubygems_version: 3.4.17
56
54
  signing_key:
57
55
  specification_version: 4
58
56
  summary: Settings object for extending configuration
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in yondu.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.21"
data/yondu.gemspec DELETED
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/yondu/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "yondu"
7
- spec.version = Yondu::VERSION
8
- spec.authors = ["Alejandro Gutiérrez"]
9
- spec.email = ["alejandrodevs@gmail.com"]
10
-
11
- spec.summary = "Settings object for extending configuration"
12
- spec.description = "Settings object for extending configuration"
13
- spec.homepage = "https://github.com/amco/yondu-rb"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.7.0"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
20
-
21
- spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = spec.homepage
23
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
24
- spec.metadata["rubygems_mfa_required"] = "true"
25
-
26
- # Specify which files should be added to the gem when it is released.
27
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
- spec.files = Dir.chdir(__dir__) do
29
- `git ls-files -z`.split("\x0").reject do |f|
30
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
31
- end
32
- end
33
-
34
- spec.bindir = "exe"
35
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
36
- spec.require_paths = ["lib"]
37
-
38
- # Uncomment to register a new dependency of your gem
39
- # spec.add_dependency "example-gem", "~> 1.0"
40
-
41
- # For more information and examples about making a new gem, check out our
42
- # guide at: https://bundler.io/guides/creating_gem.html
43
- end