checkcheckit 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,12 +9,8 @@ class CheckCheckIt::Console
9
9
  @in_stream = opts[:in_stream] || $stdin
10
10
  end
11
11
 
12
- def puts(text = '')
13
- @out_stream.puts text
14
- end
15
-
16
- def print(text = '')
17
- @out_stream.print text
12
+ def dir
13
+ File.expand_path(@list_dir)
18
14
  end
19
15
 
20
16
  def run!(args = [])
@@ -33,10 +29,33 @@ class CheckCheckIt::Console
33
29
  end
34
30
  end
35
31
 
36
- def dir
37
- File.expand_path(@list_dir)
32
+ def start(args)
33
+ target = args.first
34
+ unless target
35
+ puts "No list given.\n\n"
36
+ list(args)
37
+ return
38
+ end
39
+ hit = Dir[dir + '/*/*'].find{ |fname| fname.include? target }
40
+ if hit
41
+ step_through_list(List.new(hit))
42
+ else
43
+ puts "Could not find checklist via: #{target}"
44
+ end
45
+ end
46
+
47
+ def list(args)
48
+ puts "# Checklists\n"
49
+ Dir[dir + '/*'].each do |dir|
50
+ top_level_dir = File.basename dir
51
+ puts top_level_dir
52
+ Dir[dir + '/*'].each do |file|
53
+ puts " " + List.new(file).name
54
+ end
55
+ end
38
56
  end
39
57
 
58
+ private
40
59
  def step_through_list(list)
41
60
  results = Array.new(list.steps.length, false)
42
61
 
@@ -62,7 +81,7 @@ class CheckCheckIt::Console
62
81
  end
63
82
  rescue Interrupt => e
64
83
  puts "\nGoodbye!"
65
- exit 1
84
+ return
66
85
  end
67
86
 
68
87
  results[i] = {
@@ -90,28 +109,6 @@ class CheckCheckIt::Console
90
109
  }
91
110
  end
92
111
 
93
- def start(args)
94
- target = args.first
95
- hit = Dir[dir + '/*/*'].find{ |fname| fname.include? target }
96
- if hit
97
- step_through_list(List.new(hit))
98
- else
99
- puts "Could not find checklist via: #{target}"
100
- end
101
- end
102
-
103
- def list(args)
104
- puts "# Checklists\n"
105
- Dir[dir + '/*'].each do |dir|
106
- team = File.basename dir
107
- puts team
108
- Dir[dir + '/*'].each do |file|
109
- puts " " + List.new(file).name
110
- end
111
- end
112
- end
113
-
114
- private
115
112
  def fmt_results(results)
116
113
  keys = results.map do |result|
117
114
  if result
@@ -122,4 +119,13 @@ class CheckCheckIt::Console
122
119
  end
123
120
  "|#{keys.join}|"
124
121
  end
122
+
123
+ def puts(text = '')
124
+ @out_stream.puts text
125
+ end
126
+
127
+ def print(text = '')
128
+ @out_stream.print text
129
+ end
130
+
125
131
  end
@@ -1,3 +1,3 @@
1
1
  module CheckCheckIt
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/test/start_test.rb CHANGED
@@ -13,7 +13,10 @@ class StartTest < CheckCheckIt::TestCase
13
13
  console.in_stream.verify
14
14
  end
15
15
 
16
- def test_list_parses_commands
16
+ def test_proper_output_on_no_args
17
+ check "start"
18
+ output.must_include "No list given"
19
+ output.must_include "groceries"
17
20
  end
18
21
 
19
22
  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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: -328919571766986196
69
+ hash: 2786592115624543553
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: -328919571766986196
78
+ hash: 2786592115624543553
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.23