Skip to content

HTTPS clone URL

Subversion checkout URL

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