-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
73 lines (58 loc) · 2.07 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/syntax_highlighter/coderay'
task :default => :test
Rake::TestTask.new do |test|
test.warning = false
test.libs << 'test'
test.test_files = FileList['test/test_*.rb']
end
SUMMARY = 'kramdown-syntax-coderay uses coderay to highlight code blocks/spans'
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::SyntaxHighlighter::Coderay::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-syntax-coderay'
s.version = Kramdown::Converter::SyntaxHighlighter::Coderay::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 'coderay', '~> 1.1'
s.has_rdoc = true
s.author = 'Thomas Leitner'
s.email = '[email protected]'
s.homepage = "https://github.com/kramdown/syntax-coderay"
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-syntax-coderay.gemspec", contents, mode: 'w+')
end
CLOBBER << 'kramdown-syntax-coderay.gemspec'
desc 'Release version ' + Kramdown::Converter::SyntaxHighlighter::Coderay::VERSION
task :release => [:clobber, :package, :publish_files]
desc "Upload the release to Rubygems"
task :publish_files => [:package] do
sh "gem push pkg/kramdown-syntax-coderay-#{Kramdown::Converter::SyntaxHighlighter::Coderay::VERSION}.gem"
puts 'done'
end