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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38dd50eb1ac467b9bad06c3ce13982e69cfa15de
4
- data.tar.gz: 98e93e737188b2b082d85a9b77b4ad867d25ff47
3
+ metadata.gz: 1854c822720ec6193e9973bdf56d912e6060b4ec
4
+ data.tar.gz: d3e7066e5cc1bc7252520122e05475c6e0dd787d
5
5
  SHA512:
6
- metadata.gz: ed94893b5ac1876190d39450e5a67a78d5c5cf0ea916880f4096d101fd373fad95143984552b1cdba3457562abf7fec7f8e3c4f1156bc843ee64c43940370a99
7
- data.tar.gz: 4bf24c32bc34951d9261d74612d6c8d2f8acf77df6a90ce11fbb20c957f0628e59d5e11ad983b7aba1f8a83565b6135aacaafaa448e6d6950978c827be2db698
6
+ metadata.gz: affe0adf4c8debf539318464cd12a82dc67801da37cabdbf9fd0c594acf828d658e9da5145c91c2eaee20c06be71054209dff296e9c1f7a7602ae38a752fd6b9
7
+ data.tar.gz: bda380364bb52f92110f4f7827461910472022cb1ad087be42ffc34bff3f50cd5db3dd491de7acc648b84b8db50054dfef57476d8d968c15dca52bf85b83ad8c
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg
4
4
  .yardoc
5
5
  bin
6
6
  .tmp
7
+ Gemfile.lock
data/HISTORY.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # 1.1.1 (2014-04-03)
2
2
 
3
+ * Modified loading of configuration values
4
+ * Updated documentation
5
+
6
+ # 1.1.1 (2014-04-03)
7
+
3
8
  * Updated documentation
4
9
  * Added additional testing
5
10
 
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
- load_configuration('~/.my-app-config')
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 load_configuration(path)
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
@@ -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"
@@ -1,4 +1,4 @@
1
1
  module CLIUtils
2
2
  # The current version of the gem
3
- VERSION = '1.2.1'
3
+ VERSION = '1.2.2'
4
4
  end
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 = [{:prompt=>"Where is your SSH public key located?", :config_key=>"pub_key", :config_section=>"personal_info", :behaviors=>["local_filepath"]}]
11
- @prefs_hash = {:prompts=>@prefs_arr}
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: Where is your SSH public key located?
3
- config_key: pub_key
2
+ - prompt: Batman or Superman?
3
+ default: Batman
4
+ config_key: superhero
4
5
  config_section: personal_info
5
- behaviors:
6
- - local_filepath
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.1
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-04 00:00:00.000000000 Z
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)