shexec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/shexec.rb +34 -0
- data/lib/shexec/version.rb +3 -0
- data/shexec.gemspec +24 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3046ebc108e44bb2014351ee68f44642a35bdc12
|
4
|
+
data.tar.gz: fbed03b2adb082d9091f73a010b08d590e5b69fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b144da5f9b91e5dc510e6be943ed27fad43ac15b270b892dba81377ee7d36560c7101d2607180bdee2aeced11fb8d46f62b261f5fcb45b76d7098493f872f9b3
|
7
|
+
data.tar.gz: 4dcea8bd35144e8c27e600914e8c96944772ab2904f2ecf392ceb4f2586e4cf6358294acdace40a2e113cc04da57d5511c36316c778acdc95ee6dc8bf6925caf
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Shexec
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'shexec'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install shexec
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Development
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/shexec.
|
30
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "shexec"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/shexec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "shexec/version"
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
module Shexec
|
5
|
+
|
6
|
+
class ExecError < StandardError
|
7
|
+
attr_accessor :exit_status, :last_line
|
8
|
+
|
9
|
+
def initialize(exit_status, last_line)
|
10
|
+
super("Error on cmd. #{exit_status}")
|
11
|
+
self.exit_status = exit_status
|
12
|
+
self.last_line = last_line
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def exec(cmd)
|
17
|
+
puts "Executing cmd: #{cmd}"
|
18
|
+
exit_status = nil
|
19
|
+
last_line = ""
|
20
|
+
Open3.popen2e(cmd) do |stdin, stdout_stderr, wait_thread|
|
21
|
+
Thread.new do
|
22
|
+
stdout_stderr.each {|l|
|
23
|
+
puts l
|
24
|
+
# Save last line for error checking
|
25
|
+
last_line = l
|
26
|
+
}
|
27
|
+
end
|
28
|
+
exit_status = wait_thread.value
|
29
|
+
raise ExecError.new(exit_status, last_line) if exit_status.exitstatus != 0
|
30
|
+
end
|
31
|
+
return exit_status
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/shexec.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'shexec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "shexec"
|
8
|
+
spec.version = Shexec::VERSION
|
9
|
+
spec.authors = ["Travis Reeder"]
|
10
|
+
spec.email = ["treeder@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Library to help writing shell scripts in Ruby."
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/treeder/shexec"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shexec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Travis Reeder
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Library to help writing shell scripts in Ruby.
|
42
|
+
email:
|
43
|
+
- treeder@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- bin/console
|
53
|
+
- bin/setup
|
54
|
+
- lib/shexec.rb
|
55
|
+
- lib/shexec/version.rb
|
56
|
+
- shexec.gemspec
|
57
|
+
homepage: https://github.com/treeder/shexec
|
58
|
+
licenses: []
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.6.11
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Library to help writing shell scripts in Ruby.
|
80
|
+
test_files: []
|