rsea 0.1.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 +7 -0
- data/bin/rsea +71 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b4550ccf701eea124d60872faaeee518a70aa3fdebb2dc45747a9f92686b142b
|
|
4
|
+
data.tar.gz: 667b6c0d6b9c9de04f7144170d517a1f558104f9a4dcae807b3193415b48a572
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 950fb7efc9dba0ca4c43d03056aeb1ad0f5ade8cb37235b2493f505ad4f27f4acb170dac2c9a83bf3863668d72e4d96f287d12cfad63daa3da36bfb6ee0cd516
|
|
7
|
+
data.tar.gz: f7274a03883f007f40d223e60ba594cc3d57dbfaa4687dfc8970b352921fa70ad336a73ac190a2745be70e7ebea30a7805c6b059f53b4034a5546b3e3760bc81
|
data/bin/rsea
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# Ruby Self-Extracting Archive
|
|
4
|
+
|
|
5
|
+
require 'mimemagic'
|
|
6
|
+
require 'base64'
|
|
7
|
+
require 'pathname'
|
|
8
|
+
|
|
9
|
+
def encode(folder)
|
|
10
|
+
|
|
11
|
+
puts $code
|
|
12
|
+
|
|
13
|
+
root = Pathname.new(File.expand_path(folder))
|
|
14
|
+
|
|
15
|
+
Dir.glob(File.join(folder, '**', '*')).each do |f|
|
|
16
|
+
next if File.directory?(f)
|
|
17
|
+
|
|
18
|
+
file_path = Pathname.new(File.expand_path(f))
|
|
19
|
+
rel_path = file_path.relative_path_from(root)
|
|
20
|
+
|
|
21
|
+
text = MimeMagic.by_path(f)&.text? || false # assume binary if no extension
|
|
22
|
+
|
|
23
|
+
print text ? 't' : 'b'
|
|
24
|
+
puts " '#{rel_path}',"
|
|
25
|
+
puts '<<-EOF'
|
|
26
|
+
puts text ? File.read(f) : Base64.encode64(File.read(f))
|
|
27
|
+
puts "EOF\n\n"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def main()
|
|
32
|
+
abort $help unless ARGV[0]
|
|
33
|
+
abort 'Error: First param must be a folder' unless File.directory?(ARGV[0])
|
|
34
|
+
|
|
35
|
+
encode(ARGV[0])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
$help = <<~HELP
|
|
39
|
+
RSEA: Ruby Self-Extracting Archive
|
|
40
|
+
|
|
41
|
+
USAGE
|
|
42
|
+
rsea <folder>
|
|
43
|
+
rsea <folder> > myarchive.sar.rb
|
|
44
|
+
|
|
45
|
+
TO EXTRACT
|
|
46
|
+
ruby myarchive.sar.rb
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
HELP
|
|
50
|
+
|
|
51
|
+
$code = <<~EOF
|
|
52
|
+
require 'fileutils'
|
|
53
|
+
require 'base64'
|
|
54
|
+
|
|
55
|
+
def d(filepath)
|
|
56
|
+
return filepath unless ARGV[0]
|
|
57
|
+
File.join(ARGV[0], filepath)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def t(filepath, contents)
|
|
61
|
+
FileUtils.mkdir_p File.dirname(d(filepath))
|
|
62
|
+
File.write(d(filepath), contents)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def b(filepath, contents)
|
|
66
|
+
t(filepath, Base64.decode64(contents))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
EOF
|
|
70
|
+
|
|
71
|
+
main
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rsea
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Darren Rush
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: RSEA is a really simple, almost dependency-free, cross-platform, self-extracting
|
|
14
|
+
archive utility in ruby
|
|
15
|
+
email: dlrush@gmail.com
|
|
16
|
+
executables:
|
|
17
|
+
- rsea
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- bin/rsea
|
|
22
|
+
homepage: https://github.org/moonlight-labs/rsea
|
|
23
|
+
licenses:
|
|
24
|
+
- MIT
|
|
25
|
+
metadata: {}
|
|
26
|
+
post_install_message:
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - ">="
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '0'
|
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
requirements: []
|
|
41
|
+
rubygems_version: 3.0.4
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: 'RSEA: Ruby Self-Extracting Archive'
|
|
45
|
+
test_files: []
|