dorian-anonymize-json 0.2.2 → 0.2.3
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: 576644015b54dbfd4bc96de89357d92cfcabf889aefd2a23a7fde2525e0d93a6
|
4
|
+
data.tar.gz: cab3b5381f7c207cac6811d8eaf49a38fd4f0172ce5d1d577a217692066c4492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6b597c6fdc1023c10ba2f1ca687c8f2b15051f586a978655d17d97943eb419ea776e3b77ff094660d1c930c1b968fdecbbbd9b1451bc367179b9e84d664d7c
|
7
|
+
data.tar.gz: e75c347c6c89a9275f9691dc41abbc3373816c6b172e981f9ffa314c596e774468a7d315588c105eeffa3d01f572410c0f9190135f253986094cfc278ce82379
|
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.2.
|
4
|
+
version: 0.2.3
|
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-22 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:
|