disinnovate-greeneggs 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +75 -0
- data/Rakefile +57 -0
- data/VERSION +1 -0
- data/greeneggs.gemspec +50 -0
- data/lib/greeneggs.rb +65 -0
- data/spec/greeneggs_spec.rb +18 -0
- data/spec/spec_helper.rb +8 -0
- metadata +73 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Michael Fleet <disinnovate.com>
|
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,75 @@
|
|
1
|
+
= GreenEggs
|
2
|
+
|
3
|
+
GreenEggs is a small RedGreen-inspired plugin for Bacon.
|
4
|
+
|
5
|
+
|
6
|
+
== Requirements
|
7
|
+
|
8
|
+
* Ruby 1.8
|
9
|
+
* Bacon >= 1.0
|
10
|
+
|
11
|
+
|
12
|
+
== Installation
|
13
|
+
|
14
|
+
Using RubyGems:
|
15
|
+
(sudo) gem install greeneggs -s http://gems.github.com
|
16
|
+
|
17
|
+
Simply clone from github:
|
18
|
+
git clone git://github.com/disinnovate/greeneggs.git
|
19
|
+
|
20
|
+
Or add as a submodule to an existing git repository:
|
21
|
+
git add submodule git://github.com/disinnovate/greeneggs.git
|
22
|
+
|
23
|
+
For Ruby on Rails projects, clone to vendor/plugins/greeneggs:
|
24
|
+
git clone git://github.com/disinnovate/greeneggs.git vendor/plugins/greeneggs
|
25
|
+
git add submodule git://github.com/disinnovate/greeneggs.git vendor/plugins/greeneggs
|
26
|
+
|
27
|
+
|
28
|
+
== Usage
|
29
|
+
|
30
|
+
To use GreenEggs with Bacon[http://github.com/chneukirchen/bacon], simply <code>require 'greeneggs'</code> and you're done.
|
31
|
+
|
32
|
+
Example:
|
33
|
+
<code>
|
34
|
+
require 'bacon'
|
35
|
+
require 'greeneggs'
|
36
|
+
|
37
|
+
describe 'GreenEggs' do
|
38
|
+
it 'should display passing specs in green' do
|
39
|
+
true.should.eql? true
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should display empty specs in yellow' do
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should display err-raising specs in purple/magenta' do
|
46
|
+
raise 'this is a dummy error'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should display failed specs in red' do
|
50
|
+
should.flunk 'this is a dummy failure'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
== TODO
|
56
|
+
|
57
|
+
* Windows support
|
58
|
+
|
59
|
+
|
60
|
+
== Thanks to
|
61
|
+
|
62
|
+
* Pat Eyler (http://on-ruby.blogspot.com/) for teaching us to see in RedGreen (http://on-ruby.blogspot.com/2006/05/red-and-green-for-ruby.html).
|
63
|
+
* Christian Neukirchen (http://chneukirchen.org/) for bringing home the Bacon (http://github.com/chneukirchen/bacon).
|
64
|
+
|
65
|
+
|
66
|
+
== Links
|
67
|
+
|
68
|
+
* GreenEggs - http://github.com/disinnovate/greeneggs
|
69
|
+
* Bacon - http://github.com/chneukirchen/bacon
|
70
|
+
* Facon - http://github.com/chuyeow/facon
|
71
|
+
|
72
|
+
|
73
|
+
== Copyright
|
74
|
+
|
75
|
+
Copyright (c) 2009 Michael Fleet <disinnovate.com>. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "greeneggs"
|
8
|
+
gem.summary = %Q{GreenEggs is a small RedGreen-inspired plugin for Bacon}
|
9
|
+
gem.email = "disinnovate@gmail.com"
|
10
|
+
gem.homepage = "http://github.com/disinnovate/greeneggs"
|
11
|
+
gem.authors = ["Michael Fleet"]
|
12
|
+
gem.add_dependency('bacon', '>= 1.0')
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
24
|
+
spec.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |spec|
|
30
|
+
spec.libs << 'spec'
|
31
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
+
spec.verbose = true
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
task :rcov do
|
36
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
task :default => :spec
|
42
|
+
|
43
|
+
require 'rake/rdoctask'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
if File.exist?('VERSION.yml')
|
46
|
+
config = YAML.load(File.read('VERSION.yml'))
|
47
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
48
|
+
else
|
49
|
+
version = ""
|
50
|
+
end
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "greeneggs #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
57
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.5
|
data/greeneggs.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{greeneggs}
|
5
|
+
s.version = "0.0.5"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Michael Fleet"]
|
9
|
+
s.date = %q{2009-06-09}
|
10
|
+
s.email = %q{disinnovate@gmail.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"greeneggs.gemspec",
|
23
|
+
"lib/greeneggs.rb",
|
24
|
+
"spec/greeneggs_spec.rb",
|
25
|
+
"spec/spec_helper.rb"
|
26
|
+
]
|
27
|
+
s.has_rdoc = true
|
28
|
+
s.homepage = %q{http://github.com/disinnovate/greeneggs}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.1}
|
32
|
+
s.summary = %q{GreenEggs is a small RedGreen-inspired plugin for Bacon}
|
33
|
+
s.test_files = [
|
34
|
+
"spec/greeneggs_spec.rb",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
40
|
+
s.specification_version = 2
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_runtime_dependency(%q<bacon>, [">= 1.0"])
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<bacon>, [">= 1.0"])
|
46
|
+
end
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<bacon>, [">= 1.0"])
|
49
|
+
end
|
50
|
+
end
|
data/lib/greeneggs.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# GreenEggs -- small red/green patch for Bacon
|
2
|
+
#
|
3
|
+
# "I do not like Green Eggs and Ham." ---Sam I Am
|
4
|
+
#
|
5
|
+
# Copyright (C) 2009 Michael Fleet <disinnovate.com>
|
6
|
+
#
|
7
|
+
# GreenEggs is freely distributable under the terms of the MIT license.
|
8
|
+
# See LICENSE or http://www.opensource.org/licenses/mit-license.php for details.
|
9
|
+
|
10
|
+
module Bacon
|
11
|
+
class << self
|
12
|
+
COLORS = {
|
13
|
+
'F' => "\e[1m\e[31m", # FAILED: red
|
14
|
+
:fail => "\e[1m\e[31m", # FAILED: red
|
15
|
+
'E' => "\e[1m\e[35m", # ERROR: purple
|
16
|
+
'M' => "\e[1m\e[33m", # MISSING: yellow
|
17
|
+
:ok => "\e[1m\e[32m" # PASSED/OK: green
|
18
|
+
}
|
19
|
+
|
20
|
+
alias_method :output_handle_requirement, :handle_requirement
|
21
|
+
def handle_requirement(description)
|
22
|
+
print(colorize_requirement { output_handle_requirement(description) { yield } })
|
23
|
+
end
|
24
|
+
|
25
|
+
alias_method :output_handle_summary, :handle_summary
|
26
|
+
def handle_summary
|
27
|
+
puts(colorize_summary { output_handle_summary })
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def capture_stdout
|
32
|
+
s = StringIO.new
|
33
|
+
oldstdout = $stdout
|
34
|
+
$stdout = s
|
35
|
+
yield
|
36
|
+
s.string
|
37
|
+
ensure
|
38
|
+
$stdout = oldstdout
|
39
|
+
end
|
40
|
+
|
41
|
+
def colorize_requirement
|
42
|
+
out = capture_stdout { yield }
|
43
|
+
|
44
|
+
color = case out
|
45
|
+
when /(FAILED|ERROR|MISSING)/ then $1[0..0] # SpecDox, Tap, Knock
|
46
|
+
when /\A([FME])\Z/ then $1 # TestUnit
|
47
|
+
else :ok
|
48
|
+
end
|
49
|
+
|
50
|
+
out.sub(/^(.|(ok|not ok|-) .+)$/, colorize('\0', color))
|
51
|
+
end
|
52
|
+
|
53
|
+
def colorize_summary
|
54
|
+
line = capture_stdout { yield }
|
55
|
+
|
56
|
+
color = line.match(/0 failures, 0 errors/).nil? ? :fail : :ok
|
57
|
+
line.sub(/^.+\d+ failures, \d+ errors$/, colorize('\0', color))
|
58
|
+
end
|
59
|
+
|
60
|
+
def colorize(text, color)
|
61
|
+
"#{COLORS[color]}#{text}\e[0m"
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Greeneggs' do
|
4
|
+
it 'should display passing specs in green' do
|
5
|
+
true.should.eql? true
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should display empty specs in yellow' do
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should display err-raising specs in purple/magenta' do
|
12
|
+
raise 'this is a dummy error'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should display failed specs in red' do
|
16
|
+
should.flunk 'this is a dummy failure'
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: disinnovate-greeneggs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Fleet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-09 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bacon
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "1.0"
|
24
|
+
version:
|
25
|
+
description:
|
26
|
+
email: disinnovate@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- greeneggs.gemspec
|
42
|
+
- lib/greeneggs.rb
|
43
|
+
- spec/greeneggs_spec.rb
|
44
|
+
- spec/spec_helper.rb
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: http://github.com/disinnovate/greeneggs
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options:
|
49
|
+
- --charset=UTF-8
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 1.2.0
|
68
|
+
signing_key:
|
69
|
+
specification_version: 2
|
70
|
+
summary: GreenEggs is a small RedGreen-inspired plugin for Bacon
|
71
|
+
test_files:
|
72
|
+
- spec/greeneggs_spec.rb
|
73
|
+
- spec/spec_helper.rb
|