dinomischus 0.1.2 → 0.1.3
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/README.md +201 -19
- data/lib/dinomischus/menu.rb +1 -1
- data/lib/dinomischus/version.rb +1 -1
- metadata +2 -3
- data/.README.md.swp +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cfd0e1ee82ce880dd2394d0a6aff156997e6a171a4d6d5639a2c5db55dcc1830
|
|
4
|
+
data.tar.gz: 0570a829c352e16539b8c677072faf1a696d230018253c442440afa4abb0b9ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf9e170535203f2ba3229243d0ab716979b6f9fe9bb5c54d3bd22ddf23d424ac800aa42abb3a91e54705e637049ebb9a94f6f598e3ff72b43841455c5868087c
|
|
7
|
+
data.tar.gz: dad059a8961cd486db025cb390e025dff0a241a3ba3687e59841886ddc75e9aead77baa513898a615544c20ca84e9e4299e8835dfcbe90dd58129f2ee33721d4
|
data/README.md
CHANGED
|
@@ -27,25 +27,97 @@ Or install it yourself as:
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
29
|
### For Reading
|
|
30
|
+
Suppose you have the following configuration file:
|
|
31
|
+
```yaml:project_config.yml
|
|
32
|
+
---
|
|
33
|
+
- :key_path: "/home/vagrant/.crypt_config/project_key.yml"
|
|
34
|
+
- :animal:
|
|
35
|
+
:value: |-
|
|
36
|
+
?0thjXJj2wR4kzp3EidmJ+bgWtYXs7/DZpTlcDFiLjDbsSB2YWnZEB+ovMTNC
|
|
37
|
+
37kx
|
|
38
|
+
:desc: ''
|
|
39
|
+
:fruit:
|
|
40
|
+
:value: |-
|
|
41
|
+
?wIGrSC/bf5om/rlfIlz7hAIOjaZFjIgw4ulguIKI7YpBrx4JOcmUo3cLH1vC
|
|
42
|
+
eDeW
|
|
43
|
+
:desc: This fruit color is yellow.
|
|
44
|
+
```
|
|
45
|
+
If you want to use this in the program, you can use it as follows.
|
|
46
|
+
|
|
30
47
|
```
|
|
31
48
|
require 'dinomischus'
|
|
32
49
|
|
|
33
|
-
# ex1
|
|
34
|
-
hash = Dinomischus.
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
# ex1 ( simple reading )
|
|
51
|
+
hash = Dinomischus.load_file('config_project.yml')
|
|
52
|
+
# => {:animal=>"owl",
|
|
53
|
+
# :fruit=>"Lemon"}
|
|
54
|
+
p hash[:animal] # => owl
|
|
55
|
+
p hash[:fruit] # => Lemon
|
|
56
|
+
|
|
57
|
+
# ex2 ( more specification )
|
|
58
|
+
hash = Dinomischus.load_file('project_config.yml', true)
|
|
59
|
+
# => {:animal=>{:value=>"owl", :desc=>""},
|
|
60
|
+
# :fruit=>{:value=>"Lemon", :desc=>"This fruit color is yellow."} }
|
|
61
|
+
|
|
62
|
+
p hash[:fruit][:value] # => Lemon
|
|
63
|
+
p hash[:fruit][:desc] # => This fruit color is yellow.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Even if there are multiple configuration files, they can be read at once.
|
|
67
|
+
In that case, a separate file that defines the reading order is required. (Project_config_index.yml in the example)
|
|
68
|
+
If the setting items are duplicated, the setting value of the file read later is given priority. By using this, it is possible to prepare a setting file for the default value and separate the setting file for the development environment and the setting file for the production environment.
|
|
37
69
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
70
|
+
```yaml:project_config_index.yml
|
|
71
|
+
---
|
|
72
|
+
- :conf_path: "/path/to/config/project_config_default.yml"
|
|
73
|
+
- :conf_path: "/path/to/config/project_config_product.yml"
|
|
42
74
|
```
|
|
75
|
+
```yaml:project_config_default.yml
|
|
76
|
+
---
|
|
77
|
+
- :key_path: "/home/vagrant/.crypt_config/project_key.yml"
|
|
78
|
+
- :animal:
|
|
79
|
+
:value: |-
|
|
80
|
+
?0thjXJj2wR4kzp3EidmJ+bgWtYXs7/DZpTlcDFiLjDbsSB2YWnZEB+ovMTNC
|
|
81
|
+
37kx
|
|
82
|
+
:desc: ''
|
|
83
|
+
:fruit:
|
|
84
|
+
:value: |-
|
|
85
|
+
?wIGrSC/bf5om/rlfIlz7hAIOjaZFjIgw4ulguIKI7YpBrx4JOcmUo3cLH1vC
|
|
86
|
+
eDeW
|
|
87
|
+
:desc: This fruit color is yellow.
|
|
88
|
+
```
|
|
89
|
+
```yaml:project_config_product.yml
|
|
90
|
+
---
|
|
91
|
+
- :key_path: "/home/vagrant/.crypt_config/project_key.yml"
|
|
92
|
+
- :fruit:
|
|
93
|
+
:value: banana
|
|
94
|
+
:desc: 黄色い果物
|
|
95
|
+
:furniture:
|
|
96
|
+
:value: chair
|
|
97
|
+
:desc: 座る物
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
After reading the above, it will be as follows.
|
|
43
101
|
|
|
44
|
-
|
|
102
|
+
```ruby
|
|
103
|
+
require 'dinomischus'
|
|
104
|
+
|
|
105
|
+
hash = Dinomischus.load_file('project_name_config_index.yml')
|
|
106
|
+
# => {:animal=>"owl",
|
|
107
|
+
# :fruit=>"banana",
|
|
108
|
+
# :furniture=>"chair"}
|
|
109
|
+
```
|
|
110
|
+
The setting value of ```:fruit``` changed to ```banana``` depending on the file read later.
|
|
111
|
+
|
|
112
|
+
### For Write Setting
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
#### Create Configure File. First Use
|
|
45
116
|
設定ファイル作成(初回設定)
|
|
46
117
|
|
|
47
|
-
When you execute the following command
|
|
118
|
+
When you execute the following command from terminal.
|
|
48
119
|
```
|
|
120
|
+
$ cd /path/to/project_root
|
|
49
121
|
$ dinomischus
|
|
50
122
|
```
|
|
51
123
|
|
|
@@ -56,18 +128,128 @@ A menu will appear.
|
|
|
56
128
|
2. Add or Update Crypted Value
|
|
57
129
|
3. List Configs Simple
|
|
58
130
|
4. List Configs Specify
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
131
|
+
c. Clear Screen
|
|
132
|
+
h. Ruby Command List
|
|
133
|
+
z. End
|
|
134
|
+
-----------> Select Menu [1-4,c,h,z]:
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Select 1 when the menu appears.
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
-----------> Select Menu [1-4,c,h,z]: 1
|
|
141
|
+
|
|
142
|
+
****** Make Template ******
|
|
143
|
+
|
|
144
|
+
Input Your Config Prefix Name : ____
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
You will be asked for the first character string for identification of the configuration file. Please enter any characters. (Here prj)
|
|
148
|
+
(If there is a file that already exists with the identification character set once, the file creation process is skipped.)
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
Input Your Config Prefix Name : prj
|
|
152
|
+
Make File Default Value is ...
|
|
153
|
+
Key File Place [/path/to/home/yourid/.crypt_config/prj_key.yml]
|
|
154
|
+
Config File Place [/path/to/current directory/config/prj_config.yml]
|
|
155
|
+
Define File Place [/path/to/current directory/config/prj_config_index.yml]
|
|
156
|
+
|
|
157
|
+
Press Enter Key to Next Step...
|
|
158
|
+
```
|
|
159
|
+
Check the created file and press the enter key.
|
|
160
|
+
* Create the ```.crypt_config``` and ```config``` directories if they do not exist.
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
Done!
|
|
164
|
+
Next Step is Add Crypt Config|Plain Config to /path/to/カレントディレクトリ/config/prj_config.yml .
|
|
165
|
+
Add Config Value then You Select Menu No.2 .
|
|
166
|
+
-----------> Select Menu [1-4,c,h,z]:
|
|
62
167
|
```
|
|
63
168
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
169
|
+
This completes the template creation.
|
|
170
|
+
You can copy the completed file as appropriate, or change the save destination to change the configuration to your liking.
|
|
171
|
+
If you change the directory, the path of each file is described at the beginning of the configuration file, so change that as well.
|
|
172
|
+
|
|
173
|
+
#### Addition of setting encryption value.
|
|
174
|
+
Call the menu from the ```dinomischus``` command .
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
$ cd /path/to/project_root
|
|
178
|
+
$ dinomischus
|
|
179
|
+
****** Welcome Egoistic Config ******
|
|
180
|
+
1. Make Template
|
|
181
|
+
2. Add or Update Crypted Value
|
|
182
|
+
3. List Configs Simple
|
|
183
|
+
4. List Configs Specify
|
|
184
|
+
c. Clear Screen
|
|
185
|
+
h. Ruby Command List
|
|
186
|
+
z. End
|
|
187
|
+
-----------> Select Menu [1-4,c,h,z]:
|
|
188
|
+
```
|
|
189
|
+
Select 2 when the menu appears.
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
-----------> Select Menu [1-4,c,h,z]: 2
|
|
193
|
+
|
|
194
|
+
****** Crypted Value Setting ******"
|
|
195
|
+
Input Your Config Path : config/prj_config.yml
|
|
196
|
+
Input Your Key : email
|
|
197
|
+
Input Your Value : myValue1@example.com
|
|
198
|
+
Input Your Description : Sample e-mail address for settings. It doesn't exist.
|
|
199
|
+
|
|
200
|
+
Done!
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
After entering the setting file path you want to edit, enter the value you want to set for each item that appears. The encryption of the setting value is over. If all goes well, you should have a configuration file like the one below.
|
|
204
|
+
|
|
205
|
+
```yaml:config/prj_config_index.yml
|
|
206
|
+
---
|
|
207
|
+
- :conf_path: "/home/vagrant/config/prj_config.yml"
|
|
208
|
+
```
|
|
209
|
+
```yaml:config/prj_config.yml
|
|
210
|
+
---
|
|
211
|
+
- :key_path: "/home/vagrant/.crypt_config/prj_key.yml"
|
|
212
|
+
- :dummy:
|
|
213
|
+
:value: ''
|
|
214
|
+
:desc: ''
|
|
215
|
+
:email:
|
|
216
|
+
:value: |-
|
|
217
|
+
?Afo3Ccn307HZgQgBRwmyUQtCqDus3063wz1h9CIpRMIWdpRC07yfd2TG5jKa
|
|
218
|
+
OrQiDDMfySjQIhWfL1Gt0UJ8tngSiUJT4gfgvjN7/+LHpdk=
|
|
219
|
+
:desc: Sample e-mail address for settings. It doesn't exist.
|
|
220
|
+
```
|
|
221
|
+
※ If you are concerned about dummy, delete it with a text editor.
|
|
222
|
+
```{:dummy => {:value: '', :desc:''}}```
|
|
223
|
+
|
|
224
|
+
```yaml:~/.crypt_config/prj_key.yml
|
|
225
|
+
---
|
|
226
|
+
:key:
|
|
227
|
+
:type: sha256
|
|
228
|
+
:value: eUIZzgKKnsJCoLcRX5pXXg
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Description of each file
|
|
232
|
+
#### Definition file(```*_config_index.yml```)
|
|
233
|
+
Defines the reading order of the configuration files.
|
|
234
|
+
|
|
235
|
+
* The reading order is from top to bottom.
|
|
236
|
+
* If the setting items are duplicated, they will be overwritten with the values read later.
|
|
237
|
+
* Two or more files can be defined.
|
|
238
|
+
|
|
239
|
+
#### Setting file (```*_config.yml```)
|
|
240
|
+
The link to the key file (key_path) and the text of the setting value are saved.
|
|
241
|
+
|
|
242
|
+
* {Setting item => {value: "setting value", desc: "description"}} It is one set in the form of.
|
|
243
|
+
* If the first character of the setting value is "?", Attempts to decrypt with the password described in key_path.
|
|
244
|
+
* The encrypted setting value is encrypted twice. (The first time is the encrypted character string and salt of the set value, and the second time is the encrypted character string and salt. Combine the ruts into one encrypted string. Due to this effect, even if the setting value is the same, it will be a completely different setting value each time it is encrypted.)
|
|
245
|
+
* If you want to set the setting value in plain text, edit it directly using a text editor.
|
|
246
|
+
|
|
247
|
+
#### Key file(```*_key.yml```)
|
|
248
|
+
Stores the password used for encryption / decryption.
|
|
70
249
|
|
|
250
|
+
* The encryption method is sha256.
|
|
251
|
+
* It will be created automatically when the template is created, but ** before encryption ** you can change it to any character string with a text editor. Hmm. (If you change the password after encrypting it, it will fail when decrypting.)
|
|
252
|
+
* ```type:``` is a preliminary item for future specification expansion. Currently, "sha256" is an option.
|
|
71
253
|
|
|
72
254
|
## Development
|
|
73
255
|
|
data/lib/dinomischus/menu.rb
CHANGED
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.3
|
|
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-10-
|
|
11
|
+
date: 2020-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|
|
@@ -18,7 +18,6 @@ executables:
|
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
|
20
20
|
files:
|
|
21
|
-
- ".README.md.swp"
|
|
22
21
|
- ".gitignore"
|
|
23
22
|
- ".rspec"
|
|
24
23
|
- CODE_OF_CONDUCT.md
|
data/.README.md.swp
DELETED
|
Binary file
|