dependency_injection-sinatra 0.1.0 → 0.1.2

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: bed0b9a50f3eaea2de3a0cf5147c2b6195ca8247
4
- data.tar.gz: f832fdc9b9be2a34089e29bc34f23bd3bb71c2fb
3
+ metadata.gz: 74469c907b68c1a1c04d6e23574175832ce73437
4
+ data.tar.gz: 31eec0e6237c8b01de9c3fdec4645e6b2fe06956
5
5
  SHA512:
6
- metadata.gz: abc06a4d0de3d3eb10889fecdb31767dff813b9c6b608b37e7c34c79b1bcee2c1895db2cb36f166a976102367fe403b49b4ea91c2827fd7b363f03ee05604183
7
- data.tar.gz: fe630cfebbd6836ec66108b8b230f769ff6648e7715e3fe08f4c3dc11e285e18000d2eac0794abf3c3af210c2b551da77e245f2963b163ad45dcdb7c0b13c2b6
6
+ metadata.gz: 090f2e6936d34fc2ebbeb950ee45aee3ca5a0ac176a54a7c2abd6f8d43ff5c2f2d9aa8684dbb01f89544cd489e2a6a40df257cdcc815bc93faa5b5aad145cc33
7
+ data.tar.gz: ba1d3b099df20e08385afe86aefc3c75930fb9246996146b8eb6a63f1c792e6437b3bd863abb946d50406eac0a8dca2dac1fcd48da5659e07e79c320566a4210
@@ -0,0 +1,11 @@
1
+ # v0.1.2 (2014-03-29)
2
+
3
+ * Bump dependency_injection-ruby to [v0.4.3](https://github.com/kdisneur/dependency_injection-ruby/blob/develop/CHANGELOG.md#043-2014-03-29)
4
+
5
+ # v0.1.1 (2014-03-16)
6
+
7
+ * Bump dependency_injection-ruby to [v0.4.2](https://github.com/kdisneur/dependency_injection-ruby/blob/develop/CHANGELOG.md#042-2014-03-16)
8
+
9
+ # v0.1.0 (2014-02-24)
10
+
11
+ * Add a sinatra helper "container" to access to the service container
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dependency_injection-sinatra (0.1.0)
5
- dependency_injection (~> 0.4.1)
4
+ dependency_injection-sinatra (0.1.2)
5
+ dependency_injection (~> 0.4.2)
6
6
  sinatra
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (4.0.3)
12
- i18n (~> 0.6, >= 0.6.4)
11
+ activesupport (4.0.4)
12
+ i18n (~> 0.6, >= 0.6.9)
13
13
  minitest (~> 4.2)
14
14
  multi_json (~> 1.3)
15
15
  thread_safe (~> 0.1)
16
16
  tzinfo (~> 0.3.37)
17
- atomic (1.1.14)
18
- dependency_injection (0.4.1)
17
+ atomic (1.1.16)
18
+ dependency_injection (0.4.3)
19
19
  activesupport
20
20
  i18n (0.6.9)
21
21
  minitest (4.7.5)
22
- multi_json (1.8.4)
22
+ multi_json (1.9.2)
23
23
  rack (1.5.2)
24
24
  rack-protection (1.5.2)
25
25
  rack
@@ -27,10 +27,10 @@ GEM
27
27
  rack (~> 1.4)
28
28
  rack-protection (~> 1.4)
29
29
  tilt (~> 1.3, >= 1.3.4)
30
- thread_safe (0.1.3)
31
- atomic
30
+ thread_safe (0.3.1)
31
+ atomic (>= 1.1.7, < 2)
32
32
  tilt (1.4.1)
33
- tzinfo (0.3.38)
33
+ tzinfo (0.3.39)
34
34
 
35
35
  PLATFORMS
36
36
  ruby
@@ -0,0 +1,75 @@
1
+ # Dependency Injection for Sinatra
2
+
3
+ `Sinatra::DependencyInjection` adds a helper method, called `container`, to access to your ruby
4
+ [dependency injection container](https://github.com/kdisneur/dependency_injection-ruby)
5
+
6
+ ## Installation
7
+
8
+ Just add the gem to your Gemfile
9
+
10
+ ```ruby
11
+ gem 'dependency_injection-sinatra'
12
+ ```
13
+
14
+ Or simply install it using rubygems:
15
+
16
+ ```ruby
17
+ gem install dependency_injection-sinatra
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Classic Application
23
+
24
+ In a classic application simply require the helper, and start using it:
25
+
26
+ ```ruby
27
+ require 'sinatra'
28
+ require 'sinatra/dependency_injection'
29
+
30
+ # define a route that uses the helper
31
+ get '/' do
32
+ json container.get('awesome_service').find_trending
33
+ end
34
+
35
+ # The rest of your classic application code goes here...
36
+ ```
37
+
38
+ ### Modular Application
39
+
40
+ In a modular application you need to require the helper, and then tell the
41
+ application you will use it:
42
+
43
+ ```ruby
44
+ require 'sinatra/base'
45
+ require 'sinatra/dependency_injection'
46
+
47
+ class MyApp < Sinatra::Base
48
+ register Sinatra::DependencyInjection
49
+
50
+ # define a route that uses the helper
51
+ get '/' do
52
+ json container.get('awesome_service').find_trending
53
+ end
54
+
55
+ # The rest of your modular application code goes here...
56
+ end
57
+ ```
58
+
59
+ ### Configuration path
60
+
61
+ By default it will try to load `services.yml` configuration file, but if
62
+ your configuration file is stored in another place, you can easily change it:
63
+
64
+ ```ruby
65
+ require 'sinatra/base'
66
+ require 'sinatra/dependency_injection'
67
+
68
+ class MyApp < Sinatra::Base
69
+ register Sinatra::DependencyInjection
70
+
71
+ dependency_injection_path 'config/services.yml'
72
+
73
+ # The rest of your module application code goes here...
74
+ end
75
+ ```
@@ -15,5 +15,5 @@ Gem::Specification.new do |spec|
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
 
17
17
  spec.add_dependency('sinatra')
18
- spec.add_dependency('dependency_injection', '~> 0.4.1')
18
+ spec.add_dependency('dependency_injection', '~> 0.4.2')
19
19
  end
@@ -6,7 +6,7 @@ module Sinatra
6
6
  module DependencyInjection
7
7
  module Helper
8
8
  def container
9
- @dependency_injection_container if @dependency_injection_container
9
+ return @dependency_injection_container if @dependency_injection_container
10
10
 
11
11
  @dependency_injection_container = ::DependencyInjection::Container.new
12
12
  loader = ::DependencyInjection::Loaders::Yaml.new(@dependency_injection_container)
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module DependencyInjection
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependency_injection-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Disneur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-24 00:00:00.000000000 Z
11
+ date: 2014-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -30,22 +30,24 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.1
33
+ version: 0.4.2
34
34
  type: :runtime
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.4.1
40
+ version: 0.4.2
41
41
  description: A Sinatra wrapper for a fully customizable Dependency injection system
42
42
  email: kevin@koboyz.org
43
43
  executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
+ - CHANGELOG.md
47
48
  - Gemfile
48
49
  - Gemfile.lock
50
+ - README.md
49
51
  - dependency_injection-sinatra.gemspec
50
52
  - lib/sinatra/dependency_injection.rb
51
53
  - lib/sinatra/dependency_injection/helper.rb