blade 0.5.6 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/{index.coffee → blade/index.coffee} +0 -0
- data/assets/blade/index.html.erb +33 -0
- data/blade.gemspec +1 -1
- data/lib/blade.rb +0 -1
- data/lib/blade/assets.rb +10 -26
- data/lib/blade/rack/adapter.rb +8 -13
- data/lib/blade/version.rb +1 -1
- metadata +7 -7
- data/assets/index.html.erb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf54a7484627b181206f4c6d61ec00c8b7691a02
|
4
|
+
data.tar.gz: 5119881c102b51591450e94686c3fc95b5cfba36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4d8279ac7265e0b1efab1f03d1f0b578361b26e96d89995af700fc0182aba3ff511ef1bcd3777ac22de3382379ff292bf8d5d231021633b42af5b8530e4f2d1
|
7
|
+
data.tar.gz: dd7c9f8931919091c1b89be7dcb7928e8774fb98a7ae2ef4e069d93a46e5a3b40f8ce49d4f33ad6fc458a9940ba7d8634c8fa4db9f8783e9d976a5a52ba6056d
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Blade Runner</title>
|
6
|
+
<script src="blade/websocket/client.js" data-websocket></script>
|
7
|
+
<script src="blade.js"></script>
|
8
|
+
|
9
|
+
<% if environment["head.html"] %>
|
10
|
+
<%= depend_on_asset("head.html").to_s %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<link rel="stylesheet" type="text/css" href="blade/adapter.css">
|
14
|
+
<script src="blade/adapter.js"></script>
|
15
|
+
|
16
|
+
<% if environment["adapter/head.html"] %>
|
17
|
+
<%= depend_on_asset("blade/adapter/head.html").to_s %>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% logical_paths(:js).each do |path| %>
|
21
|
+
<script src="<%= path %>"></script>
|
22
|
+
<% end %>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<% if environment["body.html"] %>
|
26
|
+
<%= depend_on_asset("body.html").to_s %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% if environment["blade/adapter/body.html"] %>
|
30
|
+
<%= depend_on_asset("blade/adapter/body.html").to_s %>
|
31
|
+
<% end %>
|
32
|
+
</body>
|
33
|
+
</html>
|
data/blade.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.10"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
|
25
|
-
spec.add_dependency "blade-qunit_adapter", "~>
|
25
|
+
spec.add_dependency "blade-qunit_adapter", "~> 2.0.1"
|
26
26
|
spec.add_dependency "activesupport", ">= 3.0.0"
|
27
27
|
spec.add_dependency "coffee-script"
|
28
28
|
spec.add_dependency "coffee-script-source"
|
data/lib/blade.rb
CHANGED
data/lib/blade/assets.rb
CHANGED
@@ -6,41 +6,25 @@ module Blade::Assets
|
|
6
6
|
|
7
7
|
extend self
|
8
8
|
|
9
|
-
|
9
|
+
def environment
|
10
|
+
@environment ||= Sprockets::Environment.new do |env|
|
11
|
+
env.cache = Sprockets::Cache::FileStore.new(Blade.tmp_path)
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
env.cache = Sprockets::Cache::FileStore.new(Blade.tmp_path.join(cache_name))
|
16
|
-
|
17
|
-
send("#{name}_load_paths").each do |path|
|
18
|
-
env.append_path(path)
|
13
|
+
%w( blade user adapter ).each do |name|
|
14
|
+
send("#{name}_load_paths").each do |path|
|
15
|
+
env.append_path(path)
|
16
|
+
end
|
19
17
|
end
|
20
18
|
|
21
19
|
env.context_class.class_eval do
|
22
20
|
delegate :logical_paths, to: Blade::Assets
|
23
|
-
|
24
|
-
define_method(:environment) { env }
|
25
|
-
define_method(:context_name) { name }
|
26
|
-
|
27
|
-
def with_asset(path, env_name)
|
28
|
-
if asset = Blade::Assets.environment(env_name, context_name)[path]
|
29
|
-
depend_on(asset.pathname)
|
30
|
-
yield(asset)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def render_asset(path, env_name = context_name)
|
35
|
-
with_asset(path, env_name) { |asset| asset.to_s }
|
36
|
-
end
|
37
21
|
end
|
38
22
|
end
|
39
23
|
end
|
40
24
|
|
41
|
-
def build
|
25
|
+
def build
|
42
26
|
if Blade.config.build
|
43
|
-
Builder.new(environment
|
27
|
+
Builder.new(environment).build
|
44
28
|
end
|
45
29
|
end
|
46
30
|
|
@@ -93,7 +77,7 @@ module Blade::Assets
|
|
93
77
|
end
|
94
78
|
|
95
79
|
def get_mtime(logical_path)
|
96
|
-
environment
|
80
|
+
environment[logical_path].mtime
|
97
81
|
rescue Exception => e
|
98
82
|
e.to_s
|
99
83
|
end
|
data/lib/blade/rack/adapter.rb
CHANGED
@@ -3,12 +3,8 @@ class Blade::RackAdapter
|
|
3
3
|
|
4
4
|
route "", to: :redirect_to_index
|
5
5
|
route "/", to: :index
|
6
|
-
route "/blade*", environment: :blade
|
7
|
-
route "/blade/adapter*", environment: :adapter
|
8
6
|
route "/blade/websocket*", to: :websocket
|
9
|
-
default_route
|
10
|
-
|
11
|
-
delegate :environment, to: Blade::Assets
|
7
|
+
default_route to: :environment
|
12
8
|
|
13
9
|
attr_reader :request, :env
|
14
10
|
|
@@ -25,17 +21,12 @@ class Blade::RackAdapter
|
|
25
21
|
|
26
22
|
rewrite_path!(base_path)
|
27
23
|
|
28
|
-
|
29
|
-
when action[:environment]
|
30
|
-
environment(action[:environment]).call(env)
|
31
|
-
when action[:to]
|
32
|
-
send(action[:to])
|
33
|
-
end
|
24
|
+
send(action[:to])
|
34
25
|
end
|
35
26
|
|
36
27
|
def index
|
37
|
-
request.path_info = "/index.html"
|
38
|
-
response = environment
|
28
|
+
request.path_info = "/blade/index.html"
|
29
|
+
response = environment
|
39
30
|
response = add_session_cookie(response) if needs_session_cookie?
|
40
31
|
response.to_a
|
41
32
|
end
|
@@ -52,6 +43,10 @@ class Blade::RackAdapter
|
|
52
43
|
faye_adapter.call(env)
|
53
44
|
end
|
54
45
|
|
46
|
+
def environment
|
47
|
+
Blade::Assets.environment.call(env)
|
48
|
+
end
|
49
|
+
|
55
50
|
private
|
56
51
|
def needs_session_cookie?
|
57
52
|
Blade.running? && !Blade::Session.find(request.cookies[Blade::Session::KEY])
|
data/lib/blade/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javan Makhmali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.0.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -219,8 +219,8 @@ files:
|
|
219
219
|
- LICENSE.txt
|
220
220
|
- README.md
|
221
221
|
- Rakefile
|
222
|
-
- assets/index.coffee
|
223
|
-
- assets/index.html.erb
|
222
|
+
- assets/blade/index.coffee
|
223
|
+
- assets/blade/index.html.erb
|
224
224
|
- bin/console
|
225
225
|
- bin/rake
|
226
226
|
- bin/setup
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
265
|
+
rubygems_version: 2.6.6
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Blade
|
data/assets/index.html.erb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<title>Blade Runner</title>
|
6
|
-
<script src="blade/websocket/client.js" data-websocket></script>
|
7
|
-
|
8
|
-
<% with_asset("index.js", :blade) do %>
|
9
|
-
<script src="blade.js"></script>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<%= render_asset("head.html", :user) %>
|
13
|
-
|
14
|
-
<% with_asset("index.css", :adapter) do %>
|
15
|
-
<link rel="stylesheet" type="text/css" href="blade/adapter.css">
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% with_asset("index.js", :adapter) do %>
|
19
|
-
<script src="blade/adapter.js"></script>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<%= render_asset("head.html", :adapter) %>
|
23
|
-
|
24
|
-
<% logical_paths(:js).each do |path| %>
|
25
|
-
<% with_asset(path, :user) do %>
|
26
|
-
<script src="<%= path %>"></script>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<%= render_asset("body.html", :user) %>
|
32
|
-
<%= render_asset("body.html", :adapter) %>
|
33
|
-
</body>
|
34
|
-
</html>
|