-
Notifications
You must be signed in to change notification settings - Fork 21
/
Rakefile
195 lines (166 loc) · 5.37 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
require "rake"
require "rake/clean"
require "rake/gempackagetask"
require "rake/rdoctask"
require "rake/testtask"
require "fileutils"
require "yaml"
require "lib/alogr"
include FileUtils
GEM_NAME = "alogr"
#REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
REV = nil
#GEM_VERSION = ENV["VERSION"] || AlogR::VERSION::STRING + (REV ? ".#{REV}" : "")
GEM_VERSION = AlogR::Version# + (REV ? ".#{REV}" : "")
#CLEAN.include [
# "ext/aio_logger/*.{bundle,so,obj,pdb,lib,def,exp}",
# "ext/aio_logger/Makefile",
# "**/.*.sw?",
# "*.gem",
# ".config"
#]
RDOC_OPTS = ["--quiet", "--title", "AlogR Reference", "--main", "README", "--inline-source"]
@config_file = "~/.rubyforge/user-config.yml"
@config = nil
def rubyforge_username
unless @config
begin
@config = YAML.load(File.read(File.expand_path(@config_file)))
rescue
puts <<-EOS
ERROR: No rubyforge config file found: #{@config_file}"
Run 'rubyforge setup' to prepare your env for access to Rubyforge
- See http://newgem.rubyforge.org/rubyforge.html for more details
EOS
exit
end
end
@rubyforge_username ||= @config["username"]
end
#desc "Does a full compile, test run"
#task :default => [:compile, :test]
#desc "Compiles all extensions"
#task :compile => [:aio_logger] do
# if Dir.glob(File.join("lib","aio_logger.*")).length == 0
# STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# STDERR.puts "Gem actually failed to build. Your system is"
# STDERR.puts "NOT configured properly to build aio_logger."
# STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
# exit(1)
# end
#end
desc "Packages up AlogR."
task :package# => [:clean]
desc "Releases packages for all AlogR packages and platforms."
task :release => [:package]#, :rubygems_win32]
#desc "Run all the specs"
#Rake::SpecTask.new do | spec_task |
#spec_task.libs << "spec"
#spec_task.spec_files = FileList["spec/*_spec.rb"]
#spec_task.spec_opts = ["--color", "--diff"]
#end
Rake::RDocTask.new do | rdoc |
rdoc.rdoc_dir = "doc/rdoc"
rdoc.options += RDOC_OPTS
rdoc.main = "README"
rdoc.rdoc_files.add ["README", "CHANGELOG", "COPYING", "lib/**/*.rb"]
end
spec =
Gem::Specification.new do | specification |
specification.name = GEM_NAME
specification.version = GEM_VERSION
specification.platform = Gem::Platform::RUBY
specification.has_rdoc = true
specification.rdoc_options += RDOC_OPTS
specification.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
specification.summary = "a threadsafe non-blocking asynchronous configurable logger for Ruby."
specification.description = specification.summary
specification.author = "Wayne E. Seguin"
specification.email = "wayneeseguin at gmail dot com"
specification.homepage = "alogr.rubyforge.org"
specification.files = %w(COPYING README Rakefile) +
Dir.glob("{bin,doc,test,lib,extras}/**/*")# +
#Dir.glob("ext/**/*.{h,c,rb,rl}") +
#%w[ext/aio_logger/aio_logger.c] # needed because it's generated later
specification.require_path = "lib"
#specification.extensions = FileList["ext/**/extconf.rb"].to_a
specification.bindir = "bin"
end
Rake::GemPackageTask.new(spec) do | package |
package.need_tar = true
package.gem_spec = spec
end
#extension = "aio_logger"
#ext = "ext/aio_logger"
#ext_so = "#{ext}/#{extension}.#{Config::CONFIG["DLEXT"]}"
#ext_files = FileList[
#"#{ext}/*.c",
#"#{ext}/*.h",
#"#{ext}/*.rl",
#"#{ext}/extconf.rb",
#"#{ext}/Makefile",
#"lib"
#]
task "lib" do
directory "lib"
end
#desc "Builds just the #{extension} extension"
#task extension.to_sym => ["#{ext}/Makefile", ext_so ]
#file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
# Dir.chdir(ext) do
# ruby "extconf.rb"
# end
#end
#file ext_so => ext_files do
# Dir.chdir(ext) do
# sh(PLATFORM =~ /win32/ ? "nmake" : "make")
# end
# cp ext_so, "lib"
#end
task :install do
sh %{rake package}
sh %{sudo gem install pkg/#{GEM_NAME}-#{GEM_VERSION}}
end
task :uninstall do#=> [:clean] do
sh %{sudo gem uninstall #{GEM_NAME}}
end
#
# Website tasks via webgen
#
desc "Generate and upload website files"
task :website => [:generate_website, :upload_website, :generate_rdoc, :upload_rdoc]
task :generate_website do
# ruby atom.rb > output/feed.atom
sh %{pushd website; webgen; popd }
end
task :generate_rdoc do
sh %{rake rdoc}
end
desc "Upload website files to rubyforge"
task :upload_website do
sh %{rsync -avz website/output/ #{rubyforge_username}@rubyforge.org:/var/www/gforge-projects/#{GEM_NAME}/}
end
desc "Upload rdoc files to rubyforge"
task :upload_rdoc do
sh %{rsync -avz doc/rdoc/ #{rubyforge_username}@rubyforge.org:/var/www/gforge-projects/#{GEM_NAME}/rdoc}
end
desc "Release the website and new gem version"
task :deploy => [:check_version, :website, :release] do
puts "Remember to create SVN tag:"
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{GEM_VERSION} "
puts "Suggested comment:"
puts "Tagging release #{CHANGES}"
end
desc "Runs tasks website_generate and install_gem as a local deployment of the gem"
task :local_deploy => [:website_generate, :install_gem]
task :check_version do
unless ENV["VERSION"]
puts "Must pass a VERSION=x.y.z release version"
exit
end
unless ENV["VERSION"] == GEM_VERSION
puts "Please update your version.rb to match the release version, currently #{GEM_VERSION}"
exit
end
end