Bacon_Colored 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "Bacon_Colored/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "Bacon_Colored"
7
+ s.version = Bacon_Colored::VERSION
8
+ s.authors = ["da99"]
9
+ s.email = ["i-hate-spam-45671204@mailinator.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Adds color to your spec runs.}
12
+ s.description = %q{
13
+ Adds color to your spec runs.
14
+ Inspired by GreenEggs: https://github.com/fantasticmf/greeneggs
15
+ }
16
+
17
+ s.rubyforge_project = "Bacon_Colored"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+
24
+ s.add_development_dependency 'rake'
25
+
26
+ s.add_runtime_dependency 'bacon'
27
+ s.add_runtime_dependency 'colored'
28
+
29
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in Bacon_Colored.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 da01
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = Bacon_Colored
2
+
3
+ Inspired by GreenEggs: https://github.com/fantasticmf/greeneggs
4
+
5
+ == Contributing to Bacon_Colored
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 da99. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Bacon_Colored
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,53 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #
3
+ require "Bacon_Colored/version"
4
+
5
+ unless defined?(Bacon)
6
+ require 'bacon'
7
+ end
8
+
9
+ require 'colored'
10
+
11
+ module Bacon
12
+ module SpecDoxOutput
13
+
14
+ def handle_requirement(description)
15
+ error = yield
16
+ color = case error
17
+ when 'FAILED'
18
+ :red
19
+ else
20
+ :yellow
21
+ end
22
+
23
+ mark = error.empty? ? "✓ ".green : "✗ ".send(color)
24
+ print " #{mark}#{description}"
25
+
26
+ return puts("") if error.empty?
27
+ puts " [#{error}]".send(color)
28
+ end
29
+
30
+ def handle_summary
31
+ specs, reqs, fails, errs = Counter.values_at(:specifications, :requirements, :failed, :errors)
32
+ all_pass = reqs > 1 && (fails == errs) && (errs == 0)
33
+
34
+ print ErrorLog if Backtraces
35
+
36
+ print "%d specifications (%d requirements)".send(all_pass ? :green : :to_s ) % [ specs, reqs ]
37
+
38
+ if all_pass
39
+ print( ". All pass. ".green )
40
+ else
41
+ print ", "
42
+ print "#{fails} failures".send( fails > 0 ? :red : :to_s )
43
+ print ", "
44
+ print "#{errs} errors".send( errs > 0 ? :yellow : :to_s )
45
+ print ". "
46
+ end
47
+
48
+ puts
49
+ puts
50
+ end
51
+
52
+ end # === module
53
+ end # === module
data/spec/helper.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'bacon'
11
+
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+
15
+ Bacon.summary_on_exit
data/spec/main.rb ADDED
@@ -0,0 +1,32 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #
3
+ require File.expand_path('spec/helper')
4
+ require 'Bacon_Colored'
5
+
6
+ describe "Bacon_Colored" do
7
+
8
+ before do
9
+ @run = lambda { |name|
10
+ %x! bundle exec bacon spec/tests/#{name}.rb!
11
+ }
12
+ end
13
+
14
+ it("prints green when tests pass.") {
15
+ target = "\e[32m✓ \e[0mpasses"
16
+ result = @run.call("pass")
17
+ result[ target ].should.be == target
18
+ }
19
+
20
+ it("prints red when tests fail.") {
21
+ target = "\e[31m✗ \e[0mfails\e[31m [FAILED]\e[0m"
22
+ @run.call("fail")[ target ].should == target
23
+ }
24
+
25
+ it("prints green/red when tests pass/fail.") {
26
+ out = @run.call("pass_fail")
27
+ out["\e[32m✓ \e[0mpasses"].should.not.be == nil
28
+ out["\e[31m✗ \e[0mfails\e[31m [FAILED]\e[0m"].should.not.be == nil
29
+ }
30
+
31
+ end # === describe Bacon_Colored
32
+
@@ -0,0 +1,10 @@
1
+ require File.expand_path('spec/helper')
2
+ require 'Bacon_Colored'
3
+
4
+ describe "All fail:" do
5
+
6
+ it "fails" do
7
+ true.should.be == false
8
+ end
9
+
10
+ end # === describe All fail:
@@ -0,0 +1,10 @@
1
+ require File.expand_path('spec/helper')
2
+ require 'Bacon_Colored'
3
+
4
+ describe "All true:" do
5
+
6
+ it "passes" do
7
+ true.should.be == true
8
+ end
9
+
10
+ end # === describe All true:
@@ -0,0 +1,3 @@
1
+
2
+ require File.expand_path("spec/tests/pass")
3
+ require File.expand_path("spec/tests/fail")
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Bacon_Colored
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - da99
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-12 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &8379640 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *8379640
25
+ - !ruby/object:Gem::Dependency
26
+ name: bacon
27
+ requirement: &8378960 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *8378960
36
+ - !ruby/object:Gem::Dependency
37
+ name: colored
38
+ requirement: &8378220 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *8378220
47
+ description: ! "\n Adds color to your spec runs.\n Inspired by GreenEggs: https://github.com/fantasticmf/greeneggs\n
48
+ \ "
49
+ email:
50
+ - i-hate-spam-45671204@mailinator.com
51
+ executables: []
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .document
56
+ - .gitignore
57
+ - Bacon_Colored.gemspec
58
+ - Gemfile
59
+ - LICENSE.txt
60
+ - README.rdoc
61
+ - Rakefile
62
+ - lib/Bacon_Colored.rb
63
+ - lib/Bacon_Colored/version.rb
64
+ - spec/helper.rb
65
+ - spec/main.rb
66
+ - spec/tests/fail.rb
67
+ - spec/tests/pass.rb
68
+ - spec/tests/pass_fail.rb
69
+ homepage: ''
70
+ licenses: []
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project: Bacon_Colored
89
+ rubygems_version: 1.8.11
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Adds color to your spec runs.
93
+ test_files: []