yu 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yu.rb +16 -9
- data/lib/yu/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: 5cbc9c30e4947022dd66809bbc13df12d37e36b4
|
4
|
+
data.tar.gz: 24b26590093e44c3004b7e938fd929bb95799314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dac38714818da55dd73a172832b709cb12c05980b6437d29cb65366893a1422593a2525925117c9d32e2366a957b25319748e62b229b76cd060ec19b187aa320
|
7
|
+
data.tar.gz: 2746b86f59da55b1c17fc276947f5f56e5f745307a99ecd6d86fd6cfb87c739a094b0a6d20ffaf311eaaf60996215d1e4ab4bd6f38b39e55f91e2c42c484786c
|
data/lib/yu.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'yu/version'
|
2
2
|
require 'commander'
|
3
|
-
require 'open3'
|
4
3
|
|
5
4
|
module Yu
|
6
5
|
class CLI
|
@@ -69,7 +68,8 @@ module Yu
|
|
69
68
|
end
|
70
69
|
|
71
70
|
target_gemfiled_containers.each(&method(:package_gems_for_container))
|
72
|
-
|
71
|
+
info "Building images..."
|
72
|
+
execute_command("docker-compose build #{target_containers.join(" ")}")
|
73
73
|
end
|
74
74
|
|
75
75
|
def shell(args, options)
|
@@ -80,7 +80,8 @@ module Yu
|
|
80
80
|
when 1
|
81
81
|
target_container = normalise_container_name_from_dir(args.first)
|
82
82
|
env_option = options.test ? "-e APP_ENV=test" : ""
|
83
|
-
|
83
|
+
info "Loading #{"test" if options.test} shell for #{target_container}..."
|
84
|
+
execute_command("docker-compose run --rm #{env_option} #{target_container} bash")
|
84
85
|
else
|
85
86
|
info "One at a time please!"
|
86
87
|
exit 1
|
@@ -105,14 +106,15 @@ module Yu
|
|
105
106
|
end
|
106
107
|
|
107
108
|
def run_command(command, showing_output: false, exit_on_failure: true)
|
108
|
-
|
109
|
-
|
110
|
-
while line = out_and_err.gets
|
111
|
-
puts line if showing_output || verbose_mode?
|
109
|
+
unless showing_output || verbose_mode?
|
110
|
+
command = "#{command} &>/dev/null"
|
112
111
|
end
|
113
112
|
|
114
|
-
|
115
|
-
|
113
|
+
pid = fork { execute_command(command) }
|
114
|
+
_, process = Process.waitpid2(pid)
|
115
|
+
|
116
|
+
process.tap do |result|
|
117
|
+
unless result.success?
|
116
118
|
if block_given?
|
117
119
|
yield
|
118
120
|
else
|
@@ -137,5 +139,10 @@ module Yu
|
|
137
139
|
def info(message)
|
138
140
|
say "[yu] #{message}"
|
139
141
|
end
|
142
|
+
|
143
|
+
def execute_command(command)
|
144
|
+
info "Executing: #{command}" if verbose_mode?
|
145
|
+
exec(command)
|
146
|
+
end
|
140
147
|
end
|
141
148
|
end
|
data/lib/yu/version.rb
CHANGED