server_component 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dba7844e0d4e1ca570d77659d7ef3eea346900fc8ab9e84afef4dba723bf8113
4
- data.tar.gz: 8d331e9937dfc21a5f281724831a18ab9c56dc6168b4df3dc0ca398bea09d9dd
3
+ metadata.gz: 9320945a81de39a89ab9095e72f82a47e72d66cc30a46a9156f89a8e8f7735bc
4
+ data.tar.gz: 54494358d93080820cb79ef3743ecddf8a8d3dc4a2de167cf2435840b2c4408b
5
5
  SHA512:
6
- metadata.gz: a70a74596bbf8482aa244ed247bf04a8a412318c2aed0e8533c19715c9551a55099245bf8c7b93d02b5ebfd21b505c07734a655bb951dab25a9dcfc73df29796
7
- data.tar.gz: 963688b759513463ef25f378c074830ec2e83710b1465a16ee1a5b31fc495eeabb3a798c3560dd405d58409d05a0747fab5e451ab3c38b0c3b5ea80b490377e7
6
+ metadata.gz: 9230c721a1efde5cdb1e9bd67cfadcd2de2b12ea5a3fde66e8abc07b362dfd625a2eb84137c2afe7c31975638fd888bd0361eaf0fa87d7d8b11bb34bc86e1aff
7
+ data.tar.gz: b2afbce0ab6f87e36d4c1282ece5dc2bfd797036160ea5a5201fc294bc7b89a2d116ac72bc756a9481e9e252c4d4c4284c0243f2a378f41a948b8efcbb9ac7f2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CircleCI](https://circleci.com/gh/effective-spa/server_component_rails.svg?style=svg)](https://circleci.com/gh/effective-spa/server_component_rails) [![codecov](https://codecov.io/gh/effective-spa/server_component_rails/branch/master/graph/badge.svg)](https://codecov.io/gh/effective-spa/server_component_rails) [![Maintainability](https://api.codeclimate.com/v1/badges/3a8af74f091ff7c3dbf4/maintainability)](https://codeclimate.com/github/effective-spa/server_component_rails/maintainability)
1
+ [![CircleCI](https://circleci.com/gh/effective-spa/server_component_rails.svg?style=svg)](https://circleci.com/gh/effective-spa/server_component_rails) [![codecov](https://codecov.io/gh/effective-spa/server_component_rails/branch/master/graph/badge.svg)](https://codecov.io/gh/effective-spa/server_component_rails) [![Maintainability](https://api.codeclimate.com/v1/badges/3a8af74f091ff7c3dbf4/maintainability)](https://codeclimate.com/github/effective-spa/server_component_rails/maintainability) [![Gem Version](https://badge.fury.io/rb/server_component.svg)](https://badge.fury.io/rb/server_component)
2
2
 
3
3
  # ServerComponent
4
4
 
@@ -31,12 +31,14 @@ class CounterComponentController < ServerComponent::ComponentController
31
31
  }
32
32
  end
33
33
 
34
+ action :increment
34
35
  def increment
35
36
  set_state do |s|
36
37
  s.count { |prev| prev + 1 }
37
38
  end
38
39
  end
39
40
 
41
+ action :decrement
40
42
  def decrement
41
43
  set_state do |s|
42
44
  s.count { |prev| prev - 1 }
@@ -70,10 +72,10 @@ class CounterBody extends Component {
70
72
  return (
71
73
  <div>
72
74
  <h1>Counter</h1>
73
- <button onClick={increment}>increment</button>
74
- <button onClick={decrement}>decrement</button>
75
+ <button onClick={() => increment()}>increment</button>
76
+ <button onClick={() => decrement()}>decrement</button>
75
77
  <hr />
76
- <div>Count: {counter}</div>
78
+ <div>Count: {count}</div>
77
79
  </div>
78
80
  );
79
81
  }
@@ -25,5 +25,3 @@ module ServerComponent
25
25
  end
26
26
 
27
27
  require 'server_component/engine'
28
- require 'server_component/jsrb_handler'
29
- require 'server_component/railtie' if defined?(Rails)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ServerComponent
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ['lib']
33
33
 
34
- spec.add_runtime_dependency 'jsrb', '~> 0.1'
34
+ spec.add_runtime_dependency 'jsrb', '~> 0.2'
35
35
  spec.add_runtime_dependency 'rails', '~> 5.0', '>= 5.0.0'
36
36
 
37
37
  spec.add_development_dependency 'bundler', '~> 1.13'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shun MIZUKAMI
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-09 00:00:00.000000000 Z
11
+ date: 2019-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsrb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,8 +120,6 @@ files:
120
120
  - lib/server_component/component_router.rb
121
121
  - lib/server_component/engine.rb
122
122
  - lib/server_component/js_function_builder.rb
123
- - lib/server_component/jsrb_handler.rb
124
- - lib/server_component/railtie.rb
125
123
  - lib/server_component/version.rb
126
124
  - server_component.gemspec
127
125
  homepage: https://github.com/effective-spa/server_component_rails
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class JsrbHandler
4
- cattr_accessor :default_format
5
- self.default_format = Mime[:js]
6
-
7
- def self.call(template)
8
- %(jsrb = Jsrb::Base.new; #{template.source}; jsrb.generate_code)
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ServerComponent
4
- class Railtie < ::Rails::Railtie
5
- initializer :server_component do
6
- ActiveSupport.on_load :action_view do
7
- ActionView::Template.register_template_handler :jsrb, JsrbHandler
8
- end
9
-
10
- ActiveSupport.on_load :action_controller do
11
- ActionController::Renderers.add :jsrb do |obj, _options|
12
- send_data obj.to_s, type: Mime[:js]
13
- end
14
- end
15
- end
16
- end
17
- end