Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 165 lines (132 sloc) 4.492 kb
add6330 Simone Carletti Double quotes
authored
1 require "rubygems"
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
2 require "rake/testtask"
3 require "rake/gempackagetask"
7143eb1 Simone Carletti Changed Parsers to use a normalized content version called Whois::Parser...
authored
4 begin
add6330 Simone Carletti Double quotes
authored
5 require "hanna/rdoctask"
7143eb1 Simone Carletti Changed Parsers to use a normalized content version called Whois::Parser...
authored
6 rescue LoadError
add6330 Simone Carletti Double quotes
authored
7 require "rake/rdoctask"
1f4d414 Simone Carletti Change :publish_docs task to deploy on my server instead of RubyGems.
authored
8 end
9
add6330 Simone Carletti Double quotes
authored
10 $:.unshift(File.dirname(__FILE__) + "/lib")
11 require "whois"
12
1f4d414 Simone Carletti Change :publish_docs task to deploy on my server instead of RubyGems.
authored
13
be24e73 Simone Carletti Base GEM skeleton.
authored
14 # Common package properties
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
15 PKG_NAME = ENV['PKG_NAME'] || Whois::GEM
16 PKG_VERSION = ENV['PKG_VERSION'] || Whois::VERSION
add6330 Simone Carletti Double quotes
authored
17 RUBYFORGE_PROJECT = "whois"
be24e73 Simone Carletti Base GEM skeleton.
authored
18
19 if ENV['SNAPSHOT'].to_i == 1
20 PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
21 end
add6330 Simone Carletti Double quotes
authored
22
23
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
24 # Run test by default.
25 task :default => ["test"]
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
34 s.name = PKG_NAME
35 s.version = PKG_VERSION
36 s.summary = "An intelligent pure Ruby WHOIS client and parser."
37 s.author = "Simone Carletti"
38 s.email = "weppos@weppos.net"
39 s.homepage = "http://www.ruby-whois.org"
40 s.description = <<-EOD
578b5fc Simone Carletti No longer a simple client! :)
authored
41 Whois is an intelligent WHOIS client and parser written in pure Ruby. \
50efc7e Simone Carletti Updated project page
authored
42 It can query registry data for IPv4, IPv6 and top level domains, \
578b5fc Simone Carletti No longer a simple client! :)
authored
43 parse and convert responses into easy-to-use Ruby objects.
c98aec4 Simone Carletti Release Whois 0.5.0
authored
44 EOD
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
45 s.rubyforge_project = RUBYFORGE_PROJECT
be24e73 Simone Carletti Base GEM skeleton.
authored
46
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
47 s.has_rdoc = true
48 # You should probably have a README of some kind. Change the filename
49 # as appropriate
50 s.extra_rdoc_files = Dir.glob("*.rdoc")
51 s.rdoc_options = %w(--main README.rdoc)
be24e73 Simone Carletti Base GEM skeleton.
authored
52
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
53 # Add any extra files to include in the gem (like your README)
e491910 Simone Carletti Excluded test folder from the packaged .gem file to reduce the size of t...
authored
54 s.files = %w() + Dir.glob("*.{rdoc,gemspec}") + Dir.glob("{bin,lib}/**/*")
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
55 s.require_paths = ["lib"]
be24e73 Simone Carletti Base GEM skeleton.
authored
56
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
57 # If you want to depend on other gems, add them here, along with any
58 # relevant versions
59 # s.add_dependency("some_other_gem", "~> 0.1.0")
60
61 # If your tests use any gems, include them here
62 s.add_development_dependency("mocha")
be24e73 Simone Carletti Base GEM skeleton.
authored
63 end
64
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
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
71 end
be24e73 Simone Carletti Base GEM skeleton.
authored
72
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
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
d9ad2e0 Simone Carletti Add cross-ruby test tasks
authored
79
80 # Generate documentation
81 Rake::RDocTask.new do |rd|
82 rd.main = "README.rdoc"
83 rd.rdoc_files.include("*.rdoc", "lib/**/*.rb")
84 rd.rdoc_dir = "rdoc"
85 end
86
87 # Run all the tests in the /test folder
88 Rake::TestTask.new do |t|
89 t.libs << "test"
90 t.test_files = FileList["test/**/*_test.rb"]
91 t.verbose = true
92 end
93
94 task "ensure_rvm" do
95 raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
96 end
97
187c84f Simone Carletti Update rubies to Ruby 1.9.2 stable and jRuby 1.5.2
authored
98 RUBIES = %w(1.8.6-p399 1.8.7-p249 1.9.1-p378 1.9.2-p0 rbx-1.0.1-20100603 jruby-1.5.2 ree-1.8.7-2010.02)
d9ad2e0 Simone Carletti Add cross-ruby test tasks
authored
99
100 desc "Run tests for all rubies"
101 task "test_rubies" => "ensure_rvm" do
102 sh "rvm #{RUBIES.join(",")} rake test"
103 end
104
105 RUBIES.each do |ruby|
106 desc "Run tests on Ruby #{ruby}"
107 task "test_ruby_#{ruby}"=> "ensure_rvm" do
108 sh "rvm #{ruby} rake test"
109 end
110 end
111
112
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
113 desc "Remove any temporary products, including gemspec"
114 task :clean => [:clobber] do
115 rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
116 end
117
118 desc "Remove any generated file"
119 task :clobber => [:clobber_rdoc, :clobber_rcov, :clobber_package]
120
121 desc "Package the library and generates the gemspec"
122 task :package => [:gemspec]
123
124 begin
125 require "rcov/rcovtask"
126
127 desc "Create a code coverage report"
128 Rcov::RcovTask.new do |t|
129 t.test_files = FileList["test/**/*_test.rb"]
130 t.ruby_opts << "-Itest -x mocha,rcov,Rakefile"
131 t.verbose = true
132 end
133 rescue LoadError
134 task :clobber_rcov
b35722d Simone Carletti Simply ignore optional libraries
authored
135 # puts "RCov is not available"
54b1d16 Simone Carletti Added Rake :console task.
authored
136 end
137
be24e73 Simone Carletti Base GEM skeleton.
authored
138 begin
add6330 Simone Carletti Double quotes
authored
139 require "code_statistics"
be24e73 Simone Carletti Base GEM skeleton.
authored
140 desc "Show library's code statistics"
141 task :stats do
59dc638 Simone Carletti Hello, I am Whois
authored
142 CodeStatistics.new(["Whois", "lib"],
be24e73 Simone Carletti Base GEM skeleton.
authored
143 ["Tests", "test"]).to_s
144 end
145 rescue LoadError
b35722d Simone Carletti Simply ignore optional libraries
authored
146 # puts "CodeStatistics (Rails) is not available"
be24e73 Simone Carletti Base GEM skeleton.
authored
147 end
afb4065 Simone Carletti Super simple and super buggy initial version. It works, but sometimes it...
authored
148
3337771 Simone Carletti Namespace publish_rdoc task and rename it to rdoc:publish
authored
149 namespace :rdoc do
150 desc "Publish RDoc documentation to the site"
151 task :publish => [:clobber_rdoc, :rdoc] do
152 sh "rsync -avz --delete rdoc/ weppos@dads:/home/weppos/ruby-whois.org/api"
153 end
1f4d414 Simone Carletti Change :publish_docs task to deploy on my server instead of RubyGems.
authored
154 end
155
c018532 Simone Carletti Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored
156 desc "Open an irb session preloaded with this library"
157 task :console do
158 sh "irb -rubygems -I lib -r whois.rb"
159 end
160
1f4d414 Simone Carletti Change :publish_docs task to deploy on my server instead of RubyGems.
authored
161
afb4065 Simone Carletti Super simple and super buggy initial version. It works, but sometimes it...
authored
162 Dir["tasks/**/*.rake"].each do |file|
163 load(file)
164 end
Something went wrong with that request. Please try again.