jstdutil 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Description goes here.
4
4
 
5
- == Note on Patches/Pull Requests
5
+ == Note on Patches/Merge Requests
6
6
 
7
7
  * Fork the project.
8
8
  * Make your feature addition or bug fix.
@@ -11,7 +11,7 @@ Description goes here.
11
11
  * Commit, do not mess with rakefile, version, or history.
12
12
  (if you want to have your own version, that is fine but
13
13
  bump version in a commit by itself I can ignore when I pull)
14
- * Send me a pull request. Bonus points for topic branches.
14
+ * Send me a merge request. Bonus points for topic branches.
15
15
 
16
16
  == Copyright
17
17
 
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/cjohansen/jstdutil"
12
12
  gem.authors = ["Christian Johansen"]
13
13
  gem.rubyforge_project = "jstdutil"
14
- gem.add_development_dependency "thoughtbot-shoulda"
14
+ gem.add_development_dependency "shoulda"
15
15
  gem.add_dependency "watchr"
16
16
  gem.add_dependency "rake"
17
17
  gem.executables = ["jstestdriver", "jsautotest"]
@@ -21,8 +21,9 @@ begin
21
21
  Jeweler::RubyforgeTasks.new do |rubyforge|
22
22
  rubyforge.doc_task = "rdoc"
23
23
  end
24
- rescue LoadError
24
+ rescue LoadError => e
25
25
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
26
+ puts e.message
26
27
  end
27
28
 
28
29
  require 'rake/testtask'
data/TODO.org ADDED
@@ -0,0 +1,7 @@
1
+ #+SEQ_TODO: TODO INPR DONE
2
+
3
+ * TODO Catch exceptions and quit cleanly
4
+ * TODO Print results from jstestdriver in real-time from jsautotest
5
+ * TODO Don't stop the server if the current instance didn't start it
6
+ * TODO Add some tests to autotest and test runner
7
+ * TODO Catch errors caused by JsTestDriver picking up temp files such as #file.js#
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/bin/jsautotest CHANGED
@@ -7,5 +7,4 @@ begin
7
7
  rescue StandardError => err
8
8
  puts "An error occurred"
9
9
  puts err.message
10
- raise err
11
10
  end
@@ -6,7 +6,6 @@ rescue NameError
6
6
  # PLATFORM is not defined, not a problem on windows.
7
7
  # On other platforms we don't care
8
8
  end
9
-
10
9
  module Jstdutil
11
10
  class RedGreen
12
11
  # Borrowed from the ruby redgreen gem
@@ -29,8 +28,12 @@ module Jstdutil
29
28
  # colors. Returns report with encoded colors.
30
29
  #
31
30
  def self.format(report)
31
+ return "" if report.nil?
32
+
32
33
  report.split("\n").collect do |line|
33
- if line =~ /Passed: \d+; Fails: (\d+); Errors:? (\d+)/
34
+ if line =~ /Passed: 0; Fails: 0; Errors:? 0/
35
+ Color.yellow(line)
36
+ elsif line =~ /Passed: \d+; Fails: (\d+); Errors:? (\d+)/
34
37
  Color.send($1.to_i + $2.to_i != 0 ? :red : :green, line)
35
38
  elsif line =~ /^[\.EF]+$/
36
39
  line.gsub(/\./, Color.green(".")).gsub(/F/, Color.red("F")).gsub("E", Color.yellow("E"))
@@ -8,9 +8,7 @@ module Jstdutil
8
8
  class TestRunner
9
9
  def initialize(args = [])
10
10
  @args = strip_opt(args.join(" "), "tests")
11
- config = @args.scan(/--config\s+([^\s]+)/).flatten
12
- config = config.first || File.expand_path("jsTestDriver.conf")
13
- config = JsTestDriver::Config.new(config)
11
+ config = guess_config
14
12
 
15
13
  if config && config.server
16
14
  @server = JsTestDriver::Server.new(config, args({}, ["port"]).join(" "))
@@ -46,6 +44,23 @@ module Jstdutil
46
44
  end
47
45
 
48
46
  private
47
+ def guess_config
48
+ config = @args.scan(/--config\s+([^\s]+)/).flatten
49
+ config = config.first || File.expand_path("jsTestDriver.conf")
50
+
51
+ if !File.exists?(config)
52
+ config = Dir.glob("**/jstestdriver*.conf", File::FNM_CASEFOLD)
53
+ puts "Using config file #{config[0]}" if config.length > 0
54
+ config = config.length > 0 ? File.expand_path(config[0]) : nil
55
+ end
56
+
57
+ raise ArgumentError.new("Unable to guess JsTestDriver config file, please name it jstestdriver*.conf or provide the --config option") if config.nil?
58
+
59
+ @args.sub!(/(--config\s+[^\s]+)?/, "--config #{config}")
60
+
61
+ JsTestDriver::Config.new(config)
62
+ end
63
+
49
64
  def args(add = {}, remove = [])
50
65
  args = @args
51
66
  (remove + add.keys).uniq.each { |opt| args = strip_opt(args, opt) }
data/lib/jstdutil.rb CHANGED
@@ -31,7 +31,6 @@ module Jstdutil
31
31
  begin
32
32
  `java -jar #{jar} #{args}`
33
33
  rescue Exception
34
- puts "I N T E R R U P T"
35
34
  end
36
35
  end
37
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstdutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Johansen
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 +01:00
12
+ date: 2009-11-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: thoughtbot-shoulda
16
+ name: shoulda
17
17
  type: :development
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,6 +56,7 @@ files:
56
56
  - LICENSE
57
57
  - README.rdoc
58
58
  - Rakefile
59
+ - TODO.org
59
60
  - VERSION
60
61
  - bin/jsautotest
61
62
  - bin/jstestdriver