diffcrypt 0.7.0 → 0.8.0.rc1

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: 3e3ddad8a3f396ef45c6bab7511d7dea40af793a98a7b439f1c354f558774608
4
- data.tar.gz: 50bc66720f9f45f6ee88e2dd2f7ea565a73d3daee8fd90fcaff5d13c0205f3d7
3
+ metadata.gz: f92de64774d20c0589ef9e2ae8e3734cf406638fdc60473b35afe5c6630c9253
4
+ data.tar.gz: eba4811ebbeeb12fa15f092f3a5a5b439747816df025e66b3e0558a605152fdd
5
5
  SHA512:
6
- metadata.gz: eb329a93e182da12129d5444fea3e4241119583e5b5cfd2b603aba37f17ff11d03fce0500ec81dab59fe9021e18fdd58d4f0cea4bbe0b02b92c248d351eecaee
7
- data.tar.gz: 44e7fe777210f7159ab550860e8fc43006fbdf94b55e439dac57eb2072f2b569947d42b3132e6f7d6f7410c5e6246894a0a323aa668e9c7315f78973f5a2c1b0
6
+ metadata.gz: 9765122e959807815c3a658a64cff0f4395b1fc79772a6a59949a60e16f8952c1982a0f61f73f922753e349773238b42f98ffa35b76b4659737ae4ae74f022ef
7
+ data.tar.gz: a953814419b665b42ec5e079a4d9ca2671f3681533fb715259497c3555a431ac176a1566242bf8d4350c6d83c6837ab8b3729608f542ecab9546c210370af224
@@ -7,15 +7,39 @@ on:
7
7
  pull_request:
8
8
 
9
9
  jobs:
10
- rspec:
10
+ tests:
11
+ name: "RSpec @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
11
12
  runs-on: ubuntu-latest
13
+ continue-on-error: true
14
+ env:
15
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
12
16
  strategy:
13
17
  matrix:
14
18
  ruby:
15
- - "3.0.7"
16
- - "3.1.5"
19
+ - "3.1"
20
+ - "3.2"
21
+ - "3.3"
22
+ - "3.4"
23
+ - "head"
24
+ rails:
25
+ - "6.1"
26
+ - "7.2"
27
+ - "8.0"
28
+ exclude:
29
+ - ruby: "3.2"
30
+ rails: "6.1"
31
+ - ruby: "3.3"
32
+ rails: "6.1"
33
+ - ruby: "3.4"
34
+ rails: "6.1"
35
+ - ruby: "head"
36
+ rails: "6.1"
37
+ - ruby: "3.1"
38
+ rails: "7.2"
39
+ - ruby: "3.1"
40
+ rails: "8.0"
17
41
  steps:
18
- - uses: actions/checkout@v2
42
+ - uses: actions/checkout@v4
19
43
  - name: Set up Ruby
20
44
  uses: ruby/setup-ruby@v1
21
45
  with:
@@ -24,15 +48,20 @@ jobs:
24
48
  - name: Run rspec
25
49
  run: bundle exec rake test
26
50
 
27
- rubocop:
51
+ linters:
52
+ name: "Rubocop @ Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}"
28
53
  runs-on: ubuntu-latest
54
+ continue-on-error: true
55
+ env:
56
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
29
57
  strategy:
30
58
  matrix:
31
59
  ruby:
32
- - "3.0.7"
33
- - "3.1.5"
60
+ - "3.4"
61
+ rails:
62
+ - "7.2"
34
63
  steps:
35
- - uses: actions/checkout@v2
64
+ - uses: actions/checkout@v4
36
65
  - name: Set up Ruby
37
66
  uses: ruby/setup-ruby@v1
38
67
  with:
data/.gitignore CHANGED
@@ -8,3 +8,5 @@
8
8
  /tmp/
9
9
  Gemfile.lock
10
10
  *.gem
11
+ .ruby-version
12
+ gemfiles/*.lock
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
- TargetRubyVersion: 2.6
3
+ TargetRubyVersion: 3.0
4
4
 
5
5
  Style/ClassAndModuleChildren:
6
6
  Exclude:
@@ -23,10 +23,6 @@ Style/TrailingCommaInHashLiteral:
23
23
  EnforcedStyleForMultiline: consistent_comma
24
24
  Style/AccessorGrouping:
25
25
  EnforcedStyle: separated
26
- Style/OpenStructUse:
27
- Exclude:
28
- - test/*_test.rb
29
- - test/**/*_test.rb
30
26
 
31
27
  Layout/LineLength:
32
28
  Exclude:
data/Appraisals ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ SUPPORTED_RAILS_VERSIONS = %w[
4
+ 6.1
5
+ 7.1
6
+ 7.2
7
+ 8.0
8
+ ].freeze
9
+
10
+ SUPPORTED_RAILS_VERSIONS.each do |version|
11
+ appraise "rails-#{version}" do
12
+ gem 'rails', "~> #{version}"
13
+ end
14
+ end
data/CHANGELOG.md CHANGED
@@ -7,7 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
 
9
9
 
10
- ## Unreleased
10
+ ## [0.8.0.rc1]
11
+
12
+ ### Added
13
+
14
+ - Extended ruby 3.x support
15
+ - Added Rails 8 support
16
+
17
+ ### Changed
18
+
19
+ - Improved testing against multiple ruby/rails versions
20
+ - Improved support for nested arrays and hashes in YAML files
21
+
22
+ ### Removed
23
+
24
+ - Removed code coverage reporting
25
+
26
+
27
+
28
+ ## [0.7.0] - 2024-05-26
29
+
30
+ ### Added
31
+
32
+ - Added ruby 3.1. support
33
+ - Added rails 7.1 support
34
+
35
+ ### Changed
36
+
37
+ - Updated all dependencies
38
+
39
+ ### Removed
40
+
41
+ - Dropped ruby 2.x support
42
+
43
+
44
+
45
+ ## [0.6.1] - 2022-02-06
11
46
 
12
47
  ### Fixed
13
48
 
data/Gemfile CHANGED
@@ -5,9 +5,8 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in diffcrypt.gemspec
6
6
  gemspec
7
7
 
8
+ gem 'appraisal'
8
9
  gem 'minitest', '~> 5.0'
9
10
  gem 'minitest-reporters', '~> 1.6.0'
10
11
  gem 'rake', '~> 13.2'
11
12
  gem 'rubocop', '~> 1.25.1'
12
- gem 'simplecov', '~> 0.22.0', require: false # CodeClimate not compatible with 0.18+ yet - https://github.com/codeclimate/test-reporter/issues/413
13
- gem 'simplecov-lcov', '< 0.9'
data/Rakefile CHANGED
@@ -11,4 +11,4 @@ end
11
11
  task default: :test
12
12
 
13
13
  path = File.expand_path(__dir__)
14
- Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").sort.each { |f| load f }
14
+ Dir.glob("#{path}/lib/diffcrypt/tasks/**/*.rake").each { load(_1) }
data/SECURITY.md CHANGED
@@ -8,8 +8,8 @@ Since the internal APIs may change dramatically until v1.0, here is a list of th
8
8
 
9
9
  | Version | Supported |
10
10
  | ------- | ------------------ |
11
- | 0.5.1 | :white_check_mark: |
12
- | 0.6.x | :white_check_mark: |
11
+ | 0.7.0 | :x: |
12
+ | 0.8.x | :white_check_mark: |
13
13
 
14
14
 
15
15
 
data/diffcrypt.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Diffable encrypted configuration files that can be safely committed into a git repository'
13
13
  spec.homepage = 'https://github.com/diffcrypt/diffcrypt-ruby'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
18
18
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = %w[diffcrypt]
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.2'
32
+ spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 9.0'
33
33
  spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
34
34
  spec.metadata['rubygems_mfa_required'] = 'true'
35
35
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'https://rubygems.org'
6
+
7
+ gem 'appraisal'
8
+ gem 'concurrent-ruby', '1.3.4' # 1.3.5. breaks with Rails < 7, see https://github.com/ruby-concurrency/concurrent-ruby/commit/d7ce956dacd0b772273d39b8ed31a30cff7ecf38
9
+ gem 'minitest', '~> 5.0'
10
+ gem 'minitest-reporters', '~> 1.6.0'
11
+ gem 'rails', '~> 6.1'
12
+ gem 'rake', '~> 13.2'
13
+ gem 'rubocop', '~> 1.25.1'
14
+
15
+ gemspec path: '../'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'https://rubygems.org'
6
+
7
+ gem 'appraisal'
8
+ gem 'minitest', '~> 5.0'
9
+ gem 'minitest-reporters', '~> 1.6.0'
10
+ gem 'rails', '~> 7.2'
11
+ gem 'rake', '~> 13.2'
12
+ gem 'rubocop', '~> 1.25.1'
13
+
14
+ gemspec path: '../'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'https://rubygems.org'
6
+
7
+ gem 'appraisal'
8
+ gem 'minitest', '~> 5.0'
9
+ gem 'minitest-reporters', '~> 1.6.0'
10
+ gem 'rails', '~> 8.0'
11
+ gem 'rake', '~> 13.2'
12
+ gem 'rubocop', '~> 1.25.1'
13
+
14
+ gemspec path: '../'
@@ -34,16 +34,21 @@ module Diffcrypt
34
34
 
35
35
  # @param [Hash] data
36
36
  # @return [Hash]
37
+ # rubocop:disable Metrics/MethodLength
37
38
  def decrypt_hash(data)
38
39
  data.each do |key, value|
39
- data[key] = if value.is_a?(Hash) || value.is_a?(Array)
40
+ data[key] = case value
41
+ when Hash
40
42
  decrypt_hash(value)
43
+ when Array
44
+ value.map { |v| decrypt_hash(v) }
41
45
  else
42
46
  decrypt_string value
43
47
  end
44
48
  end
45
49
  data
46
50
  end
51
+ # rubocop:enable Metrics/MethodLength
47
52
 
48
53
  # @param [String] contents The raw YAML string to be encrypted
49
54
  # @param [String, nil] original_encrypted_contents The original (encrypted) content to determine which keys have changed
@@ -73,14 +78,18 @@ module Diffcrypt
73
78
  end
74
79
 
75
80
  # TODO: Fix the complexity of this method
76
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity
81
+ # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
77
82
  # @param [Hash] keys
78
83
  # @return [Hash]
79
84
  def encrypt_values(data, original_data = nil)
80
85
  data.each do |key, value|
81
- original_encrypted_value = original_data ? original_data[key] : nil
82
- data[key] = if value.is_a?(Hash) || value.is_a?(Array)
86
+ original_encrypted_value = original_data&.dig(key)
87
+
88
+ data[key] = case value
89
+ when Hash
83
90
  encrypt_values(value, original_encrypted_value)
91
+ when Array
92
+ value.map.with_index { |v, i| encrypt_values(v, original_encrypted_value&.dig(i)) }
84
93
  else
85
94
  original_decrypted_value = original_encrypted_value ? decrypt_string(original_encrypted_value) : nil
86
95
  key_changed = original_decrypted_value.nil? || original_decrypted_value != value
@@ -89,7 +98,7 @@ module Diffcrypt
89
98
  end
90
99
  data.sort.to_h
91
100
  end
92
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity
101
+ # rubocop:enable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize
93
102
 
94
103
  # @param [String] value The encrypted value that needs decrypting
95
104
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Diffcrypt
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0.rc1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffcrypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Qualie
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-26 00:00:00.000000000 Z
10
+ date: 2025-03-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -19,7 +18,7 @@ dependencies:
19
18
  version: '6.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '7.2'
21
+ version: '9.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +28,7 @@ dependencies:
29
28
  version: '6.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '7.2'
31
+ version: '9.0'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: thor
35
34
  requirement: !ruby/object:Gem::Requirement
@@ -63,6 +62,7 @@ files:
63
62
  - ".github/workflows/test.yml"
64
63
  - ".gitignore"
65
64
  - ".rubocop.yml"
65
+ - Appraisals
66
66
  - CHANGELOG.md
67
67
  - Gemfile
68
68
  - LICENSE.txt
@@ -73,6 +73,9 @@ files:
73
73
  - bin/diffcrypt
74
74
  - bin/setup
75
75
  - diffcrypt.gemspec
76
+ - gemfiles/rails_6.1.gemfile
77
+ - gemfiles/rails_7.2.gemfile
78
+ - gemfiles/rails_8.0.gemfile
76
79
  - lib/diffcrypt.rb
77
80
  - lib/diffcrypt/cli.rb
78
81
  - lib/diffcrypt/encryptor.rb
@@ -90,7 +93,6 @@ metadata:
90
93
  homepage_uri: https://github.com/diffcrypt/diffcrypt-ruby
91
94
  source_code_uri: https://github.com/diffcrypt/diffcrypt-ruby
92
95
  rubygems_mfa_required: 'true'
93
- post_install_message:
94
96
  rdoc_options: []
95
97
  require_paths:
96
98
  - lib
@@ -98,15 +100,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
100
  requirements:
99
101
  - - ">="
100
102
  - !ruby/object:Gem::Version
101
- version: 2.6.0
103
+ version: 3.0.0
102
104
  required_rubygems_version: !ruby/object:Gem::Requirement
103
105
  requirements:
104
106
  - - ">="
105
107
  - !ruby/object:Gem::Version
106
108
  version: '0'
107
109
  requirements: []
108
- rubygems_version: 3.2.33
109
- signing_key:
110
+ rubygems_version: 3.6.5
110
111
  specification_version: 4
111
112
  summary: Diffable encrypted configuration files
112
113
  test_files: []