wedge 0.1.6 → 0.1.7

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
2
  SHA1:
3
- metadata.gz: e446e1a51f9cf2ef4a91336a092939ee4e1031d2
4
- data.tar.gz: cff121115b103c3090b08164345de1411364cf50
3
+ metadata.gz: 6fb91ba6f48ff314e8120d9801d34e37e42c3a88
4
+ data.tar.gz: f707f6009257bee3fde947a44b45f68ce3e16e1e
5
5
  SHA512:
6
- metadata.gz: 780c0d077e650463bba52ee2469c3cb2aef65a07e82f6366899e5177a2ce7941998a1c8c3b15d6ff25ba4ca53afbc60b6ee7c801a0d9d81bcf5a3866658cdff6
7
- data.tar.gz: 1f18c8282f0775d1914977d0d3fae1e05a7f6281ed0c39f9381baaa204d4667e05afccdfa7b7f02af3bfdfa01730060e12f4b1c1dc7a0c0ebf57574855affd72
6
+ metadata.gz: 80e9fe36fb884a334c750c722963a5c943a7a1e84d6fda4437b20d117d350d273eb3287ab6bc0751093cb18943af605c5a714bc8867820ae5262f7563da5cbd3
7
+ data.tar.gz: 5c60d643b530fe070eb08f805462a8e26b58305551fe59158bbb20b996d1f0db31f86c13efc0ecc0d4a9202e69707e7cb9d1441ed344ff5c60373934de2c7772
data/lib/wedge.rb CHANGED
@@ -155,7 +155,7 @@ class Wedge
155
155
  js << Wedge.javascript(path)
156
156
  end
157
157
  elsif comp_class = Wedge.config.component_class[path_name.gsub(/\//, '__')]
158
- comp_class.config.before_compile.each { |blk| comp_class.instance_eval(&blk) }
158
+ comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
159
159
  comp_name = comp_class.config.name
160
160
  compiled_data = Base64.encode64 comp_class.config.client_data.to_json
161
161
 
@@ -199,7 +199,7 @@ class Wedge
199
199
  requires.each do |path|
200
200
  next unless comp_class = Wedge.config.component_class[path]
201
201
 
202
- comp_class.config.before_compile.each { |blk| comp_class.instance_eval(&blk) }
202
+ comp_class.config.on_compile.each { |blk| comp_class.instance_eval(&blk) }
203
203
 
204
204
  comp_name = comp_class.config.name
205
205
  compiled_data = Base64.encode64 comp_class.config.client_data.to_json
@@ -17,7 +17,7 @@ class Wedge
17
17
  end
18
18
 
19
19
  unless RUBY_ENGINE == 'opal'
20
- obj.config.before_compile.each do |blk|
20
+ obj.config.on_compile.each do |blk|
21
21
  obj.instance_exec &blk
22
22
  end
23
23
  end
@@ -118,11 +118,14 @@ class Wedge
118
118
  alias_method :config, :wedge_config
119
119
 
120
120
  def wedge_on(*args, &block)
121
- if args.first.to_s != 'server'
121
+ case args.first.to_s
122
+ when 'server'
123
+ wedge_on_server(&block)
124
+ when 'compile'
125
+ wedge_config.on_compile << block unless RUBY_ENGINE == 'opal'
126
+ else
122
127
  @wedge_on_count += 1
123
128
  Wedge.events.add config.name, *args, &block
124
- else
125
- wedge_on_server(&block)
126
129
  end
127
130
  end
128
131
  alias_method :on, :wedge_on
@@ -217,10 +220,6 @@ class Wedge
217
220
  def store
218
221
  wedge_config.store
219
222
  end
220
-
221
- def before_compile &block
222
- wedge_config.before_compile << block unless RUBY_ENGINE == 'opal'
223
- end
224
223
  end
225
224
 
226
225
  if RUBY_ENGINE == 'opal'
data/lib/wedge/config.rb CHANGED
@@ -27,10 +27,10 @@ class Wedge
27
27
  settings: IndifferentHash.new,
28
28
  tmpl: IndifferentHash.new,
29
29
  on_block: [],
30
+ on_compile: [],
30
31
  on_block_count: 0,
31
32
  server_methods: [],
32
33
  initialize_args: [],
33
- before_compile: [],
34
34
  plugins: [],
35
35
  allowed_client_data: %w(name path method_args method_called store tmpl key cache_assets assets_key assets_url assets_url_with_host)
36
36
  }.merge(opts))
@@ -2,7 +2,8 @@ class Wedge
2
2
  module Plugins
3
3
  class Uploader < Component
4
4
  name :uploader, :uploader_plugin
5
- before_compile do
5
+
6
+ on :compile do
6
7
  settings = Wedge.config.settings[:uploader]
7
8
  store[:settings] = settings.select do |k, v|
8
9
  client? ? %w(aws_access_key_id bucket).include?(k) : true
data/lib/wedge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Wedge
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
@@ -21,8 +21,9 @@ describe Wedge::Plugins::Uploader do
21
21
  if Wedge.server?
22
22
  expect(settings.keys).to include *%w'aws_access_key_id aws_secret_access_key bucket'
23
23
  else
24
- # expect(settings.keys).to include *%w'aws_access_key_id bucket'
25
- # expect(settings.keys).not_to include *%w'aws_secret_access_key'
24
+ # settings are nil client side as the class on :compile would need to be
25
+ # ran server side first.
26
+ expect(settings).to be_nil
26
27
  end
27
28
  end
28
29
  end
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.6
4
+ version: 0.1.7
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-21 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -283,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  version: '0'
284
284
  requirements: []
285
285
  rubyforge_project:
286
- rubygems_version: 2.4.3
286
+ rubygems_version: 2.2.2
287
287
  signing_key:
288
288
  specification_version: 4
289
289
  summary: Components for the Browser and Server