render-react 0.0.5 → 0.0.6

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
  SHA1:
3
- metadata.gz: 22ce4866889dc01d43ca995ae1e3e37a32998597
4
- data.tar.gz: aac9d3480e383e37d89b70bff5fea4e47c44e710
3
+ metadata.gz: 0601736fa6ccfc71f59c1b6b4917615d23ad10ce
4
+ data.tar.gz: c424e643224f08d78117d85ba5b1f6a9b3b5cd8c
5
5
  SHA512:
6
- metadata.gz: ddd52e5d4ac7f09c2b814666a9f8bbe464b7d8329c098c8cf3a51b29da3ec22ddf46b2855726bb47f399a2a19aa68e5b243cd7ff4552c1c2285972edcda4b99d
7
- data.tar.gz: 361771ec138830c5df3c84cf63b9160bb3fdf795b63a7271fce2e20e9e9a08ec3f1f82b2a2db37e69d0089aae777407c55828ef5d36280deb9cec8eacad59cd6
6
+ metadata.gz: f7fb9e86dd55826c6984beb8ee247450d6d4c8e50c03d732a589d3537f806bb2c4ac3eef0c3604e5613f2660f7c21308606edf2eaab88720ea5ea8235cf9f81c
7
+ data.tar.gz: 7257db251438a7b46d1913dc145aa0aed6e1361fb5dd48cb0313a543ac4b9dfecbc092bf8732670f39c4978fb3d8b8508a3116cdc1b948895c808e95ab74a1e2
data/README.md CHANGED
@@ -1,41 +1,75 @@
1
- # Render::React
1
+ ### Work in progress, please beware.
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/render/react`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ## Overview
4
+ This gem renders [React](https://facebook.github.io/react/) components into your views!
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ It's plain Ruby so you can use it with almost every Ruby framework out there.
6
7
 
7
- ## Installation
8
+ ## Design
9
+ It uses [V8 engine](https://developers.google.com/v8/) as dynamic library for JavaScript execution. On application load React components are discovered, compiled from ES6 to ES5 and executed into memory. When you call `render_react` from your view - rendering is done from preloaded components at speeds comparable to native Ruby partials.
8
10
 
9
- Add this line to your application's Gemfile:
11
+ ## Installation
12
+ Just add render-react to your Gemfile and you're done.
13
+ ```bash
14
+ echo 'gem render-react' >> Gemfile
15
+ bundle install
16
+ ```
10
17
 
18
+ ## Usage (Rails)
19
+ 1. Include Render::React into your ApplicationHelper
11
20
  ```ruby
12
- gem 'render-react'
21
+ module ApplicationHelper
22
+ include Render::React
23
+ ...
13
24
  ```
14
25
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install render-react
22
-
23
- ## Usage
26
+ 2. Create initializer config/initializers/render_react.rb
27
+ ```ruby
28
+ Render::React::Config.path File.join(Rails.root, 'app/assets/javascripts/components-local')
29
+ Render::React::Config.path File.join(Rails.root, 'some/other/directory')
30
+ ```
31
+ or
32
+ ```ruby
33
+ Render::React::Config.path(
34
+ File.join(Rails.root, 'app/assets/javascripts/components-other'),
35
+ File.join(Rails.root, 'some/other/directory')
36
+ )
37
+ ```
24
38
 
25
- TODO: Write usage instructions here
39
+ 3. Render react component into your view (e.g. slim):
40
+ ```ruby
41
+ == render_react 'Card', \
42
+ className: 'city-block swiper-slide', \
43
+ href: city_path(city.slug), \
44
+ text: city.location, \
45
+ name: city.name, \
46
+ cover: image_path(city.cover.square_thumb), \
47
+ count: city.compilations.length
48
+ ```
26
49
 
27
- ## Development
50
+ ## Debugging
51
+ To be sure that everything is tip-top.
28
52
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+ In terms of rendering time:
54
+ ```ruby
55
+ - start = Time.now
56
+ == render_react 'ComponentName', \
57
+ className: 'city-block swiper-slide', \
58
+ ...
59
+ - finish = Time.now
60
+ - Rails.logger.warn "Render::React durability: #{Render::React::Compiler.instance_variable_get(:@durability)} time: #{finish - start}"
61
+ ```
30
62
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
63
+ In terms of memory.
64
+ ```bash
65
+ ps x -o rss,command | grep "unicorn" | grep -v grep | sort
66
+ ```
32
67
 
33
68
  ## Contributing
34
69
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/render-react. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rambler-digital-solutions/render-react. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
71
 
37
72
 
38
73
  ## License
39
74
 
40
75
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,5 +1,5 @@
1
1
  module Render
2
2
  module React
3
- VERSION = '0.0.5'.freeze
3
+ VERSION = '0.0.6'.freeze
4
4
  end
5
5
  end
data/render-react.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Alexander Krasnoschekov"]
10
10
  spec.email = ["akrasnoschekov@gmail.com"]
11
11
 
12
- spec.summary = "Gem that renders react components into views"
13
- spec.homepage = "https://gitlab.rambler.ru/rnd/render-react"
12
+ spec.summary = "Renders React.js components into your Ruby views"
13
+ spec.homepage = "https://github.com/rambler-digital-solutions/render-react"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Krasnoschekov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: therubyracer
@@ -107,7 +107,7 @@ files:
107
107
  - lib/render/react/transpiler.rb
108
108
  - lib/render/react/version.rb
109
109
  - render-react.gemspec
110
- homepage: https://gitlab.rambler.ru/rnd/render-react
110
+ homepage: https://github.com/rambler-digital-solutions/render-react
111
111
  licenses:
112
112
  - MIT
113
113
  metadata: {}
@@ -130,5 +130,5 @@ rubyforge_project:
130
130
  rubygems_version: 2.5.1
131
131
  signing_key:
132
132
  specification_version: 4
133
- summary: Gem that renders react components into views
133
+ summary: Renders React.js components into your Ruby views
134
134
  test_files: []