keeptesting 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -42,7 +42,7 @@ INSTALL:
42
42
  TODO:
43
43
  =====
44
44
 
45
-
45
+ (See todo.org)
46
46
 
47
47
 
48
48
  LICENSE:
data/bin/keeptesting CHANGED
@@ -4,21 +4,68 @@ require "keeptesting"
4
4
  require "optparse"
5
5
  require 'fssm'
6
6
 
7
+
8
+
9
+ def usage
10
+ <<USAGE
11
+
12
+ Usage: keeptesting [options] 'FAILURE-MATCHING-REGEX' 'TEST-COMMAND'
13
+
14
+ Run tests whenever files change in the current directory or subdirectories.
15
+
16
+ Spits back indication of test success or failure, based on specified regex
17
+ that detects errors/failures in the output of a test run.
18
+ Starts embedded webserver by default, letting you see test feedback in browser
19
+ window. Can also run in the command line.
20
+
21
+ Note: Be sure to use quotes around params like the examples!
22
+
23
+ Examples:
24
+
25
+ keeptesting 'Error|Failure' 'rake test' (Run tests whenever anything changes)
26
+ keeptesting -p 'test' -p 'lib' -c 'Error|Failure' 'rake test' (Test on changes in test/ or lib/)
27
+
28
+ -c, --command-line-mode Commandline mode
29
+ -p, --watched-path Path to watch for changes
30
+ -h, --help Display usage
31
+ -v, --version Display version number
32
+
33
+ USAGE
34
+ end
35
+
36
+
37
+
7
38
  def parse_options
8
39
  options = {}
9
-
10
- OptionParser.new do |o|
11
- o.banner = "Usage: keeptesting [options] -f 'FAILURE-MATCHING-REGEX' -t 'TEST-COMMAND'\n\n"
12
40
 
13
- o.on("-f F", "--failure-matching-regex", "A regex that matches failing tests") { |f| options[:failure_regex] = f }
14
- o.on("-t T", "--test-command", "Command to start your test(s)") { |t| options[:test_command] = t }
41
+ ARGV.each do |arg|
42
+ if arg == "-v" || arg == "--version"
43
+ puts Keeptesting::VERSION; exit
44
+ elsif arg == "-h" || arg == "--help"
45
+ puts usage; exit
46
+ end
47
+ end
48
+
49
+ if ARGV.size < 2
50
+ puts usage; exit
51
+ end
15
52
 
16
- o.on("-c", "--command-line-mode", "Get test feedback in terminal") { options[:cli_mode] = true}
53
+ options[:failure_regex] = ARGV[ARGV.size-2]
54
+ options[:test_command] = ARGV[ARGV.size-1]
55
+
56
+ ARGV.each_with_index do |arg, i|
57
+ if arg == "-c" || arg == "--command-line-mode"
58
+ options[:cli_mode] = true
59
+ end
17
60
 
18
- o.on("-h", "--help", "Help page") { puts o; exit }
19
- o.on("-v", "--version", "Print version number") { |b| puts Keeptesting::VERSION; exit }
61
+ if arg == "-p" || arg == "--watched-path"
62
+ options[:watched_paths] ||= []
63
+ options[:watched_paths] << ARGV[i+1]
64
+ end
65
+ end
20
66
 
21
- o.parse!
67
+ if !options[:watched_paths]
68
+ options[:watched_paths] == ["**/*"]
22
69
  end
23
70
 
24
71
  return options
@@ -27,14 +74,8 @@ end
27
74
 
28
75
  options = parse_options
29
76
 
30
- if !options[:failure_regex] || !options[:test_command]
31
- puts "ERROR: missing args!" # TODO do this in optionsparse step above
32
- end
33
-
34
77
  if options[:cli_mode]
35
78
  Keeptesting::CLI::start_test_loop(options)
36
79
  else
37
80
  Keeptesting::BrowserConsole.new(options)
38
81
  end
39
-
40
-
@@ -47,10 +47,14 @@ module Keeptesting
47
47
  Thread.new do
48
48
  console = self
49
49
  console.testrun(options)
50
- FSSM.monitor('.', '**/*') do
51
- update {|base, relative| console.testrun(options)}
52
- delete {|base, relative| console.testrun(options)}
53
- create {|base, relative| console.testrun(options)}
50
+ FSSM.monitor do
51
+ options[:watched_paths].each do |watched_path|
52
+ path watched_path do
53
+ update {|base, relative| console.testrun(options)}
54
+ delete {|base, relative| console.testrun(options)}
55
+ create {|base, relative| console.testrun(options)}
56
+ end
57
+ end
54
58
  end
55
59
  end
56
60
  end
@@ -28,11 +28,16 @@ module Keeptesting
28
28
 
29
29
  def self.start_test_loop(options)
30
30
  Keeptesting::CLI::testrun(options)
31
- FSSM.monitor('.', '**/*') do
32
- update {|base, relative| Keeptesting::CLI::testrun(options)}
33
- delete {|base, relative| Keeptesting::CLI::testrun(options)}
34
- create {|base, relative| Keeptesting::CLI::testrun(options)}
31
+ FSSM.monitor do
32
+ options[:watched_paths].each do |watched_path|
33
+ path watched_path do
34
+ update {|base, relative| Keeptesting::CLI::testrun(options)}
35
+ delete {|base, relative| Keeptesting::CLI::testrun(options)}
36
+ create {|base, relative| Keeptesting::CLI::testrun(options)}
37
+ end
38
+ end
35
39
  end
36
40
  end
41
+
37
42
  end
38
43
  end
@@ -1,3 +1,3 @@
1
1
  module Keeptesting
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
-
4
3
  class CalculatorTest < Test::Unit::TestCase
5
4
  context "a calculator" do
6
5
  should "add two numbers for the sum" do
data/todo.org CHANGED
@@ -1,22 +1,17 @@
1
- * improve web console
2
- handle situation where test fails before have a time to get output?
3
- raise error out side method def
4
- what happens?
5
- blank output in web
6
- show error when backend is down
7
- prettier html output
8
- less chatty communication w. server, use websockets?
9
1
  * improve overall interface
10
- support simplified usage: keeptesting REGEX TEST_CMD
11
- set defaults for common test frameworks
12
- add options to constrain/exclude filetypes and paths
13
- .keeptesting
14
- enable dotfile for standard options
15
- can just start with keeptesting w/o options
2
+ ** .keeptesting
3
+ *** enable dotfile for standard options
4
+ *** can just start with keeptesting w/o options
5
+ * swap out fssm w/ guard/listen
6
+ ** fssm is dead!
7
+ * improve web console
8
+ ** show error when backend is down
9
+ ** prettier html output
10
+ ** less chatty communication w. server, use websockets?
16
11
  * test that everything works x-platform
17
12
  * create proper documentation
18
- website
19
- great readme page with screencaptures and workflow examples
20
- screencast
21
- blog post - release announcement
13
+ ** website
14
+ ** great readme page with screencaptures and workflow examples
15
+ ** screencast
16
+ ** blog post - release announcement
22
17
  * release 1.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keeptesting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: OptionParser
16
- requirement: &17845380 !ruby/object:Gem::Requirement
16
+ requirement: &24000840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17845380
24
+ version_requirements: *24000840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fssm
27
- requirement: &17844900 !ruby/object:Gem::Requirement
27
+ requirement: &24000300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *17844900
35
+ version_requirements: *24000300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &17844460 !ruby/object:Gem::Requirement
38
+ requirement: &23999780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *17844460
46
+ version_requirements: *23999780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &17844020 !ruby/object:Gem::Requirement
49
+ requirement: &23999360 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *17844020
57
+ version_requirements: *23999360
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: shoulda
60
- requirement: &17843600 !ruby/object:Gem::Requirement
60
+ requirement: &23998820 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *17843600
68
+ version_requirements: *23998820
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
- requirement: &17843160 !ruby/object:Gem::Requirement
71
+ requirement: &23998240 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *17843160
79
+ version_requirements: *23998240
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shoulda-context
82
- requirement: &17842740 !ruby/object:Gem::Requirement
82
+ requirement: &23997800 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *17842740
90
+ version_requirements: *23997800
91
91
  description: ! 'Usage: keeptesting [options] TESTCOMMAND'
92
92
  email:
93
93
  - thomas@kjeldahlnilsson.net