forked from jkraemer/acts_as_ferret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile
134 lines (118 loc) · 4.56 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
127
128
129
130
131
132
133
134
# rakefile for acts_as_ferret.
# use to create a gem or generate rdoc api documentation.
#
# RELEASE creation:
# rake release REL=x.y.z
require 'rake'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/testtask'
require 'rake/contrib/rubyforgepublisher'
def announce(msg='')
STDERR.puts msg
end
PKG_NAME = 'acts_as_ferret'
PKG_VERSION = ENV['REL']
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
RUBYFORGE_PROJECT = 'actsasferret'
RUBYFORGE_USER = 'jkraemer'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the acts_as_ferret plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the acts_as_ferret plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'html'
rdoc.title = "acts_as_ferret - Ferret based full text search for any ActiveRecord model"
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.options << '--main' << 'README'
rdoc.rdoc_files.include('README', 'LICENSE')
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
rdoc.rdoc_files.include('lib/**/*.rb')
end
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, RUBYFORGE_USER).upload
end
if PKG_VERSION
spec = Gem::Specification.new do |s|
s.name = PKG_NAME
s.version = PKG_VERSION
s.platform = Gem::Platform::RUBY
s.summary = "acts_as_ferret - Ferret based full text search for any ActiveRecord model"
s.files = Dir.glob('**/*', File::FNM_DOTMATCH).reject do |f|
[ /\.$/, /sqlite$/, /\.log$/, /^pkg/, /\.svn/, /\.\w+\.sw.$/,
/^html/, /\~$/, /\/\._/, /\/#/ ].any? {|regex| f =~ regex }
end
#s.files = FileList["{lib,test}/**/*"].to_a + %w(README MIT-LICENSE CHANGELOG)
# s.files.delete ...
s.require_path = 'lib'
s.bindir = "bin"
s.executables = ["aaf_install"]
s.default_executable = "aaf_install"
s.autorequire = 'acts_as_ferret'
s.has_rdoc = true
# s.test_files = Dir['test/**/*_test.rb']
s.author = "Jens Kraemer"
s.email = "jk@jkraemer.net"
s.homepage = "http://projects.jkraemer.net/acts_as_ferret"
end
package_task = Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
# Validate that everything is ready to go for a release.
task :prerelease do
announce
announce "**************************************************************"
announce "* Making RubyGem Release #{PKG_VERSION}"
announce "**************************************************************"
announce
# Are all source files checked in?
if ENV['RELTEST']
announce "Release Task Testing, skipping checked-in file test"
else
announce "Pulling in svn..."
`svk pull .`
announce "Checking for unchecked-in files..."
data = `svk st`
unless data =~ /^$/
fail "SVK status is not clean ... do you have unchecked-in files?"
end
announce "No outstanding checkins found ... OK"
# announce "Pushing to svn..."
# `svk push .`
end
end
desc "tag the new release"
task :tag => [ :prerelease ] do
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
announce "Tagging with [#{PKG_VERSION}]"
if ENV['RELTEST']
announce "Release Task Testing, skipping tagging"
else
`svn copy -m 'tagging version #{PKG_VERSION}' svn://projects.jkraemer.net/acts_as_ferret/trunk/plugin svn://projects.jkraemer.net/acts_as_ferret/tags/#{PKG_VERSION}`
`svn del -m 'remove old stable' svn://projects.jkraemer.net/acts_as_ferret/tags/stable`
`svn copy -m 'tagging version #{PKG_VERSION} as stable' svn://projects.jkraemer.net/acts_as_ferret/tags/#{PKG_VERSION} svn://projects.jkraemer.net/acts_as_ferret/tags/stable`
end
end
# Upload release to rubyforge
desc "Upload release to rubyforge"
task :prel => [ :tag, :prerelease, :package ] do
`rubyforge login`
release_command = "rubyforge add_release #{RUBYFORGE_PROJECT} #{PKG_NAME} '#{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem"
puts release_command
system(release_command)
`rubyforge config #{RUBYFORGE_PROJECT}`
release_command = "rubyforge add_file #{RUBYFORGE_PROJECT} #{PKG_NAME} '#{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.tgz"
puts release_command
system(release_command)
end
desc 'Publish the gem and API docs'
task :release => [:pdoc, :prel ]
end