diff --git a/.gitignore b/.gitignore index 560d1a6..d87d4be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,12 @@ *.rbc .bundle .config -coverage +.yardoc +Gemfile.lock InstalledFiles +_yardoc +coverage +doc/ lib/bundler/man pkg rdoc @@ -11,8 +15,3 @@ spec/reports test/tmp test/version_tmp tmp - -# YARD artifacts -.yardoc -_yardoc -doc/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..87822e6 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in rspec-rainbow.gemspec +gemspec diff --git a/README.md b/README.md index 3ece6b8..dc5e790 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ -rspec-rainbow -============= +# Rspec::Rainbow + +TODO: Write a gem description + +## Installation + +Add this line to your application's Gemfile: + + gem 'rspec-rainbow' + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install rspec-rainbow + +## Usage + +TODO: Write usage instructions here + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..2995527 --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +require "bundler/gem_tasks" diff --git a/lib/rainbow.rb b/lib/rainbow.rb new file mode 100644 index 0000000..6b88d0f --- /dev/null +++ b/lib/rainbow.rb @@ -0,0 +1,24 @@ +require 'rspec/core/formatters/base_text_formatter' + +class Rainbow < ::RSpec::Core::Formatters::BaseTextFormatter + def initialize(options) + @colors = (31..36).to_a + @color_index = 0 + super(options) + end + + def rainbow + @color_index == (@colors.size - 1) ? @color_index = 0 : @color_index += 1 + @colors[@color_index] + end + + def color(text, color_code) + colorize(text, rainbow) + end + + def color_code_for(code_or_symbol) + return code_or_symbol if code_or_symbol.is_a?(Integer) + super + end + +end diff --git a/rspec-rainbow.gemspec b/rspec-rainbow.gemspec new file mode 100644 index 0000000..b77f0c9 --- /dev/null +++ b/rspec-rainbow.gemspec @@ -0,0 +1,24 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +Gem::Specification.new do |spec| + spec.name = "rspec-rainbow" + spec.version = "0.0.1" + spec.authors = ["Mike Coutermarsh"] + spec.email = ["coutermarsh.mike@gmail.com"] + spec.description = %q{TODO: Write a gem description} + spec.summary = %q{TODO: Write a gem summary} + spec.homepage = "https://github.com/mscoutermarsh/rspec-rainbow" + spec.license = "MIT" + + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_dependency 'rspec', ['>= 2.14.0', '< 3.1.0'] + + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" +end