tod-travis 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86f58e51ec504a8404842bb71b6fad1824df4de2
4
- data.tar.gz: 8bf17acc804c262a3bf16b05ab80b3b8005d2281
3
+ metadata.gz: d00e00ac4149bb084cff31242ead9b448a2a5755
4
+ data.tar.gz: 738a0bc4d726cc37acef41e9258912ea768ab21f
5
5
  SHA512:
6
- metadata.gz: 319989208dccf8f18f80a6f6ca87c50d1975673b4a8baeccfa49637711c628b269914a50e706287442e75677d21fda382f29b6d705525045f92d9d6bbd177c3f
7
- data.tar.gz: e09771e194512d1fa734c6cce63a188ad46c97ac3e05ae80fcb8bcdcdaa1d416628429f133b3f3727a0c25f24fa4af62e293d041b42f3e14c1cef2b5aa770c4b
6
+ metadata.gz: 14a7144eb7902358d182b90ccd2da748c0b0999ea1a5450011dd2ca5bb4378cd2c1f7341bfda2ec6d760fe714140098423a6f776c4fbbfc8072dd1b87274c847
7
+ data.tar.gz: 1b99ea48bd87712b638ad4bc18e9267c46c6fad9b28377e4d39016f78c74f2430ef3cbd9f53cf063190a73039cb4d02275284ac92ea177018bc78eba235d1dd6
@@ -8,4 +8,4 @@ before_script:
8
8
  - docker build -t tod .
9
9
 
10
10
  script:
11
- - docker run -v $(pwd):/tod -it tod rspec
11
+ - docker run -v $(pwd):/tod -t tod rspec
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Tod
2
2
 
3
+ [![Build Status](https://travis-ci.org/mckomo/tod.svg?branch=master)](https://travis-ci.org/mckomo/tod) [![Code Climate](https://codeclimate.com/github/mckomo/tod/badges/gpa.svg)](https://codeclimate.com/github/mckomo/tod)
4
+
3
5
  Tod runs commands from your `.travis.yml` file. Type `tod` instead of `docker run -v $(pwd):/my-app -it my-app some-tests` to run your tests
4
6
 
5
7
  ## Installation
@@ -7,7 +9,7 @@ Tod runs commands from your `.travis.yml` file. Type `tod` instead of `docker ru
7
9
  Install it yourself simply as:
8
10
 
9
11
  ```bash
10
- $ gem install tod
12
+ $ gem install tod-travis
11
13
  ```
12
14
 
13
15
  Check the installation with following:
@@ -1,14 +1,23 @@
1
+ require 'open3'
2
+
1
3
  module Tod
2
4
  class Executor
3
5
 
4
- def execute(command)
5
- f = IO.popen(command)
6
+ def execute(command, &block)
7
+ process = Open3.popen2e("#{command}") do |stdin, stdoe, wait_thread|
8
+ read_thread(stdoe, &block).join
9
+ wait_thread.value
10
+ end
11
+
12
+ Result.new(process.exitstatus)
13
+ end
6
14
 
7
- output = f.readlines
8
- f.close
9
- code = $?.exitstatus
15
+ private
10
16
 
11
- Result.new(code, output)
17
+ def read_thread(stream)
18
+ Thread.new do
19
+ stream.each { |line| yield(line) if block_given? }
20
+ end
12
21
  end
13
22
 
14
23
  end
@@ -1,10 +1,10 @@
1
1
  module Tod
2
2
  class Result
3
3
 
4
- attr_reader :code, :output
4
+ attr_reader :code
5
5
 
6
- def initialize(code, output = '')
7
- @code, @output = code, output
6
+ def initialize(code)
7
+ @code = code.to_i
8
8
  end
9
9
 
10
10
  def ok?
@@ -15,9 +15,7 @@ module Tod
15
15
 
16
16
  @travis.section(section).each do |command|
17
17
 
18
- result = @executor.execute(command)
19
-
20
- puts result.output unless result.output.empty?
18
+ result = @executor.execute(command) { |line| puts line }
21
19
 
22
20
  if result.error?
23
21
  return result.code
@@ -1,3 +1,3 @@
1
1
  module Tod
2
- VERSION = [0, 1, 0].join('.')
2
+ VERSION = [0, 2, 0].join('.')
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tod-travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mckomo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-02 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -95,7 +95,6 @@ files:
95
95
  - Gemfile
96
96
  - LICENSE
97
97
  - README.md
98
- - TODO.md
99
98
  - exe/tod
100
99
  - lib/tod.rb
101
100
  - lib/tod/executor.rb
data/TODO.md DELETED
@@ -1,4 +0,0 @@
1
- # TODO
2
-
3
- * Use stdout and stderr streams to print intermediate output
4
- * Enable adding surfix to the command execution e.g. `tod script spec/module_spec.rb`