forked from gdotdesign/fron-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
37 lines (30 loc) · 973 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
require 'rubygems'
require 'bundler/setup'
require 'opal/rspec/rake_task'
require 'rack'
require 'fron_ui'
Bundler::GemHelper.install_tasks
html = -> (file) { "<body><script src='/assets/#{file}.js'></script><script>Opal.modules[\"#{file}\"](Opal)</script></body>" }
Opal::RSpec::RakeTask.new(:spec) do |_, task|
task.files = FileList[ARGV[1] || 'spec/**/*_spec.rb']
task.timeout = 120_000
end
desc 'Run CI Tasks'
task :ci do
sh 'SPEC_OPTS="--color" rake spec'
sh 'rubocop lib opal spec'
sh 'rubycritic lib opal --mode-ci -s 94 --no-browser'
end
task :examples do
opal = Opal::Server.new do |s|
s.main = nil
s.debug = false
end
app = proc do |env|
next [404, {}, []] if env['PATH_INFO'] =~ %r{^/assets}
example = env['PATH_INFO'][1..-1]
['200', { 'Content-Type' => 'text/html' }, [html.call("fron-ui/examples/#{example}/index")]]
end
server = Rack::Cascade.new([app, opal])
Rack::Handler::WEBrick.run server, Port: 9292
end