wdi_runas 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +3 -2
- data/lib/aws_runas/utils.rb +3 -3
- data/lib/aws_runas/version.rb +1 -1
- data/shell_profiles/sh.profile +10 -3
- data/spec/helpers/utils_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8ecbe7646139e63740d438b5f9139e74f2797d1
|
4
|
+
data.tar.gz: 144ac2590a4d06ce57c13cd4b52d926bf83e3275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b78e63381f07ed2b7c059fcdfbf3ca581acffa970e988b4c261d66ebf34c3c3a061a1ced7dc5783e03681ce52b2e298e866f079c8b4843da1440a53b0985411
|
7
|
+
data.tar.gz: b2469db23e2a25554792a8ffebdfbf253b7b459088c64a905bf33fbd7b84dc3f54d5dd7d4c8b6289293a4d75f4427cc0d2512210eb9ae9570736d2e185bbb2cc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## v0.5.2
|
2
|
+
|
3
|
+
Fixed the bug where the current PROMPT was not supporting
|
4
|
+
shell functions and colors but rather just rendering the old prompt code
|
5
|
+
as text. https://github.com/vancluever/aws-runas/issues/13
|
6
|
+
|
7
|
+
## 0.5.1
|
8
|
+
|
9
|
+
Increase the session timeout from 1 hour to 24 hours.
|
10
|
+
Rename from aws_runas to wdi_runas
|
11
|
+
|
1
12
|
## v0.5.0
|
2
13
|
|
3
14
|
### Zsh Support
|
data/README.md
CHANGED
@@ -74,8 +74,9 @@ shells:
|
|
74
74
|
returns 0 on true and 1 on false, which can be used semantically in shell
|
75
75
|
scripts.
|
76
76
|
* `aws_session_status_color`, which works off of `aws_session_expired` to
|
77
|
-
render an ANSI
|
78
|
-
|
77
|
+
render either an ANSI color number (for bash)
|
78
|
+
or a human readable color name (for zsh)
|
79
|
+
- (red or 31) when `aws_session_expired` is `true`, (yellow or 33) otherwise.
|
79
80
|
|
80
81
|
#### Skipping the Fancy Prompt
|
81
82
|
|
data/lib/aws_runas/utils.rb
CHANGED
@@ -37,7 +37,7 @@ module AwsRunAs
|
|
37
37
|
rc_file.write("#{rc_data}\n") unless rc_data.nil?
|
38
38
|
rc_file.write(IO.read("#{shell_profiles_dir}/sh.profile"))
|
39
39
|
unless skip_prompt
|
40
|
-
rc_file.write("PS1=\"\\[\\e[\\$(aws_session_status_color)m\\](#{message})\\[\\e[0m\\] $PS1\"\n")
|
40
|
+
rc_file.write("PS1=\"\\[\\e[\\$(aws_session_status_color \"bash\")m\\](#{message})\\[\\e[0m\\] $PS1\"\n")
|
41
41
|
end
|
42
42
|
rc_file.close
|
43
43
|
system(env, path, '--rcfile', rc_file.path)
|
@@ -56,8 +56,8 @@ module AwsRunAs
|
|
56
56
|
rc_file.write(IO.read("#{shell_profiles_dir}/sh.profile"))
|
57
57
|
unless skip_prompt
|
58
58
|
rc_file.write("setopt PROMPT_SUBST\n")
|
59
|
-
rc_file.write("
|
60
|
-
rc_file.write("PROMPT
|
59
|
+
rc_file.write("OLDPROMPT=\"$PROMPT\"\n")
|
60
|
+
rc_file.write("PROMPT=\"%F{$(aws_session_status_color \"zsh\")}(#{message})%f $OLDPROMPT\"\n")
|
61
61
|
end
|
62
62
|
rc_file.close
|
63
63
|
env.store('ZDOTDIR', rc_dir)
|
data/lib/aws_runas/version.rb
CHANGED
data/shell_profiles/sh.profile
CHANGED
@@ -10,14 +10,21 @@ aws_session_expired() {
|
|
10
10
|
return 1
|
11
11
|
}
|
12
12
|
|
13
|
-
# aws_session_status_color returns an ANSI color number for
|
13
|
+
# aws_session_status_color returns either an ANSI color number (for bash)
|
14
|
+
# or a human readable color name (for zsh) for the specific status
|
14
15
|
# of the session. Note that if session_expired is not correctly functioning,
|
15
16
|
# this will always be yellow. Red is shown when it's verified that the session
|
16
17
|
# has expired.
|
17
18
|
aws_session_status_color() {
|
18
19
|
if aws_session_expired; then
|
19
|
-
|
20
|
+
if [[ "$1" == zsh ]]; then
|
21
|
+
echo "red"
|
22
|
+
fi
|
23
|
+
echo "31"
|
20
24
|
else
|
21
|
-
|
25
|
+
if [[ "$1" == zsh ]]; then
|
26
|
+
echo "yellow"
|
27
|
+
fi
|
28
|
+
echo "33"
|
22
29
|
fi
|
23
30
|
}
|
data/spec/helpers/utils_spec.rb
CHANGED
@@ -11,10 +11,10 @@ ZSHRC_FILE_CONTENTS = <<EOS.freeze
|
|
11
11
|
bazqux
|
12
12
|
EOS
|
13
13
|
|
14
|
-
BASHRC_EXPECTED_PROMPT = "PS1=\"\\[\\e[\\$(aws_session_status_color)m\\](AWS:rspec)\\[\\e[0m\\] $PS1\"\n".freeze
|
15
|
-
ZSHRC_EXPECTED_PROMPT = "PROMPT
|
14
|
+
BASHRC_EXPECTED_PROMPT = "PS1=\"\\[\\e[\\$(aws_session_status_color \"bash\")m\\](AWS:rspec)\\[\\e[0m\\] $PS1\"\n".freeze
|
15
|
+
ZSHRC_EXPECTED_PROMPT = "PROMPT=\"%F{$(aws_session_status_color \"zsh\")}(AWS:rspec)%f $OLDPROMPT\"\n".freeze
|
16
16
|
ZSHRC_EXPECTED_SETSUBST = "setopt PROMPT_SUBST\n".freeze
|
17
|
-
ZSHRC_EXPECTED_OLDPROMPT = "
|
17
|
+
ZSHRC_EXPECTED_OLDPROMPT = "OLDPROMPT=\"$PROMPT\"\n".freeze
|
18
18
|
ZSH_MOCK_TMPDIR = "#{Dir.tmpdir}/aws_runas_zsh_rspec".freeze
|
19
19
|
|
20
20
|
EXPECTED_ENV = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wdi_runas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Marchesi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|