yu 0.1.0 → 0.1.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -15
  3. data/lib/yu.rb +10 -6
  4. data/lib/yu/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa7a919f0871c7106e9afb778e7061910163d373
4
- data.tar.gz: cd7a8e9f6509ead50f3ff06a05d647969e79f6a2
3
+ metadata.gz: a92783e2c1c90b67e2f7e86ca29c214a2590084a
4
+ data.tar.gz: 734abe78119bb4cb4242f98d48826c6169f62d84
5
5
  SHA512:
6
- metadata.gz: 48847ba75670ea8723dff14131b66328096f87446c80db77ed15248a603ef5694e4f884c269fbf30e8c4102e7be3748b547ded06b10ed4b44f57924ad72aa754
7
- data.tar.gz: 7080cfbd6c3a0cabe8447072ba1d244341347431665a5542fba8ad693a196fee098a6a5368c8dddb1e5cdb5961b8476a3278e7c255fb9fa49b7c2166e65147bd
6
+ metadata.gz: 1051b45b297987d900054b74ff4ef3d258a06ce5f80415a6ce06eea814e728a80ac85cba76a47f1a76921892ac36e9a56c29429ec79a0761305bace7eb7e28cc
7
+ data.tar.gz: 7ea52ab97d0217947fc36e08498638a73d947042cd3a07e519e59391eafae0c6204180c046bcba4856656554f76b50fb27b8bb096ec0e5a230a86c8d22876b73
data/README.md CHANGED
@@ -1,28 +1,32 @@
1
1
  # Yu
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yu`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ A microservice framework based on docker-compose
6
4
 
7
5
  ## Installation
8
6
 
9
- Add this line to your application's Gemfile:
7
+ Install the CLI:
10
8
 
11
- ```ruby
12
- gem 'yu'
9
+ ```bash
10
+ $ gem install yu
13
11
  ```
14
12
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install yu
22
-
23
13
  ## Usage
24
14
 
25
- TODO: Write usage instructions here
15
+ ```bash
16
+ yu --help
17
+ # Run all tests
18
+ yu test
19
+ # Test specific service(s)
20
+ yu test api
21
+ # Get a bash shell for a service
22
+ yu shell web
23
+ # Get a bash shell for testing a service
24
+ yu shell —test api
25
+ # Build base images for all services
26
+ yu build
27
+ # Build base image for specific service(s)
28
+ yu build api web
29
+ ```
26
30
 
27
31
  ## Development
28
32
 
data/lib/yu.rb CHANGED
@@ -34,6 +34,8 @@ module Yu
34
34
  c.action(method(:shell))
35
35
  end
36
36
 
37
+ global_option('-V', '--verbose', 'Verbose output') { $verbose_mode = true }
38
+
37
39
  run!
38
40
  end
39
41
 
@@ -51,7 +53,7 @@ module Yu
51
53
  run_command(
52
54
  "docker-compose run --rm #{container} bin/test",
53
55
  showing_output: true,
54
- exit_on_failure: false
56
+ exit_on_failure: false,
55
57
  )
56
58
  end
57
59
 
@@ -104,11 +106,13 @@ module Yu
104
106
 
105
107
  def run_command(command, showing_output: false, exit_on_failure: true)
106
108
  info "Running command: #{command}" if verbose_mode?
107
- output = `#{command} 2>&1`
108
- puts output if showing_output || 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?
112
+ end
109
113
 
110
- $?.tap do |result|
111
- unless result.success?
114
+ wait_thread.value.tap do |terminated_process|
115
+ unless terminated_process.success?
112
116
  if block_given?
113
117
  yield
114
118
  else
@@ -127,7 +131,7 @@ module Yu
127
131
  end
128
132
 
129
133
  def verbose_mode?
130
- true
134
+ !!$verbose_mode
131
135
  end
132
136
 
133
137
  def info(message)
data/lib/yu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yu
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: yu
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
  - Mike Kelly