forked from shajith/rinku
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRakefile
70 lines (55 loc) · 1.64 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
require 'date'
require 'rake/clean'
require 'rake/extensiontask'
require 'bundler/gem_tasks'
require 'digest/md5'
task :default => :test
# ==========================================================
# Ruby Extension
# ==========================================================
Rake::ExtensionTask.new('rinku')
# ==========================================================
# Testing
# ==========================================================
require 'rake/testtask'
Rake::TestTask.new('test') do |t|
t.test_files = FileList['test/*_test.rb']
t.ruby_opts += ['-r rubygems'] if defined? Gem
end
task 'test' => [:compile]
# PACKAGING =================================================================
require 'rubygems'
$spec = Bundler::GemHelper.gemspec
def package(ext='')
"pkg/zendesk-rinku-#{$spec.version}" + ext
end
desc 'Build packages'
task :package => package('.gem')
desc 'Build and install as local gem'
task :install => package('.gem') do
sh "gem install #{package('.gem')}"
end
desc 'Update the gemspec'
task :update_gem => file('rinku.gemspec')
directory 'pkg/'
file package('.gem') => %w[pkg/ rinku.gemspec] + $spec.files do |f|
sh "gem build rinku.gemspec"
mv File.basename(f.name), f.name
end
# GEMSPEC HELPERS ==========================================================
task :gather => 'sundown:checkout' do |t|
files =
FileList[
'sundown/src/{buffer,autolink}.h',
'sundown/src/{buffer,autolink}.c',
]
cp files, 'ext/rinku/',
:preserve => true,
:verbose => true
end
task 'sundown:checkout' do |t|
unless File.exists?('sundown/src/markdown.h')
sh 'git submodule init'
sh 'git submodule update'
end
end