Permalink
Browse files

Make a more modern gemspec that is easier to keep up-to-date.

  • Loading branch information...
1 parent c71fe20 commit dc554479ad62eee31844ab1fd61137dcd6d55585 @seancribbs seancribbs committed Jul 24, 2011
Showing with 90 additions and 42 deletions.
  1. +6 −0 .travis.yml
  2. +13 −0 Gemfile
  3. +10 −0 Guardfile
  4. +10 −42 Rakefile
  5. +3 −0 lib/webmachine/version.rb
  6. +48 −0 webmachine.gemspec
View
@@ -0,0 +1,6 @@
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - rbx
+ - jruby
+script: "rake"
View
13 Gemfile
@@ -1,3 +1,16 @@
source :rubygems
gemspec
+
+gem 'bundler'
+gem 'guard-rspec'
+gem 'rb-fsevent'
+gem 'growl'
+
+platforms :mri_18, :jruby do
+ gem 'ruby-debug'
+end
+
+platforms :mri_19 do
+ gem 'ruby-debug19'
+end
View
@@ -0,0 +1,10 @@
+gemset = ENV['RVM_GEMSET'] || 'webmachine'
+gemset = "@#{gemset}" unless gemset.to_s == ''
+
+rvms = %W[ 1.8.7 1.9.2 rbx jruby ].map {|v| "#{v}#{gemset}" }
+
+guard 'rspec', :rvm => rvms do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}){ |m| "spec/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
View
@@ -1,53 +1,23 @@
require 'rubygems'
-require 'rake/gempackagetask'
+require 'rubygems/package_task'
-gemspec = Gem::Specification.new do |gem|
- gem.name = "webmachine"
- gem.summary = %Q{webmachine is a toolkit for building HTTP applications,}
- gem.description = <<-DESC.gsub(/\s+/, ' ')
- webmachine is a toolkit for building HTTP applications in a declarative fashion, that avoids
- the confusion of going through a CGI-style interface like Rack. It is strongly influenced
- by the original Erlang project of the same name and shares its opinionated nature about HTTP.
- It uses the mongrel2 server underneath, since all other Ruby webservers are tied to the broken
- CGI/Rack model.
- DESC
- gem.version = "0.1.0"
- gem.email = "sean@basho.com"
- gem.homepage = "http://seancribbs.github.com/webmachine-rb"
- gem.authors = ["Sean Cribbs"]
- # Just copying the mongrel2 adapter bits from this gem for now. We
- # need to extend things anyway.
- # gem.add_dependency "rack-mongrel2", "~> 0.2.3"
- gem.add_dependency 'ffi-rzmq', '~> 0.8.0'
- gem.add_dependency 'multi_json', '~> 1.0.0'
- gem.add_development_dependency "rspec", "~> 2.6.0"
- gem.add_development_dependency "yard", "~> 0.6.7"
-
- files = FileList["**/*"]
- # Editor and O/S files
- files.exclude ".DS_Store", "*~", "\#*", ".\#*", "*.swp", "*.tmproj", "tmtags"
- # Generated artifacts
- files.exclude "coverage", "rdoc", "pkg", "doc", ".bundle", "*.rbc", ".rvmrc", ".watchr", ".rspec"
- # Project-specific
- files.exclude "Gemfile.lock"
- # Remove directories
- files.exclude {|d| File.directory?(d) }
-
- gem.files = files.to_a
- gem.test_files = gem.files.grep(/_spec\.rb$/)
+def gemspec
+ $webmachine_gemspec ||= Gem::Specification.load("webmachine.gemspec")
end
-Rake::GemPackageTask.new(gemspec) do |pkg|
+Gem::PackageTask.new(gemspec) do |pkg|
pkg.need_zip = false
pkg.need_tar = false
end
task :gem => :gemspec
-desc %{Build the gemspec file.}
-task :gemspec do
+desc %{Validate the gemspec file.}
+task :gemspec do |*args|
gemspec.validate
- File.open("#{gemspec.name}.gemspec", 'w'){|f| f.write gemspec.to_ruby }
+ if !args.empty?
+ puts gemspec.to_ruby
+ end
end
desc %{Release the gem to RubyGems.org}
@@ -59,8 +29,6 @@ require 'rspec/core'
require 'rspec/core/rake_task'
desc "Run specs"
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = "spec/**/*_spec.rb"
-end
+RSpec::Core::RakeTask.new(:spec)
task :default => :spec
@@ -0,0 +1,3 @@
+module Webmachine
+ VERSION = "0.1.0"
+end
View
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require 'webmachine/version'
+
+Gem::Specification.new do |gem|
+ gem.name = "webmachine"
+ gem.version = Webmachine::VERSION
+ # gem.date = File.mtime("lib/webmachine/version.rb")
+ gem.summary = %Q{webmachine is a toolkit for building HTTP applications,}
+ gem.description = <<-DESC.gsub(/\s+/, ' ')
+ webmachine is a toolkit for building HTTP applications in a declarative fashion, that avoids
+ the confusion of going through a CGI-style interface like Rack. It is strongly influenced
+ by the original Erlang project of the same name and shares its opinionated nature about HTTP.
+ DESC
+ gem.homepage = "http://seancribbs.github.com/webmachine.rb"
+ gem.authors = ["Sean Cribbs"]
+ gem.email = ["sean@basho.com"]
+
+ if gem.respond_to? :specification_version then
+ gem.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ gem.add_runtime_dependency(%q<ffi>, [">= 0"])
+ gem.add_runtime_dependency(%q<ffi-rzmq>, ["~> 0.8.0"])
+ gem.add_runtime_dependency(%q<multi_json>, ["~> 1.0.0"])
+ gem.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
+ gem.add_development_dependency(%q<yard>, ["~> 0.6.7"])
+ else
+ gem.add_dependency(%q<ffi>, [">= 0"])
+ gem.add_dependency(%q<ffi-rzmq>, ["~> 0.8.0"])
+ gem.add_dependency(%q<multi_json>, ["~> 1.0.0"])
+ gem.add_dependency(%q<rspec>, ["~> 2.6.0"])
+ gem.add_dependency(%q<yard>, ["~> 0.6.7"])
+ end
+ else
+ gem.add_dependency(%q<ffi>, [">= 0"])
+ gem.add_dependency(%q<ffi-rzmq>, ["~> 0.8.0"])
+ gem.add_dependency(%q<multi_json>, ["~> 1.0.0"])
+ gem.add_dependency(%q<rspec>, ["~> 2.6.0"])
+ gem.add_dependency(%q<yard>, ["~> 0.6.7"])
+ end
+
+ ignores = File.read(".gitignore").split(/\r?\n/).reject{ |f| f =~ /^(#.+|\s*)$/ }.map {|f| Dir[f] }.flatten
+ gem.files = (Dir['**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
+ gem.test_files = (Dir['spec/**/*','features/**/*','.gitignore'] - ignores).reject {|f| !File.file?(f) }
+ gem.executables = Dir['bin/*'].map{ |f| File.basename(f) }
+ gem.require_paths = ['lib']
+end

0 comments on commit dc55447

Please sign in to comment.