wedge 0.0.27 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/lib/roda/plugins/wedge.rb +14 -10
- data/lib/wedge.rb +71 -175
- data/lib/wedge/component.rb +94 -172
- data/lib/wedge/config.rb +33 -111
- data/lib/wedge/dom.rb +1 -1
- data/lib/wedge/events.rb +42 -31
- data/lib/wedge/html.rb +1 -1
- data/lib/wedge/opal.rb +1 -1
- data/lib/wedge/plugins/form.rb +5 -5
- data/lib/wedge/plugins/history.rb +2 -2
- data/lib/wedge/plugins/pjax.rb +4 -3
- data/lib/wedge/plugins/validations.rb +2 -2
- data/lib/wedge/utilis/hash.rb +28 -0
- data/lib/wedge/utilis/indifferent_hash.rb +1 -1
- data/lib/wedge/utilis/methods.rb +1 -1
- data/lib/wedge/version.rb +2 -2
- data/test/dummy/app.rb +15 -3
- data/test/dummy/components/bar.rb +7 -2
- data/test/dummy/components/base.rb +1 -1
- data/test/dummy/components/layout.rb +3 -3
- data/test/dummy/components/root.rb +5 -4
- data/test/dummy/forms/bar.rb +1 -1
- data/test/dummy/forms/foo.rb +3 -2
- data/test/test_basic_component.rb +5 -5
- data/test/test_helper.rb +2 -2
- metadata +3 -3
data/lib/wedge/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '0.0
|
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
|
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
|
-
|
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,7 +1,7 @@
|
|
1
1
|
class DummyApp
|
2
2
|
class LayoutComponent < Wedge::Component
|
3
|
-
|
4
|
-
|
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
|
-
|
15
|
+
dom do
|
16
16
|
dom.find('body') << assets(:js)
|
17
17
|
end
|
18
18
|
|
@@ -1,10 +1,11 @@
|
|
1
|
-
require_relative 'base'
|
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
|
-
|
6
|
-
|
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?
|
data/test/dummy/forms/bar.rb
CHANGED
data/test/dummy/forms/foo.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
class BasicComponent <
|
4
|
-
|
5
|
-
|
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
|
-
|
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
|
32
|
+
assert wedge(:basic).to_js(:foo)[/Opal/]
|
33
33
|
end
|
34
34
|
end
|
data/test/test_helper.rb
CHANGED
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
|
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-
|
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.
|
221
|
+
rubygems_version: 2.2.2
|
222
222
|
signing_key:
|
223
223
|
specification_version: 4
|
224
224
|
summary: Components for the Browser and Server
|