dinomischus 0.1.3 → 0.1.4
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 +4 -4
- data/dinomischus.gemspec +1 -1
- data/exe/dinomischus +68 -1
- data/lib/dinomischus/menu.rb +8 -8
- data/lib/dinomischus/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c817f8c29b1b2fc3db6af10567c63b806ccaf7974fb6119364b2d76a8ef0ad1e
|
|
4
|
+
data.tar.gz: 6ee738a175fe7a9ab23bafa356c7c989468daec3dcf9d1d1b4ec7de525acd0c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73e65a9ec46a854ae953f84b671c35f1e2766852057c435cf008d8f6771e32818120148d7b64f79b891a2f66c217e7ae2671e4270130dcf9377dfe8bf726b58a
|
|
7
|
+
data.tar.gz: 88b1974e147c1becc5d2142d4ef878f0efd711d33454b9e633b6c9b984f4e665b599db69a58708cd5eb87fd2f1e424529cac082d7ad2153730e07984d2ba6612
|
data/dinomischus.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
# spec.description = %q{Write a longer description or delete this line.}
|
|
11
11
|
spec.homepage = "https://github.com/kurokoSin/Dinomischus"
|
|
12
12
|
spec.license = "MIT"
|
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
|
14
14
|
|
|
15
15
|
# spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
|
|
16
16
|
|
data/exe/dinomischus
CHANGED
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require 'dinomischus'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
Version = Dinomischus::VERSION
|
|
6
|
+
|
|
7
|
+
class Command
|
|
8
|
+
def initialize
|
|
9
|
+
@options = {}
|
|
10
|
+
OptionParser.new do |opt|
|
|
11
|
+
opt.on('-g', '--get', 'Mode is value get')
|
|
12
|
+
opt.on('-l', '--list', 'Mode is list key-value')
|
|
13
|
+
opt.on('-m', '--menu', 'Mode is CUI Menu')
|
|
14
|
+
opt.on('-f FILE_PATH', '--file FILE_PATH', String, 'Reading File')
|
|
15
|
+
opt.on('-k KEY_NAME', '--key KEY_NAME', String, 'Get Value by key')
|
|
16
|
+
end.parse!(into: @options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# 指定したオプションを指定しているか?
|
|
20
|
+
def has?(name)
|
|
21
|
+
@options.include?(name)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# 指定したオプションを全て指定いるか?
|
|
25
|
+
def has_all?(*names)
|
|
26
|
+
all_finded = true
|
|
27
|
+
names.each do |nm|
|
|
28
|
+
finded = @options.include?(@option.get(nm))
|
|
29
|
+
$stderr.puts("This Command needs '#{nm}' option. ") unless finded
|
|
30
|
+
all_finded &&= finded
|
|
31
|
+
end
|
|
32
|
+
all_finded
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get(name)
|
|
36
|
+
@options[name]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.CmdGet(path, key)
|
|
40
|
+
hash = Dinomischus.load_file(path)
|
|
41
|
+
hash[key.to_sym]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.CmdList( path )
|
|
45
|
+
Dinomischus.load_file( path )
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# メニュー振り分け処理と引数チェック
|
|
50
|
+
cmd = Command.new
|
|
51
|
+
case true
|
|
52
|
+
# 値取得
|
|
53
|
+
when cmd.has?(:get) then
|
|
54
|
+
return unless cmd.has_all?(:file, :key)
|
|
55
|
+
value = Command.CmdGet(cmd.get(:file), cmd.get(:key) )
|
|
56
|
+
printf value
|
|
57
|
+
|
|
58
|
+
# 一覧表示
|
|
59
|
+
when cmd.has?(:list) then
|
|
60
|
+
return unless cmd.has_all?(:file)
|
|
61
|
+
value = Command.CmdList( cmd.get(:file) )
|
|
62
|
+
pp "#{value}"
|
|
63
|
+
|
|
64
|
+
# CUI メニュー表示
|
|
65
|
+
when cmd.has?(:menu) then
|
|
66
|
+
Dinomischus::Menu.menu
|
|
67
|
+
|
|
68
|
+
# for Compatiblility
|
|
69
|
+
else
|
|
70
|
+
Dinomischus::Menu.menu
|
|
71
|
+
end
|
|
4
72
|
|
|
5
|
-
Dinomischus::Menu.menu
|
data/lib/dinomischus/menu.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Dinomischus
|
|
|
11
11
|
menu_clear_screen()
|
|
12
12
|
loop {
|
|
13
13
|
print "-----------> Select Menu [1-4,c,h,z]: "
|
|
14
|
-
sel_num = gets.chomp
|
|
14
|
+
sel_num = STDIN.gets.chomp
|
|
15
15
|
|
|
16
16
|
case sel_num
|
|
17
17
|
when "1" then menu_template()
|
|
@@ -48,7 +48,7 @@ module Dinomischus
|
|
|
48
48
|
loop{
|
|
49
49
|
puts " "
|
|
50
50
|
print "Input Your Config Prefix Name : "
|
|
51
|
-
prj = gets.chomp
|
|
51
|
+
prj = STDIN.gets.chomp
|
|
52
52
|
key_path = File.expand_path("~/.crypt_config/#{prj}_key.yml" )
|
|
53
53
|
conf_path = File.expand_path("./config/#{prj}_config.yml", Dir.pwd )
|
|
54
54
|
def_path = File.expand_path("./config/#{prj}_config_index.yml", Dir.pwd )
|
|
@@ -60,7 +60,7 @@ module Dinomischus
|
|
|
60
60
|
puts " Define File Place [#{def_path}]"
|
|
61
61
|
puts " "
|
|
62
62
|
print "Press Enter Key to Next Step... "
|
|
63
|
-
ans = gets.chomp
|
|
63
|
+
ans = STDIN.gets.chomp
|
|
64
64
|
break
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -76,7 +76,7 @@ module Dinomischus
|
|
|
76
76
|
conf_path = ""
|
|
77
77
|
loop {
|
|
78
78
|
print " Input Your Config Path : "
|
|
79
|
-
conf_path = gets.chomp
|
|
79
|
+
conf_path = STDIN.gets.chomp
|
|
80
80
|
if !File.exist?(conf_path)
|
|
81
81
|
puts "Error. No Exists Config Path : [#{conf_path}]"
|
|
82
82
|
else
|
|
@@ -84,9 +84,9 @@ module Dinomischus
|
|
|
84
84
|
end
|
|
85
85
|
}
|
|
86
86
|
key = ""; value = ""; desc = "";
|
|
87
|
-
(print " Input Your Key : "; key = gets.chomp ) while key.empty?
|
|
88
|
-
(print " Input Your Value : "; value = gets.chomp ) while value.empty?
|
|
89
|
-
(print " Input Your Description : "; desc = gets.chomp )
|
|
87
|
+
(print " Input Your Key : "; key = STDIN.gets.chomp ) while key.empty?
|
|
88
|
+
(print " Input Your Value : "; value = STDIN.gets.chomp ) while value.empty?
|
|
89
|
+
(print " Input Your Description : "; desc = STDIN.gets.chomp )
|
|
90
90
|
|
|
91
91
|
add_crypted_value(conf_path, key, value, desc)
|
|
92
92
|
|
|
@@ -99,7 +99,7 @@ module Dinomischus
|
|
|
99
99
|
conf_path = ""
|
|
100
100
|
loop {
|
|
101
101
|
print " Input Your Config Path : "
|
|
102
|
-
conf_path = gets.chomp
|
|
102
|
+
conf_path = STDIN.gets.chomp
|
|
103
103
|
if !File.exist?(conf_path)
|
|
104
104
|
puts "Error. No Exists Config Path : [#{conf_path}]"
|
|
105
105
|
else
|
data/lib/dinomischus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dinomischus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kuroko Sin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -51,7 +51,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 2.
|
|
54
|
+
version: 2.6.0
|
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
57
|
- - ">="
|