envy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +4 -0
- data/README.rdoc +0 -0
- data/Rakefile +13 -0
- data/envy.gemspec +30 -0
- data/lib/envy.rb +32 -0
- metadata +78 -0
data/Manifest
ADDED
data/README.rdoc
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('envy', '0.0.1') do |p|
|
6
|
+
p.description = "A gem that creates the illusion of namespaced env variables"
|
7
|
+
p.url = "http://github.com/justinvt/envy"
|
8
|
+
p.author = "Justin Thibault"
|
9
|
+
p.email = "jvthibault @nospam@ gmail.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
data/envy.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{envy}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Justin Thibault"]
|
9
|
+
s.date = %q{2011-02-14}
|
10
|
+
s.description = %q{A gem that creates the illusion of namespaced env variables}
|
11
|
+
s.email = %q{jvthibault @nospam@ gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/envy.rb"]
|
13
|
+
s.files = ["README.rdoc", "Rakefile", "lib/envy.rb", "Manifest", "envy.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/justinvt/envy}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Envy", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{envy}
|
18
|
+
s.rubygems_version = %q{1.3.5}
|
19
|
+
s.summary = %q{A gem that creates the illusion of namespaced env variables}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/lib/envy.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Envy
|
2
|
+
|
3
|
+
def self.namespace(*selectors)
|
4
|
+
|
5
|
+
selectors = [ selectors.to_a ].flatten.map{|s| s.is_a?(String) ? Regexp.new( (s.upcase + "_").gsub(/_{2,}$/,"_")) : s}
|
6
|
+
|
7
|
+
added_config = {}
|
8
|
+
|
9
|
+
|
10
|
+
selectors.each do |selector|
|
11
|
+
|
12
|
+
env_config = {}
|
13
|
+
|
14
|
+
ENV.select {|k,v| k =~ selector }.to_a.each do |k|
|
15
|
+
env_config[ k[0].gsub(selector,'').to_s.downcase.to_sym ] = k[1]
|
16
|
+
env_config[ k[0].gsub(selector,'').to_s.to_sym ] = k[1]
|
17
|
+
end
|
18
|
+
|
19
|
+
constant_name = selector.to_s.split(":")[-1].to_s.gsub(/^[^a-zA-Z0-9]{1,}|[^a-zA-Z0-9]{1,}$/,'').gsub(/[^a-zA-Z0-9_]+/,'').upcase
|
20
|
+
|
21
|
+
self.const_set(constant_name, env_config) unless self.const_defined?(constant_name)
|
22
|
+
Kernel.const_set(constant_name, env_config) unless Kernel.const_defined?(constant_name)
|
23
|
+
|
24
|
+
added_config[constant_name] = env_config
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
added_config
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: envy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Justin Thibault
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-14 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: A gem that creates the illusion of namespaced env variables
|
23
|
+
email: jvthibault @nospam@ gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
- lib/envy.rb
|
31
|
+
files:
|
32
|
+
- README.rdoc
|
33
|
+
- Rakefile
|
34
|
+
- lib/envy.rb
|
35
|
+
- Manifest
|
36
|
+
- envy.gemspec
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/justinvt/envy
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options:
|
43
|
+
- --line-numbers
|
44
|
+
- --inline-source
|
45
|
+
- --title
|
46
|
+
- Envy
|
47
|
+
- --main
|
48
|
+
- README.rdoc
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 11
|
66
|
+
segments:
|
67
|
+
- 1
|
68
|
+
- 2
|
69
|
+
version: "1.2"
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project: envy
|
73
|
+
rubygems_version: 1.5.2
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: A gem that creates the illusion of namespaced env variables
|
77
|
+
test_files: []
|
78
|
+
|