speccle 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt ADDED
@@ -0,0 +1,33 @@
1
+ = Speccle =
2
+
3
+ RSpec formatter that changes the background color of the current
4
+ terminal in iTerm to match current spec state. When it starts, the
5
+ screen turns green. If any specs are pending, it turns yellow. If any
6
+ specs fail, it turns red. Colors are "sticky", so if you get a pending
7
+ after a fail the screen will stay red.
8
+
9
+ = Now With 100% More Gem Action =
10
+
11
+ sudo gem install dbrady-speccle
12
+
13
+ And now in your project folder, type speccle where you would type
14
+ spec. Speccle passes any extra arguments it is given through to spec,
15
+ so it should just work as a drop-in replacement for spec.
16
+
17
+ = Using It The Hard Way =
18
+
19
+ Here's how to include it from the command line. You can probably hook
20
+ this up from inside spec.opts, too.
21
+
22
+ Assuming $GEMDIR contains the path to your gems folder,
23
+
24
+ spec --require $GEMDIR/speccle-0.0.1/lib/iterm_color_progress_formatter.rb --format Spec::Runner::Formatter::ItermColorProgressFormatter spec
25
+
26
+ = Notes =
27
+
28
+ * This requires iTerm to work right.
29
+
30
+ * This does not check to see if you are running iTerm, so Terminal
31
+ users, YMMV. At best it will start iTerm and color it for you. More
32
+ likely it will probably just crash.
33
+
data/bin/speccle ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require "speccle"
3
+ Speccle.run ARGV
4
+
5
+
@@ -0,0 +1,60 @@
1
+ require 'rubygems'
2
+ require 'spec/runner/formatter/progress_bar_formatter'
3
+ require 'appscript'
4
+
5
+ gem 'rb-appscript', '>= 0.5.1'
6
+
7
+ module Spec
8
+ module Runner
9
+ module Formatter
10
+ class ItermColorProgressFormatter < ProgressBarFormatter
11
+ @@anything_failed_ever = false
12
+ @@anything_pended_ever = false
13
+
14
+ PASS_COLOR = [0, 16385, 0]
15
+ FAIL_COLOR = [16385, 0, 0]
16
+ PEND_COLOR = [32768, 32768, 0]
17
+
18
+ def initialize(a,b)
19
+ super
20
+ iterm = Appscript::app('iTerm')
21
+ @@term = iterm.current_terminal.sessions.get.find {|sess| sess.get == iterm.current_terminal.current_session.get }
22
+ @@original_color = @@term.background_color.get
23
+ end
24
+
25
+ def set_iterm_bg(color)
26
+ @@term.background_color.set color
27
+ end
28
+
29
+ def start_dump
30
+ # uncomment this if you don't want the final color left on the screen
31
+ # @@current_terminal.background_color.set @@original_color
32
+ super
33
+ end
34
+
35
+ def example_passed(example)
36
+ unless @@anything_pended_ever || @@anything_failed_ever
37
+ set_iterm_bg(PASS_COLOR)
38
+ end
39
+ super
40
+ end
41
+
42
+ def example_failed(example, counter, failure)
43
+ unless @@anything_failed_ever
44
+ @@anything_failed_ever = true
45
+ set_iterm_bg(FAIL_COLOR)
46
+ end
47
+ super
48
+ end
49
+
50
+ def example_pending(example, message, pending_caller)
51
+ unless @@anything_pended_ever || @@anything_failed_ever
52
+ @@anything_pended_ever = true
53
+ set_iterm_bg(PEND_COLOR)
54
+ end
55
+ super
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
data/lib/speccle.rb ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ class Speccle
4
+ def self.run(args)
5
+ args = args.map {|arg| arg =~ /\s/ ? arg.inspect : arg }
6
+ libdir = File.expand_path(File.dirname(__FILE__))
7
+ cmd = "spec --require #{libdir}/iterm_color_progress_formatter.rb --format Spec::Runner::Formatter::ItermColorProgressFormatter #{args * ' '}"
8
+ system cmd
9
+ end
10
+ end
11
+
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: speccle
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - David Brady
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-07 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Speccle - wrapper for spec that colorizes iTerm window background to reflect spec pass/pend/fail (Mac OSX only)
17
+ email: github@shinybit.com
18
+ executables:
19
+ - speccle
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.txt
24
+ files:
25
+ - bin/speccle
26
+ - lib/iterm_color_progress_formatter.rb
27
+ - lib/speccle.rb
28
+ - README.txt
29
+ has_rdoc: true
30
+ homepage: http://github.com/dbrady/speccle
31
+ licenses: []
32
+
33
+ post_install_message:
34
+ rdoc_options: []
35
+
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: "0"
43
+ version:
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ requirements: []
51
+
52
+ rubyforge_project:
53
+ rubygems_version: 1.3.5
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: wrapper for spec that colorizes iTerm window background to reflect spec pass/pend/fail (Mac OSX only)
57
+ test_files: []
58
+