-
Notifications
You must be signed in to change notification settings - Fork 418
/
Rakefile
74 lines (63 loc) · 2.56 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
74
require 'rubygems'
require 'bundler/setup'
require 'fileutils'
require 'tilt'
require 'yaml'
file '.current_version' do
FileUtils.mkdir_p('.current_version')
end
file '.current_browser_runner_version/lib' do
FileUtils.mkdir_p('.current_browser_runner_version/lib')
end
file '.current_npm_version/reporters' do
FileUtils.mkdir_p('.current_npm_version/reporters')
end
def download_core_file(file_name)
`curl -L 'https://raw.github.com/jasmine/jasmine/main/lib/#{file_name}' > .current_version/#{File.basename(file_name)}`
end
# Usage:
# rake update_edge_jasmine to pull from github
# rake 'update_edge_jasmine[../jasmine]' to pull from local dir ../jasmine
desc "update jasmine-core for edge docs"
task :update_edge_jasmine, [:path] => ['.current_version'] do |t, args|
if args.path then
system('cp', "#{args.path}/lib/jasmine-core/jasmine.js", '.current_version/')
system('cp', "#{args.path}/lib/jasmine-core.js", '.current_version/')
system('cp', "#{args.path}/lib/jasmine-core/jasmine-html.js", '.current_version/')
system('cp', "#{args.path}/lib/jasmine-core/boot0.js", '.current_version/')
system('cp', "#{args.path}/lib/jasmine-core/boot1.js", '.current_version/')
else
download_core_file('jasmine-core/jasmine.js')
download_core_file('jasmine-core.js')
download_core_file('jasmine-core/jasmine-html.js')
download_core_file('jasmine-core/boot0.js')
download_core_file('jasmine-core/boot1.js')
end
end
def download_browser_runner_file(file_name)
`curl -L 'https://raw.github.com/jasmine/jasmine-browser/main/#{file_name}' > .current_browser_runner_version/#{file_name}`
end
desc "update jasmine-browser-runner for edge docs"
task :update_edge_jasmine_browser => ['.current_browser_runner_version/lib'] do
download_browser_runner_file('index.js')
download_browser_runner_file('lib/server.js')
download_browser_runner_file('lib/runner.js')
download_browser_runner_file('lib/types.js')
end
def download_npm_file(file_name)
`curl -L 'https://raw.github.com/jasmine/jasmine-npm/main/lib/#{file_name}' > .current_npm_version/#{file_name}`
end
desc "update jasmine-npm for edge docs"
task :update_edge_jasmine_npm => ['.current_npm_version/reporters'] do
download_npm_file('jasmine.js')
download_npm_file('parallel_runner.js')
download_npm_file('runner_base.js')
download_npm_file('reporters/console_reporter.js')
end
desc "make section of docs for a newly released version of jasmine"
task :release, [:version] do |t, args|
FileUtils.cp_r('_api/edge', '_api/' + args.version)
end
task :serve do
system("jekyll serve --baseurl ''")
end