service_manager 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/service_manager.rb +11 -6
  2. metadata +3 -3
@@ -9,16 +9,21 @@ module ServiceManager
9
9
 
10
10
  def services
11
11
  return @services if @services
12
- @services = []
13
- load_services
14
- @services
12
+
13
+ (@services = []).tap do
14
+ load_services if service_files_loaded.empty?
15
+ end
16
+ end
17
+
18
+ def service_files_loaded
19
+ @service_files_loaded ||= []
15
20
  end
16
21
 
17
22
  def load_services(path = nil)
18
- path ||= SERVICES_PATH
19
- return if @services_loaded
23
+ path = File.expand_path(path || SERVICES_PATH, Dir.pwd)
24
+ return if service_files_loaded.include?(path)
25
+ service_files_loaded << path
20
26
  load path
21
- @services_loaded = true
22
27
  end
23
28
 
24
29
  def define_service(name = nil, &block)
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_manager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- version: "0.5"
8
+ - 6
9
+ version: "0.6"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tim Harper