reaper-man 0.1.8 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,8 @@
1
- require 'reaper-man'
1
+ require "reaper-man"
2
2
 
3
3
  module ReaperMan
4
4
  class Signer
5
5
  module Rubygems
6
-
7
6
  def package(*pkgs)
8
7
  nil
9
8
  end
@@ -11,7 +10,6 @@ module ReaperMan
11
10
  def valid_packages(*pkgs)
12
11
  nil
13
12
  end
14
-
15
13
  end
16
14
  end
17
15
  end
@@ -1,27 +1,23 @@
1
- require 'digest/sha1'
2
- require 'digest/sha2'
3
- require 'digest/md5'
1
+ require "digest/sha1"
2
+ require "digest/sha2"
3
+ require "digest/md5"
4
4
 
5
- require 'reaper-man'
5
+ require "reaper-man"
6
6
 
7
7
  module ReaperMan
8
8
  # Helper utilities
9
9
  module Utils
10
-
11
- autoload :Process, 'reaper-man/utils/process'
10
+ autoload :Process, "reaper-man/utils/process"
12
11
 
13
12
  # Checksum helper
14
13
  module Checksum
15
-
16
14
  def checksum(io, type)
17
15
  digest = Digest.const_get(type.to_s.upcase).new
18
- while(data = io.read(2048))
16
+ while data = io.read(2048)
19
17
  digest << data
20
18
  end
21
19
  digest.hexdigest
22
20
  end
23
-
24
21
  end
25
-
26
22
  end
27
23
  end
@@ -1,7 +1,7 @@
1
- require 'reaper-man'
2
- require 'childprocess'
3
- require 'shellwords'
4
- require 'tempfile'
1
+ require "reaper-man"
2
+ require "childprocess"
3
+ require "shellwords"
4
+ require "tempfile"
5
5
 
6
6
  module ReaperMan
7
7
  module Utils
@@ -14,7 +14,8 @@ module ReaperMan
14
14
 
15
15
  class CommandFailed < StandardError
16
16
  attr_accessor :original, :result
17
- def initialize(orig, result=nil)
17
+
18
+ def initialize(orig, result = nil)
18
19
  @original = orig
19
20
  @result = result
20
21
  super(orig.to_s)
@@ -26,11 +27,12 @@ module ReaperMan
26
27
 
27
28
  class CommandResult
28
29
  attr_reader :original, :stdout, :stderr
30
+
29
31
  def initialize(result)
30
32
  @original = result
31
- if(result.class.ancestors.map(&:to_s).include?('ChildProcess::AbstractProcess'))
33
+ if result.class.ancestors.map(&:to_s).include?("ChildProcess::AbstractProcess")
32
34
  extract_childprocess
33
- elsif(result.class.to_s == 'Mixlib::ShellOut')
35
+ elsif result.class.to_s == "Mixlib::ShellOut"
34
36
  extract_shellout
35
37
  else
36
38
  raise TypeError.new("Unknown process result type received: #{result.class}")
@@ -53,9 +55,9 @@ module ReaperMan
53
55
  end
54
56
 
55
57
  # Simple helper to shell out
56
- def shellout(cmd, args={})
58
+ def shellout(cmd, args = {})
57
59
  result = nil
58
- if(defined?(Mixlib))
60
+ if defined?(Mixlib)
59
61
  cmd_type = :mixlib_shellout
60
62
  else
61
63
  cmd_type = :childprocess
@@ -63,20 +65,20 @@ module ReaperMan
63
65
  com_block = nil
64
66
  case cmd_type
65
67
  when :childprocess
66
- com_block = lambda{ child_process_command(cmd, args) }
68
+ com_block = lambda { child_process_command(cmd, args) }
67
69
  when :mixlib_shellout
68
- require 'mixlib/shellout'
69
- com_block = lambda{ mixlib_shellout_command(cmd, args) }
70
+ require "mixlib/shellout"
71
+ com_block = lambda { mixlib_shellout_command(cmd, args) }
70
72
  else
71
73
  raise ArgumentError.new("Unknown shellout helper provided: #{cmd_type}")
72
74
  end
73
- result = defined?(Bundler) ? Bundler.with_clean_env{ com_block.call } : com_block.call
75
+ result = defined?(Bundler) ? Bundler.with_clean_env { com_block.call } : com_block.call
74
76
  result == false ? false : CommandResult.new(result)
75
77
  end
76
78
 
77
79
  def child_process_command(cmd, args)
78
- s_out = Tempfile.new('stdout')
79
- s_err = Tempfile.new('stderr')
80
+ s_out = Tempfile.new("stdout")
81
+ s_err = Tempfile.new("stderr")
80
82
  s_out.sync
81
83
  s_err.sync
82
84
  c_proc = ChildProcess.build(*Shellwords.split(cmd))
@@ -98,9 +100,8 @@ module ReaperMan
98
100
  shlout = nil
99
101
  begin
100
102
  shlout = Mixlib::ShellOut.new(cmd,
101
- :timeout => args[:timeout] || 10,
102
- :environment => args.fetch(:environment, {})
103
- )
103
+ :timeout => args[:timeout] || 10,
104
+ :environment => args.fetch(:environment, {}))
104
105
  shlout.run_command
105
106
  shlout.error!
106
107
  shlout
@@ -108,7 +109,6 @@ module ReaperMan
108
109
  raise CommandFailed.new(e, CommandResult.new(shlout))
109
110
  end
110
111
  end
111
-
112
112
  end
113
113
  end
114
114
  end
@@ -1,4 +1,4 @@
1
1
  module ReaperMan
2
2
  # current library version
3
- VERSION = Gem::Version.new("0.1.8")
3
+ VERSION = Gem::Version.new("0.1.10")
4
4
  end
data/reaper-man.gemspec CHANGED
@@ -9,11 +9,14 @@ Gem::Specification.new do |s|
9
9
  s.homepage = "https://github.com/spox/reaper-man"
10
10
  s.description = "Grow code, reap packages"
11
11
  s.require_path = "lib"
12
- s.required_ruby_version = "~> 2.2", "< 2.5"
12
+ s.required_ruby_version = "~> 2.2", "< 2.6"
13
13
  s.add_runtime_dependency "bogo-cli"
14
14
  s.add_runtime_dependency "childprocess"
15
15
  s.add_runtime_dependency "xml-simple"
16
16
  s.add_development_dependency "minitest"
17
+ s.add_development_dependency "rufo", "~> 0.3.0"
18
+ s.add_development_dependency "rake", "~> 10"
19
+ s.add_development_dependency "rspec", "~> 3.5"
17
20
  s.executables << "reaper-man"
18
21
  s.files = Dir["lib/**/*"] + %w(reaper-man.gemspec README.md CHANGELOG.md CONTRIBUTING.md LICENSE)
19
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaper-man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2018-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rufo
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.3.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.5'
69
111
  description: Grow code, reap packages
70
112
  email: code@chrisroberts.org
71
113
  executables:
@@ -118,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
160
  version: '2.2'
119
161
  - - "<"
120
162
  - !ruby/object:Gem::Version
121
- version: '2.5'
163
+ version: '2.6'
122
164
  required_rubygems_version: !ruby/object:Gem::Requirement
123
165
  requirements:
124
166
  - - ">="