File: Rakefile

package info (click to toggle)
ruby-feedparser 0.11.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: ruby: 1,871; sh: 24; makefile: 5
file content (93 lines) | stat: -rw-r--r-- 2,293 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require 'rake/testtask'
require 'rdoc/task'
require 'rubygems/package_task'
require 'rake'
require 'find'
require_relative 'lib/feedparser/version.rb'

# Globals
PKG_NAME = 'ruby-feedparser'
PKG_VERSION = FeedParser::VERSION

PKG_FILES = [ 'README', 'COPYING', 'LICENSE', 'Rakefile']
Find.find('lib/', 'test/', 'tools/') do |f|
  if FileTest.directory?(f) and f =~ /\.svn/
    Find.prune
  else
    PKG_FILES << f
  end
end

PKG_FILES.reject! { |f| f =~ /^test\/(source|.*_output)\// }

task :default => [:test]

Rake::TestTask.new do |t|
  t.libs << "test"
  t.test_files = FileList['test/tc_*.rb']
  t.verbose = true
end

Rake::RDocTask.new do |rd|
  f = []
  Find.find('lib/') do |file|
    if FileTest.directory?(file) and file =~ /\.svn/
      Find.prune
    else
      f << file if not FileTest.directory?(file)
    end
  end
  f.delete('lib/feedparser.rb')
  # hack to document the Feedparser module properly
  f.unshift('lib/feedparser.rb')
  rd.rdoc_files.include(f)
  rd.options << '--all'
  rd.options << '--diagram'
  rd.options << '--fileboxes'
  rd.options << '--inline-source'
  rd.options << '--line-numbers'
  rd.rdoc_dir = 'rdoc'
end

task :doctoweb => [:rdoc] do |t|
   # copies the rdoc to the CVS repository for ruby-feedparser website
  # repository is in $CVSDIR (default: ~/dev/ruby-feedparser-web)
   sh "tools/doctoweb.bash"
end

Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p|
  p.need_tar = true
  p.need_zip = true
  p.package_files = PKG_FILES
end

# "Gem" part of the Rakefile
begin
  spec = Gem::Specification.new do |s|
    s.platform = Gem::Platform::RUBY
    s.summary = "Ruby library to parse ATOM and RSS feeds"
    s.name = PKG_NAME
    s.version = PKG_VERSION
    s.require_path = 'lib'
    s.autorequire = 'feedparser'
    s.files = PKG_FILES
    s.description = "Ruby library to parse ATOM and RSS feeds"
    s.authors = ['Lucas Nussbaum']
    s.add_runtime_dependency 'magic'
    s.add_development_dependency 'mocha'
  end

  Gem::PackageTask.new(spec) do |pkg|
    pkg.need_zip = true
    pkg.need_tar = true
  end
rescue LoadError
  puts "Will not generate gem."
end

task :release => :repackage do
  sh 'git', 'tag', 'v' + PKG_VERSION
  sh 'git', 'push'
  sh 'git', 'push', '--tags'
  sh 'gem', 'push', "pkg/#{PKG_NAME}-#{PKG_VERSION}.gem"
end