docker-pier 0.1.0 → 0.1.1

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: 4db1df031b3184db08b38589afed042f43c93f5c
4
- data.tar.gz: 56f5f252bebdc7300fdf8d109b69827d08125dc3
3
+ metadata.gz: c6ceb7879c80d9c132767117c4e77d3061939e77
4
+ data.tar.gz: 949f3445b7f3c40d84b0b57c3d2de241c2f2547c
5
5
  SHA512:
6
- metadata.gz: 621f0d87acabf5d89435c3b5597edee4cdc73a1a61838f1250f8fb2da630941538de95f68a1a0470fe9e400906baa9c61209ba7947883a73e1b48f3a004122fb
7
- data.tar.gz: eea7967dbb62ab38d06d9047981a6672ad91849770d70967e3504d425d3277e169cd1b70603784dbaf959ee5a48150b1adf0a6b39c0c2f9b2723d155cee8b9f0
6
+ metadata.gz: 7dd886943e8278fdacb675761b58748c631b0d6a8a1cfad44cce61aefe6bb483cbc9cc449cfaf29822ec89e3e517632638a933c5965732b0071520aff75faaca
7
+ data.tar.gz: 573c684f9bebdd8d77d3c8db09072681a5f0b7f771c5d66b80978bf6fa1ae34ac217ce9278a38ab2d93e0cb9efb8c61eb29e438524d2876457492764ee8bf31f
data/exe/docker-pier CHANGED
@@ -2,6 +2,7 @@
2
2
  require "docker-pier"
3
3
  require "main"
4
4
  require "highline"
5
+ require "paint"
5
6
 
6
7
  Main do
7
8
  db do
@@ -19,8 +20,16 @@ Main do
19
20
 
20
21
  mode 'list' do
21
22
  def run
23
+ in_use_cluster_name = ENV['DOCKER_MACHINE_NAME']
24
+
22
25
  db[:clusters].each do |cluster|
23
- puts "#{cluster[:name]}: #{cluster[:pier_uri]}"
26
+ cluster_ansi = if cluster[:name] == in_use_cluster_name
27
+ Paint['*' + cluster[:name], :blue]
28
+ else
29
+ ' ' + cluster[:name]
30
+ end
31
+
32
+ puts "#{cluster_ansi}: #{cluster[:pier_uri]}"
24
33
  end
25
34
  end
26
35
  end
@@ -117,6 +126,17 @@ Main do
117
126
  end
118
127
  end
119
128
 
129
+ DMACHINE_PS1 = '${DOCKER_MACHINE_NAME:+ \\[\\033[34m\\]*$DOCKER_MACHINE_NAME\\[\\033[m\\]}'
130
+
131
+ def modified_ps1_ln
132
+ ps1 = ENV['PS1']
133
+ return '' if ps1 =~ /DOCKER_MACHINE_NAME/
134
+ escaped_ps1 = ps1.gsub(/(\\\[.+?\\\])|(\$\{.+?\})/){ |s| s.gsub(/:/, '&&COLON&&') }
135
+ escaped_ps1_parts = escaped_ps1.split(':')
136
+ return '' unless escaped_ps1_parts.length == 2
137
+ ps1_parts = escaped_ps1_parts.map{ |s| s.gsub(/&&COLON&&/, ':') }
138
+ "export PS1='#{ps1_parts[0]}#{DMACHINE_PS1}:#{ps1_parts[1]}'"
139
+ end
120
140
 
121
141
  mode 'hook:install' do
122
142
  def run
@@ -134,6 +154,8 @@ Main do
134
154
  ;;
135
155
  esac
136
156
  }
157
+
158
+ #{modified_ps1_ln}
137
159
  EOF
138
160
  end
139
161
  end
@@ -1,3 +1,3 @@
1
1
  module DockerPier
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-pier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Levi Aul