kuby-core 0.10.0 → 0.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f61bf7246e7fed1b51421252d1fee25da0bf1ad35da792e9f705d306ad5aeeba
4
- data.tar.gz: fcaed876fd5da816cd1458c41c19fc735a7d3e5de2d23879427c526f2f0f94ea
3
+ metadata.gz: 2b7d982098e06b6e511fe3404385d6762c9f37fdf7df2ac91ce9775f40ce809e
4
+ data.tar.gz: b23e5c83e32a488ba8effb2ff3a8fd0f2834c305f6046072bcd6dd1e54c1f0e9
5
5
  SHA512:
6
- metadata.gz: 78f6cad56fd00b1265a43ac36169da5d46b15c50ceb5afce6f519ef175ff3949f84204ccf40ad9531b9dbb6b357d38ac0396e6969d848bfb17b42ba1c273ba6d
7
- data.tar.gz: 056b9a151fd6f11079eb87fd5c0b7c4f92087cd8455a361ac7e668e9b94e4fc99a866b91c4f30d0a3eda582b0c2cafaac2e3ee882daebec0a52f1fd748786871
6
+ metadata.gz: d64e1c94a33045be652d9bbea27d68ec905779f8e67339a03f3e5a10729e2f9c0622f120cf66a08ab8978152dc2ae4bd863d74cca60588e9d4f0b96d484ca72a
7
+ data.tar.gz: acd984606d103c17d5150cca2fbba13757051c277733d360868cc79145472dd77e7f536fd8c71687d62da09c7eaad59fc5071aa590d95d08c4367a2ba61d1b35
@@ -1,3 +1,7 @@
1
+ ## 0.10.1
2
+ * Fix bug causing some `rails` and `rake` commands to not be executed.
3
+ * Fix issue restricting Docker CLI output.
4
+
1
5
  ## 0.10.0
2
6
  * Set default database user and password in dev environment.
3
7
  * Add ability to run rake tasks in dev environment.
@@ -81,18 +81,42 @@ module Kuby
81
81
  end
82
82
 
83
83
  def systemm(cmd)
84
+ if stdout == STDOUT && stderr == STDERR
85
+ systemm_default(cmd)
86
+ else
87
+ systemm_open3(cmd)
88
+ end
89
+ end
90
+
91
+ def systemm_default(cmd)
92
+ run_before_callbacks(cmd)
93
+ cmd_s = cmd.join(' ')
94
+ system(cmd_s).tap do
95
+ self.last_status = $?
96
+ run_after_callbacks(cmd)
97
+ end
98
+ end
99
+
100
+ def systemm_open3(cmd)
84
101
  run_before_callbacks(cmd)
85
102
  cmd_s = cmd.join(' ')
86
103
 
87
104
  Open3.popen3(cmd_s) do |p_stdin, p_stdout, p_stderr, wait_thread|
88
105
  Thread.new(stdout) do |t_stdout|
89
- p_stdout.each { |line| t_stdout.puts(line) }
106
+ begin
107
+ p_stdout.each { |line| t_stdout.puts(line) }
108
+ rescue IOError
109
+ end
90
110
  end
91
111
 
92
112
  Thread.new(stderr) do |t_stderr|
93
- p_stderr.each { |line| t_stderr.puts(line) }
113
+ begin
114
+ p_stderr.each { |line| t_stderr.puts(line) }
115
+ rescue IOError
116
+ end
94
117
  end
95
118
 
119
+ p_stdin.close
96
120
  self.last_status = wait_thread.value
97
121
  run_after_callbacks(cmd)
98
122
  wait_thread.join
@@ -100,19 +124,43 @@ module Kuby
100
124
  end
101
125
 
102
126
  def backticks(cmd)
127
+ if stdout == STDOUT && stderr == STDERR
128
+ backticks_default(cmd)
129
+ else
130
+ backticks_open3(cmd)
131
+ end
132
+ end
133
+
134
+ def backticks_default(cmd)
135
+ run_before_callbacks(cmd)
136
+ cmd_s = cmd.join(' ')
137
+ `#{cmd_s}`.tap do
138
+ self.last_status = $?
139
+ run_after_callbacks(cmd)
140
+ end
141
+ end
142
+
143
+ def backticks_open3(cmd)
103
144
  run_before_callbacks(cmd)
104
145
  cmd_s = cmd.join(' ')
105
146
  result = StringIO.new
106
147
 
107
148
  Open3.popen3(cmd_s) do |p_stdin, p_stdout, p_stderr, wait_thread|
108
149
  Thread.new do
109
- p_stdout.each { |line| result.puts(line) }
150
+ begin
151
+ p_stdout.each { |line| result.puts(line) }
152
+ rescue IOError
153
+ end
110
154
  end
111
155
 
112
156
  Thread.new(stderr) do |t_stderr|
113
- p_stderr.each { |line| t_stderr.puts(line) }
157
+ begin
158
+ p_stderr.each { |line| t_stderr.puts(line) }
159
+ rescue IOError
160
+ end
114
161
  end
115
162
 
163
+ p_stdin.close
116
164
  self.last_status = wait_thread.value
117
165
  run_after_callbacks(cmd)
118
166
  wait_thread.join
@@ -100,6 +100,17 @@ module Kuby
100
100
  end
101
101
  end
102
102
 
103
+ def pull(image_url, tag)
104
+ systemm([
105
+ executable, 'pull', "#{image_url}:#{tag}"
106
+ ])
107
+
108
+ unless last_status.success?
109
+ raise PullError, 'pull failed: docker command exited with '\
110
+ "status code #{last_status.exitstatus}"
111
+ end
112
+ end
113
+
103
114
  def status_key
104
115
  :kuby_docker_cli_last_status
105
116
  end
@@ -2,6 +2,7 @@ module Kuby
2
2
  module Docker
3
3
  class BuildError < StandardError; end
4
4
  class PushError < StandardError; end
5
+ class PullError < StandardError; end
5
6
  class LoginError < StandardError; end
6
7
 
7
8
  class MissingTagError < StandardError
@@ -50,13 +50,7 @@ module Kuby
50
50
  arglist = Args.new([*PREFIX, *args], SERVER_ARG_ALIASES)
51
51
  arglist['-b'] ||= '0.0.0.0'
52
52
  arglist['-p'] ||= '3000'
53
- when 'runner', 'r'
54
- when 'console', 'c'
55
- else
56
- return
57
53
  end
58
- elsif command == 'rake'
59
- arglist = Args.new([*PREFIX, *args])
60
54
  end
61
55
 
62
56
  setup
@@ -1,3 +1,3 @@
1
1
  module Kuby
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuby-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro