opal-spec 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
can be found in the spec/ directory.
|
4
|
-
*/
|
1
|
+
# This file is used by Opal::Spec::Server to basically load all spec files that
|
2
|
+
# can be found in the spec/ directory.
|
5
3
|
|
6
4
|
<% require_asset 'opal' %>
|
7
5
|
<% require_asset 'opal-spec' %>
|
@@ -9,3 +7,5 @@
|
|
9
7
|
<% Dir.glob('spec/**/*.{rb,opal}').each do |s| %>
|
10
8
|
<% require_asset s.sub(/^spec\//, '').sub(/\.(rb|opal)$/, '') %>
|
11
9
|
<% end %>
|
10
|
+
|
11
|
+
Spec::Runner.autorun
|
data/lib/opal/spec/rake_task.rb
CHANGED
@@ -7,12 +7,9 @@ module Opal
|
|
7
7
|
include Rake::DSL if defined? Rake::DSL
|
8
8
|
|
9
9
|
attr_accessor :name
|
10
|
-
attr_writer :runner_path, :url_path, :port
|
11
10
|
|
12
11
|
def initialize(name = 'opal:spec')
|
13
12
|
@name = name
|
14
|
-
yield self if block_given?
|
15
|
-
|
16
13
|
define_tasks
|
17
14
|
end
|
18
15
|
|
@@ -23,7 +20,7 @@ module Opal
|
|
23
20
|
require 'webrick'
|
24
21
|
|
25
22
|
server = fork do
|
26
|
-
Rack::Server.start(:app => Opal::Spec::Server.new, :Port => port,
|
23
|
+
Rack::Server.start(:app => Opal::Spec::Server.new(false), :Port => port,
|
27
24
|
:Logger => WEBrick::Log.new("/dev/null"), :AccessLog => [])
|
28
25
|
end
|
29
26
|
|
@@ -38,15 +35,15 @@ module Opal
|
|
38
35
|
end
|
39
36
|
|
40
37
|
def runner_path
|
41
|
-
|
38
|
+
File.join(VENDOR_PATH, 'spec_runner.js')
|
42
39
|
end
|
43
40
|
|
44
41
|
def url_path
|
45
|
-
|
42
|
+
"http://localhost:9999/"
|
46
43
|
end
|
47
44
|
|
48
45
|
def port
|
49
|
-
|
46
|
+
9999
|
50
47
|
end
|
51
48
|
end
|
52
49
|
end
|
data/lib/opal/spec/server.rb
CHANGED
@@ -5,9 +5,9 @@ module Opal
|
|
5
5
|
module Spec
|
6
6
|
class Server
|
7
7
|
class Index
|
8
|
-
def initialize(app,
|
8
|
+
def initialize(app, server)
|
9
9
|
@app = app
|
10
|
-
@
|
10
|
+
@server = server
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(env)
|
@@ -24,19 +24,33 @@ module Opal
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def javascript_include_tag(source)
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
if @server.debug
|
28
|
+
paths = sprockets[source].to_a.map { |d| "#{d.logical_path}?body=1" }
|
29
|
+
tags = paths.map { |p| "<script src=\"/assets/#{p}\"></script>" }
|
30
|
+
tags.join "\n"
|
31
|
+
else
|
32
|
+
"<script src=\"/assets/#{source}.js\"></script>"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def sprockets
|
37
|
+
@server.sprockets
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
33
|
-
|
41
|
+
attr_reader :sprockets
|
42
|
+
attr_reader :debug
|
43
|
+
|
44
|
+
def initialize(debug = true)
|
45
|
+
@debug = debug
|
46
|
+
server = self
|
47
|
+
|
34
48
|
@sprockets = sprockets = Opal::Environment.new
|
35
|
-
sprockets.append_path 'spec'
|
49
|
+
@sprockets.append_path 'spec'
|
36
50
|
|
37
51
|
@app = Rack::Builder.app do
|
38
52
|
map('/assets') { run sprockets }
|
39
|
-
use Index,
|
53
|
+
use Index, server
|
40
54
|
run Rack::Directory.new('spec')
|
41
55
|
end
|
42
56
|
end
|
data/lib/opal/spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -33,7 +33,7 @@ files:
|
|
33
33
|
- lib/assets/javascripts/opal/spec/phantom_formatter.rb
|
34
34
|
- lib/assets/javascripts/opal/spec/runner.rb
|
35
35
|
- lib/assets/javascripts/opal/spec/scratch_pad.rb
|
36
|
-
- lib/assets/javascripts/opal/spec/sprockets_runner.
|
36
|
+
- lib/assets/javascripts/opal/spec/sprockets_runner.rb.erb
|
37
37
|
- lib/opal-spec.rb
|
38
38
|
- lib/opal/spec.rb
|
39
39
|
- lib/opal/spec/rake_task.rb
|