forked from jchris/couchrest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
84 lines (76 loc) · 2.63 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require 'rake'
require "rake/rdoctask"
require 'spec/rake/spectask'
require 'rake/gempackagetask'
spec = Gem::Specification.new do |s|
s.name = "couchrest"
s.version = "0.12.0"
s.date = "2008-11-22"
s.summary = "Lean and RESTful interface to CouchDB."
s.email = "[email protected]"
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.md Rakefile THANKS ) +
Dir["{bin,examples,lib,spec,utils}/**/*"] -
Dir["spec/tmp"]
s.extra_rdoc_files = %w( README.md LICENSE THANKS )
s.require_path = "lib"
s.bindir = 'bin'
s.executables << 'couchdir'
s.add_dependency("json", ">= 1.1.2")
s.add_dependency("rest-client", ">= 0.5")
s.add_dependency("extlib", ">= 0.9.6")
end
::Rake::GemPackageTask.new(spec) { |p| p.gem_spec = spec }
desc "Update Github Gemspec"
task :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}, [#{ /\(([^\,]*)/ . match(ver.join(" "))[1].inspect}]\n"
end
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"
end
end
result << "end"
File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
end
desc "Run all specs"
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
end
desc "Print specdocs"
Spec::Rake::SpecTask.new(:doc) do |t|
t.spec_opts = ["--format", "specdoc"]
t.spec_files = FileList['spec/*_spec.rb']
end
desc "Generate the rdoc"
Rake::RDocTask.new do |rdoc|
files = ["README.md", "LICENSE", "lib/**/*.rb"]
rdoc.rdoc_files.add(files)
rdoc.main = "README.md"
rdoc.title = "CouchRest: Ruby CouchDB, close to the metal"
end
desc "Run the rspec"
task :default => :spec