cliutils 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -1
- data/README.md +12 -7
- data/lib/cliutils/configurator.rb +1 -1
- data/lib/cliutils/constants.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b935a6abdb2d5219fc26e2e48196ac7457d1356
|
4
|
+
data.tar.gz: d0e4774d9efc3c844f7d88adf646a3466d8625f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e27d2ac30177630a86aeb0e994a31160fb598fd2ad9970ad1958e46a2af80f7b6837a3cab7a0a962a5d97d3ef25f1e6860b5df8111fb3a7e01f2adae9a33f53
|
7
|
+
data.tar.gz: 9970736e7841b7a8762fc3c2cee06c0412b8c076c01e4e21fc46d0f4429316a1430a3d66f5dfb89e8c6fe874aed0cb7008db63c53e70f1eda30f2cc64ae89971
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -143,7 +143,7 @@ messenger.success('But Luke still blew up the Death Star!')
|
|
143
143
|
# Outputs 'Starting up...', runs the code in
|
144
144
|
# `# do stuff here`, and once complete,
|
145
145
|
# outputs 'Done!' on the same line.
|
146
|
-
messenger.info_block('Starting up...', 'Done!', multiline = false) {
|
146
|
+
messenger.info_block('Starting up...', 'Done!', multiline = false) {
|
147
147
|
# ...do stuff here...
|
148
148
|
}
|
149
149
|
|
@@ -282,7 +282,9 @@ user_data:
|
|
282
282
|
|
283
283
|
### Checking Configuration Versions
|
284
284
|
|
285
|
-
Often, you'll want to check the user's current version of your app against the last version that required some sort of configuration change
|
285
|
+
Often, you'll want to check the user's current version of your app against the last version that required some sort of configuration change; moreover, you'll want to run some "re-configuration" steps if the user's version is older than the last version that required a configuration update.
|
286
|
+
|
287
|
+
`configurator` allows for this via its `compare_version` method.
|
286
288
|
|
287
289
|
Assume you have a config file that looks like this:
|
288
290
|
|
@@ -312,16 +314,19 @@ configuration.current_version = configuration.app_data['APP_VERSION']
|
|
312
314
|
# a re-configuration in a property of the Configurator.
|
313
315
|
configuration.last_version = LATEST_CONFIG_VERSION
|
314
316
|
|
315
|
-
# Run the check
|
316
|
-
# the
|
317
|
-
#
|
317
|
+
# Run the check. If the current version is older than
|
318
|
+
# the "last" version, use a block to tell the Configurator
|
319
|
+
# what to do.
|
318
320
|
configuration.compare_version do |c, l|
|
319
321
|
puts "We need to update from #{c} to #{l}..."
|
320
322
|
# ...do stuff...
|
321
323
|
end
|
322
324
|
```
|
323
325
|
|
324
|
-
|
326
|
+
Two items to note:
|
327
|
+
|
328
|
+
1. If the `current_version` parameter is `nil`, the Configurator will assume that it the app needs to be updated when `compare_version` is run.
|
329
|
+
2. Note that if the current version is *later* than the last version that required re-configuration, the whole block is skipped over (allowing your app to get on with its day).
|
325
330
|
|
326
331
|
## Prefs
|
327
332
|
|
@@ -559,7 +564,7 @@ validators:
|
|
559
564
|
- expand_filepath # Runs File.expand_path on the answer
|
560
565
|
- lowercase # Turns "AnSwEr" into "answer"
|
561
566
|
- prefix: 'test ' # Prepends 'test ' to the answer
|
562
|
-
- suffix: 'test ' # Appends 'test ' to the answer
|
567
|
+
- suffix: 'test ' # Appends 'test ' to the answer
|
563
568
|
- titlecase # Turns "the answer" into "The Answer"
|
564
569
|
- uppercase # Turns "answer" to "ANSWER"
|
565
570
|
```
|
data/lib/cliutils/constants.rb
CHANGED