complex_config 0.23.0 → 0.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1deb5e4f387e2e1e88e6636f2354b4ee7ec0552ae2ab2e8b74c29f26338d7c35
4
- data.tar.gz: 169a0f8fceca97a3444f7522b449dc051783680770e4f16f1a657d6b8cf05253
3
+ metadata.gz: e91a5c6200dc7097395a12f476351fa74e6396405e458316966b53c81d583aaf
4
+ data.tar.gz: ac7df446aa65171fa58cc426740302dc98e19bf6671fdd050ea6a7695e044ace
5
5
  SHA512:
6
- metadata.gz: 6970033043150fd167e40be0ee30e4dfc42faa4c18ed916256f78f9cdf2d50526509e234ef0449607d45856368efcd254ea53277b2154b15481eb0cd3398764b
7
- data.tar.gz: 5e154605e6557eb0ec33893b275241c7445195f33528001269c6f86fe1558e882690d3bccbe2a864440f95fdca2c7f8e494c92d13803b7d58ad5894a689c0732
6
+ metadata.gz: 7226e11f74de096385e5168fed25171e1ddf5dd49e8bd4bf3514e7f93865e4b434aaded31e9da46720cd0d0ac401e2bc2bea755490b1cc71af70b8f9fb66d2f9
7
+ data.tar.gz: 57bed154ea2ce2106251ba12d8e58c6555225c59a0fffd59d9770fd326b29fa17d5b2c5cc68940d65799bb9b1b09ae6c7f1bb9412a7a3c226347ca970734275f
data/CHANGES.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-11-24 v0.24.0
4
+
5
+ - Added `-O` option to `complex_config` decrypt command to write output to stdout
6
+ - Added `-I` option to `complex_config` encrypt command to read input from stdin
7
+ - Modified `decrypt` command to handle stdout output when `-O` flag is present
8
+ - Marked `display` as alias for `decrypt -O` in help text
9
+ - Replaced custom `did_not_change` exception with `catch`/`throw` mechanism in edit command
10
+ - Updated `rubygems_version` from **3.6.9** to **3.7.2**
11
+ - Updated `gem_hadar` development dependency from **~> 2.6** to **~> 2.8**
12
+ - Added `openssl-dev` to apk packages in `.all_images.yml`
13
+
3
14
  ## 2025-09-14 v0.23.0
4
15
 
5
16
  - **README overhaul** with comprehensive encryption documentation, debugging
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.0
1
+ 0.24.0
data/bin/complex_config CHANGED
@@ -17,7 +17,7 @@ require 'tempfile'
17
17
  require 'fileutils'
18
18
  include FileUtils
19
19
 
20
- $opts = go 'o:n:h'
20
+ $opts = go 'o:n:IOh'
21
21
 
22
22
  # The usage method displays help information and exits the program
23
23
  #
@@ -37,13 +37,15 @@ def usage(msg: 'Displaying help', rc: 0)
37
37
  edit edit encrypted file FILENAME (suffix .enc)
38
38
  encrypt encrypt file FILENAME (suffix not .enc)
39
39
  decrypt decrypt file FILENAME (suffix .enc)
40
- display decrypt and display encrypted file FILENAME (suffix .enc)
40
+ display alias for for decrypt -O
41
41
  new_key generate a new key and display it
42
42
  recrypt recrypt a file, -o OLD_KEY to decrypt, -n NEW_KEY to encrypt
43
43
 
44
44
  Options are
45
45
 
46
46
  -c CONFIG_DIR set CONFIG_DIR (default: "./config")
47
+ -I read input from stdin instead of file (encrypt)
48
+ -O write output to stdout instead of file (decrypt)
47
49
  -h this help
48
50
 
49
51
  end
@@ -59,7 +61,7 @@ end
59
61
  #
60
62
  # @param suffix [TrueClass, FalseClass] whether to validate or remove the .enc suffix
61
63
  # @return [String] the validated filename without the .enc suffix if requested
62
- def fetch_filename(suffix: true)
64
+ def fetch_filename(suffix: true, check_exist: true)
63
65
  fn = ARGV.shift.dup or usage msg: "config filename required", rc: 1
64
66
  if suffix
65
67
  unless fn.end_with?('.enc')
@@ -70,7 +72,9 @@ def fetch_filename(suffix: true)
70
72
  usage msg: "config filename seems to be already encrypted with suffix .enc", rc: 1
71
73
  end
72
74
  end
73
- File.exist?(fn) or usage msg: "config filename #{fn} doesn't exist", rc: 1
75
+ if check_exist
76
+ File.exist?(fn) or usage msg: "config filename #{fn} doesn't exist", rc: 1
77
+ end
74
78
  suffix and fn.sub!(/\.enc\z/, '')
75
79
  fn
76
80
  end
@@ -81,8 +85,7 @@ ComplexConfig::Provider.config_dir = File.expand_path($opts[?c] || './config')
81
85
  case command = ARGV.shift
82
86
  when 'edit'
83
87
  fn = fetch_filename
84
- did_not_change = Class.new(StandardError)
85
- begin
88
+ catch :did_not_change do
86
89
  File.secure_write(fn + '.enc') do |f|
87
90
  Tempfile.open('complex_config') do |t|
88
91
  config = ComplexConfig::Provider.decrypt_config(fn)
@@ -92,31 +95,43 @@ when 'edit'
92
95
  new_config = IO.binread(t.path)
93
96
  if config == new_config
94
97
  puts "Configuration hasn't been changed."
95
- raise did_not_change
98
+ throw :did_not_change
96
99
  else
97
100
  f.write ComplexConfig::Provider.encrypt_config(fn, new_config)
98
101
  puts "New configuration has been written."
99
102
  end
100
103
  end
101
104
  end
102
- rescue did_not_change
103
105
  end
104
106
  when 'decrypt'
105
107
  fn = fetch_filename
106
- File.exist?(fn) and usage msg: "decrypted config #{fn.inspect} already exists", rc: 1
107
- File.secure_write(fn) do |f|
108
- f.write ComplexConfig::Provider.decrypt_config(fn)
108
+ if $opts[?O]
109
+ $stdout.puts ComplexConfig::Provider.decrypt_config(fn)
110
+ else
111
+ File.exist?(fn) and usage msg: "decrypted config #{fn.inspect} already exists", rc: 1
112
+ File.secure_write(fn) do |f|
113
+ f.write ComplexConfig::Provider.decrypt_config(fn)
114
+ end
115
+ puts "File was decrypted to #{fn.inspect}. You can remove #{(fn + '.enc').inspect} now."
109
116
  end
110
- puts "File was decrypted to #{fn.inspect}. You can remove #{(fn + '.enc').inspect} now."
111
117
  when 'display'
112
- puts ComplexConfig::Provider.decrypt_config(fetch_filename)
118
+ $stdout.puts ComplexConfig::Provider.decrypt_config(fetch_filename)
113
119
  when 'encrypt'
114
- fn = fetch_filename suffix: false
120
+ fn = fetch_filename suffix: false, check_exist: !$opts[?I]
115
121
  File.exist?(fn + '.enc') and usage msg: "encrypted config #{(fn + '.enc').inspect} already exists", rc: 1
116
- File.secure_write(fn + '.enc') do |f|
117
- f.write ComplexConfig::Provider.encrypt_config(fn, IO.binread(fn))
122
+ if $opts[?I]
123
+ encrypted_data = ComplexConfig::Provider.encrypt_config(fn, $stdin.read)
124
+ File.secure_write(fn + '.enc') do |f|
125
+ f.write encrypted_data
126
+ end
127
+ puts "File was encrypted to #{(fn + '.enc').inspect} from stdin."
128
+ else
129
+ encrypted_data = ComplexConfig::Provider.encrypt_config(fn, IO.binread(fn))
130
+ File.secure_write(fn + '.enc') do |f|
131
+ f.write encrypted_data
132
+ end
133
+ puts "File was encrypted to #{(fn + '.enc').inspect}. You can remove #{fn.inspect} now."
118
134
  end
119
- puts "File was encrypted to #{(fn + '.enc').inspect}. You can remove #{fn.inspect} now."
120
135
  when 'new_key'
121
136
  puts ComplexConfig::Provider.new_key
122
137
  when 'recrypt'
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: complex_config 0.23.0 ruby lib
2
+ # stub: complex_config 0.24.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "complex_config".freeze
6
- s.version = "0.23.0".freeze
6
+ s.version = "0.24.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -17,13 +17,13 @@ Gem::Specification.new do |s|
17
17
  s.homepage = "https://github.com/flori/complex_config".freeze
18
18
  s.licenses = ["Apache-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "3.6.9".freeze
20
+ s.rubygems_version = "3.7.2".freeze
21
21
  s.summary = "configuration library".freeze
22
22
  s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/key_source_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
24
24
  s.specification_version = 4
25
25
 
26
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.6".freeze])
26
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.8".freeze])
27
27
  s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
28
28
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
@@ -1,6 +1,6 @@
1
1
  module ComplexConfig
2
2
  # ComplexConfig version
3
- VERSION = '0.23.0'
3
+ VERSION = '0.24.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: complex_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.6'
18
+ version: '2.8'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '2.6'
25
+ version: '2.8'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubygems_version: 3.6.9
272
+ rubygems_version: 3.7.2
273
273
  specification_version: 4
274
274
  summary: configuration library
275
275
  test_files: