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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc34fccab31d8c247bf560b56f53c05e9b0cbe2e
4
- data.tar.gz: e9fd612410995e972f2ad670a045ae16e0408c77
3
+ metadata.gz: d8ecbe7646139e63740d438b5f9139e74f2797d1
4
+ data.tar.gz: 144ac2590a4d06ce57c13cd4b52d926bf83e3275
5
5
  SHA512:
6
- metadata.gz: d99d51e732876b3d8038e24b4166454b38158e42e41484c4eb620c2735746a0e3dfb6d141e9d9cd70f809caf8462a80586e806cddb9246a224ea0463134d9003
7
- data.tar.gz: bb1651aaa016d43aaf3822352671fdf93d278a2c04103e64a07becfc688eba2712f5878ac7d7f8bfa1c567df644a1e18669dc3aabc1faca062594b8648c2fdfd
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 numeric color code - red when `aws_session_expired` is `true`,
78
- yellow otherwise.
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
 
@@ -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("export OLDPROMPT=\"${PROMPT}\"\n")
60
- rc_file.write("PROMPT=$'%{\\e[\\%}$(aws_session_status_color)m(#{message})%{\\e[0m%} $OLDPROMPT'\n")
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)
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module AwsRunAs
16
- VERSION = '0.5.1'
16
+ VERSION = '0.5.2'
17
17
  end
@@ -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 the specific status
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
- echo "31"
20
+ if [[ "$1" == zsh ]]; then
21
+ echo "red"
22
+ fi
23
+ echo "31"
20
24
  else
21
- echo "33"
25
+ if [[ "$1" == zsh ]]; then
26
+ echo "yellow"
27
+ fi
28
+ echo "33"
22
29
  fi
23
30
  }
@@ -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=$'%{\\e[\\%}$(aws_session_status_color)m(AWS:rspec)%{\\e[0m%} $OLDPROMPT'\n".freeze
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 = "export OLDPROMPT=\"${PROMPT}\"\n".freeze
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.1
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-02-21 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk