cliutils 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/HISTORY.md +5 -0
- data/README.md +2 -2
- data/lib/cliutils/configuration.rb +1 -2
- data/lib/cliutils/pretty-io.rb +1 -1
- data/lib/cliutils/version.rb +1 -1
- data/test/prefs_test.rb +33 -2
- data/test/test_files/prefstest.yaml +17 -4
- metadata +2 -3
- data/Gemfile.lock +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1854c822720ec6193e9973bdf56d912e6060b4ec
|
4
|
+
data.tar.gz: d3e7066e5cc1bc7252520122e05475c6e0dd787d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affe0adf4c8debf539318464cd12a82dc67801da37cabdbf9fd0c594acf828d658e9da5145c91c2eaee20c06be71054209dff296e9c1f7a7602ae38a752fd6b9
|
7
|
+
data.tar.gz: bda380364bb52f92110f4f7827461910472022cb1ad087be42ffc34bff3f50cd5db3dd491de7acc648b84b8db50054dfef57476d8d968c15dca52bf85b83ad8c
|
data/.gitignore
CHANGED
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -95,7 +95,7 @@ puts 'A sample string'.colorize('35;42')
|
|
95
95
|
Naturally, memorizing the ANSI color scheme is a pain, so PrettyIO gives you a convenient method to look up these color combinations:
|
96
96
|
|
97
97
|
```ruby
|
98
|
-
color_chart
|
98
|
+
CLIUtils::PrettyIO.color_chart
|
99
99
|
```
|
100
100
|
![alt text](https://raw.githubusercontent.com/bachya/cli-utils/master/res/readme-images/prettyio-color-chart.png "PrettyIO Color Chart")
|
101
101
|
|
@@ -220,7 +220,7 @@ include CLIUtils::Configuration
|
|
220
220
|
### Loading a Configuration File
|
221
221
|
|
222
222
|
```Ruby
|
223
|
-
|
223
|
+
CLIUtils::Configuration.configuration = ('~/.my-app-config')
|
224
224
|
```
|
225
225
|
|
226
226
|
If there's data in there, it will be consumed into `configuration`'s `data` property.
|
@@ -33,9 +33,8 @@ module CLIUtils
|
|
33
33
|
# a Configurator.
|
34
34
|
# @param [String] path The filepath to use
|
35
35
|
# @return [void]
|
36
|
-
def
|
36
|
+
def self.configuration=(path)
|
37
37
|
@@configuration = Configurator.new(path)
|
38
38
|
end
|
39
|
-
alias configuration= load_configuration
|
40
39
|
end
|
41
40
|
end
|
data/lib/cliutils/pretty-io.rb
CHANGED
@@ -33,7 +33,7 @@ module CLIUtils
|
|
33
33
|
# Displays a chart of all the possible ANSI foreground
|
34
34
|
# and background color combinations.
|
35
35
|
# @return [void]
|
36
|
-
def color_chart
|
36
|
+
def self.color_chart
|
37
37
|
[0, 1, 4, 5, 7].each do |attr|
|
38
38
|
puts '----------------------------------------------------------------'
|
39
39
|
puts "ESC[#{attr};Foreground;Background"
|
data/lib/cliutils/version.rb
CHANGED
data/test/prefs_test.rb
CHANGED
@@ -7,9 +7,40 @@ require File.join(File.dirname(__FILE__), '..', 'lib/cliutils/prefs/pref')
|
|
7
7
|
|
8
8
|
class TestPrefs < Test::Unit::TestCase
|
9
9
|
def setup
|
10
|
-
@prefs_arr = [
|
11
|
-
|
10
|
+
@prefs_arr = [
|
11
|
+
{
|
12
|
+
"prompt" => "Batman or Superman?",
|
13
|
+
"default" => "Batman",
|
14
|
+
"config_key" => "superhero",
|
15
|
+
"config_section" => "personal_info"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"prompt" => "Do you feel smart for preferring Batman?",
|
19
|
+
"default" => "Y",
|
20
|
+
"config_key" => "batman_answer",
|
21
|
+
"config_section" => "personal_info",
|
22
|
+
"prereqs" => [
|
23
|
+
{
|
24
|
+
"config_key" => "superhero",
|
25
|
+
"config_value" => "Batman"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"prompt" => "Why do you prefer Superman?!",
|
31
|
+
"default" => "No clue",
|
32
|
+
"config_key" => "superman_answer",
|
33
|
+
"config_section" => "personal_info",
|
34
|
+
"prereqs" => [
|
35
|
+
{
|
36
|
+
"config_key" => "superhero",
|
37
|
+
"config_value" => "Superman"
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
]
|
12
42
|
|
43
|
+
@prefs_hash = {:prompts=>@prefs_arr}
|
13
44
|
@prefs_filepath = '/tmp/prefstest.yaml'
|
14
45
|
FileUtils.cp(File.join(File.dirname(__FILE__), '..', 'test/test_files/prefstest.yaml'), @prefs_filepath)
|
15
46
|
end
|
@@ -1,6 +1,19 @@
|
|
1
1
|
prompts:
|
2
|
-
- prompt:
|
3
|
-
|
2
|
+
- prompt: Batman or Superman?
|
3
|
+
default: Batman
|
4
|
+
config_key: superhero
|
4
5
|
config_section: personal_info
|
5
|
-
|
6
|
-
|
6
|
+
- prompt: Do you feel smart for preferring Batman?
|
7
|
+
default: Y
|
8
|
+
config_key: batman_answer
|
9
|
+
config_section: personal_info
|
10
|
+
prereqs:
|
11
|
+
- config_key: superhero
|
12
|
+
config_value: Batman
|
13
|
+
- prompt: Why do you prefer Superman?!
|
14
|
+
default: No clue
|
15
|
+
config_key: superman_answer
|
16
|
+
config_section: personal_info
|
17
|
+
prereqs:
|
18
|
+
- config_key: superhero
|
19
|
+
config_value: Superman
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- ".gitignore"
|
78
78
|
- ".travis.yml"
|
79
79
|
- Gemfile
|
80
|
-
- Gemfile.lock
|
81
80
|
- HISTORY.md
|
82
81
|
- LICENSE.txt
|
83
82
|
- README.md
|
data/Gemfile.lock
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cliutils (1.2.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
coderay (1.1.0)
|
10
|
-
method_source (0.8.2)
|
11
|
-
pry (0.9.12.6)
|
12
|
-
coderay (~> 1.0)
|
13
|
-
method_source (~> 0.8)
|
14
|
-
slop (~> 3.4)
|
15
|
-
rake (0.9.2.2)
|
16
|
-
slop (3.5.0)
|
17
|
-
yard (0.8.7.4)
|
18
|
-
|
19
|
-
PLATFORMS
|
20
|
-
ruby
|
21
|
-
|
22
|
-
DEPENDENCIES
|
23
|
-
bundler (~> 1.5)
|
24
|
-
cliutils!
|
25
|
-
pry (~> 0.9)
|
26
|
-
rake (~> 0)
|
27
|
-
yard (= 0.8.7.4)
|