dorian-anonymize-yaml 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/anonymize-yaml +9 -14
  3. metadata +19 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02f252ad1cb9c9ce845a0fc2214a336ff97390e3d924d68ddd0adafdfe852610
4
- data.tar.gz: cba95792cb663c1c6d4175b3e43a7bd0e9a957cc88ac6d554462417158299ee9
3
+ metadata.gz: 4b4a24d6484fb6c4079c7777f0f1bfdb54c4d0f16bd53ebb771388fd009d6cc3
4
+ data.tar.gz: 93debeed80b244757704efc1e610a2e0db4a3e58cc74bc3a4a6b2e3c32279006
5
5
  SHA512:
6
- metadata.gz: '083aea55f23e9e09018509b342b1cef06cc3a4436afbecd9bf752218f58b06ecaef40721a48943c1fcba482d66731e4e3ca87c43b97850840418a2baf5c4bea6'
7
- data.tar.gz: 4564cb94a90ea89e9eb6f0d7bca13a5943268614dab3a6f60dc0109a9ec0c87c190c17d1054a72f9681509a09da38f442dec9236525496d24f875272465d87ac
6
+ metadata.gz: 0543dc286a648769f4fe64fbdbc71a5f56d2e6fb13d8f596b58e89e6118ab811e4d0c1b6dc050ae7a4d83f51583626ede4736983c0a80539df4d57df2ce4ed79
7
+ data.tar.gz: cb86e85bbd65cc9f20374ad95af72a6d2936b7545583b845540835c39275ec823fab52fdbe55effacd35a7f75e2c614f64d267373b467297a375ff3f266af8f4
data/bin/anonymize-yaml CHANGED
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "yaml"
5
+ require "dorian/arguments"
5
6
 
6
7
  def anonymize_yaml(data)
7
8
  case data
@@ -22,23 +23,17 @@ def anonymize_yaml(data)
22
23
  end
23
24
  end
24
25
 
25
- if ARGV[0] == "--help" || ARGV[0] == "-h"
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 inputs.empty?
34
- inputs = $stdin.each_line.to_a
28
+ abort parsed.help if parsed.options.help
35
29
 
36
- inputs =
37
- (File.exist?(inputs.first.strip) ? inputs.map(&:strip) : [inputs.join])
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.join] if inputs.empty?
36
+
40
37
  inputs.each do |input|
41
- content = File.exist?(input) ? File.read(input) : input
42
- yaml = anonymize_yaml(YAML.safe_load(content)).to_yaml
43
- File.exist?(input) ? File.write(input, yaml) : puts(yaml)
38
+ puts anonymize_yaml(YAML.safe_load(input)).to_yaml
44
39
  end
metadata CHANGED
@@ -1,19 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-anonymize-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
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-07-05 00:00:00.000000000 Z
12
- dependencies: []
13
- description: |-
14
- Anonymize YAML file
15
-
16
- e.g. `anonymize-yaml spec/**/*.yml`
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dorian-arguments
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: anonymize yaml file
17
28
  email: dorian@dorianmarie.com
18
29
  executables:
19
30
  - anonymize-yaml
@@ -44,5 +55,5 @@ requirements: []
44
55
  rubygems_version: 3.5.11
45
56
  signing_key:
46
57
  specification_version: 4
47
- summary: Anonymize YAML file
58
+ summary: anonymize yaml file
48
59
  test_files: []