yu 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yu.rb +16 -9
  3. data/lib/yu/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a92783e2c1c90b67e2f7e86ca29c214a2590084a
4
- data.tar.gz: 734abe78119bb4cb4242f98d48826c6169f62d84
3
+ metadata.gz: 5cbc9c30e4947022dd66809bbc13df12d37e36b4
4
+ data.tar.gz: 24b26590093e44c3004b7e938fd929bb95799314
5
5
  SHA512:
6
- metadata.gz: 1051b45b297987d900054b74ff4ef3d258a06ce5f80415a6ce06eea814e728a80ac85cba76a47f1a76921892ac36e9a56c29429ec79a0761305bace7eb7e28cc
7
- data.tar.gz: 7ea52ab97d0217947fc36e08498638a73d947042cd3a07e519e59391eafae0c6204180c046bcba4856656554f76b50fb27b8bb096ec0e5a230a86c8d22876b73
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
- exec("docker-compose build #{target_containers.join(" ")}")
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
- exec("docker-compose run --rm #{env_option} #{target_container} bash")
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
- info "Running command: #{command}" if verbose_mode?
109
- _, out_and_err, wait_thread = Open3.popen2e(command)
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
- wait_thread.value.tap do |terminated_process|
115
- unless terminated_process.success?
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
@@ -1,3 +1,3 @@
1
1
  module Yu
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kelly