wedge 0.0.27 → 0.1.0

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.
data/lib/wedge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- module Wedge
2
- VERSION = '0.0.27'
1
+ class Wedge
2
+ VERSION = '0.1.0'
3
3
  end
data/test/dummy/app.rb CHANGED
@@ -7,8 +7,22 @@ require 'awesome_print'
7
7
  ROOT_PATH = File.dirname(__FILE__)
8
8
 
9
9
  class DummyApp < Roda
10
+
11
+ plugin :environments
12
+
13
+ configure :development do
14
+ require 'better_errors'
15
+
16
+ use BetterErrors::Middleware if defined? BetterErrors
17
+ use Rack::Static, urls: ["/public"]
18
+
19
+ BetterErrors::Middleware.allow_ip! "0.0.0.0/0"
20
+ BetterErrors.application_root = Dir.pwd
21
+ end
22
+
10
23
  plugin :wedge, {
11
24
  scope: self,
25
+ # debug: true,
12
26
  plugins: [:form]
13
27
  }
14
28
 
@@ -23,12 +37,10 @@ class DummyApp < Roda
23
37
  r.wedge_assets
24
38
 
25
39
  r.root do
26
- wedge(:root, :js).display
40
+ wedge(:root).to_js :display
27
41
  end
28
42
  end
29
43
  end
30
44
 
31
45
  Dir["#{ROOT_PATH}/forms/*.rb"].sort.each { |file| require file }
32
46
  Dir["#{ROOT_PATH}/components/*.rb"].sort.each { |file| require file }
33
-
34
- Wedge.compile_opal # cache files on app load
@@ -1,12 +1,17 @@
1
+ require_relative 'root'
2
+
1
3
  class DummyApp
2
4
  class BarComponent < Wedge::Component
3
- config.name :bar
4
- config.requires :root, :base
5
+ name :bar
5
6
 
6
7
  def moo
7
8
  'cow'
8
9
  end
9
10
 
11
+ on :ready do
12
+ puts 'bar ready'
13
+ end
14
+
10
15
  on :clicked_foo, for: :root do
11
16
  dom.find('body').append moo
12
17
  end
@@ -1,5 +1,5 @@
1
1
  class DummyApp
2
2
  class BaseComponent < Wedge::Component
3
- config.name :base
3
+ name :base
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  class DummyApp
2
2
  class LayoutComponent < Wedge::Component
3
- config.name :layout
4
- config.html <<-HTML
3
+ name :layout
4
+ html <<-HTML
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
@@ -12,7 +12,7 @@ class DummyApp
12
12
  </body>
13
13
  </html>
14
14
  HTML
15
- config.dom do
15
+ dom do
16
16
  dom.find('body') << assets(:js)
17
17
  end
18
18
 
@@ -1,10 +1,11 @@
1
- require_relative 'base' unless RUBY_ENGINE == 'opal'
1
+ require_relative 'base'
2
+ require_relative 'bar'
3
+ require_relative '../forms/foo'
2
4
 
3
5
  class DummyApp
4
6
  class RootComponent < BaseComponent
5
- config.name :root
6
- config.requires :base, :bar, :foo_form, :pjax_plugin
7
- config.html "<div id='foo'>bar</div>"
7
+ name :root
8
+ html "<div id='foo'>bar</div>"
8
9
 
9
10
  def display
10
11
  if server?
@@ -1,5 +1,5 @@
1
1
  class DummyApp
2
2
  class BarForm < Wedge::Plugins::Form
3
- config.name :bar_form
3
+ name :bar_form
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
+ require_relative 'bar'
2
+
1
3
  class DummyApp
2
4
  class FooForm < Wedge::Plugins::Form
3
- config.name :foo_form
4
- config.requires :bar_form
5
+ name :foo_form
5
6
  end
6
7
  end
@@ -1,8 +1,8 @@
1
1
  require_relative 'test_helper'
2
2
 
3
- class BasicComponent < wedge::Component
4
- config.name :basic
5
- config.html <<-HTML
3
+ class BasicComponent < Wedge::Component
4
+ name :basic
5
+ html <<-HTML
6
6
  <!DOCTYPE html>
7
7
  <html>
8
8
  <body>
@@ -10,7 +10,7 @@ class BasicComponent < wedge::Component
10
10
  </body>
11
11
  </html>
12
12
  HTML
13
- config.dom do
13
+ dom do
14
14
  tmpl :foo, dom.find('#foo')
15
15
  end
16
16
 
@@ -29,6 +29,6 @@ class TestComponent < Minitest::Test
29
29
  end
30
30
 
31
31
  def test_returning_js
32
- assert wedge(:basic, :js).foo[/Opal/]
32
+ assert wedge(:basic).to_js(:foo)[/Opal/]
33
33
  end
34
34
  end
data/test/test_helper.rb CHANGED
@@ -18,8 +18,8 @@ module Minitest
18
18
  @_session ||= OpenStruct.new
19
19
  end
20
20
 
21
- def wedge(*args)
22
- wedge[*args]
21
+ def wedge(name, *args, &block)
22
+ Wedge[name, *args, &block]
23
23
  end
24
24
 
25
25
  # def app(*args)
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.0.27
4
+ version: 0.1.0
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-14 00:00:00.000000000 Z
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 2.4.3
221
+ rubygems_version: 2.2.2
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Components for the Browser and Server