File: Rakefile

package info (click to toggle)
ruby-rinku 1.7.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 160 kB
  • ctags: 97
  • sloc: ansic: 710; ruby: 287; makefile: 11
file content (69 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download | duplicates (2)
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
require 'date'
require 'rake/clean'
require 'rake/extensiontask'
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 += ['-rubygems'] if defined? Gem
end
task 'test' => [:compile]

# PACKAGING =================================================================

require 'rubygems'
$spec = eval(File.read('rinku.gemspec'))

def package(ext='')
  "pkg/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