checkcheckit 0.1.4 → 0.2.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/.gitignore CHANGED
@@ -19,3 +19,4 @@ bin/minitar
19
19
  bin/rdebug
20
20
  bin/turn
21
21
  test/.test.profile*
22
+ vendor
data/Gemfile CHANGED
@@ -8,4 +8,5 @@ group :test do
8
8
  gem 'fakefs'
9
9
  gem 'ruby-debug19'
10
10
  gem 'vault-test-tools', '~> 0.2.2'
11
+ gem 'rr'
11
12
  end
data/README.md CHANGED
@@ -24,10 +24,20 @@ Everything beneath a step is that step's body or description.
24
24
  work
25
25
  deploy
26
26
 
27
+ # it's all text
28
+ $ cat ~/checkcheckit/personal/groceries.md
29
+ - bacon
30
+ - eggs
31
+ - coffee
32
+ - chicken apple sausage
33
+ - avocados
34
+
27
35
  # start a list at the command line and keep it there
28
- $ check start deploy
29
- |-------| Step 1: Pull everything from git
30
- > git pull origin
36
+ $ check start groceries
37
+ |.......| Step 1: bacon
38
+ Check: <enter>
39
+
40
+ |+......| Step 2: eggs
31
41
  Check: ^C
32
42
  Goodbye!
33
43
 
@@ -67,28 +77,28 @@ You can use the `--notes` flag to enter optional notes.
67
77
  For example:
68
78
 
69
79
  $ check start deploy --notes
70
- |-------| Step 1: Pull everything from git
80
+ |.......| Step 1: Pull everything from git
71
81
  > git pull origin
72
82
  Check: <enter>
73
83
  Notes: <enter>
74
84
 
75
- |+------| Step 2: Make sure there are no uncommitted changes
85
+ |+......| Step 2: Make sure there are no uncommitted changes
76
86
  > `git status`
77
87
  Check: <n>
78
88
  Notes: <enter>
79
89
 
80
- |+------| Step 3: Diff master with heroku/master
90
+ |+-.....| Step 3: Diff master with heroku/master
81
91
  Make sure the change you want to push are what you're pushing
82
92
  > git fetch heroku
83
93
  > git diff heroku/master | $EDITOR
84
94
  Check: <y>
85
95
  Notes: <enter>
86
96
 
87
- |+-+----| Step 4: Run the test suite
97
+ |+-+....| Step 4: Run the test suite
88
98
  Check: failures!
89
99
  Notes: <enter>
90
100
 
91
- ### Live mode
101
+ ### `--live` mode
92
102
 
93
103
  This is fun.
94
104
 
@@ -34,6 +34,10 @@ class CheckCheckIt::Console
34
34
  end
35
35
  end
36
36
 
37
+ def debug?
38
+ @options['d'] || @options['debug']
39
+ end
40
+
37
41
  def start(args)
38
42
  target = args.first
39
43
  unless target
@@ -46,6 +50,7 @@ class CheckCheckIt::Console
46
50
  list = List.new(list_name)
47
51
  if (emails = @options['email']) || @options['live']
48
52
  @list_id = list_id = notify_server_of_start(emails, list)
53
+ $stderr.puts web_service_url, list_id if debug?
49
54
  url = URI.join(web_service_url, list_id)
50
55
  puts "Live at URL: #{url}"
51
56
 
@@ -92,6 +97,20 @@ class CheckCheckIt::Console
92
97
 
93
98
  check, notes = nil
94
99
  begin
100
+ step.commands.each do |command|
101
+ puts "\nRun command `#{command}`?"
102
+ print "<enter>,y,n: "
103
+ input = in_stream.gets.chomp
104
+ puts input.inspect if debug?
105
+ case input
106
+ when /^(y|)$/
107
+ puts "running `#{command}`"
108
+ system(command)
109
+ else
110
+ puts "skipping"
111
+ end
112
+ end
113
+
95
114
  print "Check: "
96
115
  case input = in_stream.gets
97
116
  when /^[y|+]$/ || ''
@@ -181,7 +200,7 @@ class CheckCheckIt::Console
181
200
  :headers => {
182
201
  'Content-Type' => 'application/json'
183
202
  })
184
- $stderr.puts response if @options['d'] || @options['debug']
203
+ $stderr.puts response if debug?
185
204
  return response.body.gsub('"','')
186
205
  rescue Excon::Errors::SocketError => e
187
206
  puts "Error connecting to #{web_service_url}"
@@ -32,13 +32,19 @@ class List
32
32
  end
33
33
 
34
34
  class Step
35
- attr_accessor :name, :body
35
+ attr_accessor :name, :body, :commands
36
36
 
37
37
  def initialize(name, body = '')
38
38
  @name = name
39
39
  @body = body
40
40
  end
41
41
 
42
+ def commands
43
+ @body.scan(/`([^`]+)`/).map do |match,_|
44
+ match
45
+ end
46
+ end
47
+
42
48
  def to_h
43
49
  {name: @name, body: @body}
44
50
  end
@@ -1,3 +1,3 @@
1
1
  module CheckCheckIt
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
data/test/console_test.rb CHANGED
@@ -39,6 +39,37 @@ class ConsoleTest < CheckCheckIt::TestCase
39
39
  result = check "start groceries"
40
40
  end
41
41
 
42
+ def test_runs_embedded_commands
43
+ # setup
44
+ dir = File.join(home, 'personal')
45
+ FileUtils.mkdir_p(dir)
46
+ File.open(File.join(dir, 'commands'), 'w') do |file|
47
+ file << "- just one command \n `git pull`"
48
+ end
49
+ console.in_stream = MiniTest::Mock.new
50
+ console.out_stream = MiniTest::Mock.new
51
+
52
+ # console iteraction
53
+ console.out_stream.expect :puts, true, ["|.| Step 1: just one command"]
54
+ console.out_stream.expect :puts, true, [" `git pull`"]
55
+ console.out_stream.expect :puts, true, ["\nRun command `git pull`?"]
56
+ console.out_stream.expect :print, true, ["<enter>,y,n: "]
57
+ console.in_stream.expect :gets, ""
58
+ console.out_stream.expect :puts, true, ["running `git pull`"]
59
+ mock(console).system("git pull") { true }
60
+ console.out_stream.expect :print, true, ["Check: "]
61
+ console.in_stream.expect :gets, ""
62
+ console.out_stream.expect :puts, true, [""]
63
+ console.out_stream.expect :puts, true, ["|+| Done"]
64
+
65
+ #assert
66
+ check "start commands"
67
+ console.in_stream.verify
68
+ console.out_stream.verify
69
+ end
70
+
71
+ # so you can use --notes and save notes with each step
72
+ # *we actually don't use this that much*
42
73
  def test_includes_notes
43
74
  Examples.create_grocery_list(home)
44
75
  console.in_stream = MiniTest::Mock.new
data/test/helper.rb CHANGED
@@ -6,6 +6,7 @@ require 'vault-test-tools'
6
6
  require 'minitest/mock'
7
7
  require 'fakefs'
8
8
  require 'checkcheckit'
9
+ require 'rr'
9
10
 
10
11
  module Examples
11
12
  def self.create_grocery_list(home)
@@ -67,4 +68,5 @@ end
67
68
  CheckCheckIt::TestCase = Class.new(Vault::TestCase)
68
69
  CheckCheckIt::Spec = Class.new(Vault::Spec)
69
70
  MiniTest::Spec.register_spec_type //, CheckCheckIt::Spec
70
- Vault::Test.include_in_all Vault::Test::EnvironmentHelpers, ConsoleTestHelpers
71
+ Vault::Test.include_in_all Vault::Test::EnvironmentHelpers, ConsoleTestHelpers, RR::Adapters::TestUnit
72
+
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.1.4
4
+ version: 0.2.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: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lucy-goosey
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -1886666442693068607
118
+ hash: -1878263409394188210
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: -1886666442693068607
127
+ hash: -1878263409394188210
128
128
  requirements: []
129
129
  rubyforge_project:
130
130
  rubygems_version: 1.8.23