menilite 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +1 -1
- data/lib/menilite/client/http.rb +2 -2
- data/lib/menilite/client/store.rb +1 -1
- data/lib/menilite/controller.rb +1 -1
- data/lib/menilite/model.rb +1 -2
- data/lib/menilite/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a99c228624ca2ec36237affb7fdbf746d9b1724
|
4
|
+
data.tar.gz: a4168d8e73a16f0d8b07b3f1df61935744148230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8d5fa224163611d37e81e1de952530c01785f515e83b606c1afa7195c8ce45f9bee910874ae2e61250c930cf759404883a7bb9e6a124a1aeb5c69c252e46591
|
7
|
+
data.tar.gz: df53d45fda4f43e983d11b29c6ac75bcb610c533fa54219e0226f10431826d4dd5a43852789794637befe9b8101a1cd3201213fdeabbbbcf6d724e370b5711fd
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 youchan
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/youchan/menilite.svg?branch=master)](https://travis-ci.org/youchan/menilite)
|
4
4
|
|
5
|
-
An
|
5
|
+
An isomorphic web programming framework in Ruby.
|
6
6
|
Ruby codes also run on the client side by using [Opalrb](http://opalrb.org).
|
7
7
|
|
8
8
|
## Installation
|
data/lib/menilite/client/http.rb
CHANGED
@@ -9,10 +9,10 @@ module Menilite
|
|
9
9
|
promise
|
10
10
|
end
|
11
11
|
|
12
|
-
def post_json(url,
|
12
|
+
def post_json(url, data, &block)
|
13
13
|
(callback, promise) = prepare(url, &block)
|
14
14
|
|
15
|
-
`fetch(url, {method: 'post', body:
|
15
|
+
`fetch(url, {method: 'post', body: #{data.to_json}}).then(callback)`
|
16
16
|
|
17
17
|
promise
|
18
18
|
|
@@ -25,7 +25,7 @@ module Menilite
|
|
25
25
|
models = is_array ? model : [ model ]
|
26
26
|
model_class = models.first.class
|
27
27
|
table = @tables[model_class]
|
28
|
-
Menilite::Http.post_json("api/#{model_class.to_s}", models
|
28
|
+
Menilite::Http.post_json("api/#{model_class.to_s}", models) do
|
29
29
|
on :success do |json|
|
30
30
|
results = json.map do |value|
|
31
31
|
if table.has_key?(value[:id])
|
data/lib/menilite/controller.rb
CHANGED
@@ -37,7 +37,7 @@ module Menilite
|
|
37
37
|
action_url = self.respond_to?(:namespace) ? "api/#{self.namespace}/#{name}" : "api/#{name}"
|
38
38
|
post_data = {}
|
39
39
|
post_data[:args] = args
|
40
|
-
Menilite::Http.post_json(action_url, post_data
|
40
|
+
Menilite::Http.post_json(action_url, post_data) do
|
41
41
|
on :success do |res|
|
42
42
|
callback.call(:success, res) if callback
|
43
43
|
end
|
data/lib/menilite/model.rb
CHANGED
@@ -222,7 +222,6 @@ module Menilite
|
|
222
222
|
end
|
223
223
|
|
224
224
|
define_method("#{name}=") do |value|
|
225
|
-
puts "#{name}=#{value}: #{type}"
|
226
225
|
unless type_validator(type).call(value, name)
|
227
226
|
raise TypeError.new("type error: field name: #{name}, value: #{value}")
|
228
227
|
end
|
@@ -263,7 +262,7 @@ module Menilite
|
|
263
262
|
post_data[:model] = model.to_h
|
264
263
|
end
|
265
264
|
|
266
|
-
Menilite::Http.post_json(action_url, post_data
|
265
|
+
Menilite::Http.post_json(action_url, post_data) do
|
267
266
|
on :success do |res|
|
268
267
|
callback.call(:success, res) if callback
|
269
268
|
end
|
data/lib/menilite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: menilite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- ".rspec"
|
107
107
|
- ".travis.yml"
|
108
108
|
- Gemfile
|
109
|
+
- LICENSE.txt
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
111
112
|
- bin/console
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
requirements: []
|
147
148
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.6.
|
149
|
+
rubygems_version: 2.6.13
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: Isomorphic models between client side opal and server side ruby.
|