forked from turbolinks/turbolinks-source-gem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
34 lines (27 loc) · 906 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
VERSION_RB_SRC = <<-RUBY
module Turbolinks
module Source
VERSION = %s
end
end
RUBY
ROOT = File.expand_path("..", __FILE__)
TURBOLINKS_ROOT = ENV["TURBOLINKS_ROOT"]
task "build" do
unless TURBOLINKS_ROOT
warn "Please run \`rake build TURBOLINKS_ROOT=/path/to/turbolinks\`"
exit 1
end
javascript_path = File.expand_path("dist/turbolinks.js", TURBOLINKS_ROOT)
version_path = File.expand_path("src/turbolinks/VERSION", TURBOLINKS_ROOT)
unless File.exists?(javascript_path) && File.exists?(version_path)
warn "Can't find Turbolinks source in TURBOLINKS_ROOT"
exit 1
end
version = File.read(version_path).strip
FileUtils.cp(javascript_path, File.expand_path("lib/assets/javascripts"))
File.open(File.expand_path("lib/turbolinks/source/version.rb"), "w") do |file|
file << VERSION_RB_SRC % version.inspect
end
puts "Built turbolinks-source #{version}"
end