Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 140 lines (112 sloc) 4.049 kB
41fc7c4 @weppos Remove Echoe dependency
authored
1 require "rubygems"
2 require "rake/testtask"
3 require "rake/rdoctask"
4 require "rake/gempackagetask"
7338571 @weppos Initial commit
authored
5
41fc7c4 @weppos Remove Echoe dependency
authored
6 $:.unshift(File.dirname(__FILE__) + "/lib")
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored
7 require 'public_suffix_service'
7338571 @weppos Initial commit
authored
8
9
10 # Common package properties
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored
11 PKG_NAME = ENV['PKG_NAME'] || PublicSuffixService::GEM
12 PKG_VERSION = ENV['PKG_VERSION'] || PublicSuffixService::VERSION
13 RUBYFORGE_PROJECT = nil
7338571 @weppos Initial commit
authored
14
15 if ENV['SNAPSHOT'].to_i == 1
16 PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
17 end
18
19
41fc7c4 @weppos Remove Echoe dependency
authored
20 # Run all the tests in the /test folder
21 Rake::TestTask.new do |t|
22 t.libs << "test"
23 t.test_files = FileList["test/**/*_test.rb"]
24 t.verbose = true
25 end
26
27 # Generate documentation
28 Rake::RDocTask.new do |rd|
29 rd.main = "README.rdoc"
30 rd.rdoc_files.include("*.rdoc", "lib/**/*.rb")
31 rd.rdoc_dir = "rdoc"
32 end
33
34 # Run test by default.
35 task :default => ["test"]
36
37
38 # This builds the actual gem. For details of what all these options
39 # mean, and other ones you can add, check the documentation here:
40 #
41 # http://rubygems.org/read/chapter/20
42 #
43 spec = Gem::Specification.new do |s|
44
45 s.name = PKG_NAME
46 s.version = PKG_VERSION
47 s.summary = "Domain Name parser based on the Public Suffix List"
48 s.author = "Simone Carletti"
49 s.email = "weppos@weppos.net"
f8c1e12 @weppos http://www.simonecarletti.com/code/public-suffix-service =>
authored
50 s.homepage = "http://www.simonecarletti.com/code/public_suffix_service"
41fc7c4 @weppos Remove Echoe dependency
authored
51 s.description = <<-EOD
d9f6c39 @weppos The library is now known as PublicSuffixList
authored
52 Intelligent domain name parser based in the Public Suffic List. \
53 PublicSuffixService can parse and decompose a domain name into top level domain, \
41fc7c4 @weppos Remove Echoe dependency
authored
54 domain and subdomains.
55 EOD
7338571 @weppos Initial commit
authored
56
41fc7c4 @weppos Remove Echoe dependency
authored
57 s.has_rdoc = true
58 # You should probably have a README of some kind. Change the filename
59 # as appropriate
60 s.extra_rdoc_files = Dir.glob("*.rdoc")
61 s.rdoc_options = %w(--main README.rdoc)
7338571 @weppos Initial commit
authored
62
41fc7c4 @weppos Remove Echoe dependency
authored
63 # Add any extra files to include in the gem (like your README)
86465bb @weppos Missing details for the new Rakefile
authored
64 s.files = %w(Rakefile) + Dir.glob("*.{rdoc,gemspec}") + Dir.glob("{test,lib}/**/*")
41fc7c4 @weppos Remove Echoe dependency
authored
65 s.require_paths = ["lib"]
66
67 # If you want to depend on other gems, add them here, along with any
68 # relevant versions
69 # s.add_dependency("some_other_gem", "~> 0.1.0")
70
71 # If your tests use any gems, include them here
86465bb @weppos Missing details for the new Rakefile
authored
72 s.add_development_dependency("mocha")
41fc7c4 @weppos Remove Echoe dependency
authored
73 end
7338571 @weppos Initial commit
authored
74
41fc7c4 @weppos Remove Echoe dependency
authored
75 # This task actually builds the gem. We also regenerate a static
76 # .gemspec file, which is useful if something (i.e. GitHub) will
77 # be automatically building a gem for this project. If you're not
78 # using GitHub, edit as appropriate.
79 Rake::GemPackageTask.new(spec) do |pkg|
80 pkg.gem_spec = spec
7338571 @weppos Initial commit
authored
81 end
82
41fc7c4 @weppos Remove Echoe dependency
authored
83 desc "Build the gemspec file #{spec.name}.gemspec"
84 task :gemspec do
85 file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
86 File.open(file, "w") {|f| f << spec.to_ruby }
87 end
88
89 desc "Remove any temporary products, including gemspec."
90 task :clean => [:clobber] do
cc72f29 @weppos task :publish_rdoc
authored
91 rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
41fc7c4 @weppos Remove Echoe dependency
authored
92 end
93
94 desc "Remove any generated file"
95 task :clobber => [:clobber_rdoc, :clobber_rcov, :clobber_package]
96
97 desc "Package the library and generates the gemspec"
98 task :package => [:gemspec]
99
100 begin
101 require "rcov/rcovtask"
102
103 desc "Create a code coverage report."
104 Rcov::RcovTask.new do |t|
105 t.test_files = FileList["test/**/*_test.rb"]
106 t.ruby_opts << "-Itest -x mocha,rcov,Rakefile"
107 t.verbose = true
108 end
109 rescue LoadError
110 task :clobber_rcov
111 puts "RCov is not available"
112 end
7338571 @weppos Initial commit
authored
113
114 desc "Open an irb session preloaded with this library"
115 task :console do
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored
116 sh "irb -rubygems -I lib -r public_suffix_service.rb"
7338571 @weppos Initial commit
authored
117 end
118
119 begin
120 require 'code_statistics'
121 desc "Show library's code statistics"
122 task :stats do
a884054 @weppos Rename library from DomainName to PublicSuffixService to reduce the p…
authored
123 CodeStatistics.new(["Public Suffix Service", "lib"],
7338571 @weppos Initial commit
authored
124 ["Tests", "test"]).to_s
125 end
126 rescue LoadError
127 puts "CodeStatistics (Rails) is not available"
128 end
129
cc72f29 @weppos task :publish_rdoc
authored
130 desc "Publish documentation to the site"
131 task :publish_rdoc => [:clean, :rdoc] do
132 ENV["username"] || raise(ArgumentError, "Missing ssh username")
133 sh "rsync -avz --delete doc/ #{ENV["username"]}@code:/var/www/apps/code/public_suffix_service/api"
134 end
135
136
7338571 @weppos Initial commit
authored
137 Dir["tasks/**/*.rake"].each do |file|
138 load(file)
139 end
Something went wrong with that request. Please try again.