ruby-llenv 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +5 -0
- data/README.md +9 -0
- data/lib/llenv/cli.rb +2 -1
- data/lib/llenv/declare.rb +20 -8
- data/lib/llenv/version.rb +1 -1
- metadata +2 -2
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -40,6 +40,15 @@ Root directory installed all LLs. Default: "~/.llenv"
|
|
40
40
|
|
41
41
|
Declare repository URL. Default: [https://github.com/riywo/llenv-declare.git](https://github.com/riywo/llenv-declare.git)
|
42
42
|
|
43
|
+
### `LLENV_ENV`
|
44
|
+
|
45
|
+
For passing user environment variables to inside of llenv.
|
46
|
+
|
47
|
+
$ LLENV_ENV=PORT=1234,LOGDIR=/var/log/log llenv exec env
|
48
|
+
PORT=1234
|
49
|
+
LOGDIR=/var/log/log
|
50
|
+
...
|
51
|
+
|
43
52
|
## Contributing
|
44
53
|
|
45
54
|
1. Fork it
|
data/lib/llenv/cli.rb
CHANGED
@@ -7,7 +7,8 @@ class LLenv::CLI < Thor
|
|
7
7
|
def initialize(args = [], options = {}, config = {})
|
8
8
|
@root_dir = ENV["LLENV_ROOT"] || File.expand_path("~/.llenv")
|
9
9
|
@declare_repo = ENV["LLENV_DECLARE_URL"] || "https://github.com/riywo/llenv-declare.git"
|
10
|
-
@
|
10
|
+
@env = ENV["LLENV_ENV"] || ""
|
11
|
+
@declare = LLenv::Declare.new(@root_dir, @env)
|
11
12
|
super
|
12
13
|
end
|
13
14
|
|
data/lib/llenv/declare.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
require "llenv"
|
2
2
|
|
3
3
|
class LLenv::Declare
|
4
|
-
|
4
|
+
|
5
|
+
def initialize(dir, env)
|
5
6
|
@root_dir = dir
|
7
|
+
@env = {}
|
8
|
+
env.split(',').each do |str|
|
9
|
+
k, v = str.split('=')
|
10
|
+
@env[k] = v
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
def run(llenv, command, argv = [])
|
@@ -26,17 +32,23 @@ private
|
|
26
32
|
@declare_dir = File.join(@root_dir, llenv)
|
27
33
|
raise "#{llenv} not declared in #{@root_dir}" unless File.directory?(@declare_dir)
|
28
34
|
|
29
|
-
|
30
|
-
env =
|
31
|
-
env
|
32
|
-
|
33
|
-
ENV[k] = v
|
34
|
-
end
|
35
|
+
env = {}
|
36
|
+
env["LLENV_ROOT"] = ENV["LLENV_ROOT"] if ENV.has_key? "LLENV_ROOT"
|
37
|
+
env["LLENV_DECLARE_URL"] = ENV["LLENV_DECLARE_URL"] if ENV.has_key? "LLENV_DECLARE_URL"
|
38
|
+
env.merge!(@env)
|
35
39
|
|
40
|
+
ENV.clear
|
41
|
+
path = `. /etc/profile && echo $PATH`.chomp
|
36
42
|
home = File.join(@declare_dir, ".home")
|
37
|
-
Dir.mkdir(home) unless File.
|
43
|
+
Dir.mkdir(home) unless File.exists?(home)
|
44
|
+
|
45
|
+
ENV["PATH"] = path
|
38
46
|
ENV["HOME"] = home
|
39
47
|
ENV["SHELL"] = "/bin/bash"
|
48
|
+
|
49
|
+
env.each do |k,v|
|
50
|
+
ENV[k] = v
|
51
|
+
end
|
40
52
|
end
|
41
53
|
|
42
54
|
end
|
data/lib/llenv/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-llenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|