Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 109 lines (76 sloc) 2.685 kB
46f86f3 @weppos Integrate Bundler.
authored
1 require 'rubygems'
c92b5b7 @weppos Rakefile cleanup
authored
2 require 'rubygems/package_task'
46f86f3 @weppos Integrate Bundler.
authored
3 require 'bundler'
4
41fc7c4 @weppos Remove Echoe dependency
authored
5 $:.unshift(File.dirname(__FILE__) + "/lib")
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
6 require 'public_suffix'
7338571 @weppos Initial commit
authored
7
8
9 # Common package properties
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
10 PKG_NAME = ENV['PKG_NAME'] || PublicSuffix::GEM
11 PKG_VERSION = ENV['PKG_VERSION'] || PublicSuffix::VERSION
7338571 @weppos Initial commit
authored
12
13
41fc7c4 @weppos Remove Echoe dependency
authored
14 # Run test by default.
c92b5b7 @weppos Rakefile cleanup
authored
15 task :default => :test
41fc7c4 @weppos Remove Echoe dependency
authored
16
17
18 spec = Gem::Specification.new do |s|
19 s.name = PKG_NAME
20 s.version = PKG_VERSION
1abfa9a @weppos Smaller description.
authored
21 s.summary = "Domain name parser based in the Public Suffix List."
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
22 s.description = "PublicSuffix can parse and decompose a domain name into top level domain, domain and subdomains."
1abfa9a @weppos Smaller description.
authored
23
08f8732 @weppos Minimum Ruby version increased to Ruby 1.8.7.
authored
24 s.required_ruby_version = ">= 1.8.7"
25
41fc7c4 @weppos Remove Echoe dependency
authored
26 s.author = "Simone Carletti"
27 s.email = "weppos@weppos.net"
e1f4dac @weppos Update Homepage
authored
28 s.homepage = "http://www.simonecarletti.com/code/public_suffix"
7338571 @weppos Initial commit
authored
29
29cd59d @weppos Update to Markdown
authored
30 s.files = `git ls-files`.split("\n")
31 s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
fff4ae6 @weppos Code formatting
authored
32 s.require_paths = %w( lib )
41fc7c4 @weppos Remove Echoe dependency
authored
33
65af4f8 @weppos Add rake to the list of gem dependencies.
authored
34 s.add_development_dependency("rake")
4463a59 @weppos rr => mocha
authored
35 s.add_development_dependency("mocha")
0c52832 @weppos Add YARD as development dependency.
authored
36 s.add_development_dependency("yard")
41fc7c4 @weppos Remove Echoe dependency
authored
37 end
7338571 @weppos Initial commit
authored
38
2ea1139 @weppos Standardize specs
authored
39
40 require 'rubygems/package_task'
41
386a1b6 @weppos rake/gempackagetask is deprecated. Use rubygems/package_task instead.
authored
42 Gem::PackageTask.new(spec) do |pkg|
41fc7c4 @weppos Remove Echoe dependency
authored
43 pkg.gem_spec = spec
7338571 @weppos Initial commit
authored
44 end
45
41fc7c4 @weppos Remove Echoe dependency
authored
46 desc "Build the gemspec file #{spec.name}.gemspec"
47 task :gemspec do
48 file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
49 File.open(file, "w") {|f| f << spec.to_ruby }
50 end
51
cc1b44e @weppos Invalid syntax
authored
52 desc "Remove any temporary products, including gemspec"
41fc7c4 @weppos Remove Echoe dependency
authored
53 task :clean => [:clobber] do
cc72f29 @weppos task :publish_rdoc
authored
54 rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
41fc7c4 @weppos Remove Echoe dependency
authored
55 end
56
57 desc "Remove any generated file"
7645625 @weppos Remove RDoc code remnants.
authored
58 task :clobber => [:clobber_package]
41fc7c4 @weppos Remove Echoe dependency
authored
59
60 desc "Package the library and generates the gemspec"
61 task :package => [:gemspec]
62
8103edc @weppos yardoc tasks
authored
63
6f889a2 @weppos Move require near usage
authored
64 require 'rake/testtask'
65
c92b5b7 @weppos Rakefile cleanup
authored
66 Rake::TestTask.new do |t|
67 t.libs << "test"
68 t.test_files = FileList["test/**/*_test.rb"]
193dadb @weppos Make warning and verbose optionals
authored
69 t.verbose = !!ENV["VERBOSE"]
70 t.warning = !!ENV["WARNING"]
c92b5b7 @weppos Rakefile cleanup
authored
71 end
72
73
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
74 require 'yard'
75 require 'yard/rake/yardoc_task'
76
46f86f3 @weppos Integrate Bundler.
authored
77 YARD::Rake::YardocTask.new(:yardoc) do |y|
78 y.options = ["--output-dir", "yardoc"]
79 end
8103edc @weppos yardoc tasks
authored
80
46f86f3 @weppos Integrate Bundler.
authored
81 namespace :yardoc do
82 task :clobber do
83 rm_r "yardoc" rescue nil
8103edc @weppos yardoc tasks
authored
84 end
85 end
86
46f86f3 @weppos Integrate Bundler.
authored
87 task :clobber => "yardoc:clobber"
7338571 @weppos Initial commit
authored
88
8103edc @weppos yardoc tasks
authored
89
7338571 @weppos Initial commit
authored
90 desc "Open an irb session preloaded with this library"
91 task :console do
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
92 sh "irb -rubygems -I lib -r public_suffix.rb"
7338571 @weppos Initial commit
authored
93 end
94
cc72f29 @weppos task :publish_rdoc
authored
95
e9c8ed5 @weppos Update rake task to download the PSL file from the repository.
authored
96 desc <<-DESC
1e83598 @weppos Rename rake task to $ rake psl
authored
97 Downloads the Public Suffix List file from the repository and stores it locally.
e9c8ed5 @weppos Update rake task to download the PSL file from the repository.
authored
98 DESC
1e83598 @weppos Rename rake task to $ rake psl
authored
99 task :psl do
e9c8ed5 @weppos Update rake task to download the PSL file from the repository.
authored
100 require "net/http"
101
102 DEFINITION_URL = "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1"
103
de70d78 @weppos Rename PubliSuffixService => PublicSuffix
authored
104 File.open("lib/public_suffix/definitions.txt", "w+") do |f|
e9c8ed5 @weppos Update rake task to download the PSL file from the repository.
authored
105 response = Net::HTTP.get_response(URI.parse(DEFINITION_URL))
106 f.write(response.body)
107 end
7338571 @weppos Initial commit
authored
108 end
Something went wrong with that request. Please try again.