Skip to content
Newer
Older
100644 153 lines (115 sloc) 4.05 KB
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
1 require 'rubygems'
2 require 'rake/testtask'
3 require 'rspec/core/rake_task'
4 require 'rake/gempackagetask'
5 require 'yard'
6 require 'yard/rake/yardoc_task'
1f4d414 @weppos Change :publish_docs task to deploy on my server instead of RubyGems.
authored Jun 16, 2010
7
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
8 $:.unshift(File.dirname(__FILE__) + '/lib')
9 require 'whois'
add6330 @weppos Double quotes
authored Apr 12, 2010
10
1f4d414 @weppos Change :publish_docs task to deploy on my server instead of RubyGems.
authored Jun 16, 2010
11
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
12 # Common package properties
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
13 PKG_NAME = ENV['PKG_NAME'] || Whois::GEM
14 PKG_VERSION = ENV['PKG_VERSION'] || Whois::VERSION
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
15
16 if ENV['SNAPSHOT'].to_i == 1
17 PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
18 end
add6330 @weppos Double quotes
authored Apr 12, 2010
19
20
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
21 # Run test by default.
5f26417 @weppos Add support for rubygems-test.
authored Feb 13, 2011
22 task :default => :test
23 task :test => [:rspec, :testunit]
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
24
25 # This builds the actual gem. For details of what all these options
26 # mean, and other ones you can add, check the documentation here:
27 #
28 # http://rubygems.org/read/chapter/20
29 #
30 spec = Gem::Specification.new do |s|
31 s.name = PKG_NAME
32 s.version = PKG_VERSION
33 s.summary = "An intelligent pure Ruby WHOIS client and parser."
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
34 s.description = "Whois is an intelligent WHOIS client and parser written in pure Ruby. It can query registry data for IPv4, IPv6 and top level domains, parse and convert responses into easy-to-use Ruby objects."
afd063a @weppos Minimum Ruby version is now 1.8.7
authored Oct 21, 2010
35
36 s.required_ruby_version = ">= 1.8.7"
37
38 s.author = "Simone Carletti"
39 s.email = "weppos@weppos.net"
40 s.homepage = "http://www.ruby-whois.org"
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
41 s.rubyforge_project = "whois"
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
42
5f26417 @weppos Add support for rubygems-test.
authored Feb 13, 2011
43 s.files = %w( Rakefile LICENSE .gemtest .rspec .yardopts ) +
44 Dir.glob("*.{rdoc,gemspec}") +
45 Dir.glob("{bin,lib,test,spec}/**/*")
48351b2 @weppos ruby-whois executable is not installed when the Gem is installed.
authored Sep 10, 2010
46 s.executables = ["ruby-whois"]
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
47 s.require_paths = ["lib"]
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
48
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
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
5077808 @weppos Upgrade to RSpec 2.5.0
authored Feb 14, 2011
54 s.add_development_dependency("rspec", "~> 2.5.0")
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
55 s.add_development_dependency("mocha")
803568b @weppos Add YARD development dependency.
authored Dec 20, 2010
56 s.add_development_dependency("yard")
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
57 end
58
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
59 # This task actually builds the gem.
60 # We also regenerate a static .gemspec file.
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
61 Rake::GemPackageTask.new(spec) do |pkg|
62 pkg.gem_spec = spec
63 end
be24e73 @weppos Base GEM skeleton.
authored Jun 29, 2009
64
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
65 desc "Build the gemspec file #{spec.name}.gemspec"
66 task :gemspec do
67 file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
68 File.open(file, "w") {|f| f << spec.to_ruby }
69 end
70
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
71
d3842b6 @weppos Install RSpec 2
authored Sep 22, 2010
72 # Run all the specs in the /spec folder
73 RSpec::Core::RakeTask.new(:rspec)
74
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
75 # Run all the tests in the /test folder
5f26417 @weppos Add support for rubygems-test.
authored Feb 13, 2011
76 Rake::TestTask.new(:testunit) do |t|
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
77 t.libs << "test"
78 t.test_files = FileList["test/**/*_test.rb"]
79 t.verbose = true
80 end
81
82
6c55e45 @weppos Update Ruby versions
authored Mar 5, 2011
83 namespace :multitest do
84 RUBIES = %w( ruby-1.8.7-p334 ruby-1.9.2-p180 jruby-1.6.0.RC2 ree-1.8.7-2011.03 )
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
85
149f79c @weppos Cleanup rake test tasks
authored Dec 24, 2010
86 desc "Run tests for all rubies"
6c55e45 @weppos Update Ruby versions
authored Mar 5, 2011
87 task :all => :ensure_rvm do
149f79c @weppos Cleanup rake test tasks
authored Dec 24, 2010
88 sh "rvm #{RUBIES.join(",")} rake default"
89 end
90
91 task :ensure_rvm do
92 File.exist?(File.expand_path("~/.rvm/scripts/rvm")) || abort("RVM is not available")
93 end
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
94
6c55e45 @weppos Update Ruby versions
authored Mar 5, 2011
95 RUBIES.each do |ruby|
96 desc "Run tests against Ruby #{ruby}"
97 task ruby => "test:ensure_rvm" do
98 sh "rvm #{ruby} rake default"
99 end
100 end
101
39d7208 @weppos rake multitest:setup/bundleize
authored Mar 5, 2011
102 task :bundleize do
94d1af9 @weppos rake multitest:setup
authored Mar 5, 2011
103 sh "rvm #{RUBIES.join(",")} gem install bundler"
39d7208 @weppos rake multitest:setup/bundleize
authored Mar 5, 2011
104 end
105
106 task :setup do
107 sh "rvm #{RUBIES.join(",")} exec bundle install"
d9ad2e0 @weppos Add cross-ruby test tasks
authored Aug 19, 2010
108 end
109 end
110
111
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
112 desc "Remove any temporary products, including gemspec"
113 task :clean => [:clobber] do
114 rm "#{spec.name}.gemspec" if File.file?("#{spec.name}.gemspec")
115 end
116
117 desc "Remove any generated file"
4c633ca @weppos Replace RDoc with YARD
authored Dec 20, 2010
118 task :clobber => [:clobber_rcov, :clobber_package]
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
119
120 desc "Package the library and generates the gemspec"
121 task :package => [:gemspec]
122
4c633ca @weppos Replace RDoc with YARD
authored Dec 20, 2010
123
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
124 YARD::Rake::YardocTask.new(:yardoc) do |y|
125 y.options = ["--output-dir", "yardoc"]
126 end
4c633ca @weppos Replace RDoc with YARD
authored Dec 20, 2010
127
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
128 namespace :yardoc do
129 desc "Publish YARD documentation to the site"
130 task :publish => ["yardoc:clobber", "yardoc"] do
131 ENV["username"] || raise(ArgumentError, "Missing ssh username")
132 sh "rsync -avz --delete yardoc/ #{ENV["username"]}@alamak:/home/#{ENV["username"]}/ruby-whois.org/api"
4c633ca @weppos Replace RDoc with YARD
authored Dec 20, 2010
133 end
134
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
135 desc "Remove YARD products"
136 task :clobber do
137 rm_r "yardoc" rescue nil
4c633ca @weppos Replace RDoc with YARD
authored Dec 20, 2010
138 end
139 end
140
c0ff6ec @weppos Simplify Rakefile
authored Mar 11, 2011
141 task :clobber => "yardoc:clobber"
54b1d16 @weppos Added Rake :console task.
authored Jun 29, 2009
142
1f4d414 @weppos Change :publish_docs task to deploy on my server instead of RubyGems.
authored Jun 16, 2010
143
c018532 @weppos Drop dependency from Echoe and rewrite the Rakefile from scratch.
authored Aug 12, 2010
144 desc "Open an irb session preloaded with this library"
145 task :console do
146 sh "irb -rubygems -I lib -r whois.rb"
147 end
148
1f4d414 @weppos Change :publish_docs task to deploy on my server instead of RubyGems.
authored Jun 16, 2010
149
afb4065 @weppos Super simple and super buggy initial version. It works, but sometimes…
authored Jul 1, 2009
150 Dir["tasks/**/*.rake"].each do |file|
151 load(file)
152 end
Something went wrong with that request. Please try again.