Skip to content

HTTPS clone URL

Subversion checkout URL

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