blade 0.5.6 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 50cf45a71ac15735b54705ec206e64233538818d
4
- data.tar.gz: b853e26227a25f3db50e65ad9b2caa3ba32f9711
2
+ SHA256:
3
+ metadata.gz: 6ad71fcbe1bc1302b142cf165d3910df04b1837c17befcd09a40b3e882832d87
4
+ data.tar.gz: 22ab2bde34c8b17bf405a0552440089c7952d56568f94bc3eae7d68d7c6ec7b7
5
5
  SHA512:
6
- metadata.gz: 593af976b0e61959719830ea2a2336bed9dad74abeb9963417f0d2ca3e2b0651fa9e7bd04a0747fa9ffdda8a9833d6d4dfcf978a3d4dbd1b2290556f70b6aed8
7
- data.tar.gz: f03f04311a51a251a4b40703a93f58009e8887c1c82b2443f028534c62fbd86a90134e53657402a01342bbfe709e7de535d4ba8ff9b9f78642cd2fa0e399f410
6
+ metadata.gz: 6df2fcc7eb44f1dfd544352583e2378568e01cca79605d6012104540ec6e0da63a81185ae25731c9ba66d32663f95c67856f980405844fd3a897422cb23403e6
7
+ data.tar.gz: 858fe2921cb615200386cdc1c20c6b3f46a4e919ac0ec0fc2961de39deaaaaa161a03a1f914304017d37f2cb3decf8dad6a2a6c8d3bd108abbc5e26153c3c9ff
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
@@ -19,19 +19,18 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.10"
23
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "bundler", ">= 2.0"
23
+ spec.add_development_dependency "rake", ">= 10.0"
24
24
 
25
- spec.add_dependency "blade-qunit_adapter", "~> 1.20.0"
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"
29
- spec.add_dependency "curses", "~> 1.0.0"
29
+ spec.add_dependency "curses", ">= 1.4.0"
30
30
  spec.add_dependency "eventmachine"
31
31
  spec.add_dependency "faye"
32
32
  spec.add_dependency "sprockets", ">= 3.0"
33
- spec.add_dependency "sprockets-export", "~> 0.9.1"
34
33
  spec.add_dependency "thin", ">= 1.6.0"
35
- spec.add_dependency "useragent", "~> 0.16.7"
36
- spec.add_dependency "thor", "~> 0.19.1"
34
+ spec.add_dependency "useragent", ">= 0.16.7"
35
+ spec.add_dependency "thor", ">= 0.19.1"
37
36
  end
data/lib/blade.rb CHANGED
@@ -41,7 +41,7 @@ module Blade
41
41
 
42
42
  def start(options = {})
43
43
  return if running?
44
- clean_tmp_path
44
+ ensure_tmp_path
45
45
 
46
46
  initialize!(options)
47
47
  load_interface
@@ -83,6 +83,7 @@ module Blade
83
83
 
84
84
  config.plugins ||= {}
85
85
 
86
+ load_requires
86
87
  load_plugins
87
88
  load_adapter
88
89
  end
@@ -104,9 +105,12 @@ module Blade
104
105
  Pathname.new(".").join("tmp/blade")
105
106
  end
106
107
 
108
+ def ensure_tmp_path
109
+ tmp_path.mkpath
110
+ end
111
+
107
112
  def clean_tmp_path
108
113
  tmp_path.rmtree if tmp_path.exist?
109
- tmp_path.mkpath
110
114
  end
111
115
 
112
116
  private
@@ -137,6 +141,12 @@ module Blade
137
141
  require "blade/#{config.framework}_adapter"
138
142
  end
139
143
 
144
+ def load_requires
145
+ Array(config.require).each do |path|
146
+ require path
147
+ end
148
+ end
149
+
140
150
  def load_plugins
141
151
  config.plugins.keys.each do |name|
142
152
  require "blade/#{name}_plugin"
data/lib/blade/assets.rb CHANGED
@@ -1,46 +1,29 @@
1
1
  require "sprockets"
2
- require "sprockets/export"
3
2
 
4
3
  module Blade::Assets
5
4
  autoload :Builder, "blade/assets/builder"
6
5
 
7
6
  extend self
8
7
 
9
- @environments = {}
8
+ def environment
9
+ @environment ||= Sprockets::Environment.new do |env|
10
+ env.cache = Sprockets::Cache::FileStore.new(Blade.tmp_path)
10
11
 
11
- def environment(name = :user, context_name = nil)
12
- cache_name = [name, context_name].compact.map(&:to_s).uniq.join("-")
13
-
14
- @environments[cache_name] ||= Sprockets::Environment.new do |env|
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)
12
+ %w( blade user adapter ).each do |name|
13
+ send("#{name}_load_paths").each do |path|
14
+ env.append_path(path)
15
+ end
19
16
  end
20
17
 
21
18
  env.context_class.class_eval do
22
19
  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
20
  end
38
21
  end
39
22
  end
40
23
 
41
- def build(name = :user)
24
+ def build
42
25
  if Blade.config.build
43
- Builder.new(environment(name)).build
26
+ Builder.new(environment).build
44
27
  end
45
28
  end
46
29
 
@@ -93,7 +76,7 @@ module Blade::Assets
93
76
  end
94
77
 
95
78
  def get_mtime(logical_path)
96
- environment(:user)[logical_path].mtime
79
+ environment[logical_path].mtime
97
80
  rescue Exception => e
98
81
  e.to_s
99
82
  end
@@ -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 environment: :user
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
- case
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(:blade).call(env)
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
@@ -1,3 +1,3 @@
1
1
  module Blade
2
- VERSION = "0.5.6"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-04 00:00:00.000000000 Z
11
+ date: 2021-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.10'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.10'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: blade-qunit_adapter
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.20.0
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: 1.20.0
54
+ version: 2.0.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: curses
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0
103
+ version: 1.4.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.0
110
+ version: 1.4.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: eventmachine
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '3.0'
153
- - !ruby/object:Gem::Dependency
154
- name: sprockets-export
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: 0.9.1
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: 0.9.1
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: thin
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -182,28 +168,28 @@ dependencies:
182
168
  name: useragent
183
169
  requirement: !ruby/object:Gem::Requirement
184
170
  requirements:
185
- - - "~>"
171
+ - - ">="
186
172
  - !ruby/object:Gem::Version
187
173
  version: 0.16.7
188
174
  type: :runtime
189
175
  prerelease: false
190
176
  version_requirements: !ruby/object:Gem::Requirement
191
177
  requirements:
192
- - - "~>"
178
+ - - ">="
193
179
  - !ruby/object:Gem::Version
194
180
  version: 0.16.7
195
181
  - !ruby/object:Gem::Dependency
196
182
  name: thor
197
183
  requirement: !ruby/object:Gem::Requirement
198
184
  requirements:
199
- - - "~>"
185
+ - - ">="
200
186
  - !ruby/object:Gem::Version
201
187
  version: 0.19.1
202
188
  type: :runtime
203
189
  prerelease: false
204
190
  version_requirements: !ruby/object:Gem::Requirement
205
191
  requirements:
206
- - - "~>"
192
+ - - ">="
207
193
  - !ruby/object:Gem::Version
208
194
  version: 0.19.1
209
195
  description: Sprockets test runner and toolkit
@@ -219,8 +205,8 @@ files:
219
205
  - LICENSE.txt
220
206
  - README.md
221
207
  - Rakefile
222
- - assets/index.coffee
223
- - assets/index.html.erb
208
+ - assets/blade/index.coffee
209
+ - assets/blade/index.html.erb
224
210
  - bin/console
225
211
  - bin/rake
226
212
  - bin/setup
@@ -246,7 +232,7 @@ homepage: https://github.com/javan/blade
246
232
  licenses:
247
233
  - MIT
248
234
  metadata: {}
249
- post_install_message:
235
+ post_install_message:
250
236
  rdoc_options: []
251
237
  require_paths:
252
238
  - lib
@@ -261,9 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
247
  - !ruby/object:Gem::Version
262
248
  version: '0'
263
249
  requirements: []
264
- rubyforge_project:
265
- rubygems_version: 2.5.1
266
- signing_key:
250
+ rubygems_version: 3.1.2
251
+ signing_key:
267
252
  specification_version: 4
268
253
  summary: Blade
269
254
  test_files: []
@@ -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>