checkcheckit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README.md +13 -8
- data/bin/check +1 -3
- data/checkcheckit.gemspec +2 -0
- data/lib/checkcheckit/console.rb +49 -30
- data/lib/checkcheckit/version.rb +1 -1
- data/lib/checkcheckit.rb +1 -0
- data/test/console_test.rb +40 -4
- data/test/helper.rb +3 -3
- data/test/{results_test.rb → resume_test.rb} +15 -3
- data/test/start_test.rb +1 -1
- metadata +23 -7
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -8,15 +8,17 @@ use checklists, like a boss
|
|
8
8
|
|
9
9
|
## TODO
|
10
10
|
|
11
|
-
- option parsing
|
12
11
|
- save a run
|
13
12
|
- to file
|
14
13
|
- to service
|
15
14
|
- resume a run
|
16
|
-
- run
|
15
|
+
- run to campfire
|
16
|
+
- commands with confirmation
|
17
17
|
- saves results
|
18
|
-
-
|
19
|
-
-
|
18
|
+
- run on phone
|
19
|
+
- kick off from cmd line
|
20
|
+
- send email to self
|
21
|
+
- click on url in email in phone
|
20
22
|
|
21
23
|
## Usage
|
22
24
|
|
@@ -45,13 +47,12 @@ Everything beneath a step is that step's body or description.
|
|
45
47
|
|
46
48
|
You can go through a checklist by running `check start ` and then the checklist name.
|
47
49
|
|
48
|
-
(NIY - Not Implemented Yet)
|
49
50
|
If there are multiple checklists with the same name use the format `folder/checklist`.
|
50
51
|
|
51
|
-
When you iterate through a checklist you can just type "enter", "y", or "+" to confirm a step
|
52
|
+
When you iterate through a checklist you can just type "enter", "y", or "+" to confirm a step and "no" or "-" to
|
53
|
+
fail one.
|
52
54
|
|
53
|
-
|
54
|
-
The body of text is for describing what went wrong.
|
55
|
+
You can always enter optional notes.
|
55
56
|
|
56
57
|
For example:
|
57
58
|
|
@@ -59,19 +60,23 @@ For example:
|
|
59
60
|
|-------| Step 1: Pull everything from git
|
60
61
|
> git pull origin
|
61
62
|
Check: <enter>
|
63
|
+
Notes: <enter>
|
62
64
|
|
63
65
|
|+------| Step 2: Make sure there are no uncommitted changes
|
64
66
|
> `git status`
|
65
67
|
Check: <n>
|
68
|
+
Notes: <enter>
|
66
69
|
|
67
70
|
|+------| Step 3: Diff master with heroku/master
|
68
71
|
Make sure the change you want to push are what you're pushing
|
69
72
|
> git fetch heroku
|
70
73
|
> git diff heroku/master | $EDITOR
|
71
74
|
Check: <y>
|
75
|
+
Notes: <enter>
|
72
76
|
|
73
77
|
|+-+----| Step 4: Run the test suite
|
74
78
|
Check: failures!
|
79
|
+
Notes: <enter>
|
75
80
|
|
76
81
|
|
77
82
|
|
data/bin/check
CHANGED
data/checkcheckit.gemspec
CHANGED
data/lib/checkcheckit/console.rb
CHANGED
@@ -2,25 +2,25 @@ require 'ostruct'
|
|
2
2
|
|
3
3
|
class CheckCheckIt::Console
|
4
4
|
attr_accessor :list_dir
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :out_stream, :in_stream
|
6
6
|
|
7
7
|
def initialize(opts = {})
|
8
|
-
|
9
|
-
|
10
|
-
@list_dir = File.expand_path(default_dir)
|
11
|
-
@stream = opts[:out_stream] || STDOUT
|
12
|
-
@in_stream = opts[:in_stream] || STDIN
|
8
|
+
@out_stream = opts[:out_stream] || $stdout
|
9
|
+
@in_stream = opts[:in_stream] || $stdin
|
13
10
|
end
|
14
11
|
|
15
12
|
def puts(text = '')
|
16
|
-
@
|
13
|
+
@out_stream.puts text
|
17
14
|
end
|
18
15
|
|
19
16
|
def print(text = '')
|
20
|
-
@
|
17
|
+
@out_stream.print text
|
21
18
|
end
|
22
19
|
|
23
|
-
def run!(args)
|
20
|
+
def run!(args = [])
|
21
|
+
@options = Lucy::Goosey.parse_options(args)
|
22
|
+
@list_dir = File.expand_path(@options.fetch('home', '~/checkcheckit'))
|
23
|
+
|
24
24
|
if args.length == 0
|
25
25
|
puts "No command given"
|
26
26
|
else
|
@@ -43,16 +43,38 @@ class CheckCheckIt::Console
|
|
43
43
|
list.steps.each_with_index do |step, i|
|
44
44
|
puts "#{fmt_results(results)} Step #{i+1}: #{step.name}"
|
45
45
|
puts step.body unless step.body.empty?
|
46
|
-
print "Check: "
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
check, notes = nil
|
48
|
+
begin
|
49
|
+
print "Check: "
|
50
|
+
case input = in_stream.gets
|
51
|
+
when /^[y|+]$/ || ''
|
52
|
+
check = true
|
53
|
+
when /^[n|-]$/
|
54
|
+
check = false
|
55
|
+
else
|
56
|
+
check = true
|
57
|
+
end
|
58
|
+
|
59
|
+
if @options['notes'] || @options['n']
|
60
|
+
print "Notes: "
|
61
|
+
notes = in_stream.gets
|
62
|
+
end
|
63
|
+
rescue Interrupt => e
|
64
|
+
puts "\nGoodbye!"
|
65
|
+
exit 1
|
55
66
|
end
|
67
|
+
|
68
|
+
results[i] = {
|
69
|
+
step: i + 1,
|
70
|
+
name: step.name,
|
71
|
+
body: step.body,
|
72
|
+
check: check,
|
73
|
+
result: check ? 'CHECK' : 'FAIL',
|
74
|
+
status: check ? 1 : 0,
|
75
|
+
notes: notes
|
76
|
+
}
|
77
|
+
|
56
78
|
puts
|
57
79
|
end
|
58
80
|
|
@@ -64,22 +86,12 @@ class CheckCheckIt::Console
|
|
64
86
|
def save_results(list,results)
|
65
87
|
report = {
|
66
88
|
'list-name' => list.name,
|
67
|
-
'results' =>
|
89
|
+
'results' => results
|
68
90
|
}
|
69
|
-
list.steps.each_with_index do |step, i|
|
70
|
-
report['results'] << {
|
71
|
-
index: i,
|
72
|
-
name: step.name,
|
73
|
-
body: step.body,
|
74
|
-
result: results[i] ? 'CHECK' : 'FAIL',
|
75
|
-
status: results[i] ? 1 : 0,
|
76
|
-
}
|
77
|
-
end
|
78
|
-
report
|
79
91
|
end
|
80
92
|
|
81
93
|
def start(args)
|
82
|
-
target = args.
|
94
|
+
target = args.first
|
83
95
|
hit = Dir[dir + '/*/*'].find{ |fname| fname.include? target }
|
84
96
|
if hit
|
85
97
|
step_through_list(List.new(hit))
|
@@ -101,6 +113,13 @@ class CheckCheckIt::Console
|
|
101
113
|
|
102
114
|
private
|
103
115
|
def fmt_results(results)
|
104
|
-
|
116
|
+
keys = results.map do |result|
|
117
|
+
if result
|
118
|
+
result[:check] ? '+' : '-'
|
119
|
+
else
|
120
|
+
'.'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
"|#{keys.join}|"
|
105
124
|
end
|
106
125
|
end
|
data/lib/checkcheckit/version.rb
CHANGED
data/lib/checkcheckit.rb
CHANGED
data/test/console_test.rb
CHANGED
@@ -17,10 +17,46 @@ class ConsoleTest < CheckCheckIt::TestCase
|
|
17
17
|
dir = File.join('/foo', 'personal')
|
18
18
|
FileUtils.mkdir_p(dir)
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
check "list"
|
20
|
+
check "list --home /foo"
|
23
21
|
assert_match(/^personal\n/, output)
|
24
22
|
end
|
25
|
-
end
|
26
23
|
|
24
|
+
|
25
|
+
def test_default_no_notes
|
26
|
+
console.in_stream = MiniTest::Mock.new
|
27
|
+
console.out_stream = MiniTest::Mock.new
|
28
|
+
|
29
|
+
9.times do
|
30
|
+
console.out_stream.expect :puts, true, [String]
|
31
|
+
end
|
32
|
+
3.times do
|
33
|
+
console.out_stream.expect :print, true, ["Check: "]
|
34
|
+
end
|
35
|
+
console.in_stream.expect :gets, "n"
|
36
|
+
console.in_stream.expect :gets, "y"
|
37
|
+
console.in_stream.expect :gets, "n"
|
38
|
+
result = check "start groceries"
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_includes_notes
|
42
|
+
console.in_stream = MiniTest::Mock.new
|
43
|
+
console.out_stream = MiniTest::Mock.new
|
44
|
+
|
45
|
+
9.times do
|
46
|
+
console.out_stream.expect :puts, true, [String]
|
47
|
+
end
|
48
|
+
3.times do
|
49
|
+
console.out_stream.expect :print, true, ["Check: "]
|
50
|
+
console.out_stream.expect :print, true, ["Notes: "]
|
51
|
+
end
|
52
|
+
console.in_stream.expect :gets, "n"
|
53
|
+
console.in_stream.expect :gets, "Shit's fucked"
|
54
|
+
console.in_stream.expect :gets, "y"
|
55
|
+
console.in_stream.expect :gets, ""
|
56
|
+
console.in_stream.expect :gets, "n"
|
57
|
+
console.in_stream.expect :gets, "Really, bad"
|
58
|
+
check "start groceries --notes"
|
59
|
+
console.in_stream.verify
|
60
|
+
console.out_stream.verify
|
61
|
+
end
|
62
|
+
end
|
data/test/helper.rb
CHANGED
@@ -30,7 +30,7 @@ module ConsoleTestHelpers
|
|
30
30
|
#
|
31
31
|
# # check 'start deploy'
|
32
32
|
def check(cmd_string)
|
33
|
-
console.run! cmd_string.split
|
33
|
+
console.run! cmd_string.split(' ')
|
34
34
|
end
|
35
35
|
|
36
36
|
def reset_console
|
@@ -43,11 +43,11 @@ module ConsoleTestHelpers
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def output
|
46
|
-
console.
|
46
|
+
console.out_stream.string
|
47
47
|
end
|
48
48
|
|
49
49
|
def home
|
50
|
-
console.list_dir
|
50
|
+
console.list_dir || '~/checkcheckit'
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
@@ -1,18 +1,29 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe '
|
3
|
+
describe 'Resuming a checklist' do
|
4
4
|
def setup
|
5
5
|
super
|
6
6
|
Examples.create_grocery_list(home)
|
7
7
|
end
|
8
8
|
|
9
|
+
#TODO: verify though the console
|
10
|
+
|
9
11
|
it "should record the pass/fail of each step" do
|
10
12
|
console.in_stream = MiniTest::Mock.new
|
13
|
+
console.out_stream = MiniTest::Mock.new
|
14
|
+
|
15
|
+
9.times do
|
16
|
+
console.out_stream.expect :puts, true, [String]
|
17
|
+
end
|
18
|
+
3.times do
|
19
|
+
console.out_stream.expect :print, true, ["Check: "]
|
20
|
+
end
|
11
21
|
console.in_stream.expect :gets, "n"
|
12
22
|
console.in_stream.expect :gets, "y"
|
13
23
|
console.in_stream.expect :gets, "n"
|
14
24
|
result = check "start groceries"
|
15
25
|
console.in_stream.verify
|
26
|
+
console.out_stream.verify
|
16
27
|
result["results"][0][:result].must_equal "FAIL"
|
17
28
|
result["results"][0][:status].must_equal 0
|
18
29
|
result["results"][1][:result].must_equal "CHECK"
|
@@ -23,7 +34,7 @@ describe 'Storing Results after a run' do
|
|
23
34
|
|
24
35
|
it "should record the name of each step" do
|
25
36
|
console.in_stream = MiniTest::Mock.new
|
26
|
-
|
37
|
+
6.times { console.in_stream.expect :gets, "y" }
|
27
38
|
result = check "start groceries"
|
28
39
|
console.in_stream.verify
|
29
40
|
result["results"][0][:name].must_equal "pineapple"
|
@@ -33,7 +44,7 @@ describe 'Storing Results after a run' do
|
|
33
44
|
|
34
45
|
it "should record the body of each step" do
|
35
46
|
console.in_stream = MiniTest::Mock.new
|
36
|
-
|
47
|
+
6.times { console.in_stream.expect :gets, "y" }
|
37
48
|
result = check "start groceries"
|
38
49
|
console.in_stream.verify
|
39
50
|
=begin
|
@@ -44,3 +55,4 @@ describe 'Storing Results after a run' do
|
|
44
55
|
end
|
45
56
|
end
|
46
57
|
|
58
|
+
|
data/test/start_test.rb
CHANGED
@@ -8,7 +8,7 @@ class StartTest < CheckCheckIt::TestCase
|
|
8
8
|
|
9
9
|
def test_list_parses_steps
|
10
10
|
console.in_stream = MiniTest::Mock.new
|
11
|
-
|
11
|
+
6.times { console.in_stream.expect :gets, "y" }
|
12
12
|
result = check "start groceries"
|
13
13
|
console.in_stream.verify
|
14
14
|
end
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-12-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: lucy-goosey
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.2.0
|
14
30
|
description: Checklists like a boss
|
15
31
|
email:
|
16
32
|
- christopher.continanza@gmail.com
|
@@ -34,7 +50,7 @@ files:
|
|
34
50
|
- test/console_test.rb
|
35
51
|
- test/helper.rb
|
36
52
|
- test/list_test.rb
|
37
|
-
- test/
|
53
|
+
- test/resume_test.rb
|
38
54
|
- test/start_test.rb
|
39
55
|
homepage: ''
|
40
56
|
licenses: []
|
@@ -50,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
66
|
version: '0'
|
51
67
|
segments:
|
52
68
|
- 0
|
53
|
-
hash:
|
69
|
+
hash: -328919571766986196
|
54
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
71
|
none: false
|
56
72
|
requirements:
|
@@ -59,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
75
|
version: '0'
|
60
76
|
segments:
|
61
77
|
- 0
|
62
|
-
hash:
|
78
|
+
hash: -328919571766986196
|
63
79
|
requirements: []
|
64
80
|
rubyforge_project:
|
65
81
|
rubygems_version: 1.8.23
|
@@ -70,5 +86,5 @@ test_files:
|
|
70
86
|
- test/console_test.rb
|
71
87
|
- test/helper.rb
|
72
88
|
- test/list_test.rb
|
73
|
-
- test/
|
89
|
+
- test/resume_test.rb
|
74
90
|
- test/start_test.rb
|