forked from pdavies011010/gedcom-ruby
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
executable file
·126 lines (107 loc) · 3.5 KB
/
Rakefile
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# $Id$
require 'rubygems'
require 'rake'
require 'spec/rake/spectask'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/contrib/sshpublisher'
require 'rbconfig'
require 'rubyforge'
$: << './lib'
require 'gedcom'
full_name = "GEDCOM-Ruby"
short_name = full_name.downcase
# Many of these tasks came from the ruby-hl7 project rakefile
#
desc 'Default: Run RSpec Tests'
task :default => :spec
# Gem Specification
spec = Gem::Specification.new do |s|
s.name = short_name
s.version = GEDCOM::VERSION
s.author = "Phillip Davies"
s.email = "[email protected]"
s.homepage = "http://rubyforge.org/gedcom-ruby"
s.platform = Gem::Platform::RUBY
s.summary = "Ruby GEDCOM Parser Library"
s.rubyforge_project = short_name
s.description = "A simple library to enable easy, callback-based parsing of GEDCOM data files"
s.files = FileList["{lib,ext,samples,tests}/**/*"].to_a
s.require_path = "lib"
s.autorequire = short_name
s.test_files = FileList["{tests}/**/*_spec.rb"].to_a
s.has_rdoc = false
s.extra_rdoc_files = %w[README COPYING]
s.add_dependency("rake", ">= #{RAKEVERSION}")
s.add_dependency("rubyforge", ">= #{::RubyForge::VERSION}")
end
# Gem Task
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
# RSpec Test Task
desc 'Run all RSpec tests'
Spec::Rake::SpecTask.new do |t|
t.warning = false
t.spec_files = FileList['tests/*_spec.rb']
t.libs << $:
end
namespace :spec do
desc 'Run all RSpec tests with RCov to measure coverage'
Spec::Rake::SpecTask.new('with_rcov') do |t|
t.spec_files = FileList['tests/*_spec.rb']
t.libs << $:
t.rcov = true
end
desc 'Heckle the Date tests'
Spec::Rake::SpecTask.new('heckle_dates') do |t|
t.warning = true
t.spec_files = FileList['tests/date_spec.rb']
t.libs << $:
t.spec_opts << " --heckle GEDCOM::Date"
end
desc 'Heckle the DatePart test'
Spec::Rake::SpecTask.new('heckle_dateparts') do |t|
t.warning = true
t.spec_files = FileList['tests/datepart_spec.rb']
t.libs << $:
t.spec_opts << " --heckle GEDCOM::DatePart"
end
end
# Clean up Task
desc 'Clean up all the extras'
task :clean => [ :clobber_package ] do
%w[*.gem ri coverage*].each do |pattern|
files = Dir[pattern]
rm_rf files unless files.empty?
end
end
# Release task (package and upload to Ruby Forge)
desc 'Package and upload the release to rubyforge.'
task :release => [:clean, :package] do |t|
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
abort "Versions don't match '#{v}' vs '#{spec.version}'" if v != spec.version.to_s
pkg = "pkg/#{spec.name}-#{spec.version}"
if $DEBUG then
puts "release_id = rf.add_release #{spec.rubyforge_project.inspect}, #{spec.name.inspect}, #{version.inspect}, \"#{pkg}.tgz\""
puts "rf.add_file #{spec.rubyforge_project.inspect}, #{spec.name.inspect}, release_id, \"#{pkg}.gem\""
end
rf = RubyForge.new
puts "Logging in"
rf.login
# Put changelog notes in a NOTES file
changes = open("NOTES").readlines.join("") if File.exists?("NOTES")
c = rf.userconfig
c["release_notes"] = spec.description if spec.description
c["release_changes"] = changes if changes
c["preformatted"] = true
files = ["#{pkg}.tgz", "#{pkg}.gem"].compact
puts "Releasing #{spec.name} v. #{spec.version}"
rf.add_release spec.rubyforge_project, spec.name, spec.version.to_s, *files
end
# Task to install the gem locally
desc 'Install the package as a gem'
task :install_gem => [:clean, :package] do
sh "sudo gem install pkg/*.gem"
end