Skip to content
Newer
Older
100644 155 lines (120 sloc) 4.26 KB
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
1 require "rubygems"
2 require "rake/testtask"
3 require "rake/gempackagetask"
7338571 @weppos Initial commit
authored Nov 2, 2009
4
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
5 $:.unshift(File.dirname(__FILE__) + "/lib")
928336d @weppos README updates
authored Aug 19, 2010
6 require "public_suffix_service"
7338571 @weppos Initial commit
authored Nov 2, 2009
7
8
9 # Common package properties
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored May 31, 2010
10 PKG_NAME = ENV['PKG_NAME'] || PublicSuffixService::GEM
11 PKG_VERSION = ENV['PKG_VERSION'] || PublicSuffixService::VERSION
12 RUBYFORGE_PROJECT = nil
7338571 @weppos Initial commit
authored Nov 2, 2009
13
14 if ENV['SNAPSHOT'].to_i == 1
15 PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
16 end
17
18
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
19 # Run all the tests in the /test folder
20 Rake::TestTask.new do |t|
21 t.libs << "test"
22 t.test_files = FileList["test/**/*_test.rb"]
23 t.verbose = true
24 end
25
26 # Run test by default.
27 task :default => ["test"]
28
29
30 # This builds the actual gem. For details of what all these options
31 # mean, and other ones you can add, check the documentation here:
32 #
33 # http://rubygems.org/read/chapter/20
34 #
35 spec = Gem::Specification.new do |s|
36
37 s.name = PKG_NAME
38 s.version = PKG_VERSION
39 s.summary = "Domain Name parser based on the Public Suffix List"
40 s.author = "Simone Carletti"
41 s.email = "weppos@weppos.net"
f8c1e12 @weppos http://www.simonecarletti.com/code/public-suffix-service =>
authored May 31, 2010
42 s.homepage = "http://www.simonecarletti.com/code/public_suffix_service"
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
43 s.description = <<-EOD
d9f6c39 @weppos The library is now known as PublicSuffixList
authored May 31, 2010
44 Intelligent domain name parser based in the Public Suffic List. \
45 PublicSuffixService can parse and decompose a domain name into top level domain, \
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
46 domain and subdomains.
47 EOD
7338571 @weppos Initial commit
authored Nov 2, 2009
48
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
49 s.has_rdoc = true
50 # You should probably have a README of some kind. Change the filename
51 # as appropriate
52 s.extra_rdoc_files = Dir.glob("*.rdoc")
fff4ae6 @weppos Code formatting
authored Dec 5, 2010
53 s.rdoc_options = %w( --main README.rdoc )
7338571 @weppos Initial commit
authored Nov 2, 2009
54
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
55 # Add any extra files to include in the gem (like your README)
fff4ae6 @weppos Code formatting
authored Dec 5, 2010
56 s.files = %w( Rakefile ) + Dir.glob("*.{rdoc,gemspec}") + Dir.glob("{test,lib}/**/*")
57 s.require_paths = %w( lib )
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
58
59 # If you want to depend on other gems, add them here, along with any
60 # relevant versions
61 # s.add_dependency("some_other_gem", "~> 0.1.0")
62
63 # If your tests use any gems, include them here
0ac5599 @weppos Fixed a but where the RuleList cache is not recreated when a new rule…
authored Oct 9, 2010
64 s.add_development_dependency("rr")
0c52832 @weppos Add YARD as development dependency.
authored Dec 20, 2010
65 s.add_development_dependency("yard")
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
66 end
7338571 @weppos Initial commit
authored Nov 2, 2009
67
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
68 # This task actually builds the gem. We also regenerate a static
69 # .gemspec file, which is useful if something (i.e. GitHub) will
70 # be automatically building a gem for this project. If you're not
71 # using GitHub, edit as appropriate.
72 Rake::GemPackageTask.new(spec) do |pkg|
73 pkg.gem_spec = spec
7338571 @weppos Initial commit
authored Nov 2, 2009
74 end
75
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
76 desc "Build the gemspec file #{spec.name}.gemspec"
77 task :gemspec do
78 file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
79 File.open(file, "w") {|f| f << spec.to_ruby }
80 end
81
cc1b44e @weppos Invalid syntax
authored Aug 11, 2010
82 desc "Remove any temporary products, including gemspec"
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
83 task :clean => [:clobber] do
cc72f29 @weppos task :publish_rdoc
authored Jun 24, 2010
84 rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
85 end
86
87 desc "Remove any generated file"
7645625 @weppos Remove RDoc code remnants.
authored Dec 20, 2010
88 task :clobber => [:clobber_package]
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
89
90 desc "Package the library and generates the gemspec"
91 task :package => [:gemspec]
92
8103edc @weppos yardoc tasks
authored Sep 28, 2010
93
94 begin
95 require "yard"
96 require "yard/rake/yardoc_task"
97
30a7573 @weppos Output YARD documentation to /yardoc
authored Dec 5, 2010
98 YARD::Rake::YardocTask.new(:yardoc) do |y|
99 y.options = ["--output-dir", "yardoc"]
100 end
8103edc @weppos yardoc tasks
authored Sep 28, 2010
101
102 namespace :yardoc do
103 desc "Publish YARD documentation to the site"
104 task :publish => ["yardoc:clobber", "yardoc"] do
105 ENV["username"] || raise(ArgumentError, "Missing ssh username")
5c93081 @weppos PublicSuffixService.valid? should return false if the domain is not d…
authored Oct 9, 2010
106 sh "rsync -avz --delete yardoc/ #{ENV["username"]}@code:/var/www/apps/code/#{PKG_NAME}/api"
8103edc @weppos yardoc tasks
authored Sep 28, 2010
107 end
108
109 desc "Remove YARD products"
110 task :clobber do
111 rm_r "yardoc" rescue nil
112 end
113 end
114
115 task :clobber => "yardoc:clobber"
116 rescue LoadError
117 puts "YARD is not available"
118 end
119
120
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
121 begin
122 require "rcov/rcovtask"
123
cc1b44e @weppos Invalid syntax
authored Aug 11, 2010
124 desc "Create a code coverage report"
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
125 Rcov::RcovTask.new do |t|
126 t.test_files = FileList["test/**/*_test.rb"]
0ac5599 @weppos Fixed a but where the RuleList cache is not recreated when a new rule…
authored Oct 9, 2010
127 t.ruby_opts << "-Itest -x rr,rcov,Rakefile"
41fc7c4 @weppos Remove Echoe dependency
authored May 31, 2010
128 t.verbose = true
129 end
130 rescue LoadError
131 puts "RCov is not available"
132 end
7338571 @weppos Initial commit
authored Nov 2, 2009
133
8103edc @weppos yardoc tasks
authored Sep 28, 2010
134
7338571 @weppos Initial commit
authored Nov 2, 2009
135 desc "Open an irb session preloaded with this library"
136 task :console do
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored May 31, 2010
137 sh "irb -rubygems -I lib -r public_suffix_service.rb"
7338571 @weppos Initial commit
authored Nov 2, 2009
138 end
139
cc72f29 @weppos task :publish_rdoc
authored Jun 24, 2010
140
e9c8ed5 @weppos Update rake task to download the PSL file from the repository.
authored Sep 15, 2010
141 desc <<-DESC
142 Downloads the Public Suffix List file from the repository \
143 and stores it locally.
144 DESC
145 task :download_definitions do
146 require "net/http"
147
148 DEFINITION_URL = "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1"
149
150 File.open("lib/public_suffix_service/definitions.dat", "w+") do |f|
151 response = Net::HTTP.get_response(URI.parse(DEFINITION_URL))
152 f.write(response.body)
153 end
7338571 @weppos Initial commit
authored Nov 2, 2009
154 end
Something went wrong with that request. Please try again.