Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add gem packaging stuff to Rakefile

  • Loading branch information...
commit 407c9b86ec5974d388c76f4d428f9872bcbd4c25 1 parent 0e8e09b
@rtomayko authored
Showing with 109 additions and 0 deletions.
  1. +1 −0  .gitignore
  2. +69 −0 Rakefile
  3. +39 −0 sinatra-sequel.gemspec
View
1  .gitignore
@@ -1 +1,2 @@
test.db
+/pkg
View
69 Rakefile
@@ -1,6 +1,75 @@
+require 'rake/clean'
+
task :default => :spec
desc 'Run specs'
task :spec do
sh 'bacon -a'
end
+
+# PACKAGING ============================================================
+
+# Load the gemspec using the same limitations as github
+require 'rubygems/specification'
+$spec = eval(File.read('sinatra-sequel.gemspec'))
+
+def package(ext='')
+ "pkg/#{$spec.name}-#{$spec.version}" + ext
+end
+
+desc 'Build packages'
+task :package => %w[.gem .tar.gz].map { |ext| package(ext) }
+
+desc 'Build and install as local gem'
+task :install => package('.gem') do
+ sh "gem install #{package('.gem')}"
+end
+
+directory 'pkg/'
+CLOBBER.include('pkg')
+
+file package('.gem') => %W[pkg/ #{$spec.name}.gemspec] + $spec.files do |f|
+ sh "gem build #{$spec.name}.gemspec"
+ mv File.basename(f.name), f.name
+end
+
+file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
+ sh <<-SH
+ git archive \
+ --prefix=#{$spec.name}-#{$spec.version}/ \
+ --format=tar \
+ HEAD | gzip > #{f.name}
+ SH
+end
+
+# Rubyforge Release / Publish Tasks ==================================
+
+desc 'Publish gem and tarball to rubyforge'
+task 'release' => [package('.gem'), package('.tar.gz')] do |t|
+ sh <<-SH
+ rubyforge add_release wink #{$spec.name} #{$spec.version} #{package('.gem')} &&
+ rubyforge add_file wink #{$spec.name} #{$spec.version} #{package('.tar.gz')}
+ SH
+end
+
+# rebuild the gemspec manifest and update timestamps.
+task "#{$spec.name}.gemspec" => FileList['{lib,spec}/**','Rakefile','COPYING','README.md'] do |f|
+ # read spec file and split out manifest section
+ spec = File.read(f.name)
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
+ # replace version and date
+ head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'")
+ # determine file list from git ls-files
+ files = `git ls-files`.
+ split("\n").
+ sort.
+ reject{ |file| file =~ /^\./ }.
+ reject { |file| file =~ /^doc/ }.
+ map{ |file| " #{file}" }.
+ join("\n")
+ # piece file back together and write...
+ manifest = " s.files = %w[\n#{files}\n ]\n"
+ spec = [head,manifest,tail].join(" # = MANIFEST =\n")
+ File.open(f.name, 'w') { |io| io.write(spec) }
+ puts "updated #{f.name}"
+end
View
39 sinatra-sequel.gemspec
@@ -0,0 +1,39 @@
+Gem::Specification.new do |s|
+ s.specification_version = 2 if s.respond_to? :specification_version=
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+
+ s.name = 'sinatra-sequel'
+ s.version = '0.9.0'
+ s.date = '2009-08-08'
+
+ s.description = "Extends Sinatra with Sequel ORM config, migrations, and helpers"
+ s.summary = s.description
+
+ s.authors = ["Ryan Tomayko"]
+ s.email = "rtomayko@gmail.com"
+
+ # = MANIFEST =
+ s.files = %w[
+ COPYING
+ README.md
+ Rakefile
+ lib/sinatra/sequel.rb
+ sinatra-sequel.gemspec
+ spec/spec_sinatra_sequel.rb
+ ]
+ # = MANIFEST =
+
+ s.test_files = s.files.select {|path| path =~ /^spec\/.*.rb/ }
+
+ s.extra_rdoc_files = %w[README.md COPYING]
+ s.add_dependency 'sinatra', '>= 0.9.4'
+ s.add_dependency 'sequel', '>= 3.2.0'
+ s.add_development_dependency 'bacon'
+
+ s.has_rdoc = true
+ s.homepage = "http://github.com/rtomayko/sinatra-sequel"
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sinatra::Sequel"]
+ s.require_paths = %w[lib]
+ s.rubyforge_project = 'wink'
+ s.rubygems_version = '1.1.1'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.