blink1-formatter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Atsushi Nagase
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require 'rake/testtask'
2
+ require 'rake/clean'
3
+
4
+ NAME = 'blink1-formatter'
5
+
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "blink1_formatter/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "blink1-formatter"
7
+ s.version = Blink1Formatter::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Atsushi Nagase']
10
+ s.email = ['a@ngs.io']
11
+ s.homepage = "http://github.com/ngs/blink1-formatter"
12
+ s.summary = "blink(1) RSpec formatter"
13
+ s.description = "Indicates RSpec status with blink(1)"
14
+
15
+ s.rubyforge_project = "blink1_formatter"
16
+ s.add_development_dependency 'bundler', '~> 1.0'
17
+ s.add_development_dependency 'rspec', '~> 2.11'
18
+ # s.add_development_dependency 'guard-rspec', '~> 1.2'
19
+
20
+ s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\..+$/}
21
+ s.require_paths = ["lib"]
22
+ end
23
+
data/demo.rb ADDED
@@ -0,0 +1,30 @@
1
+ require_relative 'spec/spec_helper'
2
+ require 'stringio'
3
+
4
+ describe Blink1Formatter do
5
+
6
+ before do
7
+ @output = StringIO.new
8
+ @formatter = Blink1Formatter.new(@output)
9
+ @formatter.start(2)
10
+ @example = RSpec::Core::ExampleGroup.describe.example
11
+
12
+ @samples = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
13
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
14
+
15
+ sleep(0.1) # Just to slow it down a little :-)
16
+ end
17
+
18
+ 100.times do |index|
19
+ it "should perform passing specs" do
20
+ @samples.sample.should == 0
21
+ end
22
+
23
+ it "should perform pending specs" do
24
+ if @samples.sample == 1
25
+ pending
26
+ end
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,51 @@
1
+ require 'blink1'
2
+ require "rspec/core/formatters/base_formatter"
3
+
4
+ class Blink1Formatter < RSpec::Core::Formatters::BaseFormatter
5
+
6
+ COLOR_SUCCESS = [0, 255, 35]
7
+ COLOR_PENDING = [255, 240, 6]
8
+ COLOR_FAIL = [255, 7, 29]
9
+
10
+ def example_passed(example)
11
+ unless @color
12
+ @color = COLOR_SUCCESS
13
+ update_color
14
+ end
15
+ super(example)
16
+ end
17
+
18
+ def example_pending(example)
19
+ if @color == COLOR_SUCCESS
20
+ @color = COLOR_PENDING
21
+ update_color
22
+ end
23
+ super(example)
24
+ end
25
+
26
+ def example_failed(example)
27
+ if @color != COLOR_FAIL
28
+ @color = COLOR_FAIL
29
+ update_color
30
+ end
31
+ super(example)
32
+ end
33
+
34
+ def dump_summary(duration, example_count, failure_count, pending_count)
35
+ @blink1.blink(@color[0], @color[1], @color[2], 2)
36
+ @blink1.fade_to_rgb(500, @color[0], @color[1], @color[2])
37
+ super(duration, example_count, failure_count, pending_count)
38
+ end
39
+
40
+ private
41
+
42
+ def update_color
43
+ unless @blink1
44
+ @blink1 = Blink1.new
45
+ @blink1.open
46
+ end
47
+ @blink1.fade_to_rgb(300, @color[0], @color[1], @color[2])
48
+ end
49
+
50
+
51
+ end
@@ -0,0 +1,3 @@
1
+ class Blink1Formatter
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'blink1_formatter'
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blink1-formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Atsushi Nagase
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2.11'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.11'
46
+ description: Indicates RSpec status with blink(1)
47
+ email:
48
+ - a@ngs.io
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - LICENSE
54
+ - README.rdoc
55
+ - Rakefile
56
+ - blink1-formatter.gemspec
57
+ - demo.rb
58
+ - lib/blink1_formatter.rb
59
+ - lib/blink1_formatter/version.rb
60
+ - spec/spec_helper.rb
61
+ homepage: http://github.com/ngs/blink1-formatter
62
+ licenses: []
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project: blink1_formatter
81
+ rubygems_version: 1.8.24
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: blink(1) RSpec formatter
85
+ test_files: []