cliutils 1.0.2 → 1.0.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/.gitignore +2 -0
- data/.yardoc/checksums +11 -11
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +12 -33
- data/README.md +1 -1
- data/Rakefile +36 -31
- data/cliutils.gemspec +3 -2
- data/lib/cliutils/configuration.rb +13 -31
- data/lib/cliutils/configurator.rb +23 -62
- data/lib/cliutils/ext/Hash+Extensions.rb +39 -78
- data/lib/cliutils/ext/Logger+Extensions.rb +6 -11
- data/lib/cliutils/ext/String+Extensions.rb +25 -13
- data/lib/cliutils/logger-delegator.rb +15 -39
- data/lib/cliutils/messenging.rb +10 -28
- data/lib/cliutils/prefs.rb +18 -43
- data/lib/cliutils/pretty-io.rb +59 -127
- data/lib/cliutils/version.rb +2 -1
- data/lib/cliutils.rb +2 -0
- metadata +20 -32
- data/bin/cliutils +0 -38
- data/doc/CLIUtils/Configuration.html +0 -373
- data/doc/CLIUtils/Configurator.html +0 -873
- data/doc/CLIUtils/LoggerDelegator.html +0 -560
- data/doc/CLIUtils/Messenging.html +0 -396
- data/doc/CLIUtils/Prefs.html +0 -609
- data/doc/CLIUtils/PrettyIO.html +0 -1333
- data/doc/CLIUtils.html +0 -131
- data/doc/Hash.html +0 -672
- data/doc/Logger.html +0 -233
- data/doc/String.html +0 -562
- data/doc/_index.html +0 -207
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/file.README.html +0 -415
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -415
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -389
- data/doc/top-level-namespace.html +0 -114
@@ -1,49 +1,29 @@
|
|
1
1
|
module CLIUtils
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Manages any configuration values and the flat YAML file
|
6
|
-
# into which they get stored.
|
7
|
-
# ======================================================
|
2
|
+
# LoggerDelegator Class
|
3
|
+
# Delegates certain Logger methods to a number of different
|
4
|
+
# targets.
|
8
5
|
class LoggerDelegator
|
9
|
-
|
10
|
-
# Attributes
|
11
|
-
# ====================================================
|
12
|
-
attr_reader :devices
|
6
|
+
attr_reader :targets
|
13
7
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# ----------------------------------------------------
|
18
|
-
# initialize method
|
19
|
-
#
|
20
|
-
# Initializer
|
21
|
-
# @param *targets The endpoints to delegate to
|
22
|
-
# @return void
|
23
|
-
# ----------------------------------------------------
|
8
|
+
# Initializes and creates methods for the passed targets.
|
9
|
+
# @param [Logger] targets The endpoints to delegate to
|
10
|
+
# @return [void]
|
24
11
|
def initialize(*targets)
|
25
12
|
@targets = targets
|
26
13
|
LoggerDelegator.delegate
|
27
14
|
end
|
28
15
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# Attaches a new target to delegate to.
|
33
|
-
# @return void
|
34
|
-
# ----------------------------------------------------
|
16
|
+
# Attaches a new target to delegate to.
|
17
|
+
# @param [Logger] target The targets to delegate to
|
18
|
+
# @return [void]
|
35
19
|
def attach(target)
|
36
20
|
@targets << target
|
37
21
|
LoggerDelegator.delegate
|
38
22
|
end
|
39
23
|
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# Creates delegator methods for all of the methods
|
44
|
-
# on IO.
|
45
|
-
# @return void
|
46
|
-
# ----------------------------------------------------
|
24
|
+
# Creates delegator methods for a specific list of Logger
|
25
|
+
# functions.
|
26
|
+
# @return [void]
|
47
27
|
def self.delegate
|
48
28
|
%w(log debug info warn error section success).each do |m|
|
49
29
|
define_method(m) do |*args|
|
@@ -52,12 +32,8 @@ module CLIUtils
|
|
52
32
|
end
|
53
33
|
end
|
54
34
|
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# Detaches a delegation target.
|
59
|
-
# @return void
|
60
|
-
# ----------------------------------------------------
|
35
|
+
# Detaches a delegation target.
|
36
|
+
# @return [void]
|
61
37
|
def detach(target)
|
62
38
|
@targets.delete(target)
|
63
39
|
LoggerDelegator.delegate
|
data/lib/cliutils/messenging.rb
CHANGED
@@ -1,33 +1,19 @@
|
|
1
1
|
module CLIUtils
|
2
|
-
# ======================================================
|
3
2
|
# CLIMessenger Module
|
4
|
-
# Outputs
|
5
|
-
# ======================================================
|
3
|
+
# Outputs coordinated messages to a variety of targets.
|
6
4
|
module Messenging
|
7
5
|
include CLIUtils::PrettyIO
|
8
6
|
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# ----------------------------------------------------
|
13
|
-
# included method
|
14
|
-
#
|
15
|
-
# Hook called when this module gets mixed in; extends
|
16
|
-
# the includer with the methods defined here.
|
17
|
-
# @param k The includer
|
18
|
-
# @return Void
|
19
|
-
# ----------------------------------------------------
|
7
|
+
# Hook that triggers when this module is included.
|
8
|
+
# @param [Object] k The includer object
|
9
|
+
# @return [void]
|
20
10
|
def self.included(k)
|
21
11
|
k.extend(self)
|
22
12
|
end
|
23
13
|
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# Returns a default instance of LoggerDelegator that
|
28
|
-
# delegates to STDOUT only.
|
29
|
-
# @return LoggerDelegator
|
30
|
-
# ----------------------------------------------------
|
14
|
+
# Returns a default instance of LoggerDelegator that
|
15
|
+
# delegates to STDOUT only.
|
16
|
+
# @return [LoggerDelegator]
|
31
17
|
def default_instance
|
32
18
|
stdout_logger = Logger.new(STDOUT)
|
33
19
|
stdout_logger.formatter = proc do |severity, datetime, progname, msg|
|
@@ -37,13 +23,9 @@ module CLIUtils
|
|
37
23
|
LoggerDelegator.new(stdout_logger)
|
38
24
|
end
|
39
25
|
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# Singleton method to return (or initialize, if needed)
|
44
|
-
# a LoggerDelegator.
|
45
|
-
# @return LoggerDelegator
|
46
|
-
# ----------------------------------------------------
|
26
|
+
# Singleton method to return (or initialize, if needed)
|
27
|
+
# a LoggerDelegator.
|
28
|
+
# @return [LoggerDelegator]
|
47
29
|
def messenger
|
48
30
|
@messenger ||= default_instance
|
49
31
|
end
|
data/lib/cliutils/prefs.rb
CHANGED
@@ -1,26 +1,13 @@
|
|
1
1
|
module CLIUtils
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Engine to derive preferences from a YAML file, deliver
|
6
|
-
# those to a user via a prompt, and collect the results.
|
7
|
-
# ======================================================
|
2
|
+
# Engine to derive preferences from a YAML file, deliver
|
3
|
+
# those to a user via a prompt, and collect the results.
|
8
4
|
class Prefs
|
9
5
|
include PrettyIO
|
10
|
-
# ====================================================
|
11
|
-
# Attributes
|
12
|
-
# ====================================================
|
13
6
|
attr_reader :answers, :config_path, :prompts
|
14
7
|
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# ----------------------------------------------------
|
19
|
-
# initialize method
|
20
|
-
#
|
21
|
-
# Reads prompt data from YAML file.
|
22
|
-
# @return Void
|
23
|
-
# ----------------------------------------------------
|
8
|
+
# Reads prompt data from and stores it.
|
9
|
+
# @param [<String, Array>] data Either a filepath or an array
|
10
|
+
# @return [void]
|
24
11
|
def initialize(data)
|
25
12
|
@answers = []
|
26
13
|
@prompts = {}
|
@@ -45,15 +32,11 @@ module CLIUtils
|
|
45
32
|
end
|
46
33
|
end
|
47
34
|
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# requirements are examined first; once those are
|
54
|
-
# complete, questions w/ requirements are examined.
|
55
|
-
# @return Void
|
56
|
-
# ----------------------------------------------------
|
35
|
+
# Runs through all of the prompt questions and collects
|
36
|
+
# answers from the user. Note that all questions w/o
|
37
|
+
# requirements are examined first; once those are
|
38
|
+
# complete, questions w/ requirements are examined.
|
39
|
+
# @return [void]
|
57
40
|
def ask
|
58
41
|
@prompts[:prompts].reject { |p| p[:requirements] }.each do |p|
|
59
42
|
_deliver_prompt(p)
|
@@ -66,14 +49,10 @@ module CLIUtils
|
|
66
49
|
|
67
50
|
private
|
68
51
|
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
# question (taking into account any options).
|
74
|
-
# @param p The prompt
|
75
|
-
# @return Void
|
76
|
-
# ----------------------------------------------------
|
52
|
+
# Utility method for prompting the user to answer the
|
53
|
+
# question (taking into account any options).
|
54
|
+
# @param [Hash] p The prompt
|
55
|
+
# @return [void]
|
77
56
|
def _deliver_prompt(p)
|
78
57
|
if p[:options].nil?
|
79
58
|
pref = prompt(p[:prompt], p[:default])
|
@@ -93,14 +72,10 @@ module CLIUtils
|
|
93
72
|
@answers << p
|
94
73
|
end
|
95
74
|
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# requirements have already been fulfilled.
|
101
|
-
# @param p The prompt
|
102
|
-
# @return Void
|
103
|
-
# ----------------------------------------------------
|
75
|
+
# Utility method for determining whether a prompt's
|
76
|
+
# requirements have already been fulfilled.
|
77
|
+
# @param [Hash] p The prompt
|
78
|
+
# @return [void]
|
104
79
|
def _requirements_fulfilled?(p)
|
105
80
|
ret = true
|
106
81
|
p[:requirements].each do |req|
|
data/lib/cliutils/pretty-io.rb
CHANGED
@@ -7,36 +7,22 @@ end
|
|
7
7
|
require 'readline'
|
8
8
|
|
9
9
|
module CLIUtils
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# Outputs color-coordinated messages to a CLI
|
13
|
-
# ======================================================
|
10
|
+
# CLIMessenger Module
|
11
|
+
# Outputs color-coordinated messages to a CLI
|
14
12
|
module PrettyIO
|
15
13
|
@@wrap = true
|
16
14
|
@@wrap_char_limit = 40
|
17
15
|
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# ----------------------------------------------------
|
22
|
-
# included method
|
23
|
-
#
|
24
|
-
# Hook called when this module gets mixed in; extends
|
25
|
-
# the includer with the methods defined here.
|
26
|
-
# @param k The includer
|
27
|
-
# @return Void
|
28
|
-
# ----------------------------------------------------
|
16
|
+
# Hook that triggers when this module is included.
|
17
|
+
# @param [Object] k The includer object
|
18
|
+
# @return [void]
|
29
19
|
def self.included(k)
|
30
20
|
k.extend(self)
|
31
21
|
end
|
32
22
|
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# Displays a chart of all the possible ANSI foreground
|
37
|
-
# and background color combinations.
|
38
|
-
# @return Void
|
39
|
-
# ----------------------------------------------------
|
23
|
+
# Displays a chart of all the possible ANSI foreground
|
24
|
+
# and background color combinations.
|
25
|
+
# @return [void]
|
40
26
|
def color_chart
|
41
27
|
[0, 1, 4, 5, 7].each do |attr|
|
42
28
|
puts '----------------------------------------------------------------'
|
@@ -50,46 +36,31 @@ module CLIUtils
|
|
50
36
|
end
|
51
37
|
end
|
52
38
|
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# Empty method so that Messenging doesn't freak
|
57
|
-
# out when passed a debug message.
|
58
|
-
# @return Void
|
59
|
-
# ----------------------------------------------------
|
39
|
+
# Empty method so that Messenging doesn't freak
|
40
|
+
# out when passed a debug message.
|
41
|
+
# @return [void]
|
60
42
|
def debug(m); end
|
61
43
|
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# Outputs a formatted-red error message.
|
66
|
-
# @param m The message to output
|
67
|
-
# @return Void
|
68
|
-
# ----------------------------------------------------
|
44
|
+
# Outputs a formatted-red error message.
|
45
|
+
# @param [String] m The message to output
|
46
|
+
# @return [void]
|
69
47
|
def error(m)
|
70
48
|
puts _word_wrap(m, '# ').red
|
71
49
|
end
|
72
50
|
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# Outputs a formatted-blue informational message.
|
77
|
-
# @param m The message to output
|
78
|
-
# @return Void
|
79
|
-
# ----------------------------------------------------
|
51
|
+
# Outputs a formatted-blue informational message.
|
52
|
+
# @param [String] m The message to output
|
53
|
+
# @return [void]
|
80
54
|
def info(m)
|
81
55
|
puts _word_wrap(m, '# ').blue
|
82
56
|
end
|
83
57
|
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
# @param multiline Whether the message should be multiline
|
91
|
-
# @return Void
|
92
|
-
# ----------------------------------------------------
|
58
|
+
# Wraps a block in an opening and closing info message.
|
59
|
+
# @param [String] m1 The opening message to output
|
60
|
+
# @param [String] m2 The closing message to output
|
61
|
+
# @param [<True, False>] multiline Whether the message should be multiline
|
62
|
+
# @yield
|
63
|
+
# @return [void]
|
93
64
|
def info_block(m1, m2 = 'Done.', multiline = false)
|
94
65
|
if block_given?
|
95
66
|
if multiline
|
@@ -110,24 +81,17 @@ module CLIUtils
|
|
110
81
|
end
|
111
82
|
end
|
112
83
|
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
# Empty method so that Messenging doesn't freak
|
117
|
-
# out when passed a debug message.
|
118
|
-
# @return Void
|
119
|
-
# ----------------------------------------------------
|
84
|
+
# Empty method so that Messenging doesn't freak
|
85
|
+
# out when passed a debug message.
|
86
|
+
# @return [void]
|
120
87
|
def log(m); end
|
121
88
|
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
# @param default The default option
|
129
|
-
# @return String
|
130
|
-
# ----------------------------------------------------
|
89
|
+
# Outputs a prompt, collects the user's response, and
|
90
|
+
# returns it.
|
91
|
+
# @param [String] prompt The prompt to output
|
92
|
+
# @param [String] default The default option
|
93
|
+
# @param [String] start_dir The directory to start from for autocompletion
|
94
|
+
# @return [String]
|
131
95
|
def prompt(prompt, default = nil, start_dir = '')
|
132
96
|
Readline.completion_append_character = nil
|
133
97
|
Readline.completion_proc = lambda do |prefix|
|
@@ -144,27 +108,18 @@ module CLIUtils
|
|
144
108
|
end
|
145
109
|
end
|
146
110
|
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
# Outputs a formatted-purple section message.
|
151
|
-
# @param m The message to output
|
152
|
-
# @return Void
|
153
|
-
# ----------------------------------------------------
|
111
|
+
# Outputs a formatted-purple section message.
|
112
|
+
# @param [String] m The message to output
|
113
|
+
# @return [void]
|
154
114
|
def section(m)
|
155
115
|
puts _word_wrap(m, '---> ').purple
|
156
116
|
end
|
157
117
|
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
#
|
163
|
-
# @param m1 The opening message to output
|
164
|
-
# @param m2 The closing message to output
|
165
|
-
# @param multiline A multiline message or not
|
166
|
-
# @return Void
|
167
|
-
# ----------------------------------------------------
|
118
|
+
# Wraps a block in an opening and closing section message.
|
119
|
+
# @param [String] m The opening message to output
|
120
|
+
# @param [<True, False>] multiline Whether the message should be multiline
|
121
|
+
# @yield
|
122
|
+
# @return [void]
|
168
123
|
def section_block(m, multiline = true)
|
169
124
|
if block_given?
|
170
125
|
if multiline
|
@@ -179,70 +134,47 @@ module CLIUtils
|
|
179
134
|
end
|
180
135
|
end
|
181
136
|
|
182
|
-
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
# Outputs a formatted-green success message.
|
186
|
-
# @param m The message to output
|
187
|
-
# @return Void
|
188
|
-
# ----------------------------------------------------
|
137
|
+
# Outputs a formatted-green success message.
|
138
|
+
# @param [String] m The message to output
|
139
|
+
# @return [void]
|
189
140
|
def success(m)
|
190
141
|
puts _word_wrap(m, '# ').green
|
191
142
|
end
|
192
143
|
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
# Outputs a formatted-yellow warning message.
|
197
|
-
# @param m The message to output
|
198
|
-
# @return Void
|
199
|
-
# ----------------------------------------------------
|
144
|
+
# Outputs a formatted-yellow warning message.
|
145
|
+
# @param [String] m The message to output
|
146
|
+
# @return [void]
|
200
147
|
def warn(m)
|
201
148
|
puts _word_wrap(m, '# ').yellow
|
202
149
|
end
|
203
150
|
|
204
|
-
#
|
205
|
-
#
|
206
|
-
#
|
207
|
-
# Toggles wrapping on or off
|
208
|
-
# @return Integer
|
209
|
-
# ----------------------------------------------------
|
151
|
+
# Toggles wrapping on or off
|
152
|
+
# @param [<True, False>] on
|
153
|
+
# @return [void]
|
210
154
|
def self.wrap(on)
|
211
155
|
@@wrap = on
|
212
156
|
end
|
213
157
|
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
# Returns the current character wrap amount
|
218
|
-
# @return Integer
|
219
|
-
# ----------------------------------------------------
|
158
|
+
# Returns the current character wrap amount
|
159
|
+
# @return [Integer]
|
220
160
|
def self.wrap_limit
|
221
161
|
@@wrap_char_limit
|
222
162
|
end
|
223
163
|
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
# Sets the number of characters at which to wrap
|
228
|
-
# @return Integer
|
229
|
-
# ----------------------------------------------------
|
164
|
+
# Sets the number of characters at which to wrap
|
165
|
+
# @param [Integer] chars The number of chars to output before wrapping
|
166
|
+
# @return [void]
|
230
167
|
def self.wrap_at(chars)
|
231
168
|
@@wrap_char_limit = chars
|
232
169
|
end
|
233
170
|
|
234
171
|
private
|
235
172
|
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
# @param text The text to wrap
|
242
|
-
# @param prefix_str The prefix for each line
|
243
|
-
# @param line_width The number of characters per line
|
244
|
-
# @return String
|
245
|
-
# ----------------------------------------------------
|
173
|
+
# Outputs a wrapped string (where each line is limited
|
174
|
+
# to a certain number of characters).
|
175
|
+
# @param [String] text The text to wrap
|
176
|
+
# @param [String] prefix_str The prefix for each line
|
177
|
+
# @return [String]
|
246
178
|
def _word_wrap(text, prefix_str)
|
247
179
|
if @@wrap
|
248
180
|
return text if @@wrap_char_limit <= 0
|
data/lib/cliutils/version.rb
CHANGED
data/lib/cliutils.rb
CHANGED
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.0.
|
4
|
+
version: 1.0.3
|
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-03-
|
11
|
+
date: 2014-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.9'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,12 +52,25 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.8.7.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.8.7.4
|
55
69
|
description: A library of functionality designed to alleviate common tasks and headaches
|
56
70
|
when developing command-line (CLI) apps in Ruby.
|
57
71
|
email:
|
58
72
|
- bachya1208@googlemail.com
|
59
|
-
executables:
|
60
|
-
- cliutils
|
73
|
+
executables: []
|
61
74
|
extensions: []
|
62
75
|
extra_rdoc_files:
|
63
76
|
- README.md
|
@@ -72,32 +85,7 @@ files:
|
|
72
85
|
- LICENSE.txt
|
73
86
|
- README.md
|
74
87
|
- Rakefile
|
75
|
-
- bin/cliutils
|
76
88
|
- cliutils.gemspec
|
77
|
-
- doc/CLIUtils.html
|
78
|
-
- doc/CLIUtils/Configuration.html
|
79
|
-
- doc/CLIUtils/Configurator.html
|
80
|
-
- doc/CLIUtils/LoggerDelegator.html
|
81
|
-
- doc/CLIUtils/Messenging.html
|
82
|
-
- doc/CLIUtils/Prefs.html
|
83
|
-
- doc/CLIUtils/PrettyIO.html
|
84
|
-
- doc/Hash.html
|
85
|
-
- doc/Logger.html
|
86
|
-
- doc/String.html
|
87
|
-
- doc/_index.html
|
88
|
-
- doc/class_list.html
|
89
|
-
- doc/css/common.css
|
90
|
-
- doc/css/full_list.css
|
91
|
-
- doc/css/style.css
|
92
|
-
- doc/file.README.html
|
93
|
-
- doc/file_list.html
|
94
|
-
- doc/frames.html
|
95
|
-
- doc/index.html
|
96
|
-
- doc/js/app.js
|
97
|
-
- doc/js/full_list.js
|
98
|
-
- doc/js/jquery.js
|
99
|
-
- doc/method_list.html
|
100
|
-
- doc/top-level-namespace.html
|
101
89
|
- features/cli_manager.feature
|
102
90
|
- features/step_definitions/cli_manager_steps.rb
|
103
91
|
- features/support/env.rb
|
data/bin/cliutils
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'cliutils.rb'
|
3
|
-
|
4
|
-
# include CLIUtils::PrettyIO
|
5
|
-
#
|
6
|
-
# warn('test')
|
7
|
-
|
8
|
-
include CLIUtils::Messenging
|
9
|
-
# #
|
10
|
-
# file_logger = Logger.new('file.txt')
|
11
|
-
# puts ''
|
12
|
-
# messenger.info('This should only appear in STDOUT.')
|
13
|
-
# messenger.attach(file_logger)
|
14
|
-
# messenger.warn('This warning should appear in STDOUT and file.txt')
|
15
|
-
# messenger.error('This error should appear in STDOUT and file.txt')
|
16
|
-
# messenger.debug('This debug message should only appear in file.txt')
|
17
|
-
# messenger.detach(file_logger)
|
18
|
-
# messenger.section('This section message should appear only in STDOUT')
|
19
|
-
# puts ''
|
20
|
-
#
|
21
|
-
include CLIUtils::Configuration
|
22
|
-
|
23
|
-
load_configuration('~/.test')
|
24
|
-
configuration.add_section(:user_data)
|
25
|
-
configuration.add_section(:program_data)
|
26
|
-
configuration.delete_section(:program_data)
|
27
|
-
configuration.user_data.merge!(username: 'bob')
|
28
|
-
configuration.save
|
29
|
-
#
|
30
|
-
# p = CLIUtils::Prefs.new(File.join(File.expand_path(File.dirname(__FILE__)),'..', 'test/test_files/prefstest.yaml'))
|
31
|
-
#
|
32
|
-
# # arr = [{:prompt=>"What is the hostname of your DD-WRT router?", :default=>"192.168.1.1", :key=>"hostname", :section=>"ssh_info"}, {:prompt=>"What is the SSH username of your DD-WRT router?", :default=>"root", :key=>"username", :section=>"ssh_info"}, {:prompt=>"What SSH port does your DD-WRT router use?", :default=>22, :key=>"port", :section=>"ssh_info"}, {:prompt=>"How do you use password or key authentication?", :default=>"password", :key=>"auth_method", :section=>"ssh_info", :options=>["password", "key"]}, {:prompt=>"Where is your key located?", :default=>"~/.ssh", :key=>"key_location", :section=>"ssh_info", :requirements=>[{:key=>"auth_method", :value=>"key"}]}, {:prompt=>"What is your password?", :key=>"password", :section=>"ssh_info", :requirements=>[{:key=>"auth_method", :value=>"password"}]}]
|
33
|
-
# # p = CLIUtils::Prefs.new(arr)
|
34
|
-
#
|
35
|
-
# # p p.prompts
|
36
|
-
# p.ask
|
37
|
-
# configuration.ingest_prefs(p)
|
38
|
-
# configuration.save
|