-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbake.rb
More file actions
79 lines (65 loc) · 2.15 KB
/
bake.rb
File metadata and controls
79 lines (65 loc) · 2.15 KB
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
74
75
76
77
78
79
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2014, by John MacFarlane.
# Copyright, 2015-2019, by Garen Torikian.
# Copyright, 2016, by Yuki Izumi.
# Copyright, 2017, by Ashe Connor.
# Copyright, 2020-2026, by Samuel Williams.
$LOAD_PATH << ::File.expand_path("ext", __dir__)
# Update the project documentation with the new version number.
#
# @parameter version [String] The new version number.
def after_gem_release_version_increment(version)
context["releases:update"].call(version)
context["utopia:project:update"].call
end
# Create a GitHub release for the given tag.
#
# @parameter tag [String] The tag to create a release for.
def after_gem_release(tag:, **options)
context["releases:github:release"].call(tag)
end
def before_test
build
end
def build
ext_path = File.expand_path("ext/markly", __dir__)
Dir.chdir(ext_path) do
system("./extconf.rb")
system("make")
end
end
def clean
ext_path = File.expand_path("ext/markly", __dir__)
Dir.chdir(ext_path) do
system("make clean")
end
end
def format
system("clang-format -style llvm -i ext/markly/*.c ext/markly/*.h ext/markly/extensions/*.c ext/markly/extensions/*.h")
end
def benchmark
if ENV["FETCH_PROGIT"]
`rm -rf test/progit`
`git clone https://github.com/progit/progit.git test/progit`
langs = %w[ar az be ca cs de en eo es es-ni fa fi fr hi hu id it ja ko mk nl no-nb pl pt-br ro ru sr th tr uk vi zh zh-tw]
langs.each do |lang|
`cat test/progit/#{lang}/*/*.markdown >> test/benchinput.md`
end
end
$LOAD_PATH.unshift "lib"
load "test/benchmark.rb"
end
def synchronize_upstream
require "build/files"
require "build/files/system"
root = Build::Files::Path[context.root]
ext_markly = root/"ext/markly"
cmark_gfm = root/"cmark-gfm"
(cmark_gfm/"src").glob("**/*").copy(ext_markly)
(cmark_gfm/"extensions").glob("**/*").copy(ext_markly/"extensions")
(cmark_gfm/"build/src").glob("config.h").copy(ext_markly)
(cmark_gfm/"build/src").glob("cmark-gfm_export.h").copy(ext_markly)
(cmark_gfm/"build/src").glob("cmark-gfm_version.h").copy(ext_markly)
(cmark_gfm/"build/extensions").glob("cmark-gfm-extensions_export.h").copy(ext_markly/"extensions")
end