cliutils 2.0.0 → 2.0.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 +4 -0
- data/README.md +5 -0
- data/lib/cliutils/constants.rb +1 -1
- data/lib/cliutils/pretty_io.rb +3 -3
- data/test/pref_test.rb +10 -0
- data/test/string_extesions_test.rb +19 -6
- data/test/test_helper.rb +2 -2
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6e6e5b1a7f34b7dcfa6c887f2d1a704379f667
|
4
|
+
data.tar.gz: 67434a07cf330007da7640ee0e73f20355c70133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e74f6a482775f620e316fecf3e96cf5bb6e8ef3f0afb447f41d5cfb5069482e76238bd9bd882b0808baa1c0847778094d1b3dedd0338ad6512d3529efa24e3
|
7
|
+
data.tar.gz: a33d59a428bbd13e22f972ec9f56718fece03e952124171dd454046c7494253382551e1ef7aa678cfbf22d79b4fbe7772745c492914f939f4f1c97b555f8a024
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,10 @@ CLIUtils
|
|
5
5
|
|
6
6
|
CLIUtils is a library of functionality designed to alleviate common tasks and headaches when developing command-line (CLI) apps in Ruby.
|
7
7
|
|
8
|
+
# *Updating from 1.x.x to 2.0.0?*
|
9
|
+
|
10
|
+
The big difference is schema changes for Validators, Behaviors, and Pre-Post Actions. Make sure you read the [wiki](https://github.com/bachya/cliutils/wiki "CLIUtils Wiki").
|
11
|
+
|
8
12
|
# Why?
|
9
13
|
|
10
14
|
It's fairly simple:
|
@@ -79,6 +83,7 @@ Contributions are welcome and encouraged. To contribute:
|
|
79
83
|
|
80
84
|
1. Fork it (http://github.com/bachya/cliutils/fork)
|
81
85
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
86
|
+
* Make sure you add tests!
|
82
87
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
83
88
|
4. Push to the branch (`git push origin my-new-feature`)
|
84
89
|
5. Create new Pull Request
|
data/lib/cliutils/constants.rb
CHANGED
data/lib/cliutils/pretty_io.rb
CHANGED
@@ -60,9 +60,9 @@ module CLIUtils
|
|
60
60
|
return text if PrettyIO.wrap_char_limit <= 0
|
61
61
|
|
62
62
|
limit = PrettyIO.wrap_char_limit - prefix_str.length
|
63
|
-
text.gsub(/\n/, ' ')
|
64
|
-
|
65
|
-
|
63
|
+
text.to_s.gsub(/\n/, ' ')
|
64
|
+
.gsub(/(.{1,#{ limit }})(\s+|$)/, "#{ prefix_str }\\1\n")
|
65
|
+
.strip
|
66
66
|
else
|
67
67
|
text
|
68
68
|
end
|
data/test/pref_test.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'lib/cliutils/ext/hash_extensions')
|
5
|
+
require File.join(File.dirname(__FILE__), '..', 'lib/cliutils/prefs/pref')
|
6
|
+
|
7
|
+
# Tests for the Prefs class
|
8
|
+
class TestPref < Test::Unit::TestCase
|
9
|
+
|
10
|
+
end
|
@@ -5,11 +5,24 @@ require File.join(File.dirname(__FILE__), '..', 'lib/cliutils/ext/string_extensi
|
|
5
5
|
# Tests for the String extension methods
|
6
6
|
class TestStringExtensions < Test::Unit::TestCase
|
7
7
|
def test_custom_colors
|
8
|
-
assert_output("\e[34mtest\e[0m
|
9
|
-
assert_output("\e[36mtest\e[0m
|
10
|
-
assert_output("\e[32mtest\e[0m
|
11
|
-
assert_output("\e[35mtest\e[0m
|
12
|
-
assert_output("\e[31mtest\e[0m
|
13
|
-
assert_output("\e[
|
8
|
+
assert_output("\e[34mtest\e[0m") { print 'test'.blue }
|
9
|
+
assert_output("\e[36mtest\e[0m") { print 'test'.cyan }
|
10
|
+
assert_output("\e[32mtest\e[0m") { print 'test'.green }
|
11
|
+
assert_output("\e[35mtest\e[0m") { print 'test'.purple }
|
12
|
+
assert_output("\e[31mtest\e[0m") { print 'test'.red }
|
13
|
+
assert_output("\e[37mtest\e[0m") { print 'test'.white }
|
14
|
+
assert_output("\e[33mtest\e[0m") { print 'test'.yellow }
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_colorize
|
18
|
+
assert_output("\e[35;42mtest\e[0m") { print 'test'.colorize('35;42') }
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_camelize
|
22
|
+
assert_output('TestString') { print 'test_string'.camelize }
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_snakify
|
26
|
+
assert_output('test_string') { print 'TestString'.snakify }
|
14
27
|
end
|
15
28
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- test/hash_extensions_test.rb
|
135
135
|
- test/logger_extensions_test.rb
|
136
136
|
- test/messenging_test.rb
|
137
|
+
- test/pref_test.rb
|
137
138
|
- test/prefs_test.rb
|
138
139
|
- test/string_extesions_test.rb
|
139
140
|
- test/test_files/prefstest.yaml
|
@@ -167,6 +168,7 @@ test_files:
|
|
167
168
|
- test/hash_extensions_test.rb
|
168
169
|
- test/logger_extensions_test.rb
|
169
170
|
- test/messenging_test.rb
|
171
|
+
- test/pref_test.rb
|
170
172
|
- test/prefs_test.rb
|
171
173
|
- test/string_extesions_test.rb
|
172
174
|
- test/test_files/prefstest.yaml
|