jerry 2.0.0 → 2.0.1

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
  SHA1:
3
- metadata.gz: 0d97c357a390c069b18e9516ad1e5dac1fcdfea5
4
- data.tar.gz: b33040e60cc83f2a481d0181c809e7b045ca96ec
3
+ metadata.gz: 1bbd0532844dd283b58f5ef1748c6d453b906d4a
4
+ data.tar.gz: 19b1269dc85c620b8118a09046fa703aaec59699
5
5
  SHA512:
6
- metadata.gz: eae3155f70ebb6bfd88cd878f2e4dfbe95f042a23439504d185717dd4f20583ffe3ad209e65511d922be4a5e403af7a836ef1969cdd45bff8241685e064838b0
7
- data.tar.gz: f4cb19e8c591ae15611d0d02e1d7c6a46ea9fb1071ef37a83e454d48622565f537f59b44f7d67bc7be13ef9c13453cb8010d0a5fc66d4639000863f817f394d8
6
+ metadata.gz: a14d6625b6b6b159f49b69692f3bbeecb91b8710f0caaf00e7385318d37d49b1cb9fecf9112e255fe112af8e4f758a536304f492694fc5fa18f11add597d975f
7
+ data.tar.gz: 0ca041017547c5d49c161fd6fc44f11ed4fb6c02d65eb28ce210a44589c10305b9c48b8bd2ccca4ea921cafe2f19102d3decbbea5021ed578e5f44ac5c187ca1
data/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [*.md]
12
+ indent_size = 4
13
+ trim_trailing_whitespace = false
data/.rubocop.yml CHANGED
@@ -1,3 +1,18 @@
1
+ AllCops:
2
+ Include:
3
+ - jerry.gempsec
4
+ - Gemfile
5
+ - Guardfile
6
+ - Rakefile
7
+ - lib/**/*.rb
8
+ - spec/**/*.rb
9
+
10
+ Naming/FileName:
11
+ Exclude:
12
+ - Gemfile
13
+ - Rakefile
14
+ - Guardfile
15
+
1
16
  Documentation:
2
17
  Exclude:
3
18
  - lib/jerry/version.rb
data/.travis.yml CHANGED
@@ -2,10 +2,9 @@ language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.2
6
- - 2.1
7
- - 2.0.0
8
- - 1.9.3
5
+ - 2.3.1
6
+ - 2.2.5
7
+ - 2.1.9
9
8
  - jruby-19mode
10
9
  - ruby-head
11
10
  - jruby-head
data/Guardfile CHANGED
@@ -1,8 +1,9 @@
1
1
  guard 'rake', task: 'default' do
2
2
  watch 'Rakefile'
3
+ watch 'Gemfile'
4
+ watch 'Guardfile'
3
5
  watch '.rspec'
4
6
  watch '.rubocop.yml'
5
- watch '.reek'
6
7
  watch %r{^lib/}
7
8
  watch %r{^spec/}
8
9
  end
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  Jerry
2
2
  =====
3
3
 
4
- [![Build Status](https://travis-ci.org/beraboris/jerry.svg?branch=master)](https://travis-ci.org/beraboris/jerry)
5
- [![Coverage Status](https://coveralls.io/repos/beraboris/jerry/badge.png)](https://coveralls.io/r/beraboris/jerry)
4
+ [![Build Status](https://travis-ci.org/dotboris/jerry.svg?branch=master)](https://travis-ci.org/dotboris/jerry)
5
+ [![Coverage Status](https://coveralls.io/repos/github/dotboris/jerry/badge.svg?branch=master)](https://coveralls.io/github/dotboris/jerry?branch=master)
6
6
 
7
7
  Jerry is a Ruby
8
8
  [Inversion of Control](https://en.wikipedia.org/wiki/Inversion_of_control)
@@ -52,7 +52,9 @@ end
52
52
 
53
53
  Option 3: Just install it
54
54
 
55
- $ gem install jerry
55
+ ```sh
56
+ gem install jerry
57
+ ```
56
58
 
57
59
  ### Create a configuration class
58
60
 
@@ -129,4 +131,50 @@ Learn more
129
131
 
130
132
  If you'd like to learn more, here's some more documentation:
131
133
 
132
- - [Multiple configurations](doc/multiple-configurations.md)
134
+ - [Multiple configurations](doc/multiple-configurations.md)
135
+
136
+ Development
137
+ -----------
138
+
139
+ ### Setup
140
+
141
+ ```sh
142
+ ./bin/setup
143
+ ```
144
+
145
+ ### Run tests
146
+
147
+ ```sh
148
+ ./bin/rake spec
149
+ ```
150
+
151
+ ### Run linter
152
+
153
+ ```sh
154
+ ./bin/rake lint
155
+ ```
156
+
157
+ ### Generate doc
158
+
159
+ ```sh
160
+ ./bin/rake doc
161
+ ```
162
+
163
+ ### Automatic watch
164
+
165
+ This will automatically watch the source code and run the tests, run the linter
166
+ and build the doc everytime some files change.
167
+
168
+ ```sh
169
+ ./bin/guard
170
+ ```
171
+
172
+ Releasing
173
+ ---------
174
+
175
+ 1. Bump version in `lib/jerry/version.rb`
176
+ 1. Run release job
177
+
178
+ ```sh
179
+ bundle exec rake release
180
+ ```
data/Rakefile CHANGED
@@ -2,23 +2,14 @@ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
  require 'yard'
4
4
  require 'rubocop/rake_task'
5
- require 'reek/rake/task'
6
5
 
7
- task default: [:spec, :lint]
6
+ task default: %i[spec lint]
8
7
 
9
8
  RSpec::Core::RakeTask.new :spec
10
9
  YARD::Rake::YardocTask.new :doc
11
10
 
12
- task lint: [:reek, :rubocop]
11
+ desc 'Run code style checks'
12
+ task lint: %i[rubocop]
13
13
 
14
14
  desc 'Run rubocop linter on lib/**/*.rb and spec/**/*.rb'
15
- RuboCop::RakeTask.new :rubocop do |t|
16
- t.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
17
- t.fail_on_error = false
18
- end
19
-
20
- desc 'Run reek linter on lib/**/*.rb'
21
- Reek::Rake::Task.new :reek do |t|
22
- t.source_files = 'lib/**/*.rb'
23
- t.fail_on_error = false
24
- end
15
+ RuboCop::RakeTask.new :rubocop
data/jerry.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- # coding: utf-8
1
+
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'jerry/version'
@@ -8,8 +8,11 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Jerry::VERSION
9
9
  spec.authors = ['Boris Bera']
10
10
  spec.email = ['bboris@rsoft.ca']
11
- spec.summary = %q{Jerry rigs your application together. It's an Inversion of Control container.}
12
- spec.description = %q{Jerry is an Inversion of Control container. It allows you to decouple the code that bootstraps your application from the rest of your application}
11
+ spec.summary = "Jerry rigs your application together. It's an " \
12
+ 'Inversion of Control container.'
13
+ spec.description = 'Jerry is an Inversion of Control container. ' \
14
+ 'It allows you to decouple the code that bootstraps ' \
15
+ 'your application from the rest of your application'
13
16
  spec.homepage = 'http://github.com/beraboris/jerry'
14
17
  spec.license = 'MIT'
15
18
 
@@ -18,13 +21,12 @@ Gem::Specification.new do |spec|
18
21
  spec.require_paths = ['lib']
19
22
 
20
23
  spec.add_development_dependency 'bundler', '~> 1.6'
21
- spec.add_development_dependency 'rake'
22
- spec.add_development_dependency 'guard'
23
- spec.add_development_dependency 'guard-rake'
24
- spec.add_development_dependency 'rspec', '~> 3.3'
25
24
  spec.add_development_dependency 'coveralls', '~> 0.8'
26
- spec.add_development_dependency 'yard', '~> 0.8.7'
25
+ spec.add_development_dependency 'guard', '<= 2.13'
26
+ spec.add_development_dependency 'guard-rake', '~> 1.0'
27
27
  spec.add_development_dependency 'pry', '~> 0.10'
28
- spec.add_development_dependency 'rubocop', '~> 0.32'
29
- spec.add_development_dependency 'reek', '~> 2.2'
28
+ spec.add_development_dependency 'rake', '~> 10.4'
29
+ spec.add_development_dependency 'rspec', '~> 3.3'
30
+ spec.add_development_dependency 'rubocop', '~> 0.49'
31
+ spec.add_development_dependency 'yard', '~> 0.9.11'
30
32
  end
data/lib/jerry/config.rb CHANGED
@@ -73,8 +73,8 @@ class Jerry
73
73
  if provider
74
74
  provider.call @jerry, self
75
75
  else
76
- fail InstantiationError,
77
- "Failed to instanciate #{key}. Can't find provider for it"
76
+ raise InstantiationError,
77
+ "Failed to instanciate #{key}. Can't find provider for it"
78
78
  end
79
79
  rescue RuntimeError
80
80
  raise InstantiationError, "Provider for #{key} raised an error"
data/lib/jerry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Jerry
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'.freeze
3
3
  end
data/lib/jerry.rb CHANGED
@@ -32,10 +32,10 @@ class Jerry
32
32
  # @raise [Jerry::InstantiationError] if can't instanciate key
33
33
  def [](key)
34
34
  config = @configs.find { |conf| conf.knows? key }
35
- if config
36
- config[key]
37
- else
38
- fail Jerry::InstantiationError, "Can't find #{key} in any config"
35
+ unless config
36
+ raise Jerry::InstantiationError, "Can't find #{key} in any config"
39
37
  end
38
+
39
+ config[key]
40
40
  end
41
41
  end
data/spec/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ Metrics/BlockLength:
4
+ Enabled: false
@@ -17,12 +17,13 @@ describe Jerry::ClassProvider do
17
17
  instance = double 'instance'
18
18
  allow(klass).to receive(:new).and_return(instance)
19
19
 
20
- expect(provider.call jerry, config).to eq instance
20
+ expect(provider.call(jerry, config)).to eq instance
21
21
  end
22
22
 
23
23
  it 'should pass constructor arguments in the right order' do
24
24
  provider = Jerry::ClassProvider.new klass, [
25
- proc { 'fi' }, proc { 'fo' }, proc { 'fum' }]
25
+ proc { 'fi' }, proc { 'fo' }, proc { 'fum' }
26
+ ]
26
27
 
27
28
  expect(klass).to receive(:new).with('fi', 'fo', 'fum')
28
29
 
data/spec/config_spec.rb CHANGED
@@ -182,11 +182,11 @@ describe Jerry::Config do
182
182
  key = double 'some key'
183
183
  config_klass.providers[key] = double 'some provider'
184
184
 
185
- expect(config.knows? key).to be true
185
+ expect(config.knows?(key)).to be true
186
186
  end
187
187
 
188
188
  it 'should be false if key is not known' do
189
- expect(config.knows? double('some unknown key')).to be false
189
+ expect(config.knows?(double('some unknown key'))).to be false
190
190
  end
191
191
  end
192
192
  end
data/spec/error_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  describe Jerry::Error do
2
2
  def raise_error_with_cause
3
- fail 'Something went wrong'
3
+ raise 'Something went wrong'
4
4
  rescue RuntimeError
5
5
  raise Jerry::Error, 'wrapping error'
6
6
  end
@@ -12,12 +12,12 @@ describe Jerry::Error do
12
12
  end
13
13
 
14
14
  it 'should not record the causing exception when there is none' do
15
- expect { fail Jerry::Error }.to raise_error(Jerry::Error) do |ex|
15
+ expect { raise Jerry::Error }.to raise_error(Jerry::Error) do |ex|
16
16
  expect(ex.cause).to be_nil
17
17
  end
18
18
  end
19
19
 
20
20
  it 'should have a message' do
21
- expect { fail Jerry::Error, ':(' }.to raise_error(Jerry::Error, ':(')
21
+ expect { raise Jerry::Error, ':(' }.to raise_error(Jerry::Error, ':(')
22
22
  end
23
23
  end
@@ -26,6 +26,6 @@ module MultiDbApp
26
26
 
27
27
  named_bind :foo_db, Database, [proc { @foo_uri }]
28
28
  named_bind :bar_db, Database, [proc { @bar_uri }]
29
- bind Application, [:foo_db, :bar_db]
29
+ bind Application, %i[foo_db bar_db]
30
30
  end
31
31
  end
@@ -61,7 +61,7 @@ module ShoppingCart
61
61
  attr_reader :user_controller, :product_controller, :shopping_cart_controller
62
62
 
63
63
  def initialize(user_controller, product_controller,
64
- shopping_cart_controller)
64
+ shopping_cart_controller)
65
65
  @user_controller = user_controller
66
66
  @product_controller = product_controller
67
67
  @shopping_cart_controller = shopping_cart_controller
data/spec/jerry_spec.rb CHANGED
@@ -58,7 +58,7 @@ describe Jerry do
58
58
  end
59
59
 
60
60
  it 'should fail if no config know the key' do
61
- configs = 3.times.map { double_config 'some config', knows?: false }
61
+ configs = Array.new(3) { double_config 'some config', knows?: false }
62
62
  jerry = Jerry.new(*configs)
63
63
 
64
64
  expect { jerry[:not_there] }.to raise_error(Jerry::InstantiationError)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jerry
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Bera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2017-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,131 +25,117 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: coveralls
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.8'
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: '0'
40
+ version: '0.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: guard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "<="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.13'
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: '0'
54
+ version: '2.13'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: guard-rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '3.3'
61
+ version: '1.0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '3.3'
68
+ version: '1.0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: coveralls
70
+ name: pry
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '0.8'
75
+ version: '0.10'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '0.8'
82
+ version: '0.10'
97
83
  - !ruby/object:Gem::Dependency
98
- name: yard
84
+ name: rake
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 0.8.7
89
+ version: '10.4'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 0.8.7
96
+ version: '10.4'
111
97
  - !ruby/object:Gem::Dependency
112
- name: pry
98
+ name: rspec
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '0.10'
103
+ version: '3.3'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '0.10'
110
+ version: '3.3'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: rubocop
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: '0.32'
117
+ version: '0.49'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: '0.32'
124
+ version: '0.49'
139
125
  - !ruby/object:Gem::Dependency
140
- name: reek
126
+ name: yard
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: '2.2'
131
+ version: 0.9.11
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: '2.2'
138
+ version: 0.9.11
153
139
  description: Jerry is an Inversion of Control container. It allows you to decouple
154
140
  the code that bootstraps your application from the rest of your application
155
141
  email:
@@ -158,8 +144,8 @@ executables: []
158
144
  extensions: []
159
145
  extra_rdoc_files: []
160
146
  files:
147
+ - ".editorconfig"
161
148
  - ".gitignore"
162
- - ".reek"
163
149
  - ".rspec"
164
150
  - ".rubocop.yml"
165
151
  - ".travis.yml"
@@ -180,6 +166,7 @@ files:
180
166
  - lib/jerry/config.rb
181
167
  - lib/jerry/errors.rb
182
168
  - lib/jerry/version.rb
169
+ - spec/.rubocop.yml
183
170
  - spec/class_provider_spec.rb
184
171
  - spec/config_spec.rb
185
172
  - spec/error_spec.rb
@@ -211,11 +198,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
198
  version: '0'
212
199
  requirements: []
213
200
  rubyforge_project:
214
- rubygems_version: 2.4.5.1
201
+ rubygems_version: 2.6.14
215
202
  signing_key:
216
203
  specification_version: 4
217
204
  summary: Jerry rigs your application together. It's an Inversion of Control container.
218
205
  test_files:
206
+ - spec/.rubocop.yml
219
207
  - spec/class_provider_spec.rb
220
208
  - spec/config_spec.rb
221
209
  - spec/error_spec.rb
@@ -227,4 +215,3 @@ test_files:
227
215
  - spec/fixtures/shopping_cart_config.rb
228
216
  - spec/jerry_spec.rb
229
217
  - spec/spec_helper.rb
230
- has_rdoc:
data/.reek DELETED
@@ -1,2 +0,0 @@
1
- IrresponsibleModule:
2
- enabled: false