2008-06-20 20:54:25 +02:00
require 'rake'
2008-09-12 07:21:16 +02:00
require " rake/rdoctask "
2008-06-20 20:54:25 +02:00
require 'spec/rake/spectask'
2008-10-26 16:03:59 +01:00
require 'rake/gempackagetask'
2008-09-12 21:45:21 +02:00
spec = Gem :: Specification . new do | s |
s . name = " couchrest "
2009-01-02 07:54:41 +01:00
s . version = " 0.11.1 "
2008-11-22 23:16:44 +01:00
s . date = " 2008-11-22 "
2008-09-12 21:45:21 +02:00
s . summary = " Lean and RESTful interface to CouchDB. "
s . email = " jchris@grabb.it "
s . homepage = " http://github.com/jchris/couchrest "
s . description = " CouchRest provides a simple interface on top of CouchDB's RESTful HTTP API, as well as including some utility scripts for managing views and attachments. "
s . has_rdoc = true
s . authors = [ " J. Chris Anderson " ]
2008-10-29 19:46:57 +01:00
s . files = %w( LICENSE README.rdoc Rakefile THANKS ) +
Dir [ " {bin,examples,lib,spec,utils}/**/* " ] -
2008-10-29 20:01:38 +01:00
Dir [ " spec/fixtures/couchapp*/**/* " ] - Dir [ " spec/fixtures/couchapp* " ]
2008-09-12 21:45:21 +02:00
s . extra_rdoc_files = %w( README.rdoc LICENSE THANKS )
s . require_path = " lib "
s . bindir = 'bin'
s . executables << 'couchdir'
2008-09-16 17:49:14 +02:00
s . executables << 'couchapp'
2008-09-12 21:56:26 +02:00
s . add_dependency ( " json " , " >= 1.1.2 " )
s . add_dependency ( " rest-client " , " >= 0.5 " )
2008-09-30 19:20:15 +02:00
s . add_dependency ( " extlib " , " >= 0.9.6 " )
2008-09-12 21:45:21 +02:00
end
2008-10-26 16:03:59 +01:00
:: Rake :: GemPackageTask . new ( spec ) { | p | p . gem_spec = spec }
2008-09-30 19:22:17 +02:00
desc " Update Github Gemspec "
task :gemspec do
skip_fields = %w( new_platform original_platform )
integer_fields = %w( specification_version )
2008-09-12 21:45:21 +02:00
2008-09-30 19:22:17 +02:00
result = " Gem::Specification.new do |s| \n "
spec . instance_variables . each do | ivar |
value = spec . instance_variable_get ( ivar )
name = ivar . split ( " @ " ) . last
next if skip_fields . include? ( name ) || value . nil? || value == " " || ( value . respond_to? ( :empty? ) && value . empty? )
if name == " dependencies "
value . each do | d |
dep , * ver = d . to_s . split ( " " )
result << " s.add_dependency #{ dep . inspect } , [ #{ / \ (([^ \ ,]*) / . match ( ver . join ( " " ) ) [ 1 ] . inspect } ] \n "
2008-09-12 21:45:21 +02:00
end
2008-09-30 19:22:17 +02:00
else
case value
when Array
value = name != " files " ? value . inspect : value . inspect . split ( " , " ) . join ( " , \n " )
when Fixnum
# leave as-is
when String
value = value . to_i if integer_fields . include? ( name )
value = value . inspect
else
value = value . to_s . inspect
end
result << " s. #{ name } = #{ value } \n "
2008-09-12 21:45:21 +02:00
end
end
2008-09-30 19:22:17 +02:00
result << " end "
File . open ( File . join ( File . dirname ( __FILE__ ) , " #{ spec . name } .gemspec " ) , " w " ) { | f | f << result }
2008-09-12 21:45:21 +02:00
end
2008-06-20 20:54:25 +02:00
desc " Run all specs "
Spec :: Rake :: SpecTask . new ( 'spec' ) do | t |
2008-10-06 21:27:01 +02:00
t . spec_files = FileList [ 'spec/**/*_spec.rb' ]
2008-06-20 20:54:25 +02:00
end
desc " Print specdocs "
Spec :: Rake :: SpecTask . new ( :doc ) do | t |
2008-09-30 06:08:52 +02:00
t . spec_opts = [ " --format " , " specdoc " ]
2008-06-20 20:54:25 +02:00
t . spec_files = FileList [ 'spec/*_spec.rb' ]
end
2008-09-12 07:21:16 +02:00
desc " Generate the rdoc "
Rake :: RDocTask . new do | rdoc |
files = [ " README.rdoc " , " LICENSE " , " lib/**/*.rb " ]
rdoc . rdoc_files . add ( files )
rdoc . main = " README.rdoc "
rdoc . title = " CouchRest: Ruby CouchDB, close to the metal "
end
2008-10-15 00:39:40 +02:00
desc " Run the rspec "
2008-06-21 00:06:11 +02:00
task :default = > :spec