Skip to content

Commit

Permalink
Add .gemspec.
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Jul 3, 2012
1 parent 7d71f5f commit f6184c5
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@ ext/thin_parser/vc60.pdb
ext/thin_parser/*.so
*.bundle
*.so
*.gem
log
spec/rails_app/log
doc/rdoc/*
Expand Down
41 changes: 9 additions & 32 deletions Rakefile
@@ -1,44 +1,21 @@
RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
SUDO = (WIN ? "" : "sudo")

require 'rake'
require 'rake/clean'
require 'rake/extensiontask' # from rake-compiler gem

$: << File.join(File.dirname(__FILE__), 'lib')
require 'thin/version'
load 'thin.gemspec'

# Load tasks in tasks/
Dir['tasks/**/*.rake'].each { |rake| load rake }

task :default => :spec

Rake::ExtensionTask.new('thin_parser', Thin::GemSpec) do |ext|
# enable cross compilation (requires cross compile toolchain)
ext.cross_compile = true

# forces the Windows platform instead of the default one
# configure options only for cross compile
ext.cross_platform = %w( i386-mswin32 x86-mingw32 )
end

CLEAN.include %w(**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log} ext/*/Makefile ext/*/conftest.dSYM lib/1.{8,9}})

desc "Compile the Ragel state machines"
task :ragel do
Dir.chdir 'ext/thin_parser' do
target = "parser.c"
File.unlink target if File.exist? target
sh "ragel parser.rl -G2 -o #{target}"
raise "Failed to compile Ragel state machine" unless File.exist? target
end
desc "Build gem packages"
task :build do
sh "gem build thin.gemspec"
end

desc "Build gem packages"
task :gems do
sh "rake clean gem && rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.1"
desc "Push gem packages"
task :push => :build do
sh "gem push thin-*.gem"
end

desc "Release version #{Thin::VERSION::STRING} gems to rubyforge"
task :release => [:tag, "gem:push"]
desc "Release version #{Thin::VERSION::STRING}"
task :release => [:tag, :push]
22 changes: 22 additions & 0 deletions tasks/ext.rake
@@ -0,0 +1,22 @@
require 'rake/extensiontask' # from rake-compiler gem

Rake::ExtensionTask.new('thin_parser', Thin::GemSpec) do |ext|
# enable cross compilation (requires cross compile toolchain)
ext.cross_compile = true

# forces the Windows platform instead of the default one
# configure options only for cross compile
ext.cross_platform = %w( i386-mswin32 x86-mingw32 )
end

CLEAN.include %w(**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log} ext/*/Makefile ext/*/conftest.dSYM lib/1.{8,9}})

desc "Compile the Ragel state machines"
task :ragel do
Dir.chdir 'ext/thin_parser' do
target = "parser.c"
File.unlink target if File.exist? target
sh "ragel parser.rl -G2 -o #{target}"
raise "Failed to compile Ragel state machine" unless File.exist? target
end
end
65 changes: 0 additions & 65 deletions tasks/gem.rake

This file was deleted.

38 changes: 38 additions & 0 deletions thin.gemspec
@@ -0,0 +1,38 @@
$:.push File.expand_path("../lib", __FILE__)

# Maintain your gem's version:
require "thin/version"

# Describe your gem and declare its dependencies:
Thin::GemSpec = Gem::Specification.new do |s|
s.name = Thin::NAME
s.version = Thin::VERSION::STRING
s.platform = Thin.win? ? Gem::Platform::CURRENT : Gem::Platform::RUBY
s.summary =
s.description = "A thin and fast web server"
s.author = "Marc-Andre Cournoyer"
s.email = 'macournoyer@gmail.com'
s.homepage = 'http://code.macournoyer.com/thin/'
s.rubyforge_project = 'thin'
s.license = 'Ruby'
s.executables = %w( thin )

s.required_ruby_version = '>= 1.8.5'

s.add_dependency 'rack', '>= 1.0.0'
s.add_dependency 'eventmachine', '>= 0.12.6'
s.add_dependency 'daemons', '>= 1.0.9' unless Thin.win?

s.files = %w(CHANGELOG README.md Rakefile) +
Dir["{bin,doc,example,lib}/**/*"] - Dir["lib/thin_parser.*"] +
Dir["ext/**/*.{h,c,rb,rl}"]

if Thin.win?
s.files += Dir["lib/*/thin_parser.*"]
else
s.extensions = Dir["ext/**/extconf.rb"]
end

s.require_path = "lib"
s.bindir = "bin"
end

0 comments on commit f6184c5

Please sign in to comment.