self_data 1.2.1 → 1.3.0

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: ace750c9fee999c5fee53ce98fa9e958f8cfa405234fc76433d0c12225167076
4
- data.tar.gz: 1f37f78e87718c9ef7ce72c477803033e5a4d2c0d0eace08a89c416bdbfc1aed
3
+ metadata.gz: b79811eeab45fe00ca77ccf2829d2f95a3fb870bab871f3f67ce359d206b42c3
4
+ data.tar.gz: 402041e352b55e2c165d2753ae162d5892182624cbf5d49c545201abe5b964d2
5
5
  SHA512:
6
- metadata.gz: 5c49d4345d6861651dc72f9a3389335baee5abebac90364830c68b05f5435ea81860873808e4d21055b929a4d0b9a3f441035ba76d94261640256054eb35935f
7
- data.tar.gz: eaa40576e8998947d0799852c6adf5b474f702a3e1a77a05d466e7ec6de49efd7bbae83b646ef60158f1799e8cefc9085bd16b50bf5487c36e020b26ddf1d140
6
+ metadata.gz: 1ef0ffbbfe322e6318141e0e3c08bab970ecc310c494e57b79557d2e803c91ac5e44d156c2e84661d84ce819d0f45ae4870a891c8e6a9b3fd67f5b36ac8e9dc3
7
+ data.tar.gz: 2c3622cb728c06b46721a8e748df2482197a3301aa9221510fa4591229703712bf0e5e39aeac6e0cfd57b91055d906478f54ffe5d1ecaead4b3657b8045d8461
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ # We want to run on external PRs, but not on our own internal PRs as they'll be run on push event
10
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'umbrellio/self_data'
11
+
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: ["2.6", "2.7", "3.0", "3.1"]
16
+
17
+ name: ${{ matrix.ruby }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+
22
+ - uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+
27
+ - run: bundle exec rspec
28
+ - run: bundle exec rubocop
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
data/.rubocop.yml CHANGED
@@ -3,4 +3,4 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.5
6
+ TargetRubyVersion: 2.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## [1.3.0] - 2022-01-13
4
+
5
+ - Drop Ruby 2.5 support.
6
+ - Use `YAML.unsafe_load` if available.
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in self_data.gemspec
6
6
  gemspec
7
+
8
+ gem "activesupport", "~> 6.0" # AS 7 requires ruby > 2.7
data/Gemfile.lock ADDED
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ self_data (1.3.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (6.1.4.4)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 1.6, < 2)
12
+ minitest (>= 5.1)
13
+ tzinfo (~> 2.0)
14
+ zeitwerk (~> 2.3)
15
+ ast (2.4.2)
16
+ coderay (1.1.3)
17
+ concurrent-ruby (1.1.9)
18
+ coveralls (0.7.2)
19
+ multi_json (~> 1.3)
20
+ rest-client (= 1.6.7)
21
+ simplecov (>= 0.7)
22
+ term-ansicolor (= 1.2.2)
23
+ thor (= 0.18.1)
24
+ diff-lcs (1.5.0)
25
+ docile (1.4.0)
26
+ i18n (1.8.11)
27
+ concurrent-ruby (~> 1.0)
28
+ method_source (1.0.0)
29
+ mime-types (3.4.1)
30
+ mime-types-data (~> 3.2015)
31
+ mime-types-data (3.2022.0105)
32
+ minitest (5.15.0)
33
+ multi_json (1.15.0)
34
+ parallel (1.21.0)
35
+ parser (3.1.0.0)
36
+ ast (~> 2.4.1)
37
+ pry (0.14.1)
38
+ coderay (~> 1.1)
39
+ method_source (~> 1.0)
40
+ rack (2.2.3)
41
+ rainbow (3.1.1)
42
+ rake (13.0.6)
43
+ regexp_parser (2.2.0)
44
+ rest-client (1.6.7)
45
+ mime-types (>= 1.16)
46
+ rexml (3.2.5)
47
+ rspec (3.10.0)
48
+ rspec-core (~> 3.10.0)
49
+ rspec-expectations (~> 3.10.0)
50
+ rspec-mocks (~> 3.10.0)
51
+ rspec-core (3.10.1)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-expectations (3.10.1)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-mocks (3.10.2)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-support (3.10.3)
60
+ rubocop (1.24.0)
61
+ parallel (~> 1.10)
62
+ parser (>= 3.0.0.0)
63
+ rainbow (>= 2.2.2, < 4.0)
64
+ regexp_parser (>= 1.8, < 3.0)
65
+ rexml
66
+ rubocop-ast (>= 1.15.0, < 2.0)
67
+ ruby-progressbar (~> 1.7)
68
+ unicode-display_width (>= 1.4.0, < 3.0)
69
+ rubocop-ast (1.15.1)
70
+ parser (>= 3.0.1.1)
71
+ rubocop-config-umbrellio (1.24.0.56)
72
+ rubocop (= 1.24.0)
73
+ rubocop-performance (= 1.13.0)
74
+ rubocop-rails (= 2.13.0)
75
+ rubocop-rake (= 0.6.0)
76
+ rubocop-rspec (= 2.7.0)
77
+ rubocop-sequel (= 0.3.3)
78
+ rubocop-performance (1.13.0)
79
+ rubocop (>= 1.7.0, < 2.0)
80
+ rubocop-ast (>= 0.4.0)
81
+ rubocop-rails (2.13.0)
82
+ activesupport (>= 4.2.0)
83
+ rack (>= 1.1)
84
+ rubocop (>= 1.7.0, < 2.0)
85
+ rubocop-rake (0.6.0)
86
+ rubocop (~> 1.0)
87
+ rubocop-rspec (2.7.0)
88
+ rubocop (~> 1.19)
89
+ rubocop-sequel (0.3.3)
90
+ rubocop (~> 1.0)
91
+ ruby-progressbar (1.11.0)
92
+ simplecov (0.21.2)
93
+ docile (~> 1.1)
94
+ simplecov-html (~> 0.11)
95
+ simplecov_json_formatter (~> 0.1)
96
+ simplecov-html (0.12.3)
97
+ simplecov_json_formatter (0.1.3)
98
+ term-ansicolor (1.2.2)
99
+ tins (~> 0.8)
100
+ thor (0.18.1)
101
+ tins (0.13.2)
102
+ tzinfo (2.0.4)
103
+ concurrent-ruby (~> 1.0)
104
+ unicode-display_width (2.1.0)
105
+ zeitwerk (2.5.3)
106
+
107
+ PLATFORMS
108
+ arm64-darwin-21
109
+ x86_64-linux
110
+
111
+ DEPENDENCIES
112
+ activesupport (~> 6.0)
113
+ bundler
114
+ coveralls
115
+ pry
116
+ rake
117
+ rspec
118
+ rubocop-config-umbrellio
119
+ self_data!
120
+ simplecov
121
+
122
+ BUNDLED WITH
123
+ 2.3.5
@@ -8,5 +8,8 @@ SelfData.default_formats = [:erb, :yaml]
8
8
  SelfData.default_options = {}
9
9
 
10
10
  SelfData.add_converter :erb, -> (data, options) { ERB.new(data).result(options[:context]) }
11
- SelfData.add_converter :yaml, -> (data, _options) { YAML.load(data) }
12
11
  SelfData.add_converter :json, -> (data, _options) { JSON.parse(data) }
12
+
13
+ SelfData.add_converter :yaml do |data, _options|
14
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(data) : YAML.load(data)
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SelfData
4
- VERSION = "1.2.1"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/self_data.rb CHANGED
@@ -24,8 +24,8 @@ class SelfData
24
24
  @converters ||= {}
25
25
  end
26
26
 
27
- def add_converter(name, block)
28
- converters[name] = block
27
+ def add_converter(name, proc = nil, &block)
28
+ converters[name] = proc || block
29
29
  end
30
30
  end
31
31
 
@@ -50,7 +50,7 @@ class SelfData
50
50
  end
51
51
 
52
52
  def read
53
- IO.read(file).scan(/\n__END__\n(.*)/m).flatten.first or raise NoDataFound, file
53
+ File.read(file).scan(/\n__END__\n(.*)/m).flatten.first or raise NoDataFound, file
54
54
  end
55
55
 
56
56
  private
@@ -59,10 +59,10 @@ class SelfData
59
59
  calls = caller.lazy
60
60
  .map { |call_string| call_string.split(":").first }
61
61
  .reject { |file| file == __FILE__ }
62
- .select(&File.method(:exist?))
62
+ .select { |x| File.exist?(x) }
63
63
 
64
64
  self.class.filters.each do |filter|
65
- calls = calls.select(&filter.method(:call))
65
+ calls = calls.select { |x| filter.call(x) }
66
66
  end
67
67
 
68
68
  calls.first
data/self_data.gemspec CHANGED
@@ -7,6 +7,8 @@ require "self_data/version"
7
7
  files_regexp = %r{^(test|spec|features)/}
8
8
 
9
9
  Gem::Specification.new do |spec|
10
+ spec.required_ruby_version = ">= 2.6.0"
11
+
10
12
  spec.name = "self_data"
11
13
  spec.version = SelfData::VERSION
12
14
  spec.authors = ["Umbrellio"]
@@ -21,6 +23,7 @@ Gem::Specification.new do |spec|
21
23
  spec.bindir = "exe"
22
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
25
  spec.require_paths = ["lib"]
26
+ spec.metadata = { "rubygems_mfa_required" => "false" }
24
27
 
25
28
  spec.add_development_dependency "bundler"
26
29
  spec.add_development_dependency "coveralls"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: self_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-30 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,11 +115,13 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
+ - ".github/workflows/ci.yml"
118
119
  - ".gitignore"
119
120
  - ".rspec"
120
121
  - ".rubocop.yml"
121
- - ".travis.yml"
122
+ - CHANGELOG.md
122
123
  - Gemfile
124
+ - Gemfile.lock
123
125
  - LICENSE.txt
124
126
  - README.md
125
127
  - Rakefile
@@ -135,8 +137,9 @@ files:
135
137
  homepage: https://github.com/umbrellio/self_data
136
138
  licenses:
137
139
  - MIT
138
- metadata: {}
139
- post_install_message:
140
+ metadata:
141
+ rubygems_mfa_required: 'false'
142
+ post_install_message:
140
143
  rdoc_options: []
141
144
  require_paths:
142
145
  - lib
@@ -144,15 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
147
  requirements:
145
148
  - - ">="
146
149
  - !ruby/object:Gem::Version
147
- version: '0'
150
+ version: 2.6.0
148
151
  required_rubygems_version: !ruby/object:Gem::Requirement
149
152
  requirements:
150
153
  - - ">="
151
154
  - !ruby/object:Gem::Version
152
155
  version: '0'
153
156
  requirements: []
154
- rubygems_version: 3.1.2
155
- signing_key:
157
+ rubygems_version: 3.3.5
158
+ signing_key:
156
159
  specification_version: 4
157
160
  summary: It's like DATA but better
158
161
  test_files: []
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- before_install: gem install bundler
4
- script:
5
- - bundle exec rubocop
6
- - bundle exec rspec
7
- matrix:
8
- fast_finish: true
9
- include:
10
- - rvm: 2.3.7
11
- - rvm: 2.4.4
12
- - rvm: 2.5.1
13
- - rvm: ruby-head
14
- allow_failures:
15
- - rvm: ruby-head