strudel 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -3
- data/.travis.yml +4 -1
- data/CHANGELOG.md +25 -0
- data/bin/check-version +7 -3
- data/bin/rspec +4 -2
- data/bin/rubocop +4 -2
- data/bin/yard +4 -2
- data/bin/yardoc +4 -2
- data/bin/yri +4 -2
- data/lib/strudel.rb +10 -8
- data/lib/strudel/version.rb +5 -1
- data/strudel.gemspec +3 -3
- metadata +8 -24
- data/Rakefile +0 -13
- data/bin/rake +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db4e6d114547cb7cea2a9fa90518d63d6bd57a740cc0e98d7e91653570c65c6
|
4
|
+
data.tar.gz: 0ef732a0b969100b1e5e1d43e86437231bbdda1a77d78ad923c6bd1a96e63921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74888d188dd6910dc36cd8c59bd20e7600eaefad47a5084480ebfbe481112d2f773671bee37d82591df61a90835f8629c24fc5d87b17a78c16356c803ab7ee9e
|
7
|
+
data.tar.gz: 34d51387b1f6784a349be15ac1aa5a30a4131c1d68d46f0aa2830997faa6e0786365fb2402ccd932252fbbeb75b4cbfbb45ee25e86b3a742d2de2730fb5ab120
|
data/.rubocop.yml
CHANGED
@@ -5,13 +5,13 @@ AllCops:
|
|
5
5
|
Layout/EndAlignment:
|
6
6
|
EnforcedStyleAlignWith: variable
|
7
7
|
|
8
|
-
Layout/
|
8
|
+
Layout/ParameterAlignment:
|
9
9
|
EnforcedStyle: with_fixed_indentation
|
10
10
|
|
11
|
-
Layout/
|
11
|
+
Layout/FirstArrayElementIndentation:
|
12
12
|
EnforcedStyle: consistent
|
13
13
|
|
14
|
-
Layout/
|
14
|
+
Layout/FirstHashElementIndentation:
|
15
15
|
EnforcedStyle: consistent
|
16
16
|
|
17
17
|
Layout/MultilineMethodCallIndentation:
|
@@ -19,3 +19,10 @@ Layout/MultilineMethodCallIndentation:
|
|
19
19
|
|
20
20
|
Lint/MissingCopEnableDirective:
|
21
21
|
Enabled: false
|
22
|
+
|
23
|
+
Metrics/BlockLength:
|
24
|
+
Exclude:
|
25
|
+
- spec/*
|
26
|
+
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -4,6 +4,8 @@ rvm:
|
|
4
4
|
- 2.3
|
5
5
|
- 2.4
|
6
6
|
- 2.5
|
7
|
+
- 2.6
|
8
|
+
- 2.7
|
7
9
|
env:
|
8
10
|
global:
|
9
11
|
- COVERAGE=1
|
@@ -17,6 +19,7 @@ before_script:
|
|
17
19
|
script:
|
18
20
|
- bin/rubocop
|
19
21
|
- bin/rspec --format doc
|
22
|
+
- bin/check-version
|
20
23
|
|
21
24
|
after_script:
|
22
25
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
@@ -30,7 +33,7 @@ jobs:
|
|
30
33
|
provider: rubygems
|
31
34
|
api_key:
|
32
35
|
secure: 'tcEf3gBUUPOVkDFjvKhBX44cYghbFLXA5BEtmBPwqDXbWaoMVSDcsBRCddLLJts2k1tmYyGVSLP7FR8zE7tfJy40iqSqQRTtdB58SxAoMdU02+x0D8uCgMwdX7qLJePoxW4WVryMo8bql7N4ydtXwlV9POJiDKK47R21G7KvIplMGvav0/SYFFfI21BzCc6Pt8X6a0EuJXJNvqFhJAEvyp+7T8M83owIXwEIsarVc3VTTmefjAJ6zAvpLlRKYU63qN1hOqdzDfGhynNAYhIgstpDwmbwSqxkn4vxmn2OQSXwCeajLiB+nDMpevPGgE9KoeKKGWmv/N0qsgLohR9HziCBl1rolhjfYKshgN18iBBOW1iKBr0sb3EeWU2EDcnDGRvCx6vqD6LTj2TkFI0/nQYuIdPK8eWogpH3hpDwQWcC970bFDWrPFnuQ/jy2wS43y+Q8eAY3cbi07qzc5dMtA/YHkl/PpXM/VjPSWz95clcKc9tSgZN6Vy9dEfYhsTbtbY32SSBw+54N9g1dBaLgeA0T5J/HfNRRldLsZmoolNpeQ11ZLD/afL0Va4rR+qgKG3Hx8Yglp34NzZhSZ0wkrw/RPE2cSCBvknwL/thw+9PKqbSiao9GGFadVJt5KajIP501Bn8oBzoHqU9OuGG8i95MNLZSktnemMbYIgBsDc='
|
33
|
-
gem:
|
36
|
+
gem: strudel
|
34
37
|
on:
|
35
38
|
tags: true
|
36
39
|
condition: bin/check-version
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## Release v1.0.2
|
2
|
+
|
3
|
+
* Remove rake development dependency
|
4
|
+
* Add Strudel.version method
|
5
|
+
* Add support for Ruby 2.7
|
6
|
+
|
7
|
+
## Release v1.0.0
|
8
|
+
|
9
|
+
Update dependencies and first stable release
|
10
|
+
|
11
|
+
## Release v0.1.3
|
12
|
+
|
13
|
+
Add support for Ruby 2.3
|
14
|
+
|
15
|
+
## Release v0.1.2
|
16
|
+
|
17
|
+
Add versions to all dev dependencies
|
18
|
+
|
19
|
+
## Release v0.1.1
|
20
|
+
|
21
|
+
Clean up development dependencies
|
22
|
+
|
23
|
+
## Release v0.1.0
|
24
|
+
|
25
|
+
Initial release
|
data/bin/check-version
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/usr/bin/env sh
|
2
2
|
|
3
|
-
|
3
|
+
set -e
|
4
|
+
|
5
|
+
tag="$(git describe --abbrev=0 2>/dev/null || echo)"
|
4
6
|
tag="${tag#v}"
|
5
|
-
|
6
|
-
|
7
|
+
[ "$tag" = '' ] && exit 0
|
8
|
+
|
9
|
+
tag_gt_version=$(ruby -r ./lib/strudel/version -e "puts Strudel.version >= Gem::Version.new('${tag}')")
|
10
|
+
test "$tag_gt_version" = true
|
data/bin/rspec
CHANGED
@@ -9,8 +9,10 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'pathname'
|
12
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
-
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
+
'../../Gemfile',
|
14
|
+
Pathname.new(__FILE__).realpath
|
15
|
+
)
|
14
16
|
|
15
17
|
require 'rubygems'
|
16
18
|
require 'bundler/setup'
|
data/bin/rubocop
CHANGED
@@ -9,8 +9,10 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'pathname'
|
12
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
-
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
+
'../../Gemfile',
|
14
|
+
Pathname.new(__FILE__).realpath
|
15
|
+
)
|
14
16
|
|
15
17
|
require 'rubygems'
|
16
18
|
require 'bundler/setup'
|
data/bin/yard
CHANGED
@@ -9,8 +9,10 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'pathname'
|
12
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
-
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
+
'../../Gemfile',
|
14
|
+
Pathname.new(__FILE__).realpath
|
15
|
+
)
|
14
16
|
|
15
17
|
require 'rubygems'
|
16
18
|
require 'bundler/setup'
|
data/bin/yardoc
CHANGED
@@ -9,8 +9,10 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'pathname'
|
12
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
-
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
+
'../../Gemfile',
|
14
|
+
Pathname.new(__FILE__).realpath
|
15
|
+
)
|
14
16
|
|
15
17
|
require 'rubygems'
|
16
18
|
require 'bundler/setup'
|
data/bin/yri
CHANGED
@@ -9,8 +9,10 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'pathname'
|
12
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
-
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
|
13
|
+
'../../Gemfile',
|
14
|
+
Pathname.new(__FILE__).realpath
|
15
|
+
)
|
14
16
|
|
15
17
|
require 'rubygems'
|
16
18
|
require 'bundler/setup'
|
data/lib/strudel.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'strudel/version'
|
4
|
+
|
3
5
|
# Strudel
|
4
6
|
#
|
5
7
|
# A tiny dependency injection container
|
@@ -57,8 +59,8 @@ class Strudel
|
|
57
59
|
# service
|
58
60
|
# @yield [self]
|
59
61
|
# @return [self]
|
60
|
-
def set(key, service = nil)
|
61
|
-
create(key, service ||
|
62
|
+
def set(key, service = nil, &block)
|
63
|
+
create(key, service || block, @procs)
|
62
64
|
end
|
63
65
|
|
64
66
|
# Set a factory service by key and value
|
@@ -73,8 +75,8 @@ class Strudel
|
|
73
75
|
# @param [Proc, block] factory The service factory Proc or static service
|
74
76
|
# @yield [self]
|
75
77
|
# @return [self]
|
76
|
-
def factory(key, factory = nil)
|
77
|
-
create(key, factory ||
|
78
|
+
def factory(key, factory = nil, &block)
|
79
|
+
create(key, factory || block, @factories)
|
78
80
|
end
|
79
81
|
|
80
82
|
# Set a protected service by name and value
|
@@ -89,8 +91,8 @@ class Strudel
|
|
89
91
|
# @param [Proc, value, nil] service The service function.
|
90
92
|
# @yield [self]
|
91
93
|
# @return [self]
|
92
|
-
def protect(key, service = nil)
|
93
|
-
create(key, service ||
|
94
|
+
def protect(key, service = nil, &block)
|
95
|
+
create(key, service || block)
|
94
96
|
end
|
95
97
|
|
96
98
|
# Extends an existing service and overrides it.
|
@@ -116,8 +118,8 @@ class Strudel
|
|
116
118
|
# @param [Proc, value, nil] extender
|
117
119
|
# @yield [old_value, self]
|
118
120
|
# @return [self]
|
119
|
-
def extend(key, extender = nil)
|
120
|
-
extender ||=
|
121
|
+
def extend(key, extender = nil, &block)
|
122
|
+
extender ||= block
|
121
123
|
return set(key, extender) unless extender.is_a?(Proc) && @services.key?(key)
|
122
124
|
|
123
125
|
extended = @services[key]
|
data/lib/strudel/version.rb
CHANGED
data/strudel.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'strudel/version'
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'strudel'
|
9
|
-
spec.version = Strudel
|
9
|
+
spec.version = Strudel.version
|
10
10
|
spec.authors = ['Justin Howard']
|
11
11
|
spec.email = ['jmhoward0@gmail.com']
|
12
12
|
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
end
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
23
22
|
spec.add_development_dependency 'redcarpet', '~> 3.4'
|
24
23
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
25
|
-
|
24
|
+
# 0.81 is the last rubocop version with Ruby 2.3 support
|
25
|
+
spec.add_development_dependency 'rubocop', '0.81.0'
|
26
26
|
spec.add_development_dependency 'simplecov', '~> 0.11'
|
27
27
|
spec.add_development_dependency 'yard', '>= 0.9.11'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strudel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '10.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '10.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: redcarpet
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +42,16 @@ dependencies:
|
|
56
42
|
name: rubocop
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - '='
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: 0.81.0
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - '='
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: 0.81.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: simplecov
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,12 +92,11 @@ files:
|
|
106
92
|
- ".rubocop.yml"
|
107
93
|
- ".travis.yml"
|
108
94
|
- ".yardopts"
|
95
|
+
- CHANGELOG.md
|
109
96
|
- Gemfile
|
110
97
|
- LICENSE.txt
|
111
98
|
- README.md
|
112
|
-
- Rakefile
|
113
99
|
- bin/check-version
|
114
|
-
- bin/rake
|
115
100
|
- bin/rspec
|
116
101
|
- bin/rubocop
|
117
102
|
- bin/yard
|
@@ -139,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
124
|
- !ruby/object:Gem::Version
|
140
125
|
version: '0'
|
141
126
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.7.7
|
127
|
+
rubygems_version: 3.0.8
|
144
128
|
signing_key:
|
145
129
|
specification_version: 4
|
146
130
|
summary: A tiny dependency injection container
|
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
require 'yard'
|
7
|
-
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
9
|
-
RuboCop::RakeTask.new
|
10
|
-
YARD::Rake::YardocTask.new
|
11
|
-
|
12
|
-
task default: :check
|
13
|
-
task check: %i[rubocop spec]
|
data/bin/rake
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'rake' 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
|
-
require 'rubygems'
|
16
|
-
require 'bundler/setup'
|
17
|
-
|
18
|
-
load Gem.bin_path('rake', 'rake')
|