egi 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  .bundle
3
+ egi.conf
3
4
  Gemfile.lock
4
5
  pkg/*
5
6
 
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.0.4
4
+ * ENHANCEMENT
5
+ * [](name) to access item
6
+ * tagged(name) to find tag
7
+
3
8
  ## 0.0.3
4
9
  * ENHANCEMENT
5
10
  * EGI.env loads Egi.config_file, ./egi.conf, or /etc/egi.conf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  [ [ 'rake' ],
23
23
  [ 'rspec' ],
24
24
  [ 'autowatchr' ],
25
+ [ 'tapp' ],
25
26
  ].each do |gem, version|
26
27
  s.add_development_dependency gem, version
27
28
  end
data/lib/egi.rb CHANGED
@@ -6,14 +6,15 @@ module Egi
6
6
  autoload :Group, 'egi/group'
7
7
  autoload :Item, 'egi/item'
8
8
 
9
+ module_function
9
10
  def env
10
11
  load_file(config_file) unless @env
11
12
 
12
- name = ENV['EGI_ENV'] || 'default'
13
- self[name]
13
+ self[(ENV['EGI_ENV'] || 'default').to_sym]
14
14
  end
15
15
 
16
16
  def [](name)
17
+ name = name.to_sym
17
18
  @env.has_key?(name) ? @env[name] : nil
18
19
  end
19
20
 
@@ -28,6 +29,7 @@ module Egi
28
29
  def reset
29
30
  @env = nil
30
31
  end
32
+
31
33
  def config_file
32
34
  @config_file ||
33
35
  ( File.exist?('./egi.conf') && './egi.conf' ) ||
@@ -38,6 +40,4 @@ module Egi
38
40
  def config_file=(file)
39
41
  @config_file = file
40
42
  end
41
-
42
- module_function :env, :[], :load, :reset, :config_file, :config_file=
43
43
  end
@@ -26,5 +26,18 @@ module Egi
26
26
  def item(name, hash = {})
27
27
  items[name.to_sym].update(hash)
28
28
  end
29
+
30
+ def [](name)
31
+ items[name.to_sym]
32
+ end
33
+
34
+ def tags
35
+ @tags ||= items.values.map {|item| item[:tags] || [] }.flatten.uniq
36
+ end
37
+
38
+ def tagged(name)
39
+ name = name.to_sym
40
+ tags.include?(name) ? items.select {|k, v| v[:tags].include?(name) } : nil
41
+ end
29
42
  end
30
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-28 00:00:00.000000000 Z
12
+ date: 2011-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &84892960 !ruby/object:Gem::Requirement
16
+ requirement: &79798420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *84892960
24
+ version_requirements: *79798420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &84892670 !ruby/object:Gem::Requirement
27
+ requirement: &79798110 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *84892670
35
+ version_requirements: *79798110
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: autowatchr
38
- requirement: &84892430 !ruby/object:Gem::Requirement
38
+ requirement: &79797870 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,18 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *84892430
46
+ version_requirements: *79797870
47
+ - !ruby/object:Gem::Dependency
48
+ name: tapp
49
+ requirement: &79797600 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *79797600
47
58
  description: manage multi-environments
48
59
  email:
49
60
  - okitakunio@gmail.com