Skip to content

Commit

Permalink
Simplify Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Mar 11, 2011
1 parent 039b52d commit c0ff6ec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 52 deletions.
1 change: 0 additions & 1 deletion LICENSE
Expand Up @@ -20,4 +20,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

75 changes: 24 additions & 51 deletions Rakefile
@@ -1,16 +1,17 @@
require "rubygems" require 'rubygems'
require "rake/testtask" require 'rake/testtask'
require "rspec/core/rake_task" require 'rspec/core/rake_task'
require "rake/gempackagetask" require 'rake/gempackagetask'
require 'yard'
require 'yard/rake/yardoc_task'


$:.unshift(File.dirname(__FILE__) + "/lib") $:.unshift(File.dirname(__FILE__) + '/lib')
require "whois" require 'whois'




# Common package properties # Common package properties
PKG_NAME = ENV['PKG_NAME'] || Whois::GEM PKG_NAME = ENV['PKG_NAME'] || Whois::GEM
PKG_VERSION = ENV['PKG_VERSION'] || Whois::VERSION PKG_VERSION = ENV['PKG_VERSION'] || Whois::VERSION
RUBYFORGE_PROJECT = "whois"


if ENV['SNAPSHOT'].to_i == 1 if ENV['SNAPSHOT'].to_i == 1
PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S") PKG_VERSION << "." << Time.now.utc.strftime("%Y%m%d%H%M%S")
Expand All @@ -30,18 +31,14 @@ spec = Gem::Specification.new do |s|
s.name = PKG_NAME s.name = PKG_NAME
s.version = PKG_VERSION s.version = PKG_VERSION
s.summary = "An intelligent pure Ruby WHOIS client and parser." s.summary = "An intelligent pure Ruby WHOIS client and parser."
s.description = <<-EOD 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."
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.
EOD


s.required_ruby_version = ">= 1.8.7" s.required_ruby_version = ">= 1.8.7"


s.author = "Simone Carletti" s.author = "Simone Carletti"
s.email = "weppos@weppos.net" s.email = "weppos@weppos.net"
s.homepage = "http://www.ruby-whois.org" s.homepage = "http://www.ruby-whois.org"
s.rubyforge_project = RUBYFORGE_PROJECT s.rubyforge_project = "whois"


s.files = %w( Rakefile LICENSE .gemtest .rspec .yardopts ) + s.files = %w( Rakefile LICENSE .gemtest .rspec .yardopts ) +
Dir.glob("*.{rdoc,gemspec}") + Dir.glob("*.{rdoc,gemspec}") +
Expand All @@ -59,10 +56,8 @@ spec = Gem::Specification.new do |s|
s.add_development_dependency("yard") s.add_development_dependency("yard")
end end


# This task actually builds the gem. We also regenerate a static # This task actually builds the gem.
# .gemspec file, which is useful if something (i.e. GitHub) will # We also regenerate a static .gemspec file.
# be automatically building a gem for this project. If you're not
# using GitHub, edit as appropriate.
Rake::GemPackageTask.new(spec) do |pkg| Rake::GemPackageTask.new(spec) do |pkg|
pkg.gem_spec = spec pkg.gem_spec = spec
end end
Expand Down Expand Up @@ -126,46 +121,24 @@ desc "Package the library and generates the gemspec"
task :package => [:gemspec] task :package => [:gemspec]




begin YARD::Rake::YardocTask.new(:yardoc) do |y|
require "yard" y.options = ["--output-dir", "yardoc"]
require "yard/rake/yardoc_task" end


YARD::Rake::YardocTask.new(:yardoc) do |y| namespace :yardoc do
y.options = ["--output-dir", "yardoc"] desc "Publish YARD documentation to the site"
task :publish => ["yardoc:clobber", "yardoc"] do
ENV["username"] || raise(ArgumentError, "Missing ssh username")
sh "rsync -avz --delete yardoc/ #{ENV["username"]}@alamak:/home/#{ENV["username"]}/ruby-whois.org/api"
end end


namespace :yardoc do desc "Remove YARD products"
desc "Publish YARD documentation to the site" task :clobber do
task :publish => ["yardoc:clobber", "yardoc"] do rm_r "yardoc" rescue nil
ENV["username"] || raise(ArgumentError, "Missing ssh username")
sh "rsync -avz --delete yardoc/ #{ENV["username"]}@alamak:/home/#{ENV["username"]}/ruby-whois.org/api"
end

desc "Remove YARD products"
task :clobber do
rm_r "yardoc" rescue nil
end
end end

task :clobber => "yardoc:clobber"
rescue LoadError
puts "YARD is not available"
end end



task :clobber => "yardoc:clobber"
begin
require "rcov/rcovtask"

desc "Create a code coverage report"
Rcov::RcovTask.new do |t|
t.test_files = FileList["test/**/*_test.rb"]
t.ruby_opts << "-Itest -x mocha,rcov,Rakefile"
t.verbose = true
end
rescue LoadError
task :clobber_rcov
# puts "RCov is not available"
end




desc "Open an irb session preloaded with this library" desc "Open an irb session preloaded with this library"
Expand Down

0 comments on commit c0ff6ec

Please sign in to comment.