diffcrypt 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +40 -0
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +27 -0
- data/Gemfile +3 -2
- data/README.md +2 -2
- data/SECURITY.md +2 -1
- data/diffcrypt.gemspec +4 -3
- data/lib/diffcrypt/rails/encrypted_configuration.rb +3 -1
- data/lib/diffcrypt/tasks/rails.rake +6 -2
- data/lib/diffcrypt/version.rb +1 -1
- data/lib/diffcrypt.rb +1 -1
- metadata +10 -9
- data/.circleci/config.yml +0 -78
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb31613525e78d8a5f45fe9276daa26127c3f6555b69864cf6c438713c8a5385
|
4
|
+
data.tar.gz: f0cccb6f0706f613284e4f42e04c482dc3368c9e3b121b4d3a895c961e74383b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0d83aedaafe07809888c2bf7edb1100ee7b51c3d99dbf9deaa6108932a6585246e7b1d0f917f403f5a765e4421a73804465afacb6bd1c942c4a2befee1ecec
|
7
|
+
data.tar.gz: d40a2bfb110cae3f2961c5ca57f5de5e5250d54354b9470b1ffa140bf88717970cb9d067f65a4f03576e26b7b2372c88b5294eb22158bbfcc51bb8aa749cb07a
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby:
|
15
|
+
- "2.7.5"
|
16
|
+
- "3.0.3"
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Run rspec
|
25
|
+
run: bundle exec rake test
|
26
|
+
rubocop:
|
27
|
+
runs-on: ubuntu-latest
|
28
|
+
strategy:
|
29
|
+
matrix:
|
30
|
+
ruby:
|
31
|
+
- "2.7.5"
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
- name: Set up Ruby
|
35
|
+
uses: ruby/setup-ruby@v1
|
36
|
+
with:
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
38
|
+
bundler-cache: true
|
39
|
+
- name: Run rubocop
|
40
|
+
run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
@@ -9,6 +9,11 @@ Style/Documentation:
|
|
9
9
|
Enabled: false
|
10
10
|
Metrics/MethodLength:
|
11
11
|
Exclude:
|
12
|
+
- test/*_test.rb
|
13
|
+
- test/**/*_test.rb
|
14
|
+
Naming/VariableNumber:
|
15
|
+
Exclude:
|
16
|
+
- test/*_test.rb
|
12
17
|
- test/**/*_test.rb
|
13
18
|
Style/TrailingCommaInArrayLiteral:
|
14
19
|
EnforcedStyleForMultiline: consistent_comma
|
@@ -18,7 +23,12 @@ Style/TrailingCommaInHashLiteral:
|
|
18
23
|
EnforcedStyleForMultiline: consistent_comma
|
19
24
|
Style/AccessorGrouping:
|
20
25
|
EnforcedStyle: separated
|
26
|
+
Style/OpenStructUse:
|
27
|
+
Exclude:
|
28
|
+
- test/*_test.rb
|
29
|
+
- test/**/*_test.rb
|
21
30
|
|
22
31
|
Layout/LineLength:
|
23
32
|
Exclude:
|
33
|
+
- test/*_test.rb
|
24
34
|
- test/**/*_test.rb
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
+
## Unreleased
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Broken namespace when saving credentials in rails
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## [0.6.0] - 2022-02-06
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
- Rails 7 support
|
23
|
+
- Ruby 3.0 support
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
|
27
|
+
- Updated all dependencies
|
28
|
+
- Migrated from CircleCI to GitHub Actions
|
29
|
+
- Moved repo to own organisation
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
- Only add `.gitignore` entry once #52
|
34
|
+
|
35
|
+
|
36
|
+
|
10
37
|
## [0.5.1] - 2021-03-29
|
11
38
|
|
12
39
|
### Added
|
data/Gemfile
CHANGED
@@ -6,7 +6,8 @@ source 'https://rubygems.org'
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
gem 'minitest', '~> 5.0'
|
9
|
+
gem 'minitest-reporters', '~> 1.5.0'
|
9
10
|
gem 'rake', '~> 13.0'
|
10
|
-
gem 'rubocop', '~> 1.
|
11
|
+
gem 'rubocop', '~> 1.25.1'
|
11
12
|
gem 'simplecov', '~> 0.21.2', require: false # CodeClimate not compatible with 0.18+ yet - https://github.com/codeclimate/test-reporter/issues/413
|
12
|
-
gem 'simplecov-lcov', '< 0.
|
13
|
+
gem 'simplecov-lcov', '< 0.9'
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Diffcrypt
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/diffcrypt.svg)](https://rubygems.org/gems/diffcrypt)
|
4
|
-
[![CircleCI](https://circleci.com/gh/
|
4
|
+
[![CircleCI](https://circleci.com/gh/diffcrypt/diffcrypt-ruby.svg?style=svg)](https://circleci.com/gh/diffcrypt/diffcrypt-ruby)
|
5
5
|
|
6
6
|
|
7
7
|
Diffable encrypted files that you can safely commit into your repo.
|
@@ -97,7 +97,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
97
97
|
|
98
98
|
## Contributing
|
99
99
|
|
100
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
100
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/diffcrypt/diffcrypt-ruby.
|
101
101
|
|
102
102
|
|
103
103
|
|
data/SECURITY.md
CHANGED
data/diffcrypt.gemspec
CHANGED
@@ -10,14 +10,14 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Diffable encrypted configuration files'
|
12
12
|
spec.description = 'Diffable encrypted configuration files that can be safely committed into a git repository'
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/diffcrypt/diffcrypt-ruby'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
18
18
|
|
19
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
-
spec.metadata['source_code_uri'] = 'https://github.com/
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/diffcrypt/diffcrypt-ruby'
|
21
21
|
# spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
@@ -29,6 +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', '<
|
32
|
+
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.1'
|
33
33
|
spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
|
34
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
34
35
|
end
|
@@ -4,6 +4,8 @@ require 'fileutils'
|
|
4
4
|
require 'pathname'
|
5
5
|
require 'tmpdir'
|
6
6
|
|
7
|
+
require 'active_support/isolated_execution_state' if Gem.loaded_specs['activesupport'].version.to_s.index('7.')&.zero?
|
8
|
+
|
7
9
|
require 'active_support/ordered_options'
|
8
10
|
require 'active_support/core_ext/hash'
|
9
11
|
require 'active_support/core_ext/module/delegation'
|
@@ -52,7 +54,7 @@ module Diffcrypt
|
|
52
54
|
def write(contents, original_encrypted_contents = nil)
|
53
55
|
deserialize(contents)
|
54
56
|
|
55
|
-
|
57
|
+
::File.binwrite "#{content_path}.tmp", encrypt(contents, original_encrypted_contents)
|
56
58
|
::FileUtils.mv "#{content_path}.tmp", content_path
|
57
59
|
end
|
58
60
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/BlockLength
|
3
4
|
namespace :diffcrypt do
|
4
5
|
desc 'Initialize credentials for all environments'
|
5
6
|
task :init, %i[environments] do |_t, args|
|
@@ -11,7 +12,6 @@ namespace :diffcrypt do
|
|
11
12
|
environments.each do |environment|
|
12
13
|
key_path = Rails.root.join('config', 'credentials', "#{environment}.key")
|
13
14
|
file_path = Rails.root.join('config', 'credentials', "#{environment}.yml.enc")
|
14
|
-
gitignore_path = Rails.root.join('.gitignore')
|
15
15
|
next if File.exist?(file_path) || File.exist?(key_path)
|
16
16
|
|
17
17
|
# Generate a new key
|
@@ -26,11 +26,15 @@ namespace :diffcrypt do
|
|
26
26
|
'secret_key_base' => SecureRandom.hex(32),
|
27
27
|
}
|
28
28
|
file.write(key, data)
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
+
# Ensure .key files are always ignored
|
32
|
+
gitignore_path = Rails.root.join('.gitignore')
|
33
|
+
unless File.read(gitignore_path).include?('config/credentials/*.key')
|
31
34
|
::File.open(gitignore_path, 'a') do |f|
|
32
35
|
f.write("\nconfig/credentials/*.key")
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
40
|
+
# rubocop:enable Metrics/BlockLength
|
data/lib/diffcrypt/version.rb
CHANGED
data/lib/diffcrypt.rb
CHANGED
@@ -17,7 +17,7 @@ module Diffcrypt
|
|
17
17
|
def initialize(key_path:, env_key:)
|
18
18
|
super \
|
19
19
|
'Missing encryption key to decrypt file with. ' \
|
20
|
-
|
20
|
+
"Ask your team for your master key and write it to #{key_path} or put it in the ENV['#{env_key}']."
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffcrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Qualie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '6.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '6.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: thor
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,8 +59,8 @@ executables:
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".circleci/config.yml"
|
63
62
|
- ".github/dependabot.yml"
|
63
|
+
- ".github/workflows/test.yml"
|
64
64
|
- ".gitignore"
|
65
65
|
- ".rubocop.yml"
|
66
66
|
- CHANGELOG.md
|
@@ -83,12 +83,13 @@ files:
|
|
83
83
|
- lib/diffcrypt/tasks/rails.rake
|
84
84
|
- lib/diffcrypt/version.rb
|
85
85
|
- tmp/.keep
|
86
|
-
homepage: https://github.com/
|
86
|
+
homepage: https://github.com/diffcrypt/diffcrypt-ruby
|
87
87
|
licenses:
|
88
88
|
- MIT
|
89
89
|
metadata:
|
90
|
-
homepage_uri: https://github.com/
|
91
|
-
source_code_uri: https://github.com/
|
90
|
+
homepage_uri: https://github.com/diffcrypt/diffcrypt-ruby
|
91
|
+
source_code_uri: https://github.com/diffcrypt/diffcrypt-ruby
|
92
|
+
rubygems_mfa_required: 'true'
|
92
93
|
post_install_message:
|
93
94
|
rdoc_options: []
|
94
95
|
require_paths:
|
@@ -104,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
105
|
- !ruby/object:Gem::Version
|
105
106
|
version: '0'
|
106
107
|
requirements: []
|
107
|
-
rubygems_version: 3.1.
|
108
|
+
rubygems_version: 3.1.6
|
108
109
|
signing_key:
|
109
110
|
specification_version: 4
|
110
111
|
summary: Diffable encrypted configuration files
|
data/.circleci/config.yml
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
jobs:
|
4
|
-
bundle:
|
5
|
-
docker:
|
6
|
-
- image: circleci/ruby:2.7.1
|
7
|
-
working_directory: /mnt/ramdisk
|
8
|
-
steps:
|
9
|
-
- checkout
|
10
|
-
- restore_cache:
|
11
|
-
keys:
|
12
|
-
- bundler-{{ checksum "diffcrypt.gemspec" }}-{{ .Environment.CACHE_VERSION }}
|
13
|
-
- run:
|
14
|
-
name: bundle install
|
15
|
-
command: |
|
16
|
-
gem install bundler -v '2.1.4'
|
17
|
-
bundle install --path=vendor/bundle --jobs=4 --retry=3
|
18
|
-
- save_cache:
|
19
|
-
key: bundler-{{ checksum "diffcrypt.gemspec" }}-{{ .Environment.CACHE_VERSION }}
|
20
|
-
paths:
|
21
|
-
- vendor/bundle
|
22
|
-
|
23
|
-
test:
|
24
|
-
docker:
|
25
|
-
- image: circleci/ruby:2.7.1
|
26
|
-
working_directory: /mnt/ramdisk
|
27
|
-
steps:
|
28
|
-
- checkout
|
29
|
-
- restore_cache:
|
30
|
-
keys:
|
31
|
-
- bundler-{{ checksum "diffcrypt.gemspec" }}-{{ .Environment.CACHE_VERSION }}
|
32
|
-
- run:
|
33
|
-
name: bundle install
|
34
|
-
command: |
|
35
|
-
gem install bundler -v '2.1.4'
|
36
|
-
bundle install --path=vendor/bundle --jobs=4 --retry=3
|
37
|
-
- run:
|
38
|
-
name: Setup Code Climate test-reporter
|
39
|
-
command: |
|
40
|
-
# download test reporter as a static binary
|
41
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
42
|
-
chmod +x ./cc-test-reporter
|
43
|
-
- run:
|
44
|
-
name: rake test
|
45
|
-
command: |
|
46
|
-
./cc-test-reporter before-build
|
47
|
-
bundle exec rake test
|
48
|
-
./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?
|
49
|
-
rubocop:
|
50
|
-
docker:
|
51
|
-
- image: circleci/ruby:2.7.1
|
52
|
-
working_directory: /mnt/ramdisk
|
53
|
-
steps:
|
54
|
-
- checkout
|
55
|
-
- restore_cache:
|
56
|
-
keys:
|
57
|
-
- bundler-{{ checksum "diffcrypt.gemspec" }}-{{ .Environment.CACHE_VERSION }}
|
58
|
-
- run:
|
59
|
-
name: bundle install
|
60
|
-
command: |
|
61
|
-
gem install bundler -v '2.1.4'
|
62
|
-
bundle install --path=vendor/bundle --jobs=4 --retry=3
|
63
|
-
- run:
|
64
|
-
name: rubocop
|
65
|
-
command: bundle exec rubocop
|
66
|
-
when: always
|
67
|
-
|
68
|
-
workflows:
|
69
|
-
version: 2
|
70
|
-
all:
|
71
|
-
jobs:
|
72
|
-
- bundle
|
73
|
-
- test:
|
74
|
-
requires:
|
75
|
-
- bundle
|
76
|
-
- rubocop:
|
77
|
-
requires:
|
78
|
-
- bundle
|