self_data 1.0.0 → 1.1.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
- SHA1:
3
- metadata.gz: c8962303f898d24eda050395bd35c083e49398da
4
- data.tar.gz: a374856a6e86a6b75f41d94d98fe22a665b2f912
2
+ SHA256:
3
+ metadata.gz: 1201a0f6a585e439017884ffa5b3afec52eac0aa1a9a0087117e326d1b340a58
4
+ data.tar.gz: d31a28c60370483eb586ef7f727c7ce5dcaa9cd2dc1b944901727943c1335c88
5
5
  SHA512:
6
- metadata.gz: 401be953df4e180a387f1e2c35cbe4b7a706ddfde483ec91ec56a9dcb1b8d43625ff3547dffcdee396318c6fe4fd33c7adbbeeec3392d9ff7e1a21c1ae61eedc
7
- data.tar.gz: eb071a1c1c2f3b5fe5f5039a3fc694cbf09326dd5fe3223e1acb2fe80e4556a3cb6b43db8e2d9a305da819fbb9a3c0eaedc14fb6fdc41f8a04ed5189c9ec8a9a
6
+ metadata.gz: cefd92d3033735314a03cede47baf2bf5c962b51eb7f5dcbec922dd4553f50b60e904bcda4e5f728a676f1f669a502b86962a7bf3dc8cc573d6bf4b2c7eb8820
7
+ data.tar.gz: 0f4197e8a3e5b1e268e14d7ce5f8e471fcd1889b932bb9e97a2bc8d420e1a6dd837a8e3078dd2251a8fe7694166c8a9ee71dabe49c6411ee7dbfdb338ecf747a
data/.rubocop.yml CHANGED
@@ -1,16 +1,6 @@
1
- Metrics/LineLength:
2
- Max: 100
3
- Exclude:
4
- - 'self_data.gemspec'
1
+ inherit_gem:
2
+ rubocop-config-umbrellio: lib/rubocop.yml
5
3
 
6
- Style/Documentation:
7
- Enabled: false
8
-
9
- Style/StringLiterals:
10
- Enabled: false
11
-
12
- Style/MultilineOperationIndentation:
13
- EnforcedStyle: indented
14
-
15
- Style/AndOr:
16
- EnforcedStyle: conditionals
4
+ AllCops:
5
+ DisplayCopNames: true
6
+ TargetRubyVersion: 2.5
data/.travis.yml CHANGED
@@ -1,4 +1,24 @@
1
1
  language: ruby
2
+
3
+ sudo: false
4
+
2
5
  rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - ruby-head
10
+
11
+ before_install: gem install bundler
12
+
13
+ env: SUITE="rspec"
14
+
15
+ script: bundle exec $SUITE
16
+
17
+ matrix:
18
+ fast_finish: true
19
+ # Only run RuboCop on the latest Ruby
20
+ include:
21
+ - rvm: 2.5
22
+ env: SUITE="rubocop"
23
+ allow_failures:
24
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in self_data.gemspec
4
6
  gemspec
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SelfData.default_formats = [:erb, :yaml]
2
4
  SelfData.default_options = {}
3
5
  SelfData.filters = []
4
6
 
5
- SelfData.add_converter :erb, ->(data, options) { ERB.new(data).result(options[:context]) }
6
- SelfData.add_converter :yaml, ->(data, _options) { YAML.load(data) }
7
- SelfData.add_converter :json, ->(data, _options) { JSON.parse(data) }
7
+ SelfData.add_converter :erb, -> (data, options) { ERB.new(data).result(options[:context]) }
8
+ SelfData.add_converter :yaml, -> (data, _options) { YAML.load(data) }
9
+ SelfData.add_converter :json, -> (data, _options) { JSON.parse(data) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class SelfData
2
4
  Error = Class.new(StandardError)
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class SelfData
2
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
3
5
  end
data/lib/self_data.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
2
4
  require "json"
3
5
  require "active_support/core_ext/module/delegation.rb"
@@ -30,7 +32,7 @@ class SelfData
30
32
  options = default_options if options.empty?
31
33
 
32
34
  formats.reduce(read) do |data, format|
33
- fail ConverterNotFound, format unless converters[format]
35
+ raise ConverterNotFound, format unless converters[format]
34
36
  begin
35
37
  converters[format].call(data, options)
36
38
  rescue => e
@@ -40,15 +42,15 @@ class SelfData
40
42
  end
41
43
 
42
44
  def read
43
- IO.read(file).scan(/\n__END__\n(.*)/m).flatten.first or fail NoDataFound, file
45
+ IO.read(file).scan(/\n__END__\n(.*)/m).flatten.first or raise NoDataFound, file
44
46
  end
45
47
 
46
48
  private
47
49
 
48
50
  def caller_file
49
51
  calls = caller.lazy
50
- .map { |call_string| call_string.split(':').first }
51
- .select { |file| file != __FILE__ }
52
+ .map { |call_string| call_string.split(":").first }
53
+ .reject { |file| file == __FILE__ }
52
54
  .select(&File.method(:exist?))
53
55
 
54
56
  filters.each do |filter|
data/self_data.gemspec CHANGED
@@ -1,7 +1,10 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'self_data/version'
5
+ require "self_data/version"
6
+
7
+ files_regexp = %r{^(test|spec|features)/}
5
8
 
6
9
  Gem::Specification.new do |spec|
7
10
  spec.name = "self_data"
@@ -12,18 +15,18 @@ Gem::Specification.new do |spec|
12
15
  spec.summary = ""
13
16
  spec.description = "It's like DATA but better"
14
17
  spec.homepage = "https://github.com/umbrellio/self_data"
15
- spec.license = 'MIT'
18
+ spec.license = "MIT"
16
19
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(files_regexp) }
18
21
  spec.bindir = "exe"
19
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
23
  spec.require_paths = ["lib"]
21
24
 
22
25
  spec.add_runtime_dependency "activesupport", ">= 3.0"
23
26
 
24
- spec.add_development_dependency "bundler", "~> 1.10"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.4"
27
- spec.add_development_dependency "rubocop", "~> 0.35"
27
+ spec.add_development_dependency "bundler"
28
28
  spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "rubocop-config-umbrellio"
29
32
  end
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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-09 00:00:00.000000000 Z
11
+ date: 2018-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,60 +28,60 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.10'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.10'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.4'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '3.4'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.35'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.35'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
84
+ name: rubocop-config-umbrellio
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -111,6 +111,7 @@ files:
111
111
  - Rakefile
112
112
  - bin/console
113
113
  - bin/rspec
114
+ - bin/rubocop
114
115
  - bin/setup
115
116
  - lib/self_data.rb
116
117
  - lib/self_data/config.rb
@@ -137,9 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  version: '0'
138
139
  requirements: []
139
140
  rubyforge_project:
140
- rubygems_version: 2.5.1
141
+ rubygems_version: 2.7.6
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: ''
144
145
  test_files: []
145
- has_rdoc: