dorian-anonymize-json 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/anonymize-json +9 -14
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67961a55e6bc76d4beda59e3165a829e91407602a8c217f5193501baf574805b
|
4
|
+
data.tar.gz: 391089eda0cef67311a1ec7b9799c54592372cb1b83a1a4248efcd5c62aa70de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4691e584e30d5ca69a8fecaef3b780c85b09876ed38d4b9ce0b65043f08b18c8b958c8ed4844d1282bbb7e367de9a27209bd95c379d1dde6953dab6a6cbf5ef1
|
7
|
+
data.tar.gz: e1549253b66a84459df81edb6aefbaa3ec6882f6a2e7210ab9f1265073a2c3e87024029608fe4706a10abe467c825cd26211f3ee6fcb426c501e7d6a8f2ed8fd
|
data/bin/anonymize-json
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "json"
|
5
|
+
require "dorian/arguments"
|
5
6
|
|
6
7
|
def anonymize_json(data)
|
7
8
|
case data
|
@@ -22,23 +23,17 @@ def anonymize_json(data)
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
-
puts "USAGE: anonymize-yaml FILES..."
|
27
|
-
puts "USAGE: ... | anonymize-yaml"
|
28
|
-
exit
|
29
|
-
end
|
30
|
-
|
31
|
-
inputs = ARGV
|
26
|
+
parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
|
32
27
|
|
33
|
-
if
|
34
|
-
inputs = $stdin.each_line.to_a
|
28
|
+
abort parsed.help if parsed.options.help
|
35
29
|
|
36
|
-
|
37
|
-
|
30
|
+
if parsed.options.version
|
31
|
+
abort File.read(File.expand_path("../../VERSION", __FILE__))
|
38
32
|
end
|
39
33
|
|
34
|
+
inputs = parsed.arguments + parsed.files.map { |file| File.read(file) }
|
35
|
+
inputs = [$stdin.each_line.to_a.map(&:strip).join] if inputs.empty?
|
36
|
+
|
40
37
|
inputs.each do |input|
|
41
|
-
|
42
|
-
json = JSON.pretty_generate(anonymize_json(JSON.parse(content)))
|
43
|
-
File.exist?(input) ? File.write(input, json) : puts(json)
|
38
|
+
puts(JSON.pretty_generate(anonymize_json(JSON.parse(input))))
|
44
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-anonymize-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dorian-arguments
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: anonymize json file
|
28
42
|
email: dorian@dorianmarie.com
|
29
43
|
executables:
|