credman 0.0.4 → 0.0.5

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: 6388da4cf0f1f8567e5a14e214e1ed7db9143307d836286050a91fbeeaf03f16
4
- data.tar.gz: 3a8b0e4e839371279e819463c659898556f81d171ba980da006b459f4e7812f4
3
+ metadata.gz: f25d3191780d08906d8892c1f95ad775b11bebef09037be0bb93118bf3d86886
4
+ data.tar.gz: b07393ac4330ee9aaa4bc9b022ab9a64f7330cbea16f130b8a00886fa76dcdcd
5
5
  SHA512:
6
- metadata.gz: 605cb0d66f1a5c7889325e80ae3de4f604ab6958a0c08ceef401f35db8b6378d949030d4f58502ce91fe699563a206ffb7dac418315732d544b0d2eecf3cb262
7
- data.tar.gz: 9cd6975ad0f9a1ebdfa69fac1807a27217a0a0fce7c6ebf66ee07c804e4a38e18631c6a0def1732fc4d5d61a817fb65edd62f48a225f875400795ca6b2d2d209
6
+ metadata.gz: 32b50f324c60ae1257b2838cc596d30d5c6681351885cb0f0b9f98f7ee6d6d8ee6df053ee6b0d593574567cca3008b3878e4c2e99b20ff83c2af6d04979f6644
7
+ data.tar.gz: 24389f20374400c35c28813bd463f41f51af0f807cda971aa8e1c9d29f39542956596cd2bc69abedd7feb912db2f189a9531279cefa2b75dd9fc9b969153d445
data/Appraisals ADDED
@@ -0,0 +1,15 @@
1
+ appraise "activesupport-6" do
2
+ gem "activesupport", "~> 6.0.0"
3
+ end
4
+
5
+ appraise "activesupport-6-1" do
6
+ gem "activesupport", "~> 6.1.0"
7
+ end
8
+
9
+ appraise "activesupport-7" do
10
+ gem "activesupport", "~> 7.0.0"
11
+ end
12
+
13
+ appraise "activesupport-master" do
14
+ gem "activesupport", github: "rails/rails", branch: "main"
15
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.0.5] - 2022-09-06
2
+
3
+ - Introduce config with `default_diff_branch` and `available_environments` options (PR #9)
4
+ - Setup Github actions (PR #6)
5
+ - small fixes related to linters and specs (PR #6)
6
+
1
7
  ## [0.0.4] - 2022-09-06
2
8
 
3
9
  - fix: list command failure when root key exists (PR #2)
data/Gemfile CHANGED
@@ -4,7 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in credman.gemspec
6
6
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.0"
10
- gem "standard", "~> 1.13"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- credman (0.0.4)
4
+ credman (0.0.5)
5
5
  activesupport (>= 6.0)
6
6
  dry-cli (~> 0.7)
7
7
  hash_diff (~> 1.0)
@@ -16,11 +16,15 @@ GEM
16
16
  i18n (>= 1.6, < 2)
17
17
  minitest (>= 5.1)
18
18
  tzinfo (~> 2.0)
19
+ appraisal (2.4.1)
20
+ bundler
21
+ rake
22
+ thor (>= 0.14.0)
19
23
  ast (2.4.2)
20
24
  concurrent-ruby (1.1.10)
21
25
  diff-lcs (1.5.0)
22
26
  dry-cli (0.7.0)
23
- hash_diff (1.1.0)
27
+ hash_diff (1.1.1)
24
28
  i18n (1.12.0)
25
29
  concurrent-ruby (~> 1.0)
26
30
  json (2.6.2)
@@ -66,6 +70,7 @@ GEM
66
70
  standard (1.13.0)
67
71
  rubocop (= 1.31.2)
68
72
  rubocop-performance (= 1.14.3)
73
+ thor (1.2.1)
69
74
  tty-color (0.6.0)
70
75
  tty-command (0.10.1)
71
76
  pastel (~> 0.8)
@@ -74,9 +79,12 @@ GEM
74
79
  unicode-display_width (2.2.0)
75
80
 
76
81
  PLATFORMS
82
+ ruby
77
83
  x86_64-darwin-21
84
+ x86_64-linux
78
85
 
79
86
  DEPENDENCIES
87
+ appraisal
80
88
  credman!
81
89
  rake (~> 13.0)
82
90
  rspec (~> 3.0)
@@ -0,0 +1,5 @@
1
+ default_diff_branch: main
2
+ available_environments:
3
+ - development
4
+ - test
5
+ - production
data/credman.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
24
  end
25
25
  end
26
- spec.executables = 'credman'
26
+ spec.executables = "credman"
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_dependency "activesupport", ">= 6.0"
@@ -32,6 +32,8 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "pastel", "~> 0.8"
33
33
  spec.add_dependency "hash_diff", "~> 1.0"
34
34
 
35
+ spec.add_development_dependency "rake", "~> 13.0"
35
36
  spec.add_development_dependency "rspec", "~> 3.0"
36
37
  spec.add_development_dependency "standard", "~> 1.13"
38
+ spec.add_development_dependency "appraisal"
37
39
  end
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,98 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ credman (0.0.5)
5
+ activesupport (>= 6.0)
6
+ dry-cli (~> 0.7)
7
+ hash_diff (~> 1.0)
8
+ pastel (~> 0.8)
9
+ tty-command (~> 0.10)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (6.0.5.1)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
19
+ zeitwerk (~> 2.2, >= 2.2.2)
20
+ appraisal (2.4.1)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
24
+ ast (2.4.2)
25
+ concurrent-ruby (1.1.10)
26
+ diff-lcs (1.5.0)
27
+ dry-cli (0.7.0)
28
+ hash_diff (1.1.1)
29
+ i18n (1.12.0)
30
+ concurrent-ruby (~> 1.0)
31
+ json (2.6.2)
32
+ minitest (5.16.3)
33
+ parallel (1.22.1)
34
+ parser (3.1.2.1)
35
+ ast (~> 2.4.1)
36
+ pastel (0.8.0)
37
+ tty-color (~> 0.5)
38
+ rainbow (3.1.1)
39
+ rake (13.0.6)
40
+ regexp_parser (2.5.0)
41
+ rexml (3.2.5)
42
+ rspec (3.11.0)
43
+ rspec-core (~> 3.11.0)
44
+ rspec-expectations (~> 3.11.0)
45
+ rspec-mocks (~> 3.11.0)
46
+ rspec-core (3.11.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-expectations (3.11.0)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-mocks (3.11.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-support (3.11.0)
55
+ rubocop (1.35.1)
56
+ json (~> 2.3)
57
+ parallel (~> 1.10)
58
+ parser (>= 3.1.2.1)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml (>= 3.2.5, < 4.0)
62
+ rubocop-ast (>= 1.20.1, < 2.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 1.4.0, < 3.0)
65
+ rubocop-ast (1.21.0)
66
+ parser (>= 3.1.1.0)
67
+ rubocop-performance (1.14.3)
68
+ rubocop (>= 1.7.0, < 2.0)
69
+ rubocop-ast (>= 0.4.0)
70
+ ruby-progressbar (1.11.0)
71
+ standard (1.16.1)
72
+ rubocop (= 1.35.1)
73
+ rubocop-performance (= 1.14.3)
74
+ thor (1.2.1)
75
+ thread_safe (0.3.6)
76
+ tty-color (0.6.0)
77
+ tty-command (0.10.1)
78
+ pastel (~> 0.8)
79
+ tzinfo (1.2.10)
80
+ thread_safe (~> 0.1)
81
+ unicode-display_width (2.2.0)
82
+ zeitwerk (2.6.0)
83
+
84
+ PLATFORMS
85
+ ruby
86
+ x86_64-darwin-21
87
+ x86_64-linux
88
+
89
+ DEPENDENCIES
90
+ activesupport (~> 6.0.0)
91
+ appraisal
92
+ credman!
93
+ rake (~> 13.0)
94
+ rspec (~> 3.0)
95
+ standard (~> 1.13)
96
+
97
+ BUNDLED WITH
98
+ 2.2.29
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.1.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ credman (0.0.5)
5
+ activesupport (>= 6.0)
6
+ dry-cli (~> 0.7)
7
+ hash_diff (~> 1.0)
8
+ pastel (~> 0.8)
9
+ tty-command (~> 0.10)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (6.1.5.1)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ zeitwerk (~> 2.3)
20
+ appraisal (2.4.1)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
24
+ ast (2.4.2)
25
+ concurrent-ruby (1.1.10)
26
+ diff-lcs (1.5.0)
27
+ dry-cli (0.7.0)
28
+ hash_diff (1.1.1)
29
+ i18n (1.12.0)
30
+ concurrent-ruby (~> 1.0)
31
+ json (2.6.2)
32
+ minitest (5.16.3)
33
+ parallel (1.22.1)
34
+ parser (3.1.2.1)
35
+ ast (~> 2.4.1)
36
+ pastel (0.8.0)
37
+ tty-color (~> 0.5)
38
+ rainbow (3.1.1)
39
+ rake (13.0.6)
40
+ regexp_parser (2.5.0)
41
+ rexml (3.2.5)
42
+ rspec (3.11.0)
43
+ rspec-core (~> 3.11.0)
44
+ rspec-expectations (~> 3.11.0)
45
+ rspec-mocks (~> 3.11.0)
46
+ rspec-core (3.11.0)
47
+ rspec-support (~> 3.11.0)
48
+ rspec-expectations (3.11.0)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.11.0)
51
+ rspec-mocks (3.11.1)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.11.0)
54
+ rspec-support (3.11.0)
55
+ rubocop (1.35.1)
56
+ json (~> 2.3)
57
+ parallel (~> 1.10)
58
+ parser (>= 3.1.2.1)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8, < 3.0)
61
+ rexml (>= 3.2.5, < 4.0)
62
+ rubocop-ast (>= 1.20.1, < 2.0)
63
+ ruby-progressbar (~> 1.7)
64
+ unicode-display_width (>= 1.4.0, < 3.0)
65
+ rubocop-ast (1.21.0)
66
+ parser (>= 3.1.1.0)
67
+ rubocop-performance (1.14.3)
68
+ rubocop (>= 1.7.0, < 2.0)
69
+ rubocop-ast (>= 0.4.0)
70
+ ruby-progressbar (1.11.0)
71
+ standard (1.16.1)
72
+ rubocop (= 1.35.1)
73
+ rubocop-performance (= 1.14.3)
74
+ thor (1.2.1)
75
+ tty-color (0.6.0)
76
+ tty-command (0.10.1)
77
+ pastel (~> 0.8)
78
+ tzinfo (2.0.5)
79
+ concurrent-ruby (~> 1.0)
80
+ unicode-display_width (2.2.0)
81
+ zeitwerk (2.6.0)
82
+
83
+ PLATFORMS
84
+ ruby
85
+ x86_64-darwin-21
86
+ x86_64-linux
87
+
88
+ DEPENDENCIES
89
+ activesupport (~> 6.1.0)
90
+ appraisal
91
+ credman!
92
+ rake (~> 13.0)
93
+ rspec (~> 3.0)
94
+ standard (~> 1.13)
95
+
96
+ BUNDLED WITH
97
+ 2.2.29
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 7.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ credman (0.0.5)
5
+ activesupport (>= 6.0)
6
+ dry-cli (~> 0.7)
7
+ hash_diff (~> 1.0)
8
+ pastel (~> 0.8)
9
+ tty-command (~> 0.10)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (7.0.3.1)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 1.6, < 2)
17
+ minitest (>= 5.1)
18
+ tzinfo (~> 2.0)
19
+ appraisal (2.4.1)
20
+ bundler
21
+ rake
22
+ thor (>= 0.14.0)
23
+ ast (2.4.2)
24
+ concurrent-ruby (1.1.10)
25
+ diff-lcs (1.5.0)
26
+ dry-cli (0.7.0)
27
+ hash_diff (1.1.1)
28
+ i18n (1.12.0)
29
+ concurrent-ruby (~> 1.0)
30
+ json (2.6.2)
31
+ minitest (5.16.3)
32
+ parallel (1.22.1)
33
+ parser (3.1.2.1)
34
+ ast (~> 2.4.1)
35
+ pastel (0.8.0)
36
+ tty-color (~> 0.5)
37
+ rainbow (3.1.1)
38
+ rake (13.0.6)
39
+ regexp_parser (2.5.0)
40
+ rexml (3.2.5)
41
+ rspec (3.11.0)
42
+ rspec-core (~> 3.11.0)
43
+ rspec-expectations (~> 3.11.0)
44
+ rspec-mocks (~> 3.11.0)
45
+ rspec-core (3.11.0)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-expectations (3.11.0)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.11.0)
50
+ rspec-mocks (3.11.1)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.11.0)
53
+ rspec-support (3.11.0)
54
+ rubocop (1.35.1)
55
+ json (~> 2.3)
56
+ parallel (~> 1.10)
57
+ parser (>= 3.1.2.1)
58
+ rainbow (>= 2.2.2, < 4.0)
59
+ regexp_parser (>= 1.8, < 3.0)
60
+ rexml (>= 3.2.5, < 4.0)
61
+ rubocop-ast (>= 1.20.1, < 2.0)
62
+ ruby-progressbar (~> 1.7)
63
+ unicode-display_width (>= 1.4.0, < 3.0)
64
+ rubocop-ast (1.21.0)
65
+ parser (>= 3.1.1.0)
66
+ rubocop-performance (1.14.3)
67
+ rubocop (>= 1.7.0, < 2.0)
68
+ rubocop-ast (>= 0.4.0)
69
+ ruby-progressbar (1.11.0)
70
+ standard (1.16.1)
71
+ rubocop (= 1.35.1)
72
+ rubocop-performance (= 1.14.3)
73
+ thor (1.2.1)
74
+ tty-color (0.6.0)
75
+ tty-command (0.10.1)
76
+ pastel (~> 0.8)
77
+ tzinfo (2.0.5)
78
+ concurrent-ruby (~> 1.0)
79
+ unicode-display_width (2.2.0)
80
+
81
+ PLATFORMS
82
+ ruby
83
+ x86_64-darwin-21
84
+ x86_64-linux
85
+
86
+ DEPENDENCIES
87
+ activesupport (~> 7.0.0)
88
+ appraisal
89
+ credman!
90
+ rake (~> 13.0)
91
+ rspec (~> 3.0)
92
+ standard (~> 1.13)
93
+
94
+ BUNDLED WITH
95
+ 2.2.29
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", github: "rails/rails", branch: "main"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,103 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails.git
3
+ revision: 9a439f633205af0800f34af32f2122150faa2767
4
+ branch: main
5
+ specs:
6
+ activesupport (7.1.0.alpha)
7
+ concurrent-ruby (~> 1.0, >= 1.0.2)
8
+ connection_pool (>= 2.2.5)
9
+ i18n (>= 1.6, < 2)
10
+ minitest (>= 5.1)
11
+ tzinfo (~> 2.0)
12
+
13
+ PATH
14
+ remote: ..
15
+ specs:
16
+ credman (0.0.5)
17
+ activesupport (>= 6.0)
18
+ dry-cli (~> 0.7)
19
+ hash_diff (~> 1.0)
20
+ pastel (~> 0.8)
21
+ tty-command (~> 0.10)
22
+
23
+ GEM
24
+ remote: https://rubygems.org/
25
+ specs:
26
+ appraisal (2.4.1)
27
+ bundler
28
+ rake
29
+ thor (>= 0.14.0)
30
+ ast (2.4.2)
31
+ concurrent-ruby (1.1.10)
32
+ connection_pool (2.2.5)
33
+ diff-lcs (1.5.0)
34
+ dry-cli (0.7.0)
35
+ hash_diff (1.1.1)
36
+ i18n (1.12.0)
37
+ concurrent-ruby (~> 1.0)
38
+ json (2.6.2)
39
+ minitest (5.16.3)
40
+ parallel (1.22.1)
41
+ parser (3.1.2.1)
42
+ ast (~> 2.4.1)
43
+ pastel (0.8.0)
44
+ tty-color (~> 0.5)
45
+ rainbow (3.1.1)
46
+ rake (13.0.6)
47
+ regexp_parser (2.5.0)
48
+ rexml (3.2.5)
49
+ rspec (3.11.0)
50
+ rspec-core (~> 3.11.0)
51
+ rspec-expectations (~> 3.11.0)
52
+ rspec-mocks (~> 3.11.0)
53
+ rspec-core (3.11.0)
54
+ rspec-support (~> 3.11.0)
55
+ rspec-expectations (3.11.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.11.0)
58
+ rspec-mocks (3.11.1)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.11.0)
61
+ rspec-support (3.11.0)
62
+ rubocop (1.35.1)
63
+ json (~> 2.3)
64
+ parallel (~> 1.10)
65
+ parser (>= 3.1.2.1)
66
+ rainbow (>= 2.2.2, < 4.0)
67
+ regexp_parser (>= 1.8, < 3.0)
68
+ rexml (>= 3.2.5, < 4.0)
69
+ rubocop-ast (>= 1.20.1, < 2.0)
70
+ ruby-progressbar (~> 1.7)
71
+ unicode-display_width (>= 1.4.0, < 3.0)
72
+ rubocop-ast (1.21.0)
73
+ parser (>= 3.1.1.0)
74
+ rubocop-performance (1.14.3)
75
+ rubocop (>= 1.7.0, < 2.0)
76
+ rubocop-ast (>= 0.4.0)
77
+ ruby-progressbar (1.11.0)
78
+ standard (1.16.1)
79
+ rubocop (= 1.35.1)
80
+ rubocop-performance (= 1.14.3)
81
+ thor (1.2.1)
82
+ tty-color (0.6.0)
83
+ tty-command (0.10.1)
84
+ pastel (~> 0.8)
85
+ tzinfo (2.0.5)
86
+ concurrent-ruby (~> 1.0)
87
+ unicode-display_width (2.2.0)
88
+
89
+ PLATFORMS
90
+ ruby
91
+ x86_64-darwin-21
92
+ x86_64-linux
93
+
94
+ DEPENDENCIES
95
+ activesupport!
96
+ appraisal
97
+ credman!
98
+ rake (~> 13.0)
99
+ rspec (~> 3.0)
100
+ standard (~> 1.13)
101
+
102
+ BUNDLED WITH
103
+ 2.2.29
data/lib/credman/base.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  module Credman
2
2
  class Base
3
- AVAILABLE_ENVIRONMENTS = %i[development test staging production].freeze
4
-
5
3
  def initialize(environment_list)
6
- @environment_list = environment_list.map(&:to_sym).keep_if { |env| env.to_sym.in?(AVAILABLE_ENVIRONMENTS) }
4
+ @environment_list = environment_list.keep_if { |env| env.in?(Credman.config.available_environments) }
7
5
  abort pastel.red("No valid environments specified. Valid example: `-e development,test`") if @environment_list.empty?
8
6
  end
9
7
 
@@ -9,7 +9,7 @@ module Credman
9
9
  option :environments,
10
10
  aliases: ["e"],
11
11
  type: :array,
12
- default: Credman::Base::AVAILABLE_ENVIRONMENTS,
12
+ default: Credman.config.available_environments,
13
13
  desc: "filter for environments"
14
14
 
15
15
  def call(keys:, environments:, **)
@@ -23,7 +23,7 @@ module Credman
23
23
  option :environments,
24
24
  aliases: ["e"],
25
25
  type: :array,
26
- default: Credman::Base::AVAILABLE_ENVIRONMENTS,
26
+ default: Credman.config.available_environments,
27
27
  desc: "filter for environments"
28
28
 
29
29
  def call(environments:, **)
@@ -67,12 +67,12 @@ module Credman
67
67
  class Diff < Dry::CLI::Command
68
68
  desc "Show credentials diff between given branch (heroku by default) and current changes"
69
69
 
70
- argument :branch, type: :string, default: "heroku", required: false
70
+ argument :branch, type: :string, default: Credman.config.default_diff_branch, required: false
71
71
 
72
72
  option :environments,
73
73
  aliases: ["e"],
74
74
  type: :array,
75
- default: Credman::Base::AVAILABLE_ENVIRONMENTS,
75
+ default: Credman.config.available_environments,
76
76
  desc: "filter for environments"
77
77
 
78
78
  def call(branch:, environments:, **)
@@ -86,7 +86,7 @@ module Credman
86
86
  option :environments,
87
87
  aliases: ["e"],
88
88
  type: :array,
89
- default: Credman::Base::AVAILABLE_ENVIRONMENTS,
89
+ default: Credman.config.available_environments,
90
90
  desc: "filter for environments"
91
91
 
92
92
  def call(environments:, **)
@@ -0,0 +1,42 @@
1
+ require "yaml"
2
+
3
+ module Credman
4
+ class Configuration
5
+ include Singleton
6
+
7
+ attr_writer :settings_list
8
+
9
+ def self.add_setting(name, default_value = nil)
10
+ attr_accessor name
11
+ instance.send("#{name}=", default_value)
12
+ instance.settings_list = instance.settings_list.push(name.to_sym)
13
+ end
14
+
15
+ def self.reset
16
+ load __FILE__
17
+ self
18
+ end
19
+
20
+ def settings_list
21
+ @settings_list ||= []
22
+ end
23
+
24
+ def setting_exists?(setting_name)
25
+ settings_list.include?(setting_name)
26
+ end
27
+
28
+ def load_from_yml(config_path = "config/credman.yml")
29
+ return unless File.exist?(config_path)
30
+
31
+ settings = YAML.load_file(config_path)
32
+ return unless settings
33
+
34
+ settings.each do |setting_name, setting_value|
35
+ send("#{setting_name}=", setting_value) if setting_exists?(setting_name.to_sym)
36
+ end
37
+ end
38
+
39
+ add_setting :default_diff_branch, "main"
40
+ add_setting :available_environments, %w[development test production]
41
+ end
42
+ end
@@ -43,9 +43,7 @@ module Credman
43
43
  end
44
44
 
45
45
  def deserialize(raw_config)
46
- # rubocop:disable Security/YAMLLoad
47
- YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(raw_config) : YAML.load(raw_config)
48
- # rubocop:enable Security/YAMLLoad
46
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(raw_config) : YAML.safe_load(raw_config)
49
47
  end
50
48
 
51
49
  def deep_print_diff(diff, key_path = [])
data/lib/credman/diff.rb CHANGED
@@ -37,9 +37,7 @@ module Credman
37
37
  end
38
38
 
39
39
  def deserialize(raw_config)
40
- # rubocop:disable Security/YAMLLoad
41
- YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(raw_config) : YAML.load(raw_config)
42
- # rubocop:enable Security/YAMLLoad
40
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(raw_config) : YAML.safe_load(raw_config)
43
41
  end
44
42
 
45
43
  def deep_print_diff(diff, key_path = [])
@@ -1,3 +1,3 @@
1
1
  module Credman
2
- VERSION = "0.0.4".freeze
2
+ VERSION = "0.0.5".freeze
3
3
  end
data/lib/credman.rb CHANGED
@@ -5,6 +5,15 @@ require "dry/cli"
5
5
  require "pastel"
6
6
  require "hash_diff"
7
7
 
8
+ require_relative "credman/configuration"
9
+ module Credman
10
+ def self.configuration
11
+ Credman::Configuration.instance
12
+ end
13
+ singleton_class.send(:alias_method, :config, :configuration)
14
+ end
15
+ Credman.configuration.load_from_yml
16
+
8
17
  require_relative "credman/base"
9
18
  require_relative "credman/commands"
10
19
  require_relative "credman/get"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Andronov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: '1.13'
125
+ - !ruby/object:Gem::Dependency
126
+ name: appraisal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  description: The tool what you miss for managing Rails credentials
112
140
  email:
113
141
  - dev@uscreen.tv
@@ -118,6 +146,7 @@ extra_rdoc_files: []
118
146
  files:
119
147
  - ".rspec"
120
148
  - ".vscode/settings.json"
149
+ - Appraisals
121
150
  - CHANGELOG.md
122
151
  - Gemfile
123
152
  - Gemfile.lock
@@ -128,10 +157,21 @@ files:
128
157
  - bin/credman
129
158
  - bin/rspec
130
159
  - bin/setup
160
+ - config/credman.yml
131
161
  - credman.gemspec
162
+ - gemfiles/.bundle/config
163
+ - gemfiles/activesupport_6.gemfile
164
+ - gemfiles/activesupport_6.gemfile.lock
165
+ - gemfiles/activesupport_6_1.gemfile
166
+ - gemfiles/activesupport_6_1.gemfile.lock
167
+ - gemfiles/activesupport_7.gemfile
168
+ - gemfiles/activesupport_7.gemfile.lock
169
+ - gemfiles/activesupport_master.gemfile
170
+ - gemfiles/activesupport_master.gemfile.lock
132
171
  - lib/credman.rb
133
172
  - lib/credman/base.rb
134
173
  - lib/credman/commands.rb
174
+ - lib/credman/configuration.rb
135
175
  - lib/credman/conflicts.rb
136
176
  - lib/credman/delete.rb
137
177
  - lib/credman/diff.rb