addressable 1.0.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/rakefile DELETED
@@ -1,242 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/contrib/rubyforgepublisher'
8
- require 'spec/rake/spectask'
9
-
10
- require File.join(File.dirname(__FILE__), 'lib/addressable', 'version')
11
-
12
- PKG_DISPLAY_NAME = 'Addressable'
13
- PKG_NAME = PKG_DISPLAY_NAME.downcase
14
- PKG_VERSION = Addressable::ADDRESSABLE_VERSION::STRING
15
- PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
16
-
17
- RELEASE_NAME = "REL #{PKG_VERSION}"
18
-
19
- RUBY_FORGE_PROJECT = PKG_NAME
20
- RUBY_FORGE_USER = "sporkmonger"
21
- RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
22
-
23
- PKG_SUMMARY = "URI Implementation"
24
- PKG_DESCRIPTION = <<-TEXT
25
- Addressable is a replacement for the URI implementation that is part of
26
- Ruby's standard library. It more closely conforms to the relevant RFCs and
27
- adds support for IRIs and URI templates.
28
- TEXT
29
-
30
- PKG_FILES = FileList[
31
- "lib/**/*", "spec/**/*", "vendor/**/*",
32
- "doc/**/*", "specdoc/**/*", "coverage/**/*",
33
- "[A-Z]*", "rakefile"
34
- ].exclude(/\bCVS\b|~$/).exclude(/database\.yml/).exclude(/[_\.]svn$/)
35
-
36
- module Rake
37
- def self.browse(filepath)
38
- if RUBY_PLATFORM =~ /mswin/
39
- system(filepath)
40
- else
41
- try_browsers = lambda do
42
- result = true
43
- if !(`which firefox 2>&1` =~ /no firefox/)
44
- system("firefox #{filepath}")
45
- elsif !(`which mozilla 2>&1` =~ /no mozilla/)
46
- system("mozilla #{filepath}")
47
- elsif !(`which netscape 2>&1` =~ /no netscape/)
48
- system("netscape #{filepath}")
49
- elsif !(`which links 2>&1` =~ /no links/)
50
- system("links #{filepath}")
51
- elsif !(`which lynx 2>&1` =~ /no lynx/)
52
- system("lynx #{filepath}")
53
- else
54
- result = false
55
- end
56
- result
57
- end
58
- opened = false
59
- if RUBY_PLATFORM =~ /darwin/
60
- opened = true
61
- system("open #{filepath}")
62
- elsif !(`which gnome-open 2>&1` =~ /no gnome-open/)
63
- success =
64
- !(`gnome-open #{filepath} 2>&1` =~ /There is no default action/)
65
- if !success
66
- opened = try_browsers.call()
67
- else
68
- opened = true
69
- end
70
- else
71
- opened = try_browsers.call()
72
- end
73
- if !opened
74
- puts "Don't know how to browse to location."
75
- end
76
- end
77
- end
78
- end
79
-
80
- task :default => [ "spec:run" ]
81
-
82
- gem_spec = Gem::Specification.new do |s|
83
- s.name = PKG_NAME
84
- s.version = PKG_VERSION
85
- s.summary = PKG_SUMMARY
86
- s.description = PKG_DESCRIPTION
87
-
88
- s.files = PKG_FILES.to_a
89
-
90
- s.has_rdoc = true
91
- s.extra_rdoc_files = %w( README )
92
- s.rdoc_options.concat ['--main', 'README']
93
-
94
- s.add_dependency('rake', '>= 0.7.3')
95
- s.add_dependency('rspec', '>= 1.0.8')
96
-
97
- s.require_path = 'lib'
98
-
99
- s.author = "Bob Aman"
100
- s.email = "bob@sporkmonger.com"
101
- s.homepage = "http://sporkmonger.com/"
102
- s.rubyforge_project = "addressable"
103
- end
104
-
105
- Rake::GemPackageTask.new(gem_spec) do |p|
106
- p.gem_spec = gem_spec
107
- p.need_tar = true
108
- p.need_zip = true
109
- end
110
-
111
- Rake::RDocTask.new do |rdoc|
112
- rdoc.rdoc_dir = 'doc'
113
- rdoc.title = "Addressable -- URI Implementation"
114
- rdoc.options << '--line-numbers' << '--inline-source' <<
115
- '--accessor' << 'cattr_accessor=object' << '--charset' << 'utf-8'
116
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
117
- rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE')
118
- rdoc.rdoc_files.include('lib/**/*.rb')
119
- end
120
-
121
- namespace :rcov do
122
- desc 'Open the RCov code coverage report in a browser.'
123
- task :browse do
124
- if !File.exists?(File.expand_path(
125
- File.dirname(__FILE__) + '/coverage/index.html'))
126
- Rake::Task["spec:run"].invoke
127
- end
128
- Rake.browse(File.expand_path(
129
- File.dirname(__FILE__) + '/coverage/index.html'))
130
- end
131
- end
132
-
133
- namespace :spec do
134
- desc "Run all the specs"
135
- Spec::Rake::SpecTask.new(:run) do |t|
136
- t.spec_files = FileList['spec/**/*_spec.rb']
137
- t.spec_opts = ['--color']
138
- t.rcov = true
139
- t.rcov_opts = [
140
- # Don't include the actual spec files in the coverage report
141
- '--exclude', '"spec\/.*"'
142
- ]
143
- end
144
-
145
- desc "Run all the specs"
146
- Spec::Rake::SpecTask.new(:run_without_rcov) do |t|
147
- t.spec_files = FileList['spec/**/*_spec.rb']
148
- t.spec_opts = ['--color']
149
- end
150
-
151
- desc "Heckle the URI class"
152
- Spec::Rake::SpecTask.new(:heckle) do |t|
153
- heckle_param = 'Addressable::URI'
154
- heckle_param = ENV['TARGET'] if ENV['TARGET']
155
- t.spec_files = FileList['spec/addressable/uri_spec.rb']
156
- t.spec_opts = ['--heckle', heckle_param]
157
- end
158
-
159
- desc "Print Specdoc for all specs"
160
- Spec::Rake::SpecTask.new(:doc) do |t|
161
- t.spec_files = FileList[
162
- 'spec/**/*_spec.rb'
163
- ]
164
- t.spec_opts = ["--format", "specdoc"]
165
- end
166
-
167
- desc "Generate HTML Specdocs for all specs"
168
- Spec::Rake::SpecTask.new(:html) do |t|
169
- if !File.exists?(
170
- File.expand_path(File.dirname(__FILE__) + '/specdoc/'))
171
- puts "Creating specdoc folder..."
172
- Dir.mkdir(File.expand_path(File.dirname(__FILE__) + '/specdoc/'))
173
- end
174
-
175
- output_file = File.expand_path(
176
- File.dirname(__FILE__) + '/specdoc/index.html')
177
- t.spec_files = FileList['spec/**/*_spec.rb']
178
- t.spec_opts = ["--format", "html:#{output_file}"]
179
- end
180
-
181
- desc 'Open the RSpec HTML specifications in a browser.'
182
- task :browse => [ "spec:html" ] do
183
- Rake.browse(File.expand_path(
184
- File.dirname(__FILE__) + '/specdoc/index.html'))
185
- end
186
- end
187
-
188
- namespace :publish do
189
- desc "Publish the coverage report"
190
- task :coverage => [ "spec:run" ] do
191
- Rake::SshDirPublisher.new(
192
- "#{RUBY_FORGE_USER}@rubyforge.org",
193
- "#{RUBY_FORGE_PATH}/coverage/",
194
- "coverage"
195
- ).upload
196
- end
197
-
198
- desc "Publish the specifications"
199
- task :specs => [ "spec:html" ] do
200
- Rake::SshDirPublisher.new(
201
- "#{RUBY_FORGE_USER}@rubyforge.org",
202
- "#{RUBY_FORGE_PATH}/specdoc/",
203
- "specdoc"
204
- ).upload
205
- end
206
-
207
- desc "Publish the API documentation"
208
- task :api => [ "rdoc" ] do
209
- Rake::SshDirPublisher.new(
210
- "#{RUBY_FORGE_USER}@rubyforge.org",
211
- "#{RUBY_FORGE_PATH}/api/",
212
- "doc"
213
- ).upload
214
- end
215
-
216
- desc "Runs all of the publishing tasks"
217
- task :all => ["publish:coverage", "publish:api", "publish:specs"] do
218
- end
219
- end
220
-
221
- task :lines do
222
- lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
223
-
224
- for file_name in FileList["lib/**/*.rb"]
225
- f = File.open(file_name)
226
-
227
- while line = f.gets
228
- lines += 1
229
- next if line =~ /^\s*$/
230
- next if line =~ /^\s*#/
231
- codelines += 1
232
- end
233
- puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
234
-
235
- total_lines += lines
236
- total_codelines += codelines
237
-
238
- lines, codelines = 0, 0
239
- end
240
-
241
- puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
242
- end