public
Description: Ruby HTTP client based on libcurl
Homepage: http://toland.github.com/patron/
Clone URL: git://github.com/toland/patron.git
toland (author)
Sat Oct 10 08:04:57 -0700 2009
commit  e72f70bda6519cb7f7c0abc556a614c05d7c98f9
tree    e3543203105e6e25422c7e12c90966baab9e1b0c
parent  8bbca5b5c2e8c547abfb55a476ab7f79301962d9
patron / Rakefile
100644 136 lines (117 sloc) 4.114 kb
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
## -------------------------------------------------------------------
##
## Copyright (c) 2008 The Hive http://www.thehive.com/
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in
## all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
## THE SOFTWARE.
##
## -------------------------------------------------------------------
require 'yaml'
require 'rake/clean'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'jeweler'
require 'yard'
 
require 'rbconfig'
include Config
 
EXT_DIR = 'ext/patron'
SESSION_SO = "#{EXT_DIR}/session_ext.#{CONFIG['DLEXT']}"
SESSION_SRC = "#{EXT_DIR}/session_ext.c"
 
CLEAN.include FileList["#{EXT_DIR}/*"].exclude(/^.*\.(rb|c)$/)
CLOBBER.include %w( doc coverage pkg )
 
module Git
  class Lib
    def tag(tag)
      # Force an annotated tag
      command('tag', [tag, '-a', '-m', tag])
    end
  end
end
 
Jeweler::Tasks.new do |s|
  s.name = 'patron'
  s.platform = Gem::Platform::RUBY
  s.author = 'Phillip Toland'
  s.email = 'phil.toland@gmail.com'
  s.homepage = 'http://github.com/toland/Patron'
  s.rubyforge_project = 'patron'
  s.summary = 'Patron HTTP client'
  s.description = 'Ruby HTTP client library based on libcurl'
 
  s.extensions << 'ext/patron/extconf.rb'
  s.require_paths << 'ext'
 
  s.files = FileList['README.txt',
                     'VERSION.yml',
                     'LICENSE',
                     'Rakefile',
                     'lib/**/*',
                     'spec/*',
                     'ext/patron/*.{rb,c}']
 
  # rdoc
  s.has_rdoc = true
  s.extra_rdoc_files = ['README.txt']
  s.rdoc_options = ['--quiet',
                        '--title', "Patron documentation",
                        '--opname', 'index.html',
                        '--line-numbers',
                        '--main', 'README.txt',
                        '--inline-source']
end
 
file SESSION_SO => SESSION_SRC do
  cd EXT_DIR do
    ruby 'extconf.rb'
    sh 'make'
  end
end
 
desc "Compile extension"
task :compile => SESSION_SO
 
desc "Start an IRB shell"
task :shell => :compile do
  sh 'irb -I./lib -I./ext -r patron'
end
 
Rake::RDocTask.new do |rdoc|
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title = 'Patron documentation'
  rdoc.main = 'README.txt'
  rdoc.options << '--line-numbers' << '--inline-source'
  rdoc.rdoc_files.include('README.txt')
  rdoc.rdoc_files.include('lib/**/*.rb')
end
 
YARD::Rake::YardocTask.new do |t|
  t.files = ['lib/**/*.rb']
  t.options = ['--readme', 'README.txt']
end
 
desc "Run specs"
Spec::Rake::SpecTask.new(:spec) do |t|
  t.spec_opts = ['--options', "spec/spec.opts"]
  t.spec_files = FileList['spec/**/*_spec.rb']
end
 
task :spec => [:compile]
 
desc "Run specs with RCov"
Spec::Rake::SpecTask.new('spec:rcov') do |t|
  t.spec_files = FileList['spec/**/*_spec.rb']
  t.rcov = true
  t.rcov_opts << '--sort coverage'
  t.rcov_opts << '--comments'
  t.rcov_opts << '--exclude spec'
  t.rcov_opts << '--exclude lib/magneto.rb'
  t.rcov_opts << '--exclude /Library/Ruby/Gems'
end
 
Jeweler::RubyforgeTasks.new do |t|
  t.remote_doc_path = ''
  t.doc_task = :yardoc
end
 
task :default => :spec