environment 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest ADDED
@@ -0,0 +1,6 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ environment.gemspec
5
+ lib/enviornment.rb
6
+ lib/save_environment_variables.sh
data/README.rdoc ADDED
@@ -0,0 +1,18 @@
1
+ = Environment
2
+
3
+ Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.
4
+
5
+ == Installation
6
+
7
+ # gem install environment
8
+
9
+ == Usage
10
+
11
+ The global constant ENV is left untouched. A constant Environment::ENV is available; Environment::ENV is a Hash and so all hash operations can be run on it.
12
+
13
+ Example usage:
14
+
15
+ require "rubygems"
16
+ require "environment"
17
+
18
+ path = Environment::ENV['PATH']
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "rubygems"
2
+ require "rake"
3
+ require "echoe"
4
+
5
+ Echoe.new("environment", "0.1.0") do |p|
6
+ p.description = "Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables."
7
+ p.summary = "Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables."
8
+ p.url = "http://rubygems.org/gems/environment"
9
+ p.author = "Nitesh Goel"
10
+ p.email = "nitesh@wikinvest.com"
11
+ p.ignore_pattern = ["tmp/*", "script/*"]
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{environment}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Nitesh Goel"]
9
+ s.date = %q{2011-04-21}
10
+ s.description = %q{Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.}
11
+ s.email = %q{nitesh@wikinvest.com}
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/enviornment.rb", "lib/save_environment_variables.sh"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "environment.gemspec", "lib/enviornment.rb", "lib/save_environment_variables.sh"]
14
+ s.homepage = %q{http://rubygems.org/gems/environment}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Environment", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{environment}
18
+ s.rubygems_version = %q{1.7.2}
19
+ s.summary = %q{Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.}
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
@@ -0,0 +1,40 @@
1
+ =begin rdoc
2
+ = Environment
3
+
4
+ Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.
5
+
6
+ == Installation
7
+
8
+ # gem install environment
9
+
10
+ == Usage
11
+
12
+ The global constant ENV is left untouched. A constant Environment::ENV is available; Environment::ENV is a Hash and so all hash operations can be run on it.
13
+
14
+ Example usage:
15
+
16
+ require "rubygems"
17
+ require "environment"
18
+
19
+ path = Environment::ENV['PATH']
20
+ =end
21
+ module Environment
22
+ CURRENT_DIR = File.dirname(__FILE__)
23
+ SHELL_SCRIPT = "#{CURRENT_DIR}/save_environment_variables.sh"
24
+ VARIABLE_DUMP = "#{CURRENT_DIR}/.environment_variables"
25
+ ENV = {}
26
+
27
+ def self.load
28
+ success = system("bash -l #{SHELL_SCRIPT}")
29
+ if success && File.exists?(VARIABLE_DUMP)
30
+ File.read(VARIABLE_DUMP).each_line do |line|
31
+ key,value = line.split("=")
32
+ Environment::ENV[key] = value
33
+ end
34
+ File.delete(VARIABLE_DUMP)
35
+ end
36
+ end
37
+ end
38
+
39
+ Environment.load
40
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/bash
2
+ /usr/bin/env > .environment_variables
3
+ exit
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: environment
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Nitesh Goel
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-04-21 00:00:00 Z
19
+ dependencies: []
20
+
21
+ description: Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.
22
+ email: nitesh@wikinvest.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.rdoc
29
+ - lib/enviornment.rb
30
+ - lib/save_environment_variables.sh
31
+ files:
32
+ - Manifest
33
+ - README.rdoc
34
+ - Rakefile
35
+ - environment.gemspec
36
+ - lib/enviornment.rb
37
+ - lib/save_environment_variables.sh
38
+ homepage: http://rubygems.org/gems/environment
39
+ licenses: []
40
+
41
+ post_install_message:
42
+ rdoc_options:
43
+ - --line-numbers
44
+ - --inline-source
45
+ - --title
46
+ - Environment
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: environment
73
+ rubygems_version: 1.7.2
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Environment variables in are not available to scripts running as crons and/or services. This gem allows ruby scripts running as a cron and/or as a service full access to the system environment variables.
77
+ test_files: []
78
+