rotlib 0.1.0 → 0.1.1
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 +4 -4
- data/bin/utf-coder +67 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f84e0d1562958eaa1e6524fdba2379b31e4784d2a14adcd996b56d6b75721b
|
4
|
+
data.tar.gz: 5fc5b3ec49aca70b8e592cb929b93f5403acc236c40dd97db347238598892f7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f39ddf786a4fc82b82b8debeb62caeb3ad070bc7f18909f13124a35e761d96d38b362a4f46a49a8c97b6660c391f861e776879826f8eb99fb04a80c61f66f92d
|
7
|
+
data.tar.gz: b39098227db279a23ed973c0657b4387c59e002f8ea312bb5bde7fafc841a138724f2382b0ce9597a633998f0c11a3c88fa7c62a09b54524975c1011b656bd25
|
data/bin/utf-coder
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#! /bin/env ruby
|
2
|
+
|
3
|
+
class Hex
|
4
|
+
attr_accessor :data
|
5
|
+
def initialize(data = $stdin.read)
|
6
|
+
@data = data
|
7
|
+
end
|
8
|
+
def toutf
|
9
|
+
$stdout.print @data.dump
|
10
|
+
end
|
11
|
+
def fromutf
|
12
|
+
$stdout.print @data.undump
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def main
|
17
|
+
file = ''
|
18
|
+
data = ''
|
19
|
+
encode = true
|
20
|
+
help = "utf-coder [-d][-h] [file]\n"
|
21
|
+
help += "print utf-8 formate.\n"
|
22
|
+
help += " -d decode.\n\n"
|
23
|
+
help += "lib: rotlib\n"
|
24
|
+
help += "<Madhava-mng@github.com>"
|
25
|
+
|
26
|
+
ARGV.length.times do |a|
|
27
|
+
if ARGV[a].start_with? '-'
|
28
|
+
if ARGV[a] == '-d'
|
29
|
+
encode = false
|
30
|
+
else
|
31
|
+
puts help
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
else
|
35
|
+
file = ARGV[a]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if file != ''
|
40
|
+
if File.file? file
|
41
|
+
File.open(file, 'r') do |f|
|
42
|
+
data += f.read
|
43
|
+
f.close
|
44
|
+
end
|
45
|
+
hex = Hex::new(data)
|
46
|
+
else
|
47
|
+
puts "utf-coder: #{file}: No such file."
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
else
|
51
|
+
hex = Hex::new
|
52
|
+
end
|
53
|
+
if encode
|
54
|
+
hex.toutf
|
55
|
+
else
|
56
|
+
hex.fromutf
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
begin
|
62
|
+
main
|
63
|
+
rescue Interrupt
|
64
|
+
puts "\r\e[A"
|
65
|
+
rescue => e
|
66
|
+
puts 'utf-coder :Invalid base16(hex)'
|
67
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rotlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Madhava-mng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email:
|
@@ -18,6 +18,7 @@ executables:
|
|
18
18
|
- rot13
|
19
19
|
- rot47
|
20
20
|
- url-coder
|
21
|
+
- utf-coder
|
21
22
|
extensions: []
|
22
23
|
extra_rdoc_files: []
|
23
24
|
files:
|
@@ -26,6 +27,7 @@ files:
|
|
26
27
|
- bin/rot13
|
27
28
|
- bin/rot47
|
28
29
|
- bin/url-coder
|
30
|
+
- bin/utf-coder
|
29
31
|
- lib/rotlib.rb
|
30
32
|
homepage: https://github.com/Madhava-mng/rotlib-ruby
|
31
33
|
licenses:
|