secretmgr 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3963af6a19062adf86d445a63f946ed9a29adbee1d42658a3d1ba6bdcf1bf841
4
- data.tar.gz: fdcc370e9a59e12624eb2d19088abeb671fe5ba6583d837d2c41f87cace4f4be
3
+ metadata.gz: 7fda7934d5a11c91db39b564f04132bd1208ed67e090f2059da7d6be310623c5
4
+ data.tar.gz: d984c3eb66db54b42b5e093e4997edc29687e04d058dba23d71842e8021d7233
5
5
  SHA512:
6
- metadata.gz: 4b5878e6b755a2093b7f1c604c926bd25ab140eda458105857cd8bef2312af65563692c5fc9c87274bc267ef45f767d601aade4502b82e6615ba89ca9ee30deb
7
- data.tar.gz: 7a118458b75959fbf289be98fd1ee297e8ff78c56a570e84acd5619e610f3a7d695dd344e24574e24149fcde50f123192af278a0c5410f330251cd2dfdb9f3ce
6
+ metadata.gz: 84883e264d7918497bca6cdc86e14cf35d0a9db895aca0f4590dbf8ce03849c3ca20c4784685c0ec0be0502a621f631d03a9f47074350a8ab81a9151377e97b5
7
+ data.tar.gz: 91deac409a846d86f4872ea4650322578d58334a855f0241f269f1c1a5f379c5401289c7f552e02a136e1985e6c184c936671f5ee1b6102b5063e7d110c0d8d1
data/.rubocop.yml CHANGED
@@ -1,22 +1,27 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- TargetRubyVersion: 2.6
5
-
6
- Style/StringLiterals:
7
- Enabled: true
8
- EnforcedStyle: double_quotes
9
-
10
- Style/StringLiteralsInInterpolation:
11
- Enabled: true
12
- EnforcedStyle: double_quotes
13
-
14
- Layout/LineLength:
15
- Max: 120
16
-
17
- Documentation:
18
- Enabled: false
19
-
20
- #追加
21
- Style/FrozenStringLiteralComment:
22
- Enabled: false
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-rake
5
+ - rubocop-rspec
6
+
7
+ AllCops:
8
+ NewCops: enable
9
+ TargetRubyVersion: 2.6
10
+
11
+ Style/StringLiterals:
12
+ Enabled: true
13
+ EnforcedStyle: double_quotes
14
+
15
+ Style/StringLiteralsInInterpolation:
16
+ Enabled: true
17
+ EnforcedStyle: double_quotes
18
+
19
+ Layout/LineLength:
20
+ Max: 120
21
+
22
+ Style/Documentation:
23
+ Enabled: false
24
+ #
25
+ Naming/AccessorMethodName:
26
+ Enabled: false
27
+
data/.rubocop_todo.yml CHANGED
@@ -1,46 +1,101 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2023-11-30 09:19:30 UTC using RuboCop version 1.57.2.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 4
10
- # Configuration parameters: EnforcedStyle.
11
- # SupportedStyles: native, lf, crlf
12
- Layout/EndOfLine:
13
- Exclude:
14
- - 'Rakefile'
15
- - 'bin/console'
16
- - 'lib/secretmgr/version.rb'
17
- # - 'spec/secretmgr_spec.rb'
18
-
19
- # Offense count: 1
20
- # Configuration parameters: AllowComments.
21
- Lint/EmptyWhen:
22
- Exclude:
23
- # - 'exe/secretmgr'
24
-
25
- # Offense count: 2
26
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
27
- Metrics/AbcSize:
28
- Max: 27
29
-
30
- # Offense count: 1
31
- # Configuration parameters: CountComments, CountAsOne.
32
- Metrics/ClassLength:
33
- Max: 154
34
-
35
- # Offense count: 5
36
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
37
- Metrics/MethodLength:
38
- Max: 21
39
-
40
- # Offense count: 1
41
- # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
42
- # SupportedStyles: snake_case, normalcase, non_integer
43
- # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
44
- Naming/VariableNumber:
45
- Exclude:
46
- # - 'spec/spec_helper.rb'
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2024-01-17 04:42:45 UTC using RuboCop version 1.59.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
12
+ # SupportedStyles: case, end
13
+ Layout/CaseIndentation:
14
+ Exclude:
15
+ # - 'lib/secretmgr/globalsetting.rb'
16
+ # - 'lib/secretmgr/secretmgr.rb'
17
+
18
+ # Offense count: 3
19
+ # This cop supports safe autocorrection (--autocorrect).
20
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
21
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
22
+ Layout/EndAlignment:
23
+ Exclude:
24
+ # - 'lib/secretmgr/config.rb'
25
+ # - 'lib/secretmgr/globalsetting.rb'
26
+ # - 'lib/secretmgr/secretmgr.rb'
27
+
28
+ # Offense count: 1
29
+ # This cop supports safe autocorrection (--autocorrect).
30
+ # Configuration parameters: Width, AllowedPatterns.
31
+ Layout/IndentationWidth:
32
+ Exclude:
33
+ # - 'lib/secretmgr/config.rb'
34
+
35
+ # Offense count: 2
36
+ # This cop supports safe autocorrection (--autocorrect).
37
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
38
+ Layout/LeadingCommentSpace:
39
+ Exclude:
40
+ # - 'spec/secretmgr/secretmgr_spec.rb'
41
+
42
+ # Offense count: 6
43
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
44
+ Metrics/AbcSize:
45
+ Max: 67
46
+
47
+ # Offense count: 3
48
+ # Configuration parameters: CountComments, CountAsOne.
49
+ Metrics/ClassLength:
50
+ Max: 182
51
+
52
+ # Offense count: 3
53
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
54
+ Metrics/CyclomaticComplexity:
55
+ Max: 13
56
+
57
+ # Offense count: 13
58
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
59
+ Metrics/MethodLength:
60
+ Max: 44
61
+
62
+ # Offense count: 3
63
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
64
+ Metrics/ParameterLists:
65
+ Max: 10
66
+
67
+ # Offense count: 3
68
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
69
+ Metrics/PerceivedComplexity:
70
+ Max: 13
71
+
72
+ # Offense count: 4
73
+ # Configuration parameters: CountAsOne.
74
+ RSpec/ExampleLength:
75
+ Max: 16
76
+
77
+ # Offense count: 2
78
+ RSpec/MultipleExpectations:
79
+ Max: 2
80
+
81
+ # Offense count: 6
82
+ # This cop supports unsafe autocorrection (--autocorrect-all).
83
+ # Configuration parameters: EnforcedStyle.
84
+ # SupportedStyles: always, always_true, never
85
+ Style/FrozenStringLiteralComment:
86
+ Exclude:
87
+ - 'd.rb'
88
+ - 'lib/secretmgr/cli.rb'
89
+ - 'lib/secretmgr/globalsetting.rb'
90
+ - 'lib/secretmgr/loggerxs.rb'
91
+ - 'lib/secretmgr/secret.rb'
92
+ - 'spec/secretmgr/cli_spec.rb'
93
+
94
+ # Offense count: 12
95
+ # This cop supports unsafe autocorrection (--autocorrect-all).
96
+ # Configuration parameters: Mode.
97
+ Style/StringConcatenation:
98
+ Exclude:
99
+ # - 'Rakefile'
100
+ # - 'lib/secretmgr/secretmgr.rb'
101
+ # - 'spec/spec_helper.rb'
data/Gemfile CHANGED
@@ -1,14 +1,25 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Specify your gem's dependencies in secretmgr.gemspec
6
- gemspec
7
-
8
- gem "rake", "~> 13.0"
9
- gem "rspec", "~> 3.0"
10
- gem "rubocop", "~> 1.21"
11
-
12
- gem "multi_json"
13
- gem "ykutils"
14
- gem "ykxutils"
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in secretmgr.gemspec
6
+ gemspec
7
+
8
+ gem "multi_json"
9
+
10
+ # gem "loggerx", path: "../loggerx"
11
+ gem "loggerx", "~> 0.2.0"
12
+
13
+ group :development, :test do
14
+ gem "rake", "~> 13.0"
15
+ gem "rspec", "~> 3.0"
16
+ gem "rubocop", "~> 1.21"
17
+ gem "rubocop-rake", require: false
18
+ gem "rubocop-rspec", require: false
19
+
20
+ # gem "multi_json"
21
+
22
+ gem "debug"
23
+
24
+ gem "rufo"
25
+ end
data/Gemfile.lock CHANGED
@@ -1,80 +1,96 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- secretmgr (0.1.0)
5
- multi_json
6
- rake (~> 13.0)
7
- rspec (~> 3.0)
8
- rubocop (~> 1.21)
9
- ykutils
10
- ykxutils
4
+ secretmgr (0.2.0)
5
+ loggerx
11
6
 
12
7
  GEM
13
8
  remote: https://rubygems.org/
14
9
  specs:
15
10
  ast (2.4.2)
11
+ debug (1.9.1)
12
+ irb (~> 1.10)
13
+ reline (>= 0.3.8)
16
14
  diff-lcs (1.5.0)
17
- erubi (1.11.0)
18
- erubis (2.7.0)
19
- filex (0.1.7)
20
- erubis
21
- messagex
22
- json (2.6.2)
23
- messagex (0.1.5)
15
+ io-console (0.7.1)
16
+ irb (1.11.1)
17
+ rdoc
18
+ reline (>= 0.4.2)
19
+ json (2.7.1)
20
+ language_server-protocol (3.17.0.3)
21
+ loggerx (0.2.0)
24
22
  multi_json (1.15.0)
25
- parallel (1.22.1)
26
- parser (3.1.2.1)
23
+ parallel (1.24.0)
24
+ parser (3.3.0.2)
27
25
  ast (~> 2.4.1)
26
+ racc
27
+ psych (5.1.2)
28
+ stringio
29
+ racc (1.7.3)
28
30
  rainbow (3.1.1)
29
- rake (13.0.6)
30
- regexp_parser (2.6.0)
31
- rexml (3.2.5)
32
- rspec (3.11.0)
33
- rspec-core (~> 3.11.0)
34
- rspec-expectations (~> 3.11.0)
35
- rspec-mocks (~> 3.11.0)
36
- rspec-core (3.11.0)
37
- rspec-support (~> 3.11.0)
38
- rspec-expectations (3.11.1)
31
+ rake (13.1.0)
32
+ rdoc (6.6.2)
33
+ psych (>= 4.0.0)
34
+ regexp_parser (2.9.0)
35
+ reline (0.4.2)
36
+ io-console (~> 0.5)
37
+ rexml (3.2.6)
38
+ rspec (3.12.0)
39
+ rspec-core (~> 3.12.0)
40
+ rspec-expectations (~> 3.12.0)
41
+ rspec-mocks (~> 3.12.0)
42
+ rspec-core (3.12.2)
43
+ rspec-support (~> 3.12.0)
44
+ rspec-expectations (3.12.3)
39
45
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.11.0)
41
- rspec-mocks (3.11.1)
46
+ rspec-support (~> 3.12.0)
47
+ rspec-mocks (3.12.6)
42
48
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.11.0)
44
- rspec-support (3.11.1)
45
- rubocop (1.36.0)
49
+ rspec-support (~> 3.12.0)
50
+ rspec-support (3.12.1)
51
+ rubocop (1.59.0)
46
52
  json (~> 2.3)
53
+ language_server-protocol (>= 3.17.0)
47
54
  parallel (~> 1.10)
48
- parser (>= 3.1.2.1)
55
+ parser (>= 3.2.2.4)
49
56
  rainbow (>= 2.2.2, < 4.0)
50
57
  regexp_parser (>= 1.8, < 3.0)
51
58
  rexml (>= 3.2.5, < 4.0)
52
- rubocop-ast (>= 1.20.1, < 2.0)
59
+ rubocop-ast (>= 1.30.0, < 2.0)
53
60
  ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 1.4.0, < 3.0)
55
- rubocop-ast (1.21.0)
56
- parser (>= 3.1.1.0)
57
- ruby-progressbar (1.11.0)
58
- tilt (2.0.11)
59
- unicode-display_width (2.3.0)
60
- ykutils (0.1.7)
61
- erubi
62
- filex
63
- tilt
64
- ykxutils (0.1.7)
61
+ unicode-display_width (>= 2.4.0, < 3.0)
62
+ rubocop-ast (1.30.0)
63
+ parser (>= 3.2.1.0)
64
+ rubocop-capybara (2.20.0)
65
+ rubocop (~> 1.41)
66
+ rubocop-factory_bot (2.25.1)
67
+ rubocop (~> 1.41)
68
+ rubocop-rake (0.6.0)
69
+ rubocop (~> 1.0)
70
+ rubocop-rspec (2.26.1)
71
+ rubocop (~> 1.40)
72
+ rubocop-capybara (~> 2.17)
73
+ rubocop-factory_bot (~> 2.22)
74
+ ruby-progressbar (1.13.0)
75
+ rufo (0.17.0)
76
+ stringio (3.1.0)
77
+ unicode-display_width (2.5.0)
65
78
 
66
79
  PLATFORMS
67
- x64-mingw-ucrt
68
- x64-mingw32
80
+ ruby
81
+ x86_64-linux
69
82
 
70
83
  DEPENDENCIES
84
+ debug
85
+ loggerx (~> 0.2.0)
71
86
  multi_json
72
87
  rake (~> 13.0)
73
88
  rspec (~> 3.0)
74
89
  rubocop (~> 1.21)
90
+ rubocop-rake
91
+ rubocop-rspec
92
+ rufo
75
93
  secretmgr!
76
- ykutils
77
- ykxutils
78
94
 
79
95
  BUNDLED WITH
80
- 2.4.6
96
+ 2.5.3
data/Rakefile CHANGED
@@ -1,12 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
4
 
6
- RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
7
6
 
8
- require "rubocop/rake_task"
7
+ ###
8
+ require "secretmgr"
9
+ require "pathname"
9
10
 
10
- RuboCop::RakeTask.new
11
+ begin
12
+ require "rspec/core/rake_task"
13
+ rescue LoadError => e
14
+ puts e.message
15
+ end
11
16
 
17
+ begin
18
+ RSpec::Core::RakeTask.new(:spec)
19
+ rescue NameError, LoadError => e
20
+ puts e.message
21
+ end
22
+
23
+ begin
24
+ require "rubocop/rake_task"
25
+ rescue LoadError => e
26
+ puts e.message
27
+ end
28
+
29
+ begin
30
+ RuboCop::RakeTask.new
31
+ rescue NameError, LoadError => e
32
+ puts e.message
33
+ end
34
+
35
+ desc "secretmgr setup"
12
36
  task default: %i[spec rubocop]
37
+
38
+ desc "setup"
39
+ task :setup do
40
+ home_dir_pn = Pathname.new(Dir.home)
41
+ spec_dir_pn = home_dir_pn + "spec"
42
+ test_data_dir_pn = spec_dir_pn + "test_data"
43
+ ssh_dir_pn = test_data_dir_pn + ".ssh"
44
+ if ssh_dir_pn.exist?
45
+ puts "Exist ssh_dir_pn=#{ssh_dir_pn}"
46
+ else
47
+ puts "Not Exist ssh_dir_pn=#{ssh_dir_pn}"
48
+ end
49
+ end
data/SECURITY.md ADDED
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Use this section to tell people about which versions of your project are
6
+ currently being supported with security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 5.1.x | :white_check_mark: |
11
+ | 5.0.x | :x: |
12
+ | 4.0.x | :white_check_mark: |
13
+ | < 4.0 | :x: |
14
+
15
+ ## Reporting a Vulnerability
16
+
17
+ Use this section to tell people how to report a vulnerability.
18
+
19
+ Tell them where to go, how often they can expect to get an update on a
20
+ reported vulnerability, what to expect if the vulnerability is accepted or
21
+ declined, etc.
data/exe/secretmgr CHANGED
@@ -1,78 +1,15 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "pathname"
5
- require "secretmgr"
6
-
7
- arg = ARGV
8
- cmd = arg[0]
9
- if cmd == "setup_data"
10
- # p "setup_data 0"
11
- arg.shift
12
- secret_dir = arg.shift
13
- plain_setting_file = arg.shift
14
- plain_secret_file = arg.shift
15
- secret_dir_pn = Pathname.new(secret_dir)
16
- plain_setting_file_pn = Pathname.new(plain_setting_file)
17
- plain_secret_file_pn = Pathname.new(plain_secret_file)
18
-
19
- exit 10 unless secret_dir_pn.exist?
20
- # p "setup_data 11"
21
- exit 11 unless secret_dir_pn.directory?
22
- # p "setup_data 12"
23
- exit 12 unless plain_setting_file_pn.exist?
24
- # p "setup_data 13"
25
- exit 13 unless plain_setting_file_pn.file?
26
- # p "setup_data 14"
27
- exit 14 unless plain_secret_file_pn.exist?
28
- # p "setup_data 15"
29
- exit 15 unless plain_secret_file_pn.file?
30
-
31
- # p "setup_data 100"
32
- else
33
- setting_txt_file = arg.shift
34
- secret_txt_file = arg.shift
35
-
36
- # p "setting_txt_file=#{setting_txt_file}"
37
- if (arg[0] == "--template-dir") || (arg[0] == "-d")
38
- template_dir = arg[1]
39
- arg.shift
40
- arg.shift
41
- end
42
-
43
- # p "template_dir=#{template_dir}"
44
-
45
- if (arg[0] == "--target") || (arg[0] == "-t")
46
- target = arg[1]
47
- sub_target = arg[2]
48
- arg.shift
49
- arg.shift
50
- arg.shift
51
- end
52
-
53
- # p "target=#{target}"
54
- # p "sub_target=#{sub_target}"
55
-
56
- setting_pn = Pathname.new(setting_txt_file)
57
- exit 10 unless setting_pn.exist?
58
- exit 10 unless setting_pn.file?
59
-
60
- secret_dir_pn = setting_pn.parent
61
-
62
- secret_pn = Pathname.new(secret_txt_file)
63
- exit 10 unless secret_pn.exist?
64
- exit 10 unless secret_pn.file?
65
-
66
- # secret_txt_file
67
- end
68
-
69
- case cmd
70
- when "setup_data"
71
- inst = Secretmgr::Secretmgr.create(secret_dir_pn, plain_setting_file_pn, plain_secret_file_pn)
72
- inst.setup
73
- else
74
- sm = Secretmgr::Secretmgr.new(secret_dir_pn)
75
- sm.set_setting_for_query(target, sub_target)
76
- sm.load
77
- p sm.make(template_dir, target, sub_target)
78
- end
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "secretmgr"
5
+
6
+ cli = Secretmgr::Cli.new
7
+ ret = cli.arg_parse(ARGV)
8
+ # p 1
9
+ if ret
10
+ # p 2
11
+ cli.execute
12
+ else
13
+ # p 3
14
+ exit(Secretmgr::Cli::EXIT_CODE_FAILURE)
15
+ end