wedgeio 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +49 -0
- data/Rakefile +9 -0
- data/lib/roda/plugins/wedge.rb +93 -0
- data/lib/wedge.rb +238 -0
- data/lib/wedge/component.rb +321 -0
- data/lib/wedge/config.rb +128 -0
- data/lib/wedge/dom.rb +139 -0
- data/lib/wedge/events.rb +136 -0
- data/lib/wedge/html.rb +29 -0
- data/lib/wedge/opal.rb +18 -0
- data/lib/wedge/plugins/form.rb +431 -0
- data/lib/wedge/plugins/history.rb +92 -0
- data/lib/wedge/plugins/location.rb +78 -0
- data/lib/wedge/plugins/pjax.rb +65 -0
- data/lib/wedge/plugins/validations.rb +251 -0
- data/lib/wedge/utilis/blank.rb +133 -0
- data/lib/wedge/utilis/element.rb +23 -0
- data/lib/wedge/utilis/hash.rb +77 -0
- data/lib/wedge/utilis/indifferent_hash.rb +209 -0
- data/lib/wedge/utilis/methods.rb +25 -0
- data/lib/wedge/utilis/nokogiri.rb +44 -0
- data/lib/wedge/utilis/titleize.rb +97 -0
- data/lib/wedge/utilis/try.rb +106 -0
- data/lib/wedge/version.rb +3 -0
- data/test.rb +44 -0
- data/test/dummy/app.rb +34 -0
- data/test/dummy/components/bar.rb +14 -0
- data/test/dummy/components/base.rb +5 -0
- data/test/dummy/components/root.rb +42 -0
- data/test/dummy/config.ru +6 -0
- data/test/dummy/forms/bar.rb +5 -0
- data/test/dummy/forms/foo.rb +6 -0
- data/test/test.js +59 -0
- data/test/test_basic_component.rb +34 -0
- data/test/test_browserio.rb +13 -0
- data/test/test_helper.rb +38 -0
- data/wedge.gemspec +32 -0
- metadata +236 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class BasicComponent < wedge::Component
|
4
|
+
config.name :basic
|
5
|
+
config.html <<-HTML
|
6
|
+
<!DOCTYPE html>
|
7
|
+
<html>
|
8
|
+
<body>
|
9
|
+
<div id='foo'>bar</div>
|
10
|
+
</body>
|
11
|
+
</html>
|
12
|
+
HTML
|
13
|
+
config.dom do
|
14
|
+
tmpl :foo, dom.find('#foo')
|
15
|
+
end
|
16
|
+
|
17
|
+
def foo
|
18
|
+
'bar'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class TestComponent < Minitest::Test
|
23
|
+
def test_calling_basic_component
|
24
|
+
assert_equal 'bar', wedge(:basic).foo
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_parsing_html
|
28
|
+
assert_equal '<div id="foo">bar</div>', wedge(:basic).tmpl(:foo).to_html
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_returning_js
|
32
|
+
assert wedge(:basic, :js).foo[/Opal/]
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'phantomjs'
|
2
|
+
require_relative 'test_helper'
|
3
|
+
|
4
|
+
class Testwedge < Minitest::Test
|
5
|
+
def test_javascript_and_source_maps
|
6
|
+
assert wedge.javascript[/Opal/]
|
7
|
+
assert wedge.source_map[/mappings/]
|
8
|
+
end
|
9
|
+
|
10
|
+
# def test_moo
|
11
|
+
# Phantomjs.run('./test/test.js')
|
12
|
+
# end
|
13
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup :default, ENV.fetch('RACK_ENV') { 'development' }
|
3
|
+
|
4
|
+
require 'minitest/autorun'
|
5
|
+
require 'minitest/reporters'
|
6
|
+
require 'wedge'
|
7
|
+
|
8
|
+
require 'pry'
|
9
|
+
require 'awesome_print'
|
10
|
+
|
11
|
+
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
|
12
|
+
|
13
|
+
module Minitest
|
14
|
+
class Test
|
15
|
+
extend Minitest::Spec::DSL
|
16
|
+
|
17
|
+
def session
|
18
|
+
@_session ||= OpenStruct.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def wedge(*args)
|
22
|
+
wedge[*args]
|
23
|
+
end
|
24
|
+
|
25
|
+
# def app(*args)
|
26
|
+
# a = Class.new(PropertyLink).new
|
27
|
+
#
|
28
|
+
# a.instance_variable_set(:@_request, OpenStruct.new(
|
29
|
+
# session: session,
|
30
|
+
# env: {
|
31
|
+
# 'rack.session' => {}
|
32
|
+
# }
|
33
|
+
# ))
|
34
|
+
#
|
35
|
+
# a.component(*args)
|
36
|
+
# end
|
37
|
+
end
|
38
|
+
end
|
data/wedge.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wedge/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wedgeio"
|
8
|
+
spec.version = Wedge::VERSION
|
9
|
+
spec.authors = ["cj"]
|
10
|
+
spec.email = ["cjlazell@gmail.com"]
|
11
|
+
spec.summary = %q{Components for the Browser and Server}
|
12
|
+
spec.description = %q{Components for the Browser and Server}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "opal"
|
22
|
+
spec.add_runtime_dependency "opal-jquery"
|
23
|
+
spec.add_runtime_dependency "nokogiri", '~> 1.6.6.2'
|
24
|
+
|
25
|
+
spec.add_development_dependency "pry"
|
26
|
+
spec.add_development_dependency "awesome_print"
|
27
|
+
spec.add_development_dependency "yard"
|
28
|
+
spec.add_development_dependency "phantomjs.rb"
|
29
|
+
spec.add_development_dependency 'minitest-line'
|
30
|
+
spec.add_development_dependency 'minitest-reporters'
|
31
|
+
spec.add_development_dependency 'roda'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wedgeio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- cj
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opal-jquery
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.6.6.2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.6.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: awesome_print
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: phantomjs.rb
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest-line
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest-reporters
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: roda
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Components for the Browser and Server
|
154
|
+
email:
|
155
|
+
- cjlazell@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- Gemfile
|
162
|
+
- LICENSE.txt
|
163
|
+
- README.md
|
164
|
+
- Rakefile
|
165
|
+
- lib/roda/plugins/wedge.rb
|
166
|
+
- lib/wedge.rb
|
167
|
+
- lib/wedge/component.rb
|
168
|
+
- lib/wedge/config.rb
|
169
|
+
- lib/wedge/dom.rb
|
170
|
+
- lib/wedge/events.rb
|
171
|
+
- lib/wedge/html.rb
|
172
|
+
- lib/wedge/opal.rb
|
173
|
+
- lib/wedge/plugins/form.rb
|
174
|
+
- lib/wedge/plugins/history.rb
|
175
|
+
- lib/wedge/plugins/location.rb
|
176
|
+
- lib/wedge/plugins/pjax.rb
|
177
|
+
- lib/wedge/plugins/validations.rb
|
178
|
+
- lib/wedge/utilis/blank.rb
|
179
|
+
- lib/wedge/utilis/element.rb
|
180
|
+
- lib/wedge/utilis/hash.rb
|
181
|
+
- lib/wedge/utilis/indifferent_hash.rb
|
182
|
+
- lib/wedge/utilis/methods.rb
|
183
|
+
- lib/wedge/utilis/nokogiri.rb
|
184
|
+
- lib/wedge/utilis/titleize.rb
|
185
|
+
- lib/wedge/utilis/try.rb
|
186
|
+
- lib/wedge/version.rb
|
187
|
+
- test.rb
|
188
|
+
- test/dummy/app.rb
|
189
|
+
- test/dummy/components/bar.rb
|
190
|
+
- test/dummy/components/base.rb
|
191
|
+
- test/dummy/components/root.rb
|
192
|
+
- test/dummy/config.ru
|
193
|
+
- test/dummy/forms/bar.rb
|
194
|
+
- test/dummy/forms/foo.rb
|
195
|
+
- test/test.js
|
196
|
+
- test/test_basic_component.rb
|
197
|
+
- test/test_browserio.rb
|
198
|
+
- test/test_helper.rb
|
199
|
+
- wedge.gemspec
|
200
|
+
homepage: ''
|
201
|
+
licenses:
|
202
|
+
- MIT
|
203
|
+
metadata: {}
|
204
|
+
post_install_message:
|
205
|
+
rdoc_options: []
|
206
|
+
require_paths:
|
207
|
+
- lib
|
208
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
213
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - ">="
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
requirements: []
|
219
|
+
rubyforge_project:
|
220
|
+
rubygems_version: 2.2.2
|
221
|
+
signing_key:
|
222
|
+
specification_version: 4
|
223
|
+
summary: Components for the Browser and Server
|
224
|
+
test_files:
|
225
|
+
- test/dummy/app.rb
|
226
|
+
- test/dummy/components/bar.rb
|
227
|
+
- test/dummy/components/base.rb
|
228
|
+
- test/dummy/components/root.rb
|
229
|
+
- test/dummy/config.ru
|
230
|
+
- test/dummy/forms/bar.rb
|
231
|
+
- test/dummy/forms/foo.rb
|
232
|
+
- test/test.js
|
233
|
+
- test/test_basic_component.rb
|
234
|
+
- test/test_browserio.rb
|
235
|
+
- test/test_helper.rb
|
236
|
+
has_rdoc:
|