tdc 0.4.4.1 → 0.4.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: eca13ff55c92fc5eb5b78f57e7d4e21fab8cffbc6a06eb3f1e824339b678736b
4
- data.tar.gz: '057623005580c59c306cf9efd677cfc36547cba6f2bc633ac456d7d219a0fa90'
3
+ metadata.gz: a605f44cef27e72e80f13f582363886ca57b61238bec36ff2f3367c2c0cd4973
4
+ data.tar.gz: a61883e606e164fa260f02c3b2588a352600b54b6c0fc9e8b0ae9fc7df6d3970
5
5
  SHA512:
6
- metadata.gz: 2f130af08383189a6b21cb2d35a71705efecc6e64fe17e44f13265bc8b4b0967b7a85e8baea4ca1a84effb60b6998de5e57c53c6eff8f1ad979917f37f161093
7
- data.tar.gz: 1b3cf70a0abe5fa1b6f6cfcf1c3d3455a227ceeca98ed39714ad65b8ecf786a04af9c83ce5452840b469038661acbc076f6657251c3660519a6dbd2bf2efa98c
6
+ metadata.gz: 2f2d9ac1591cf59bbc6c4bc2c128f5a891cef41c5399b480215f4644dae499f24a8f68bc4e3aef729e66d4f99aee978b4be523d82d58e5757b536bec19ae973e
7
+ data.tar.gz: 5b69a6c7393477eab60ffea42f8c0764ab1a289fb791c952e3f56f7ad6e9e368f9dfbc9229b82cddb431f6bd5fe637a9fa99dbc3428eb52f75940a0984004a47
@@ -20,7 +20,10 @@ Lint/MissingSuper:
20
20
  Enabled: false
21
21
 
22
22
  Metrics/BlockLength:
23
- Enabled: false
23
+ Exclude:
24
+ - 'tdc.gemspec'
25
+ - '**/*_shared_example.rb'
26
+ - '**/*_spec.rb'
24
27
 
25
28
  Naming/MemoizedInstanceVariableName:
26
29
  EnforcedStyleForLeadingUnderscores: required
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.6] - 2020-09-26
10
+
11
+ - Better error message when a tag cannot be resolved
12
+
13
+ Note: version `0.4.5` was yanked from RubyGems.
14
+
9
15
  ## [0.4.4.1] - 2020-09-12
10
16
 
11
17
  - Avoid registering the same class of interpreter a second time
data/Gemfile CHANGED
@@ -2,6 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in tdc.gemspec
4
4
  gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
data/Rakefile CHANGED
@@ -1,8 +1,17 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require "rubocop/rake_task"
4
+ require "rubycritic/rake_task"
4
5
 
5
- RuboCop::RakeTask.new
6
6
  RSpec::Core::RakeTask.new(:spec)
7
+ RuboCop::RakeTask.new
8
+
9
+ RubyCritic::RakeTask.new do |task|
10
+ files = FileList["**/*.rb"]
11
+ files.exclude("**/*_spec.rb")
12
+ files.exclude("**/*_shared_example.rb")
13
+
14
+ task.paths = files
15
+ end
7
16
 
8
17
  task :default => [:rubocop, :spec]
@@ -24,15 +24,23 @@ module Tdc
24
24
  # Use the tag to source an object from the current catalog.
25
25
  sourced_object = catalog_entry.send(tag)
26
26
 
27
- unless sourced_object
28
- message = "Could not find a tag reference for '#{key}' in the catalog entries provided."
29
-
30
- raise Tdc::FatalError, message
31
- end
27
+ unresolvable_tag(tag, catalog_entry) unless sourced_object
32
28
 
33
29
  # Replace the tag value with the sourced object.
34
30
  instance_definition[key] = sourced_object
35
31
  end
32
+
33
+ private
34
+
35
+ def unresolvable_tag(tag, catalog_entry)
36
+ source_tags = catalog_entry.entries.sort.map { |entry| "'#{entry}'" }.to_sentence
37
+
38
+ raise Tdc::FatalError, <<~MESSAGE
39
+ Could not resolve key '#{key}' from source '#{source}'.
40
+
41
+ Attempted to resolve tag '#{tag}' from these tags: #{source_tags}
42
+ MESSAGE
43
+ end
36
44
  end
37
45
  end
38
46
  end
@@ -13,6 +13,10 @@ module Tdc
13
13
  to_h.empty?
14
14
  end
15
15
 
16
+ def entries
17
+ to_h.keys
18
+ end
19
+
16
20
  def first
17
21
  to_h.first&.second
18
22
  end
@@ -46,7 +46,7 @@ module Tdc
46
46
  end
47
47
  end
48
48
 
49
- def respond_to_missing?(method, include_all = false) # rubocop:disable Style/OptionalBooleanParameter
49
+ def respond_to_missing?(method, include_all = false)
50
50
  ghost_definition?(method) || ghost_optional_definition?(method) ? true : super
51
51
  end
52
52
 
@@ -1,3 +1,3 @@
1
1
  module Tdc
2
- VERSION = "0.4.4.1"
2
+ VERSION = "0.4.6"
3
3
  end
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rake", ">= 12.1", "< 13.1"
34
34
  spec.add_development_dependency "rspec", ">= 3.9", "< 4.0"
35
35
  spec.add_development_dependency "rubocop", "~> 0.89"
36
+ spec.add_development_dependency "rubocop-performance", "~> 1.8"
36
37
  spec.add_development_dependency "rubocop-rspec", "~> 1.42"
38
+ spec.add_development_dependency "rubycritic", "~> 4.5"
37
39
  spec.add_development_dependency "simplecov", "~> 0.17"
38
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4.1
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alistair McKinnell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -78,6 +78,20 @@ dependencies:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0.89'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rubocop-performance
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '1.8'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '1.8'
81
95
  - !ruby/object:Gem::Dependency
82
96
  name: rubocop-rspec
83
97
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +106,20 @@ dependencies:
92
106
  - - "~>"
93
107
  - !ruby/object:Gem::Version
94
108
  version: '1.42'
109
+ - !ruby/object:Gem::Dependency
110
+ name: rubycritic
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '4.5'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '4.5'
95
123
  - !ruby/object:Gem::Dependency
96
124
  name: simplecov
97
125
  requirement: !ruby/object:Gem::Requirement