-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
73 lines (58 loc) · 2 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
# -*- ruby -*-
require 'rubygems/package_task'
require 'fileutils'
require 'rake/clean'
require 'rake/testtask'
require_relative 'lib/kramdown/converter/math_engine/ritex'
task :default => :test
Rake::TestTask.new do |test|
test.warning = false
test.libs << 'test'
test.test_files = FileList['test/test_*.rb']
end
SUMMARY = 'kramdown-math-ritex uses ritex to convert math elements to MathML'
PKG_FILES = FileList.new(['COPYING', 'VERSION', 'CONTRIBUTERS', 'lib/**/*.rb', 'test/**/*'])
CLOBBER << "VERSION"
file 'VERSION' do
puts "Generating VERSION file"
File.open('VERSION', 'w+') {|file| file.write(Kramdown::Converter::MathEngine::Ritex::VERSION + "\n")}
end
CLOBBER << 'CONTRIBUTERS'
file 'CONTRIBUTERS' do
puts "Generating CONTRIBUTERS file"
`echo " Count Name" > CONTRIBUTERS`
`echo "======= ====" >> CONTRIBUTERS`
`git log | grep ^Author: | sed 's/^Author: //' | sort | uniq -c | sort -nr >> CONTRIBUTERS`
end
spec = Gem::Specification.new do |s|
s.name = 'kramdown-math-ritex'
s.version = Kramdown::Converter::MathEngine::Ritex::VERSION
s.summary = SUMMARY
s.license = 'MIT'
s.files = PKG_FILES.to_a
s.require_path = 'lib'
s.required_ruby_version = '>= 2.3'
s.add_dependency 'kramdown', '~> 2.0'
s.add_dependency 'ritex', '~> 1.0'
s.has_rdoc = true
s.author = 'Thomas Leitner'
s.email = '[email protected]'
s.homepage = "https://github.com/kramdown/math-ritex"
end
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
task :gemspec => ['CONTRIBUTERS', 'VERSION'] do
print "Generating Gemspec\n"
contents = spec.to_ruby
File.write("kramdown-math-ritex.gemspec", contents, mode: 'w+')
end
CLOBBER << 'kramdown-math-ritex.gemspec'
desc 'Release version ' + Kramdown::Converter::MathEngine::Ritex::VERSION
task :release => [:clobber, :package, :publish_files]
desc "Upload the release to Rubygems"
task :publish_files => [:package] do
sh "gem push pkg/kramdown-math-ritex-#{Kramdown::Converter::MathEngine::Ritex::VERSION}.gem"
puts 'done'
end