Skip to content

Commit

Permalink
Updated GEM config to best practices.
Browse files Browse the repository at this point in the history
Also added travis-ci support & gemnasium.
  • Loading branch information
hopsoft committed Apr 18, 2013
1 parent 3404bc8 commit 75a698a
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 71 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.bundle
.rvmrc
doc
Gemfile.lock
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: ruby
rvm:
- "1.9.3"
- "2.0.0"
10 changes: 2 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
source :rubygems
source "https://rubygems.org"
gemspec

group :development do
# gem "awesome_print"
gem "micro_test"
gem "micro_mock"
gem "pry"
# gem "pry-stack_explorer"
end
33 changes: 0 additions & 33 deletions Gemfile.lock

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Hero

[![Dependency Status](https://gemnasium.com/hopsoft/hero.png)](https://gemnasium.com/hopsoft/hero)

![Hero GEM](http://hopsoft.github.com/hero/images/hero.jpg)

## Its a bird, its a plane, its... its... my Hero
Expand Down
11 changes: 11 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "bundler/gem_tasks"

task :default => [:test]

desc "Runs the test suite."
task :test do
ENV["TEST"] = "1"
output = `bundle exec mt`
puts output
exit output.index(/tests\sfinished.*failed/).nil?
end
33 changes: 15 additions & 18 deletions hero.gemspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
require "rake"
# -*- encoding: utf-8 -*-
require File.join(File.dirname(__FILE__), "lib", "hero", "version")

Gem::Specification.new do |spec|
spec.name = "hero"
spec.version = Hero::VERSION
spec.license = "MIT"
spec.homepage = "http://hopsoft.github.com/hero/"
spec.summary = "Think of Hero as a simplified state machine."
spec.description = <<-DESC
Simplify your app by effectively modeling business processes within it.
DESC
Gem::Specification.new do |gem|
gem.name = "hero"
gem.license = "MIT"
gem.version = Hero::VERSION
gem.authors = ["Nathan Hopkins"]
gem.email = ["natehop@gmail.com"]
gem.homepage = "http://hopsoft.github.com/hero/"
gem.summary = "Think of Hero as a simplified state machine."
gem.description = "Think of Hero as a simplified state machine."

spec.authors = ["Nathan Hopkins"]
spec.email = ["natehop@gmail.com"]
gem.files = Dir["lib/**/*.rb", "bin/*", "[A-Z]*"]
gem.test_files = Dir["test/**/*.rb"]

spec.files = FileList[
"lib/**/*.rb",
"bin/*",
"[A-Z]*",
"test/**/*.rb"
]
gem.add_development_dependency "micro_test"
gem.add_development_dependency "micro_mock"
gem.add_development_dependency "pry"
end

2 changes: 1 addition & 1 deletion lib/hero/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hero
VERSION = "0.1.7"
VERSION = "0.1.8"
end
18 changes: 9 additions & 9 deletions test/formula_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ def invoke_notify_method(name)

test "should allow unnamed Class steps" do
step = MicroMock.make
step.stub(:call) {}
step.def(:call) {}
Hero::Formula[@formula_name].add_step step
assert Hero::Formula[@formula_name].steps.map{|s| s.first}.first =~ /MicroMock/
assert Hero::Formula[@formula_name].steps.map{|s| s.last}.include?(step)
end

test "should allow named Class steps" do
step = MicroMock.make
step.stub(:call) {}
step.def(:call) {}
Hero::Formula[@formula_name].add_step :foo, step
assert Hero::Formula[@formula_name].steps.map{|s| s.first}.include?(:foo)
assert Hero::Formula[@formula_name].steps.map{|s| s.last}.include?(step)
end

test "should allow unnamed instance steps" do
step = MicroMock.make.new
step.stub(:call) {}
step.def(:call) {}
Hero::Formula[@formula_name].add_step step
names = Hero::Formula[@formula_name].steps.map{|s| s.first}
steps = Hero::Formula[@formula_name].steps.map{|s| s.last}
Expand All @@ -71,7 +71,7 @@ def invoke_notify_method(name)

test "should allow named instance steps" do
step = MicroMock.make.new
step.stub(:call) {}
step.def(:call) {}
Hero::Formula[@formula_name].add_step :foo, step
names = Hero::Formula[@formula_name].steps.map{|s| s.first}
steps = Hero::Formula[@formula_name].steps.map{|s| s.last}
Expand Down Expand Up @@ -167,7 +167,7 @@ def invoke_notify_method(name)

test "should support running step defined in a class" do
step = MicroMock.make.new
step.stub(:call) do |context, options|
step.def(:call) do |context, options|
options[:context] = context
end

Expand Down Expand Up @@ -209,8 +209,8 @@ def invoke_notify_method(name)
logger = MicroMock.make.new
logger.attr :buffer
logger.buffer = []
logger.stub(:info) { |value| buffer << value }
logger.stub(:error) { |value| buffer << value }
logger.def(:info) { |value| buffer << value }
logger.def(:error) { |value| buffer << value }
Hero.logger = logger

Hero::Formula[@formula_name].add_step(:one) { |list, opts| list << 1; opts[:step] = 1 }
Expand All @@ -231,8 +231,8 @@ def invoke_notify_method(name)
# logger.attr :buffer
# logger.attr(:info_count)
# logger.attr(:error_count)
# logger.stub(:info) { |value| buffer << value; self.info_count += 1 }
# logger.stub(:error) { |value| buffer << value; self.error_count += 1 }
# logger.def(:info) { |value| buffer << value; self.info_count += 1 }
# logger.def(:error) { |value| buffer << value; self.error_count += 1 }
# logger.buffer = []
# logger.info_count = 0
# logger.error_count = 0
Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "bundler"
Bundler.require :default, :development
require "micro_test"
require "micro_mock"

Dir[File.join(File.dirname(__FILE__), "..", "lib", "*.rb")].each do |file|
require file
Expand Down

0 comments on commit 75a698a

Please sign in to comment.