jsimple 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -1
- data/lib/jsimple.rb +3 -2
- data/lib/jsimple/rails_view_helper.rb +10 -0
- data/lib/jsimple/railtie.rb +9 -0
- data/lib/jsimple/version.rb +1 -1
- metadata +3 -3
- data/lib/jsimple/view_helper.rb +0 -7
- data/lib/railtie.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043e7f12d06d338ad9427266465716b82c88a9c9
|
4
|
+
data.tar.gz: 5771c6a61a7a60561c37b1992e87f586fe7716aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 910b428605fef1fa5716a4a03f0e471cf4ae9b3287fdbc0e96ec1aa5b0644f9fb38221ff231dc0ee23dd503f4ce224d25aabd0e54b730b4c7dd7e74e79695a5d
|
7
|
+
data.tar.gz: a5d57d6fc5bf693b7ee9a80c4fb8f7979fd1064bf31e4b47b3f1cb3c8eff82c383d2287f9672444b18f25a6814ae10d9db56ac1eb230b98ed9c137a8d607dcdd
|
data/README.md
CHANGED
@@ -18,10 +18,33 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install jsimple
|
20
20
|
|
21
|
+
## Configure
|
22
|
+
|
23
|
+
In order to have this make sense with your current setup you probably want to configure some of the defaults.
|
24
|
+
|
25
|
+
__Host__: `Jsimple.host = 'localhost'`
|
26
|
+
Server host for the JS client (usually Node) in development mode. Default is localhost.
|
27
|
+
|
28
|
+
__Port__: `Jsimple.port = '3100'`
|
29
|
+
Server port for the JS client (usually Node) in development mode. Default is 3100.
|
30
|
+
|
31
|
+
__Development__: `Jsimple.development = false`
|
32
|
+
Whether to start Jsimple in development mode. Default is `Rails.env.development?` otherwise false.
|
33
|
+
|
34
|
+
__Js_start_command__: `Jsimple.js_start_command = 'start'`
|
35
|
+
JS function name the legacy app will call to initialize the JS app.
|
36
|
+
|
21
37
|
## Usage
|
22
38
|
|
23
39
|
```ruby
|
24
|
-
|
40
|
+
data = {name: 'Alice', age: 26}
|
41
|
+
app = Jsimple.app('ContactList', props: data, id: 'contact-list-id')
|
42
|
+
app.path
|
43
|
+
# => jsimple/test_app.min.js
|
44
|
+
app.init
|
45
|
+
# => <script>
|
46
|
+
# test_app.start(document.getElementById('contact-list-id'), JSON.parse('{"name": "Alice", "age": 26}'));
|
47
|
+
# </script>
|
25
48
|
```
|
26
49
|
|
27
50
|
## Development
|
data/lib/jsimple.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'jsimple/version'
|
2
2
|
|
3
3
|
require 'jsimple/builder'
|
4
|
+
require 'jsimple/railtie' if defined?(Rails)
|
4
5
|
|
5
6
|
require 'hot_reload_proxy'
|
6
7
|
|
@@ -20,12 +21,12 @@ module Jsimple
|
|
20
21
|
@js_start_command = DEFAULT_JS_START_COMMAND
|
21
22
|
|
22
23
|
def self.host=(host)
|
23
|
-
HotReloadProxy::Proxy.
|
24
|
+
HotReloadProxy::Proxy.host = host
|
24
25
|
@host = host
|
25
26
|
end
|
26
27
|
|
27
28
|
def self.port=(port)
|
28
|
-
HotReloadProxy::Proxy.
|
29
|
+
HotReloadProxy::Proxy.port = port
|
29
30
|
@port = port
|
30
31
|
end
|
31
32
|
|
data/lib/jsimple/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsimple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Burenstam
|
@@ -103,9 +103,9 @@ files:
|
|
103
103
|
- jsimple.gemspec
|
104
104
|
- lib/jsimple.rb
|
105
105
|
- lib/jsimple/builder.rb
|
106
|
+
- lib/jsimple/rails_view_helper.rb
|
107
|
+
- lib/jsimple/railtie.rb
|
106
108
|
- lib/jsimple/version.rb
|
107
|
-
- lib/jsimple/view_helper.rb
|
108
|
-
- lib/railtie.rb
|
109
109
|
homepage: https://github.com/buren/jsimple
|
110
110
|
licenses:
|
111
111
|
- MIT
|
data/lib/jsimple/view_helper.rb
DELETED