keeptesting 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,8 +31,7 @@ keeptesting -p 'test' -p 'lib' -c 'Error|Failure' 'rake test' Test on changes i
31
31
  keeptesting -d 'Error|Failure' 'rake test' Store current config in .keeptesting
32
32
  keeptesting Run using .keeptesting config file
33
33
 
34
- -c, --command-line-mode Commandline mode
35
- -p, --watched-path Path to watch for changes
34
+ -p, --watched-path Path to watch for changes
36
35
  -d, --store-dotfile Save current keeptesting config in dotfile
37
36
  -h, --help Display usage
38
37
  -v, --version Display version number
@@ -47,7 +46,7 @@ def parse_options
47
46
  if ARGV.size == 0
48
47
  return YAML.load(File.read(".keeptesting"))
49
48
  end
50
-
49
+
51
50
  ARGV.each do |arg|
52
51
  if arg == "-v" || arg == "--version"
53
52
  puts Keeptesting::VERSION; exit
@@ -62,12 +61,8 @@ def parse_options
62
61
 
63
62
  options[:failure_regex] = ARGV[ARGV.size-2]
64
63
  options[:test_command] = ARGV[ARGV.size-1]
65
-
64
+
66
65
  ARGV.each_with_index do |arg, i|
67
- if arg == "-c" || arg == "--command-line-mode"
68
- options[:cli_mode] = true
69
- end
70
-
71
66
  if arg == "-p" || arg == "--watched-path"
72
67
  options[:watched_paths] ||= []
73
68
  options[:watched_paths] << ARGV[i+1]
@@ -78,20 +73,15 @@ def parse_options
78
73
  options[:watched_paths] == ["**/*"]
79
74
  end
80
75
 
81
- if ARGV.include?("-d") || ARGV.include?("--store-dotfile")
76
+ if ARGV.include?("-d") || ARGV.include?("--store-dotfile")
82
77
  File.open(".keeptesting", "w+") do |f|
83
78
  f.write(YAML::dump(options))
84
79
  end
85
80
  end
86
-
81
+
87
82
  return options
88
83
  end
89
84
 
90
85
 
91
86
  options = parse_options
92
-
93
- if options[:cli_mode]
94
- Keeptesting::CLI::start_test_loop(options)
95
- else
96
- Keeptesting::BrowserConsole.new(options)
97
- end
87
+ Keeptesting::CLI::start_test_loop(options)
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Thomas Kjeldahl Nilsson"]
9
9
  s.email = ["thomas@kjeldahlnilsson.net"]
10
10
  s.homepage = "https://github.com/thomanil/keeptesting"
11
- s.summary = %q{A stripped down CLI utility for reading tweets}
11
+ s.summary = %q{A platform/language agnostic autotest tool}
12
12
  s.description = %q{Usage: keeptesting [options] TESTCOMMAND}
13
13
 
14
14
  s.rubyforge_project = "keeptesting"
@@ -21,10 +21,9 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
23
  s.add_runtime_dependency "fssm"
24
- s.add_runtime_dependency "sinatra"
25
-
24
+
26
25
  s.add_development_dependency "mocha"
27
26
  s.add_development_dependency "minitest"
28
27
  s.add_development_dependency "shoulda"
29
- s.add_development_dependency "shoulda-context"
28
+ s.add_development_dependency "shoulda-context"
30
29
  end
@@ -1,8 +1,7 @@
1
1
  require "keeptesting/version"
2
2
  require "keeptesting/common"
3
3
  require "keeptesting/cli"
4
- require "keeptesting/browser_console"
5
4
 
6
5
  module Keeptesting
7
-
6
+
8
7
  end
@@ -8,23 +8,31 @@ module Keeptesting
8
8
  RED_TEXT="\033[31m"
9
9
  RESET_TEXT="\033[0m"
10
10
 
11
-
11
+
12
12
  def self.testrun(options)
13
13
  puts `clear`
14
14
  puts "#{YELLOW_TEXT}RUNNING TESTS...#{RESET_TEXT}"
15
-
15
+ Keeptesting::CLI::colorize_emacs_modeline("Black", "Gold")
16
+
16
17
  cmd = options[:test_command]
17
18
  test_output = `#{cmd} 2>&1`
18
19
  test_succeded = Keeptesting::Common::test_success?(test_output, options[:failure_regex])
19
20
  puts `clear`
20
21
  if test_succeded
21
22
  puts "#{GREEN_TEXT}SUCCESS!#{RESET_TEXT}\n\n\n"
23
+ Keeptesting::CLI::colorize_emacs_modeline("White", "ForestGreen")
22
24
  else
23
25
  puts "#{RED_TEXT}FAILURE!#{RESET_TEXT}\n\n\n"
26
+ Keeptesting::CLI::colorize_emacs_modeline("White", "Firebrick")
24
27
  end
25
28
 
26
29
  puts test_output
27
- end
30
+ end
31
+
32
+ def self.colorize_emacs_modeline(fg, bg)
33
+ #TODO only run if emacsclient exists
34
+ %x{emacsclient --eval "(set-face-attribute 'mode-line nil :background \\"#{bg}\\" :foreground \\"#{fg}\\")"}
35
+ end
28
36
 
29
37
  def self.start_test_loop(options)
30
38
  Keeptesting::CLI::testrun(options)
@@ -38,6 +46,6 @@ module Keeptesting
38
46
  end
39
47
  end
40
48
  end
41
-
49
+
42
50
  end
43
51
  end
@@ -1,3 +1,3 @@
1
1
  module Keeptesting
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
data/todo.org CHANGED
@@ -1,24 +1,28 @@
1
- * improve web console
2
- ** show error when backend is down
3
- ** stop sinatra from dumping internal stuff to stdout
4
- ** make sure it looks ok in IE6,7,8
5
- ** test offline, add local copy of jquery, cut cdn dep
6
- * swap out fssm w/ guard/listen
7
- ** fssm is dead!
1
+ * depend on onchange for monitoring/running tests?
2
+ reuse options etc, just add a few params?
8
3
  * fix cli interface
4
+ ** simplify usage?
9
5
  ** handle multiple options on same dash (-cd..)
6
+ ** handle multiple paths
7
+ ** only call emacsclient if present on system
10
8
  ** if no paths given, use */** by default
11
- ** ... test more combinations of options
12
- * test that everything works x-platform
9
+ ** make sure it doesnt die on exceptions/failures
10
+ ** test more combinations of options
11
+ * what happens if new run starts before last finished?
13
12
  * final code cleanup
14
13
  ** add tests?
15
- ** make super easy to follow structure
14
+ * test that everything works x-platform
15
+ mac, linux
16
16
  * proper documentation
17
17
  ** great readme
18
- *** redgreen nice-typeface logo
19
-
20
18
  *** screenshots
21
- *** link to screencast (if not embeddable in markdown)
22
19
  *** user documentation
23
- *** call for pull requests + developer guideline/doc
20
+ * gpl 3
24
21
  * release 1.0
22
+ ** blog about it
23
+ "keeptesting: how to auto-test anything"
24
+
25
+ "I regularly use TDD for development, and when I do so I enjoy
26
+ autotesting. Don't want to use different tools for each
27
+ language/platform, scenario, since underlying process is the same:
28
+ run tests from shell, run on each file change, react to change to/from test failure"
metadata CHANGED
@@ -1,90 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: keeptesting
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Thomas Kjeldahl Nilsson
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-26 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-05-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: fssm
16
- requirement: &17940780 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: *17940780
25
- - !ruby/object:Gem::Dependency
26
- name: sinatra
27
- requirement: &17940360 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
28
24
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
33
32
  type: :runtime
34
- prerelease: false
35
- version_requirements: *17940360
36
- - !ruby/object:Gem::Dependency
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
37
35
  name: mocha
38
- requirement: &17939940 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
44
46
  type: :development
45
- prerelease: false
46
- version_requirements: *17939940
47
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
48
49
  name: minitest
49
- requirement: &17939520 !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
50
52
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
55
60
  type: :development
56
- prerelease: false
57
- version_requirements: *17939520
58
- - !ruby/object:Gem::Dependency
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
59
63
  name: shoulda
60
- requirement: &17905340 !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
61
66
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
66
74
  type: :development
67
- prerelease: false
68
- version_requirements: *17905340
69
- - !ruby/object:Gem::Dependency
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
70
77
  name: shoulda-context
71
- requirement: &17904920 !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
72
80
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
77
88
  type: :development
78
- prerelease: false
79
- version_requirements: *17904920
80
- description: ! 'Usage: keeptesting [options] TESTCOMMAND'
81
- email:
89
+ version_requirements: *id005
90
+ description: "Usage: keeptesting [options] TESTCOMMAND"
91
+ email:
82
92
  - thomas@kjeldahlnilsson.net
83
- executables:
93
+ executables:
84
94
  - keeptesting
85
95
  extensions: []
96
+
86
97
  extra_rdoc_files: []
87
- files:
98
+
99
+ files:
88
100
  - .gitignore
89
101
  - Gemfile
90
102
  - README.md
@@ -99,30 +111,38 @@ files:
99
111
  - test/test_helper.rb
100
112
  - test/test_keeptesting.rb
101
113
  - todo.org
102
- - webconsole.html
103
- - webconsole.rb
104
114
  homepage: https://github.com/thomanil/keeptesting
105
115
  licenses: []
116
+
106
117
  post_install_message:
107
118
  rdoc_options: []
108
- require_paths:
119
+
120
+ require_paths:
109
121
  - lib
110
- required_ruby_version: !ruby/object:Gem::Requirement
122
+ required_ruby_version: !ruby/object:Gem::Requirement
111
123
  none: false
112
- requirements:
113
- - - ! '>='
114
- - !ruby/object:Gem::Version
115
- version: '0'
116
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
132
  none: false
118
- requirements:
119
- - - ! '>='
120
- - !ruby/object:Gem::Version
121
- version: '0'
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ hash: 3
137
+ segments:
138
+ - 0
139
+ version: "0"
122
140
  requirements: []
141
+
123
142
  rubyforge_project: keeptesting
124
- rubygems_version: 1.8.15
143
+ rubygems_version: 1.8.25
125
144
  signing_key:
126
145
  specification_version: 3
127
- summary: A stripped down CLI utility for reading tweets
146
+ summary: A platform/language agnostic autotest tool
128
147
  test_files: []
148
+
@@ -1,89 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
6
- <title>Keeptesting</title>
7
- </head>
8
- <body class="yellow">
9
-
10
- <style>
11
- .red {
12
- background-color: #FF3B3B;
13
- }
14
- .green {
15
- background-color: #3BFF3E;
16
- }
17
- .yellow {
18
- background-color: #FFCB3B;
19
- }
20
- h1 {
21
- -webkit-border-radius: 7px;
22
- -moz-border-radius: 7px;
23
- border-radius: 7px;
24
- background-color: white;
25
- margin: 50px 50px 50px 50px;
26
- padding: 20px 20px 20px 20px;
27
- background-color: white;
28
- background-color: rgba(255,255,255,0.7);
29
- font-family: Helvetica, Georgia;
30
- }
31
- #test-output {
32
- -webkit-border-radius: 7px;
33
- -moz-border-radius: 7px;
34
- border-radius: 7px;
35
- margin: 50px 50px 50px 50px;
36
- padding: 20px 20px 20px 20px;
37
- background-color: white;
38
- background-color: rgba(255,255,255,0.7);
39
- font-family: sans-serif;
40
- }
41
- </style>
42
-
43
- <h1>Starting</h1>
44
-
45
- <div id="test-output">
46
- Waiting for first test result...
47
- <div>
48
-
49
-
50
- <script>
51
- var showLastTest = function(){
52
- $.get("/latest-test-json", function(data) {
53
- var header = $("h1");
54
- var last_test = data;
55
- var test_output_div = $("#test-output");
56
- var body = $("body")
57
- var result = last_test.result;
58
-
59
- header.html(result);
60
- var test_output = last_test.output;
61
- test_output_div.html("<pre>"+test_output+"</pre");
62
-
63
- body.removeClass("red green yellow")
64
-
65
- if(result.match(/Success/)){
66
- body.addClass("green");
67
- }
68
-
69
- if(result.match(/Failure/)){
70
- body.addClass("red");
71
- }
72
-
73
- if(result.match(/Running/)){
74
- body.addClass("yellow");
75
- test_output_div.html("Waiting for result...");
76
- }
77
-
78
- }, "json");
79
- };
80
-
81
- $(document).ready(function(){
82
- setInterval(showLastTest, 300);
83
- });
84
- </script>
85
-
86
-
87
-
88
- </body>
89
- </html>
@@ -1,16 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rubygems'
3
- require 'sinatra'
4
- require 'keeptesting'
5
- require 'json'
6
-
7
- get '/' do
8
- html_path = File.dirname(__FILE__) + '/webconsole.html'
9
- file = File.open(html_path, "rb")
10
- markup = file.read
11
- end
12
-
13
- get '/latest-test-json' do
14
- @result, @output = Keeptesting::BrowserConsole.retrieve_last_test_summary
15
- {:result => @result, :output => @output}.to_json
16
- end