forked from openhab/openhab-jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
38 lines (26 loc) · 1002 Bytes
/
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
# frozen_string_literal: true
require "rake/packagetask"
require "bundler/gem_tasks"
require "English"
require "time"
PACKAGE_DIR = "pkg"
TMP_DIR = File.expand_path("tmp")
OPENHAB_DIR = File.join(TMP_DIR, "openhab")
CLEAN << PACKAGE_DIR
DOC_FILES = %w[
templates/default/fulldoc/html/js/app.js
templates/default/layout/html/versions.erb
].freeze
def file_sub(file, old, new)
contents = File.read(file)
contents.gsub!(old, new)
File.write(file, contents)
end
desc "Update links in YARD doc navigation to mark the latest minor release as stable"
task :update_doc_links, [:old_version, :new_version] do |_t, args|
old_version = Gem::Version.new(args[:old_version]).segments[0..1].join(".")
new_version = Gem::Version.new(args[:new_version]).segments[0..1].join(".")
next if old_version == new_version
DOC_FILES.each { |file| file_sub(file, old_version, new_version) }
file_sub(".known_good_references", "/openhab-jruby/#{old_version}", "/openhab-jruby/#{new_version}")
end