checkcheckit 0.4.0 → 0.5.0
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.
- data/checkcheckit.gemspec +1 -0
- data/lib/checkcheckit/console.rb +8 -6
- data/lib/checkcheckit/version.rb +1 -1
- data/test/console_test.rb +11 -8
- metadata +20 -4
data/checkcheckit.gemspec
CHANGED
data/lib/checkcheckit/console.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'uri'
|
3
|
+
require 'colored'
|
3
4
|
|
4
5
|
# Uses the "big bowl of pudding' architecture
|
5
6
|
class CheckCheckIt::Console
|
@@ -22,7 +23,7 @@ class CheckCheckIt::Console
|
|
22
23
|
@list_dir = File.expand_path(@options.fetch('home', '~/checkcheckit'))
|
23
24
|
|
24
25
|
if args.length == 0
|
25
|
-
puts "No command given"
|
26
|
+
puts "No command given".red
|
26
27
|
else
|
27
28
|
method = args.shift
|
28
29
|
if respond_to? method
|
@@ -96,22 +97,23 @@ class CheckCheckIt::Console
|
|
96
97
|
results = Array.new(list.steps.length, false)
|
97
98
|
|
98
99
|
list.steps.each_with_index do |step, i|
|
99
|
-
|
100
|
+
header = "Step #{i+1}"
|
101
|
+
puts "#{fmt_results(results)} #{header}: #{step.name.bold}"
|
100
102
|
puts step.body unless step.body.empty?
|
101
103
|
|
102
104
|
check, notes = nil
|
103
105
|
begin
|
104
106
|
step.commands.each do |command|
|
105
|
-
puts "\nRun command `#{command}`?"
|
107
|
+
puts "\nRun command `#{command.white}`?"
|
106
108
|
print "<enter>,y,n: "
|
107
109
|
input = in_stream.gets.chomp
|
108
110
|
puts input.inspect if debug?
|
109
111
|
case input
|
110
112
|
when /^(y|)$/
|
111
|
-
puts "running..."
|
113
|
+
puts "running...".green
|
112
114
|
system(command)
|
113
115
|
else
|
114
|
-
puts "skipping"
|
116
|
+
puts "skipping".red
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
@@ -165,7 +167,7 @@ class CheckCheckIt::Console
|
|
165
167
|
def fmt_results(results)
|
166
168
|
keys = results.map do |result|
|
167
169
|
if result
|
168
|
-
result[:check] ? '+' : '-'
|
170
|
+
result[:check] ? '+'.green : '-'.red
|
169
171
|
else
|
170
172
|
'.'
|
171
173
|
end
|
data/lib/checkcheckit/version.rb
CHANGED
data/test/console_test.rb
CHANGED
@@ -50,17 +50,17 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
50
50
|
console.out_stream = MiniTest::Mock.new
|
51
51
|
|
52
52
|
# console iteraction
|
53
|
-
console.out_stream.expect :puts, true, ["|.| Step 1: just one command"]
|
53
|
+
console.out_stream.expect :puts, true, ["|.| Step 1: #{'just one command'.bold}"]
|
54
54
|
console.out_stream.expect :puts, true, [" `git pull`"]
|
55
|
-
console.out_stream.expect :puts, true, ["\nRun command
|
55
|
+
console.out_stream.expect :puts, true, ["\nRun command `#{'git pull'.white}`?"]
|
56
56
|
console.out_stream.expect :print, true, ["<enter>,y,n: "]
|
57
57
|
console.in_stream.expect :gets, ""
|
58
|
-
console.out_stream.expect :puts, true, ["running..."]
|
58
|
+
console.out_stream.expect :puts, true, ["running...".green]
|
59
59
|
mock(console).system("git pull") { true }
|
60
60
|
console.out_stream.expect :print, true, ["Check: "]
|
61
61
|
console.in_stream.expect :gets, ""
|
62
62
|
console.out_stream.expect :puts, true, [""]
|
63
|
-
console.out_stream.expect :puts, true, ["
|
63
|
+
console.out_stream.expect :puts, true, ["|#{'+'.green}| Done"]
|
64
64
|
|
65
65
|
#assert
|
66
66
|
check "start commands"
|
@@ -76,7 +76,7 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
76
76
|
console.out_stream = MiniTest::Mock.new
|
77
77
|
|
78
78
|
#check 1
|
79
|
-
console.out_stream.expect :puts, true, ["|...| Step 1: pineapple"]
|
79
|
+
console.out_stream.expect :puts, true, ["|...| Step 1: #{'pineapple'.bold}"]
|
80
80
|
console.out_stream.expect :print, true, ["Check: "]
|
81
81
|
console.in_stream.expect :gets, "n"
|
82
82
|
|
@@ -86,7 +86,8 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
86
86
|
console.out_stream.expect :puts, true, ['']
|
87
87
|
|
88
88
|
#check 2
|
89
|
-
|
89
|
+
progress = '|' + '-'.red + '..|'
|
90
|
+
console.out_stream.expect :puts, true, ["#{progress} Step 2: #{'mangoes'.bold}"]
|
90
91
|
console.out_stream.expect :puts, true, [String]
|
91
92
|
console.out_stream.expect :print, true, ["Check: "]
|
92
93
|
console.in_stream.expect :gets, "y"
|
@@ -97,7 +98,8 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
97
98
|
console.out_stream.expect :puts, true, ['']
|
98
99
|
|
99
100
|
# NO FUDGE FOR YOU
|
100
|
-
|
101
|
+
progress = '|' + '-'.red + '+'.green + '.|'
|
102
|
+
console.out_stream.expect :puts, true, ["#{progress} Step 3: #{'fudge'.bold}"]
|
101
103
|
console.out_stream.expect :puts, true, [String]
|
102
104
|
console.out_stream.expect :print, true, ["Check: "]
|
103
105
|
console.in_stream.expect :gets, "n"
|
@@ -107,7 +109,8 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
107
109
|
console.in_stream.expect :gets, "Tasty"
|
108
110
|
console.out_stream.expect :puts, true, ['']
|
109
111
|
|
110
|
-
|
112
|
+
progress = '|' + '-'.red + '+'.green + '-'.red + '|'
|
113
|
+
console.out_stream.expect :puts, true, ["#{progress} Done"]
|
111
114
|
|
112
115
|
check "start groceries --notes"
|
113
116
|
console.in_stream.verify
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkcheckit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lucy-goosey
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: colored
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Checklists like a boss
|
63
79
|
email:
|
64
80
|
- christopher.continanza@gmail.com
|
@@ -101,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
117
|
version: '0'
|
102
118
|
segments:
|
103
119
|
- 0
|
104
|
-
hash:
|
120
|
+
hash: -2235224873951287033
|
105
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
122
|
none: false
|
107
123
|
requirements:
|
@@ -110,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
126
|
version: '0'
|
111
127
|
segments:
|
112
128
|
- 0
|
113
|
-
hash:
|
129
|
+
hash: -2235224873951287033
|
114
130
|
requirements: []
|
115
131
|
rubyforge_project:
|
116
132
|
rubygems_version: 1.8.23
|