dry-container-nested 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f425c20e6f54909b735216c866a22620b63c8562
4
+ data.tar.gz: 872f701e2c513e828a41b1f74fd08a5c7d4c5e28
5
+ SHA512:
6
+ metadata.gz: 4eed20d03d1e60e5815d2ac07711dca040aa24118ab04e2dcd798661ab37c9ff3bc847e0afd20cd064952d4ac7c9c10426a34d538317474068534c8f1fdd3478
7
+ data.tar.gz: 8167082ac9486c97296d1b9e1bba6a68ffa1a825b1ed488f023a9a77eed402350ca8d2a8662f933e5f600885fb8394ee9a63e89b8d4f71405389333115cd6062
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile*.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require ./spec/spec_helper.rb
@@ -0,0 +1,42 @@
1
+ # We are using default RuboCop settings.
2
+ # We are writing beautiful code.
3
+ # There is nothing to change here. At least now.
4
+ AllCops:
5
+ TargetRubyVersion: 2.4
6
+ DefaultFormatter: fuubar
7
+ DisplayCopNames: true
8
+ ExtraDetails: true
9
+
10
+ # Ignore block length in DSLs using blocks extensively
11
+ Metrics/BlockLength:
12
+ Exclude:
13
+ # Rake DSL
14
+ - rakelib/**/*.rake
15
+ # RSpec DSL
16
+ - spec/**/*.rb
17
+ # Rubygems DSL
18
+ - '**/*.gemspec'
19
+
20
+ Metrics/MethodLength:
21
+ Exclude:
22
+ # Rake DSL
23
+ - rakelib/**/*.rake
24
+ # RSpec DSL
25
+ - spec/**/*.rb
26
+
27
+ Metrics/ModuleLength:
28
+ Exclude:
29
+ # RSpec DSL
30
+ - spec/**/*.rb
31
+
32
+ Metrics/AbcSize:
33
+ Exclude:
34
+ # Rake DSL
35
+ - rakelib/**/*.rake
36
+ # RSpec DSL
37
+ - spec/**/*.rb
38
+
39
+ Style/FileName:
40
+ Exclude:
41
+ # Exclude convenient require file name
42
+ - lib/dry-container-nested.rb
@@ -0,0 +1,12 @@
1
+ SimpleCov.start do
2
+ add_filter '/bin/'
3
+ add_filter '/spec/'
4
+ add_group('Missing') do |src|
5
+ src.covered_percent < 100
6
+ end
7
+ add_group('Covered') do |src|
8
+ src.covered_percent == 100
9
+ end
10
+ end
11
+ require 'codeclimate-test-reporter'
12
+ CodeClimate::TestReporter.start
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.13.7
@@ -0,0 +1,7 @@
1
+ --title 'dry-container'
2
+ --markup markdown
3
+ --readme README.md
4
+ --private
5
+ --files docs/*.md
6
+ lib/**/*.rb
7
+ --
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at alex@semyonov.us. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ # Specify your gem's dependencies in dry-container-nested.gemspec
5
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Alex Semyonov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ # Dry::Container::Nested
2
+
3
+
4
+ * [Sources](https://github.com/alsemyonov/dry-container-nested)
5
+ * [Documentation](http://rubydoc.info/gems/dry-container-nested)
6
+ * [Issue Tracker](https://github.com/alsemyonov/dry-container-nested/issues)
7
+ * [Wiki](https://github.com/alsemyonov/dry-container-nested/wiki)
8
+ * [![Code Climate](https://codeclimate.com/github/alsemyonov/dry-container-nested/badges/gpa.svg)](https://codeclimate.com/github/alsemyonov/dry-container-nested)
9
+ * [![Test Coverage](https://codeclimate.com/github/alsemyonov/dry-container-nested/badges/coverage.svg)](https://codeclimate.com/github/alsemyonov/dry-container-nested/coverage)
10
+ * [![Build Status](https://travis-ci.org/alsemyonov/dry-container-nested.png?branch=master)](http://travis-ci.org/alsemyonov/dry-container-nested)
11
+ * [![Dependency Status](https://gemnasium.com/alsemyonov/dry-container-nested.png)](https://gemnasium.com/alsemyonov/dry-container-nested)
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'dry-container-nested'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install dry-container-nested
28
+
29
+ ## Usage
30
+
31
+ ```ruby
32
+ module Example
33
+ extend Dry::Container::Mixin
34
+
35
+ register :key, Object.new
36
+ register :callable, proc { 1 }, call: false
37
+ module Nested
38
+ extend Dry::Container::Nested
39
+ register :another, :value
40
+ end
41
+ self[:callable].call #=> 1
42
+ self['nested.another'].call #=> :value
43
+ end
44
+
45
+ ```
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dry-container-nested. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
56
+
57
+
58
+ ## License
59
+
60
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
61
+
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/setup'
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'dry/container/nested'
6
+
7
+ using Dry::Container::Nested
8
+
9
+ # Example container
10
+ module ContainerModule
11
+ extend Dry::Container::Mixin
12
+
13
+ register :object, Object.new
14
+
15
+ # Example nested container
16
+ module Nested
17
+ extend Dry::Container::Nested
18
+ end
19
+ end
20
+
21
+ # (If you use this, don't forget to add pry to your Gemfile!)
22
+ # require "pry"
23
+ # Pry.start
24
+
25
+ require 'irb'
26
+ IRB.start
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rspec' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rubocop' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rubocop', 'rubocop')
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yard' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yard')
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yardoc' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yardoc')
data/bin/yri ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yri' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yri')
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'dry/container/nested/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'dry-container-nested'
9
+ spec.version = Dry::Container::Nested::VERSION
10
+ spec.authors = ['Alex Semyonov']
11
+ spec.email = ['alex@semyonov.us']
12
+
13
+ spec.summary = 'Nested containers DSL'
14
+ spec.description = 'Nested containers using Dry::Container and Ruby'
15
+ spec.homepage = 'http://alsemyonov.github.com/'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_runtime_dependency 'dry-container', '~> 0.6.0'
26
+ spec.add_runtime_dependency 'inflecto'
27
+
28
+ spec.add_development_dependency 'yard', '~> 0.9.5'
29
+ spec.add_development_dependency 'bundler', '~> 1.13'
30
+ spec.add_development_dependency 'bundler-audit', '~> 0.5.0'
31
+ spec.add_development_dependency 'rake', '~> 12.0.0'
32
+ spec.add_development_dependency 'rspec', '~> 3.0'
33
+ spec.add_development_dependency 'rspec-its', '~> 1.2.0'
34
+ spec.add_development_dependency 'simplecov', '~> 0.14.0'
35
+ spec.add_development_dependency 'simplecov-html', '~> 0.10.0'
36
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.6.0'
37
+ spec.add_development_dependency 'rubocop', '~> 0.47.1'
38
+ spec.add_development_dependency 'redcarpet', '~> 3.4.0'
39
+ end
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require 'dry/container/nested'
@@ -0,0 +1,211 @@
1
+ # frozen_string_literal: true
2
+ require 'dry/container/nested/version'
3
+ require 'dry/container'
4
+ require 'forwardable'
5
+ require 'inflecto'
6
+
7
+ module Dry
8
+ class Container
9
+ # @example
10
+ # module Example
11
+ # extend Dry::Container::Mixin
12
+ #
13
+ # register :key, Object.new
14
+ # register :callable, proc { 1 }, call: false
15
+ # module Nested
16
+ # extend Dry::Container::Nested
17
+ # register :another, Object.new
18
+ # end
19
+ # end
20
+ module Nested
21
+ Undefined = Object.new do
22
+ class << self
23
+ def inspect
24
+ 'Undefined'
25
+ end
26
+
27
+ alias_method :to_str, :inspect
28
+ alias_method :to_s, :inspect
29
+ end
30
+ end.freeze
31
+
32
+ # rubocop:disable Metrics/BlockLength
33
+
34
+ refine Module do
35
+ # @param [String] name
36
+ # @return [String]
37
+ def containing_path(name = self.name)
38
+ path(name)[0..-2].join('/')
39
+ end
40
+
41
+ # @return [Module]
42
+ def containing_module
43
+ Inflecto.constantize Inflecto.camelize containing_path
44
+ end
45
+
46
+ # @return [String]
47
+ # @example
48
+ # module Example
49
+ # key #=> 'example'
50
+ # key #=> 'example'
51
+ # module Nested
52
+ # key #=> 'example.nested'
53
+ # end
54
+ # end
55
+ def key(key = Undefined)
56
+ @__key__ = key unless key == Undefined
57
+ @__key__ ||= path(name).last
58
+ end
59
+
60
+ # @param key [String?]
61
+ # @return [String]
62
+ def prefixed(key = nil)
63
+ [prefix, key].compact.join('.')
64
+ end
65
+
66
+ def prefix
67
+ container? ? nil : "#{containing_module.prefix}#{key}"
68
+ end
69
+
70
+ def namespace_dsl
71
+ container[prefixed]
72
+ end
73
+
74
+ def path(name = self.name)
75
+ Inflecto.underscore(name).split('/')
76
+ end
77
+
78
+ def container?
79
+ singleton_class.included_modules.include? Dry::Container::Mixin
80
+ end
81
+
82
+ def container
83
+ if containing_module.container?
84
+ containing_module
85
+ else
86
+ containing_module.container
87
+ end
88
+ end
89
+
90
+ def matcher
91
+ /\A#{prefix}\./
92
+ end
93
+
94
+ def deprefixed(key)
95
+ key.gsub(matcher, '')
96
+ end
97
+ end
98
+
99
+ # rubocop:enable Metrics/BlockLength
100
+
101
+ using self
102
+
103
+ # Error
104
+ class NoNameError < ArgumentError
105
+ def initialize(other)
106
+ super("#{other.inspect} cannot be used as a nested container, "\
107
+ 'because it does not have a name')
108
+ end
109
+ end
110
+
111
+ def self.extended(other)
112
+ super
113
+ raise NoNameError, other unless other.name
114
+ end
115
+
116
+ # Class-level DSL for nested container definition
117
+ module ClassInterface
118
+ using Nested
119
+ include Forwardable
120
+
121
+ def apply_namespace!
122
+ key_methods.map do |method|
123
+ redefine_method method
124
+ end
125
+ end
126
+
127
+ private
128
+
129
+ # Methods accepting key as one of their parameters
130
+ # @return [<UnboundMethod>]
131
+ def key_methods
132
+ Mixin.instance_methods(false).inject([]) do |result, method|
133
+ key_parameter(method) ? result + [method] : result
134
+ end
135
+ end
136
+
137
+ # @param [UnboundMethod] method_or_name
138
+ def key_parameter(method_or_name)
139
+ method_or_name = method_definition(method_or_name)
140
+ method_or_name.parameters.detect { |_kind, name| :key == name }
141
+ end
142
+
143
+ # @param [UnboundMethod, Symbol] method_or_name
144
+ # @param [Module] from
145
+ # @return [UnboundMethod]
146
+ def method_definition(method_or_name, from: Mixin)
147
+ if method_or_name.is_a?(Symbol)
148
+ method_or_name = from.instance_method method_or_name
149
+ end
150
+ unless method_or_name.is_a? UnboundMethod
151
+ raise ArgumentError,
152
+ "#{method_or_name} is not an unbound method or symbol "\
153
+ "found in #{from}",
154
+ caller.join("\n")
155
+ end
156
+ method_or_name
157
+ end
158
+
159
+ # @param [UnboundMethod] method
160
+ def redefine_method(method)
161
+ method = method_definition(method)
162
+ key_parameter = key_parameter(method)
163
+ index = method.parameters.index(key_parameter)
164
+ define_method method.name do |*args, **kwargs|
165
+ args = args.dup
166
+ args[index] = prefixed(args[index])
167
+ container.send(method.name, *args, **kwargs)
168
+ end
169
+ end
170
+ end
171
+
172
+ extend ClassInterface
173
+ apply_namespace!
174
+
175
+ # An array of registered names for the container
176
+ #
177
+ # @return [Array<String>]
178
+ def keys
179
+ container.keys.each_with_object([]) do |key, keys|
180
+ keys << deprefixed(key) if matcher.match?(key)
181
+ end
182
+ end
183
+
184
+ # Calls block once for each key in container, passing the key as a
185
+ # parameter.
186
+ #
187
+ # If no block is given, an enumerator is returned instead.
188
+ #
189
+ # @return [Dry::Container::Mixin] self
190
+ def each_key(&block)
191
+ keys.each_key(&block)
192
+ self
193
+ end
194
+
195
+ # Calls block once for each key/value pair in the container, passing the
196
+ # key and the registered item parameters.
197
+ #
198
+ # If no block is given, an enumerator is returned instead.
199
+ #
200
+ # @return [Enumerator]
201
+ def each(&block)
202
+ container.config
203
+ .resolver
204
+ .each(_container)
205
+ .each_with_object([]) do |(key, value), result|
206
+ result << [deprefixed(key), value] if matcher.match?(key)
207
+ end.each(&block)
208
+ end
209
+ end
210
+ end
211
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ module Dry
3
+ class Container
4
+ module Nested
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/audit/task'
3
+
4
+ Bundler::Audit::Task.new
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Dir['*.gemspec'].any?
4
+ namespace :gem do
5
+ require 'bundler/gem_tasks'
6
+ task release: :default
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Document and Test code'
4
+ task default: %i(doc spec)
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new :spec do |t|
5
+ t.rspec_path = 'bin/rspec'
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ require 'rubocop/rake_task'
3
+
4
+ RuboCop::RakeTask.new :cop
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Audit code, run RSpec Suite, Check style'
4
+ task test: %i(bundle:audit spec cop)
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ require 'yard'
3
+ require 'yard/rake/yardoc_task'
4
+
5
+ namespace :doc do
6
+ YARD::Rake::YardocTask.new :generate
7
+
8
+ desc 'Run server watching file changes and updating docs'
9
+ task :server do
10
+ # require 'yard/cli/server'
11
+ # server = YARD::Cli::Server.new
12
+ # server.run('--reload', '--cache')
13
+ sh 'bin/yard', 'server', '--reload', '--cache'
14
+ end
15
+
16
+ desc 'Generate YARD documentation & open it'
17
+ task open: :doc do
18
+ sh 'open', 'doc/index.html'
19
+ end
20
+ end
21
+
22
+ task doc: 'doc:generate'
23
+ task generate: :doc
metadata ADDED
@@ -0,0 +1,256 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dry-container-nested
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Semyonov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dry-container
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: inflecto
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.5
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.5
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.13'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.13'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler-audit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.5.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.5.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 12.0.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 12.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-its
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.2.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.14.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.14.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov-html
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.10.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.10.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: codeclimate-test-reporter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.6.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.6.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.47.1
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.47.1
181
+ - !ruby/object:Gem::Dependency
182
+ name: redcarpet
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 3.4.0
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 3.4.0
195
+ description: Nested containers using Dry::Container and Ruby
196
+ email:
197
+ - alex@semyonov.us
198
+ executables: []
199
+ extensions: []
200
+ extra_rdoc_files: []
201
+ files:
202
+ - ".gitignore"
203
+ - ".rspec"
204
+ - ".rubocop.yml"
205
+ - ".simplecov"
206
+ - ".travis.yml"
207
+ - ".yardopts"
208
+ - CODE_OF_CONDUCT.md
209
+ - Gemfile
210
+ - LICENSE.txt
211
+ - README.md
212
+ - Rakefile
213
+ - bin/console
214
+ - bin/rake
215
+ - bin/rspec
216
+ - bin/rubocop
217
+ - bin/setup
218
+ - bin/yard
219
+ - bin/yardoc
220
+ - bin/yri
221
+ - dry-container-nested.gemspec
222
+ - lib/dry-container-nested.rb
223
+ - lib/dry/container/nested.rb
224
+ - lib/dry/container/nested/version.rb
225
+ - rakelib/bundle_audit.rake
226
+ - rakelib/bundler.rake
227
+ - rakelib/default.rake
228
+ - rakelib/rspec.rake
229
+ - rakelib/rubocop.rake
230
+ - rakelib/test.rake
231
+ - rakelib/yard.rake
232
+ homepage: http://alsemyonov.github.com/
233
+ licenses:
234
+ - MIT
235
+ metadata: {}
236
+ post_install_message:
237
+ rdoc_options: []
238
+ require_paths:
239
+ - lib
240
+ required_ruby_version: !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ version: '0'
245
+ required_rubygems_version: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - ">="
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ requirements: []
251
+ rubyforge_project:
252
+ rubygems_version: 2.6.10
253
+ signing_key:
254
+ specification_version: 4
255
+ summary: Nested containers DSL
256
+ test_files: []