Permalink
Browse files

Merge pull request #1 from mrflip/master

Made the support files (gemspec, Gemfile, etc) look like goliath's)
  • Loading branch information...
2 parents 89aab31 + cdd0287 commit 72d8c75efc7e7e4e706a19b9e4df2127a8ffbae1 @igrigorik igrigorik committed Jul 6, 2012
Showing with 132 additions and 21 deletions.
  1. +15 −0 Gemfile
  2. +20 −0 Guardfile
  3. +27 −2 Rakefile
  4. +44 −15 goliath-contrib.gemspec
  5. +1 −4 lib/goliath/contrib.rb
  6. +5 −0 lib/goliath/contrib/version.rb
  7. +6 −0 spec/goliath/contrib_spec.rb
  8. +14 −0 spec/spec_helper.rb
View
@@ -2,3 +2,18 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in goliath-contrib.gemspec
gemspec
+
+gem 'goliath', :path => '../goliath'
+
+group :development do
+ gem 'rake'
+end
+
+# Gems for testing and coverage
+group :test do
+ gem 'pry'
+ gem 'rspec'
+ gem 'guard'
+ gem 'guard-rspec'
+ gem 'guard-yard'
+end
View
@@ -0,0 +1,20 @@
+# -*- ruby -*-
+
+format = 'progress' # 'doc' for more verbose, 'progress' for less
+tags = %w[ ]
+guard 'rspec', :version => 2, :cli => "--format #{format} #{ tags.map{|tag| "--tag #{tag}"}.join(' ') }" do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch(%r{^examples/(.+)\.rb$}) { |m| "spec/integration/#{m[1]}_spec.rb" }
+
+ watch('spec/spec_helper.rb') { 'spec' }
+ watch(/spec\/support\/(.+)\.rb/) { 'spec' }
+end
+
+group :docs do
+ guard 'yard' do
+ watch(%r{app/.+\.rb})
+ watch(%r{lib/.+\.rb})
+ watch(%r{ext/.+\.c})
+ end
+end
View
@@ -1,2 +1,27 @@
-#!/usr/bin/env rake
-require "bundler/gem_tasks"
+require 'bundler'
+Bundler::GemHelper.install_tasks
+
+require 'yard'
+require 'rspec/core/rake_task'
+require 'rake/testtask'
+
+task :default => [:test]
+task :test => [:spec, :unit]
+
+desc "run the unit test"
+Rake::TestTask.new(:unit) do |t|
+ t.libs << "test"
+ t.test_files = FileList['test/**/*_test.rb']
+ t.verbose = true
+end
+
+desc "run spec tests"
+RSpec::Core::RakeTask.new('spec') do |t|
+ t.pattern = 'spec/**/*_spec.rb'
+end
+
+desc 'Generate documentation'
+YARD::Rake::YardocTask.new do |t|
+ t.files = ['lib/**/*.rb', '-', 'LICENSE']
+ t.options = ['--main', 'README.md', '--no-private']
+end
@@ -1,23 +1,52 @@
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require 'goliath/contrib/version'
-require File.expand_path('../lib/goliath/contrib', __FILE__)
+Gem::Specification.new do |s|
+ s.name = "goliath-contrib"
+ s.version = Goliath::Contrib::VERSION
-# require './lib/goliath/contrib'
+ s.authors = ["goliath-io"]
+ s.email = ["goliath-io@googlegroups.com"]
-Gem::Specification.new do |gem|
- gem.authors = ["goliath-io"]
- gem.email = ["goliath-io@googlegroups.com"]
+ s.homepage = "https://github.com/postrank-labs/goliath-contrib"
+ s.summary = "Contributed Goliath middleware, plugins, and utilities"
+ s.description = s.summary
- gem.homepage = "https://github.com/postrank-labs/goliath-contrib"
- gem.description = "Contributed Goliath middleware, plugins, and utilities"
- gem.summary = gem.description
+ s.required_ruby_version = '>=1.9.2'
- gem.files = `git ls-files`.split($\)
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
- gem.name = "goliath-contrib"
- gem.require_paths = ["lib"]
- gem.version = Goliath::Contrib::VERSION
+ s.add_dependency 'goliath'
- gem.add_dependency 'goliath'
+ s.add_development_dependency 'rspec', '>2.0'
+
+ s.add_development_dependency 'em-http-request', '>=1.0.0'
+ s.add_development_dependency 'postrank-uri'
+
+ s.add_development_dependency 'guard'
+ s.add_development_dependency 'guard-rspec'
+ if RUBY_PLATFORM.include?('darwin')
+ s.add_development_dependency 'growl', '~> 1.0.3'
+ s.add_development_dependency 'rb-fsevent'
+ end
+
+ if RUBY_PLATFORM != 'java'
+ s.add_development_dependency 'yajl-ruby'
+ s.add_development_dependency 'bluecloth'
+ s.add_development_dependency 'bson_ext'
+ else
+ s.add_development_dependency 'json-jruby'
+ s.add_development_dependency 'maruku'
+ end
+
+ ignores = File.readlines(".gitignore").grep(/\S+/).map {|i| i.chomp }
+ dotfiles = [".gemtest", ".gitignore", ".rspec", ".yardopts"]
+
+ # s.files = `git ls-files`.split($\)
+ # s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
+ # s.test_files = s.files.grep(%r{^(test|spec|features)/})
+ # s.require_paths = ["lib"]
+
+ s.files = Dir["**/*"].reject {|f| File.directory?(f) || ignores.any? {|i| File.fnmatch(i, f) } } + dotfiles
+ s.test_files = s.files.grep(/^spec\//)
+ s.require_paths = ['lib']
end
@@ -1,11 +1,8 @@
+
# TODO: tries to start server :-)
# require 'goliath'
module Goliath
- module Contrib
- VERSION = "1.0.0.beta1"
- end
-
# autoload :MiddlewareName, "goliath/contrib/middleware_name"
# ...
end
@@ -0,0 +1,5 @@
+module Goliath
+ module Contrib
+ VERSION = "1.0.0.beta1"
+ end
+end
@@ -0,0 +1,6 @@
+
+describe Goliath::Contrib do
+ it 'has a version' do
+ Goliath::Contrib::VERSION.should be_a(String)
+ end
+end
View
@@ -0,0 +1,14 @@
+require 'bundler'
+
+Bundler.setup
+Bundler.require
+
+require 'goliath/test_helper'
+
+Goliath.env = :test
+
+RSpec.configure do |c|
+ c.include Goliath::TestHelper, :example_group => {
+ :file_path => /spec\/integration/
+ }
+end

0 comments on commit 72d8c75

Please sign in to comment.