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 +4 -4
- data/exe/docker-pier +23 -1
- data/lib/docker-pier/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6ceb7879c80d9c132767117c4e77d3061939e77
|
4
|
+
data.tar.gz: 949f3445b7f3c40d84b0b57c3d2de241c2f2547c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/docker-pier/version.rb
CHANGED