forked from mjackson/sinatra-session
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
62 lines (48 loc) · 1.46 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
require 'rake/clean'
task :default => :package
# DOCS ########################################################################
desc "Generate API documentation"
task :api => FileList['lib/**/*.rb'] do |t|
output_dir = ENV['OUTPUT_DIR'] || 'api'
rm_rf output_dir
sh((<<-SH).gsub(/[\s\n]+/, ' ').strip)
hanna
--op #{output_dir}
--promiscuous
--charset utf8
--fmt html
--inline-source
--line-numbers
--accessor option_accessor=RW
--main Sinatra::Session
--title 'Sinatra::Session API Documentation'
#{t.prerequisites.join(' ')}
SH
end
CLEAN.include 'api'
# PACKAGING & INSTALLATION ####################################################
if defined?(Gem)
$spec = eval("#{File.read('sinatra-session.gemspec')}")
directory 'dist'
def package(ext='')
"dist/#{$spec.name}-#{$spec.version}" + ext
end
file package('.gem') => %w< dist > + $spec.files do |f|
sh "gem build sinatra-session.gemspec"
mv File.basename(f.name), f.name
end
file package('.tar.gz') => %w< dist > + $spec.files do |f|
sh "git archive --format=tar HEAD | gzip > #{f.name}"
end
desc "Build packages"
task :package => %w< .gem .tar.gz >.map {|e| package(e) }
desc "Build and install as local gem"
task :install => package('.gem') do |t|
sh "gem install #{package('.gem')}"
end
desc "Upload gem to rubygems.org"
task :release => package('.gem') do |t|
sh "gem push #{package('.gem')}"
end
end
CLOBBER.include 'dist'