This repository was archived by the owner on Oct 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathRakefile
More file actions
62 lines (52 loc) · 2 KB
/
Rakefile
File metadata and controls
62 lines (52 loc) · 2 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
require('rubygems')
require('json')
require('yaml')
require 'opal'
#require 'opal-browser'
#require 'react-latest'
require 'opal-jquery'
require 'reactrb'
desc "Build inline code editor support reactive-playground.js"
task :build_reactive_playground do
Opal.append_path "reactive-playground"
File.binwrite "reactive-playground.js", Opal::Builder.build("application").to_s
end
desc "Build chat_service and test_chat_service.js"
task :build_chat_service do
Opal.append_path "chat_service"
File.binwrite "./react/js/chat_service.js", Opal::Builder.build("chat_service").to_s
File.binwrite "./react/js/test_chat_service.js", Opal::Builder.build("test_chat_service").to_s
end
desc "generate js from jsx"
task :js do
system "cp ../react/node_modules/babel/node_modules/babel-core/browser.min.js ./react/js/babel-browser.min.js"
system "../react/node_modules/.bin/babel _js --out-dir=react/js"
end
desc "watch js"
task :watch do
Process.spawn "../react/node_modules/.bin/babel _js --out-dir=react/js --watch"
Process.waitall
end
desc "update version to match ../package.json"
task :update_version do
react_version = JSON.parse(File.read('../package.json'))['version']
site_config = YAML.load_file('_config.yml')
if site_config['react_version'] != react_version
site_config['react_version'] = react_version
File.open('_config.yml', 'w+') { |f| f.write(site_config.to_yaml) }
end
end
desc "update acknowledgements list"
task :update_acknowledgements do
authors = File.readlines('../AUTHORS').map {|author| author.gsub(/ <.*\n/,'')}
# split into cols here because nobody knows how to use liquid
# need to to_f because ruby will keep slice_size as int and round on its own
slice_size = (authors.size / 3.to_f).ceil
cols = authors.each_slice(slice_size).to_a
File.open('_data/acknowledgements.yml', 'w+') { |f| f.write(cols.to_yaml) }
end
desc "build into ../../react-gh-pages"
task :release => [:update_version, :default] do
system "jekyll build -d ../../react-gh-pages"
end
task :default => [:js]