isolation 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: f054029ef487c3c9644e4ce9c5dcd87a725bca1a
4
- data.tar.gz: 40d406ce0c2668bc6d5c11f34496d95d4c86d9de
3
+ metadata.gz: e0f3ac0ebe98db1d3c2ee04c180813c4927ae58f
4
+ data.tar.gz: 77df7a31db10affbdbf2e0a1208fbcb16ba85dc3
5
5
  SHA512:
6
- metadata.gz: a3d7cba71cda88d296e4855ab7c493976f2df404a50909d520d204c6887704acb56c3e2240590c8bccb6870e67152c488067ae5a51e7e42d75be72786bedb23a
7
- data.tar.gz: 9647de0fbe9f405920277df13206b9b744ee952a50cdc35dcd6ae694e8fa2c0e376657d9ef145aafc465b0b81e5342a3586ae4efbe9ecdc56a9c71aace1fde38
6
+ metadata.gz: d09800aa031582dd5d944aee9b97df037e7e0cec6e287a7c9a17e66effd3f3a9f05d81354d5321c22185c03ab1d4eaa18146a7d6394c23f85228a92f9b60eb87
7
+ data.tar.gz: c5ad6e108468693fc625632b6b1a4c7bdb33673baf9c6f3dc173ac83aec86e94706d047b5011284b7452f6be60116f3ccadbff73e919596e70688f4b70ea95e1
data/README.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Isolation
2
2
  ===
3
- A ruby gem to run command-line commands in isolation.
3
+ A ruby gem to run command-line commands in isolation and capture error messages.
4
+
5
+ ## Usage
6
+
7
+ ```ruby
8
+ runner = Isolation.run("echo hello")
9
+ runner.success? # true
10
+ runner.error_message # "" (empty string)
11
+
12
+ runner2 = Isolation.run("ls -z")
13
+ runner2.success? # false
14
+ runner2.error_message # ls: illegal option -- z\nusage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]\n
15
+ ```
4
16
 
5
17
  ## Installation
6
18
 
@@ -18,32 +30,9 @@ Or install it yourself as:
18
30
 
19
31
  $ gem install isolation
20
32
 
21
- ## Usage
22
-
23
- ```ruby
24
- runner = Isolation::CommandRunner.new("echo hello")
25
- runner.run
26
-
27
- runner.success? # true
28
- runner.error_message # "" (empty string)
29
-
30
- runner2 = Isolation::CommandRunner.new("ls -z")
31
- runner2.run
32
-
33
- runner2.success? # false
34
- runner2.error_message # ls: illegal option -- z\nusage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]\n
35
- ```
36
-
37
- ## Development
38
-
39
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
-
41
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
-
43
33
  ## Contributing
44
34
 
45
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/isolation.
46
-
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/chickenriceplatter/isolation.
47
36
 
48
37
  ## License
49
38
 
@@ -1,18 +1,26 @@
1
- module Isolation; class CommandRunner
1
+ module Isolation;
2
2
 
3
- attr_reader :command
4
- attr_accessor :success_status, :error_message
5
- alias_method :success?, :success_status
3
+ class CommandRunner
6
4
 
7
- def initialize(command)
8
- @command = command
9
- end
5
+ attr_reader :command
6
+ attr_accessor :success_status, :error_message
7
+ alias_method :success?, :success_status
8
+
9
+ def initialize(command)
10
+ @command = command
11
+ end
10
12
 
11
- def run
12
- Open3.popen3(ENV, command) do |stdin, stdout, stderr, wait_thr|
13
- self.success_status = wait_thr.value.success?
14
- self.error_message = stderr.read
13
+ def run
14
+ Open3.popen3(ENV, command) do |stdin, stdout, stderr, wait_thr|
15
+ self.success_status = wait_thr.value.success?
16
+ self.error_message = stderr.read
17
+ end
15
18
  end
19
+
20
+ end
21
+
22
+ def self.run(command)
23
+ CommandRunner.new(command).tap {|cr| cr.run }
16
24
  end
17
25
 
18
- end; end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Isolation
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isolation
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
  - chickenriceplatter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler