rake task to generate github gemspec
This commit is contained in:
parent
7714349ad0
commit
eaee9ae351
62
Rakefile
62
Rakefile
|
@ -2,6 +2,61 @@ require 'rake'
|
|||
require "rake/rdoctask"
|
||||
require 'spec/rake/spectask'
|
||||
|
||||
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.name = "couchrest"
|
||||
s.version = "0.9.4"
|
||||
s.date = "2008-09-11"
|
||||
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"]
|
||||
s.files = %w( LICENSE README.rdoc Rakefile THANKS ) + Dir["{bin,examples,lib,spec,utils}/**/*"]
|
||||
s.extra_rdoc_files = %w( README.rdoc LICENSE THANKS )
|
||||
s.require_path = "lib"
|
||||
s.bindir = 'bin'
|
||||
s.executables << 'couchview'
|
||||
s.executables << 'couchdir'
|
||||
s.add_dependency("json", [">= 1.1.2"])
|
||||
s.add_dependency("rest-client", [">= 0.5"])
|
||||
end
|
||||
|
||||
namespace :github do # thanks merb!
|
||||
desc "Update Github Gemspec"
|
||||
task :update_gemspec do
|
||||
skip_fields = %w(new_platform original_platform)
|
||||
integer_fields = %w(specification_version)
|
||||
|
||||
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}, #{ver.join(" ").inspect.gsub(/[()]/, "")}\n"
|
||||
end
|
||||
else
|
||||
case value
|
||||
when Array
|
||||
value = name != "files" ? value.inspect : value.inspect.split(",").join(",\n")
|
||||
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"
|
||||
end
|
||||
end
|
||||
result << "end"
|
||||
File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run all specs"
|
||||
Spec::Rake::SpecTask.new('spec') do |t|
|
||||
t.spec_files = FileList['spec/*_spec.rb']
|
||||
|
@ -19,8 +74,11 @@ Rake::RDocTask.new do |rdoc|
|
|||
rdoc.rdoc_files.add(files)
|
||||
rdoc.main = "README.rdoc"
|
||||
rdoc.title = "CouchRest: Ruby CouchDB, close to the metal"
|
||||
# rdoc.rdoc_dir = "doc/rdoc"
|
||||
# rdoc.options << "--line-numbers" << "--inline-source"
|
||||
end
|
||||
|
||||
desc "Generate the gemspec"
|
||||
|
||||
|
||||
|
||||
|
||||
task :default => :spec
|
||||
|
|
Loading…
Reference in a new issue