reaper-man 0.1.8 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/reaper-man.rb +10 -10
- data/lib/reaper-man/command.rb +4 -6
- data/lib/reaper-man/command/package.rb +3 -5
- data/lib/reaper-man/command/package/add.rb +1 -5
- data/lib/reaper-man/command/package/remove.rb +1 -5
- data/lib/reaper-man/command/repository.rb +2 -4
- data/lib/reaper-man/command/repository/generate.rb +3 -7
- data/lib/reaper-man/command/sign.rb +4 -6
- data/lib/reaper-man/error.rb +2 -3
- data/lib/reaper-man/generator.rb +15 -18
- data/lib/reaper-man/generator/apt.rb +23 -24
- data/lib/reaper-man/generator/rubygems.rb +13 -12
- data/lib/reaper-man/generator/yum.rb +92 -95
- data/lib/reaper-man/package_list.rb +17 -18
- data/lib/reaper-man/package_list/deb.rb +32 -34
- data/lib/reaper-man/package_list/gem.rb +46 -21
- data/lib/reaper-man/package_list/rpm.rb +43 -44
- data/lib/reaper-man/signer.rb +15 -18
- data/lib/reaper-man/signer/deb.rb +6 -7
- data/lib/reaper-man/signer/rpm.rb +6 -7
- data/lib/reaper-man/signer/rubygems.rb +1 -3
- data/lib/reaper-man/utils.rb +6 -10
- data/lib/reaper-man/utils/process.rb +19 -19
- data/lib/reaper-man/version.rb +1 -1
- data/reaper-man.gemspec +4 -1
- metadata +50 -9
data/lib/reaper-man/utils.rb
CHANGED
@@ -1,27 +1,23 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "digest/sha1"
|
2
|
+
require "digest/sha2"
|
3
|
+
require "digest/md5"
|
4
4
|
|
5
|
-
require
|
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
|
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
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
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
|
-
|
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
|
33
|
+
if result.class.ancestors.map(&:to_s).include?("ChildProcess::AbstractProcess")
|
32
34
|
extract_childprocess
|
33
|
-
elsif
|
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
|
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
|
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(
|
79
|
-
s_err = Tempfile.new(
|
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
|
-
|
102
|
-
|
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
|
data/lib/reaper-man/version.rb
CHANGED
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.
|
12
|
+
s.required_ruby_version = "~> 2.6", "< 2.8"
|
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.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-22 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:
|
@@ -107,7 +149,7 @@ files:
|
|
107
149
|
homepage: https://github.com/spox/reaper-man
|
108
150
|
licenses: []
|
109
151
|
metadata: {}
|
110
|
-
post_install_message:
|
152
|
+
post_install_message:
|
111
153
|
rdoc_options: []
|
112
154
|
require_paths:
|
113
155
|
- lib
|
@@ -115,19 +157,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
157
|
requirements:
|
116
158
|
- - "~>"
|
117
159
|
- !ruby/object:Gem::Version
|
118
|
-
version: '2.
|
160
|
+
version: '2.6'
|
119
161
|
- - "<"
|
120
162
|
- !ruby/object:Gem::Version
|
121
|
-
version: '2.
|
163
|
+
version: '2.8'
|
122
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
165
|
requirements:
|
124
166
|
- - ">="
|
125
167
|
- !ruby/object:Gem::Version
|
126
168
|
version: '0'
|
127
169
|
requirements: []
|
128
|
-
|
129
|
-
|
130
|
-
signing_key:
|
170
|
+
rubygems_version: 3.1.2
|
171
|
+
signing_key:
|
131
172
|
specification_version: 4
|
132
173
|
summary: Reap packages
|
133
174
|
test_files: []
|