wedge 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wedge.rb +1 -39
- data/lib/wedge/config.rb +1 -0
- data/lib/wedge/opal.rb +55 -0
- data/lib/wedge/version.rb +1 -1
- data/playground/app/app.rb +6 -0
- data/playground/app/components/index.rb +2 -0
- data/playground/public/includes/_head.html +0 -6
- data/playground/public/index.html +0 -6
- data/playground/public/uploader.html +0 -6
- data/playground/src/includes/_head.slim +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce2530673c2bea5a82a3493eccee06ca6b38edb8
|
4
|
+
data.tar.gz: 749f488627caa91778e41654e56624e6497c0c1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59e62d4db567029a0a3b52ea62828d830c5305eb13d2f08cf6ab8c8643564a46b2d001477e87e4e7f10339ea6eb66b4cc31d326857f2bfaff4577f57b381546a
|
7
|
+
data.tar.gz: ac916c88681edf2a142e660b0dee92c07a46108acbb26b200324e691c1421f592de925f6cdfb1ec2c968549d26477b11acbfffa8435d5dfbe145617d37869e37
|
data/lib/wedge.rb
CHANGED
@@ -145,28 +145,7 @@ class Wedge
|
|
145
145
|
|
146
146
|
if server?
|
147
147
|
javascript_cache[path_name] ||= begin
|
148
|
-
|
149
|
-
|
150
|
-
if path_name == 'wedge'
|
151
|
-
compiled_data = Base64.encode64 config.client_data.to_json
|
152
|
-
# We need to merge in some data that is only set on the server.
|
153
|
-
# i.e. path, assets_key etc....
|
154
|
-
js << Opal.compile("Wedge.config.data = HashObject.new(Wedge.config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
155
|
-
# load all global plugins into wedge
|
156
|
-
config.plugins.each do |path|
|
157
|
-
js << Wedge.javascript(path)
|
158
|
-
end
|
159
|
-
elsif comp_class = Wedge.config.component_class[path_name.gsub(/\//, '__')]
|
160
|
-
comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
|
161
|
-
comp_name = comp_class.config.name
|
162
|
-
compiled_data = Base64.encode64 comp_class.config.client_data.to_json
|
163
|
-
|
164
|
-
js << Opal.compile("Wedge.config.component_class[:#{comp_name}].config.data = HashObject.new(Wedge.config.component_class[:#{comp_name}].config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
165
|
-
|
166
|
-
load_requires path_name, js
|
167
|
-
end
|
168
|
-
|
169
|
-
js
|
148
|
+
build(path_name, options).to_s
|
170
149
|
end
|
171
150
|
else
|
172
151
|
url = "#{Wedge.assets_url_with_host}/#{options[:path]}.js"
|
@@ -196,23 +175,6 @@ class Wedge
|
|
196
175
|
end
|
197
176
|
end
|
198
177
|
|
199
|
-
def load_requires path_name, js
|
200
|
-
if requires = config.requires[path_name.gsub(/\//, '__')]
|
201
|
-
requires.each do |path|
|
202
|
-
next unless comp_class = Wedge.config.component_class[path]
|
203
|
-
|
204
|
-
comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
|
205
|
-
|
206
|
-
comp_name = comp_class.config.name
|
207
|
-
compiled_data = Base64.encode64 comp_class.config.client_data.to_json
|
208
|
-
|
209
|
-
load_requires path, js
|
210
|
-
|
211
|
-
js << Opal.compile("Wedge.config.component_class[:#{comp_name}].config.data = HashObject.new(Wedge.config.component_class[:#{comp_name}].config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
178
|
def config
|
217
179
|
@config ||= begin
|
218
180
|
args = { component_class: IndifferentHash.new }
|
data/lib/wedge/config.rb
CHANGED
data/lib/wedge/opal.rb
CHANGED
@@ -9,6 +9,61 @@ unless RUBY_ENGINE == 'opal'
|
|
9
9
|
to_s
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def self.original_compile(source, options = {})
|
14
|
+
Compiler.new(source, options).original_compile
|
15
|
+
end
|
16
|
+
|
17
|
+
class Compiler
|
18
|
+
alias_method :original_compile, :compile
|
19
|
+
def compile
|
20
|
+
@result = original_compile
|
21
|
+
|
22
|
+
if defined? Wedge
|
23
|
+
logical_path = self.file
|
24
|
+
classes = Wedge.config.component_class
|
25
|
+
comp_class = classes["#{Wedge.config.app_dir}/#{logical_path}".gsub(/\//, '__')] || classes[logical_path.gsub(/\//, '__')]
|
26
|
+
|
27
|
+
if logical_path == 'wedge'
|
28
|
+
compiled_data = Base64.encode64 Wedge.config.client_data.to_json
|
29
|
+
# We need to merge in some data that is only set on the server.
|
30
|
+
# i.e. path, assets_key etc....
|
31
|
+
@result << Opal.original_compile("require '#{self.file}'; Wedge.config.data = HashObject.new(Wedge.config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
32
|
+
# load all global plugins into wedge
|
33
|
+
Wedge.config.plugins.each do |path|
|
34
|
+
@result << Builder.build(path).to_s
|
35
|
+
end
|
36
|
+
elsif comp_class
|
37
|
+
comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
|
38
|
+
comp_name = comp_class.config.name
|
39
|
+
compiled_data = Base64.encode64 comp_class.config.client_data.to_json
|
40
|
+
|
41
|
+
@result << Opal.original_compile("require '#{self.file}'; Wedge.config.component_class[:#{comp_name}].config.data = HashObject.new(Wedge.config.component_class[:#{comp_name}].config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
42
|
+
|
43
|
+
load_requires logical_path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
@result
|
48
|
+
end
|
49
|
+
|
50
|
+
def load_requires path_name
|
51
|
+
if requires = Wedge.config.requires[path_name.gsub(/\//, '__')]
|
52
|
+
requires.each do |path|
|
53
|
+
next unless comp_class = Wedge.config.component_class[path]
|
54
|
+
|
55
|
+
comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
|
56
|
+
|
57
|
+
comp_name = comp_class.config.name
|
58
|
+
compiled_data = Base64.encode64 comp_class.config.client_data.to_json
|
59
|
+
|
60
|
+
load_requires path
|
61
|
+
|
62
|
+
@result << Opal.original_compile("require '#{path}'; Wedge.config.component_class[:#{comp_name}].config.data = HashObject.new(Wedge.config.component_class[:#{comp_name}].config.data.to_h.merge JSON.parse(Base64.decode64('#{compiled_data}')))")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
12
67
|
end
|
13
68
|
end
|
14
69
|
|
data/lib/wedge/version.rb
CHANGED
data/playground/app/app.rb
CHANGED
@@ -25,8 +25,14 @@ class Playground
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
+
# builder = Opal::Builder.new(:stubs=>['opal'])
|
29
|
+
# builder.append_paths(APP_ROOT)
|
30
|
+
# builder.use_gem('opal-jquery')
|
31
|
+
# builder.use_gem('wedge')
|
32
|
+
|
28
33
|
plugin :assets, {
|
29
34
|
path: "#{APP_ROOT}/../", css_dir: '', js_dir: '', group_subdirs: false,
|
35
|
+
# js_opts: { builder: builder }
|
30
36
|
css: {
|
31
37
|
default: [
|
32
38
|
'public/vendor/normalize-css/normalize.css',
|
@@ -1,9 +1,3 @@
|
|
1
|
-
<script type="text/javascript">
|
2
|
-
document.write('<script src="http://'
|
3
|
-
+ (location.host || 'localhost').split(':')[0]
|
4
|
-
+ ':35729/livereload.js"></'
|
5
|
-
+ 'script>')</script>
|
6
|
-
</script>
|
7
1
|
<meta charset="utf-8" />
|
8
2
|
<!--Page Info--><title>Wedge - </title><!--Styles-->
|
9
3
|
<link href="css/styles.css" rel="stylesheet" />
|
@@ -1,12 +1,6 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<script type="text/javascript">
|
5
|
-
document.write('<script src="http://'
|
6
|
-
+ (location.host || 'localhost').split(':')[0]
|
7
|
-
+ ':35729/livereload.js"></'
|
8
|
-
+ 'script>')</script>
|
9
|
-
</script>
|
10
4
|
<meta charset="utf-8" />
|
11
5
|
<!--Page Info--><title>Wedge - </title><!--Styles-->
|
12
6
|
<link href="css/styles.css" rel="stylesheet" />
|
@@ -1,12 +1,6 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<script type="text/javascript">
|
5
|
-
document.write('<script src="http://'
|
6
|
-
+ (location.host || 'localhost').split(':')[0]
|
7
|
-
+ ':35729/livereload.js"></'
|
8
|
-
+ 'script>')</script>
|
9
|
-
</script>
|
10
4
|
<meta charset="utf-8" />
|
11
5
|
<!--Page Info--><title>Wedge - </title><!--Styles-->
|
12
6
|
<link href="css/styles.css" rel="stylesheet" />
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/ Remove this in production
|
2
|
-
javascript:
|
3
|
-
document.write('<script src="http://'
|
4
|
-
+ (location.host || 'localhost').split(':')[0]
|
5
|
-
+ ':35729/livereload.js"></'
|
6
|
-
+ 'script>')</script>
|
2
|
+
/javascript:
|
3
|
+
/ document.write('<script async src="http://'
|
4
|
+
/ + (location.host || 'localhost').split(':')[0]
|
5
|
+
/ + ':35729/livereload.js"></'
|
6
|
+
/ + 'script>')</script>
|
7
7
|
meta charset="utf-8"
|
8
8
|
/! Page Info
|
9
9
|
title
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wedge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
283
|
rubyforge_project:
|
284
|
-
rubygems_version: 2.
|
284
|
+
rubygems_version: 2.2.2
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Components for the Browser and Server
|