react_component 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/MIT-LICENSE +20 -0
- data/README.rdoc +55 -0
- data/Rakefile +34 -0
- data/lib/react_component/engine.rb +6 -0
- data/lib/react_component/sprockets.rb +4 -0
- data/lib/react_component/version.rb +3 -0
- data/lib/react_component.rb +7 -0
- data/lib/tasks/react_component_tasks.rake +4 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f267b1f6fb8676d1e991828550fefc908c50516
|
4
|
+
data.tar.gz: ad16c4e507d9c0d3071b184ebf7c8fc534d0e14d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5431b5828f9388ccb95b771467da842da496011d1e729d58bd6d0a7d1533b104da177fb0374c7a205551277a3410153f227114b70f0fec9d3eea79fd77dd151b
|
7
|
+
data.tar.gz: d8a0e8ccfcf8007e8ebd77789e8ac94e2e4a07031f00412431a8abc00ac38c16c6fb33028219f261ba8af946274a1a132fe07518fcf287166cb272cc9f2d7f2c
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Hubert Łępicki
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
= react_componet
|
2
|
+
|
3
|
+
react_component is a small gem that serves single CoffeeScript file to help you clean up your render() function in your React components.
|
4
|
+
It is intended to be used along (react-rails)[https://github.com/reactjs/react-rails] gem.
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
Add to your Gemfile:
|
9
|
+
|
10
|
+
gem 'react_component'
|
11
|
+
|
12
|
+
Add to your components.js:
|
13
|
+
|
14
|
+
//= require react_component
|
15
|
+
|
16
|
+
|
17
|
+
Run:
|
18
|
+
|
19
|
+
bundle
|
20
|
+
|
21
|
+
Restart your Rails server.
|
22
|
+
|
23
|
+
== Usage
|
24
|
+
|
25
|
+
Define your components as follow:
|
26
|
+
|
27
|
+
@MyComponent = ReactComponent({
|
28
|
+
...
|
29
|
+
})
|
30
|
+
|
31
|
+
But in your Render function you can use the followint DSL (exposing all methods from React.DOM except "var" ;)):
|
32
|
+
|
33
|
+
div(null, span("Hello"))
|
34
|
+
|
35
|
+
This gets way nicer if you use CoffeeScript. The DSL becomes close to slim or haml:
|
36
|
+
|
37
|
+
render: ->
|
38
|
+
div null,
|
39
|
+
h1 null, "This is some header"
|
40
|
+
ul null,
|
41
|
+
li null, "Item 1"
|
42
|
+
li null, "Item 2"
|
43
|
+
li null, "Item 3"
|
44
|
+
|
45
|
+
You can always embed other components like you would before:
|
46
|
+
|
47
|
+
render: ->
|
48
|
+
some_component = React.createFactory(SomeComponent)(some: 'props', go: 'here')
|
49
|
+
|
50
|
+
div null,
|
51
|
+
h1 null, "This is some header"
|
52
|
+
some_component
|
53
|
+
|
54
|
+
Enjoy!
|
55
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ReactComponent'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: react_component
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hubert Łępicki, Marcin Nieborak
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coffee-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.0
|
41
|
+
description: ''
|
42
|
+
email:
|
43
|
+
- hubert.lepicki@amberbit.com, marcin.nieborak@amberbit.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.rdoc
|
50
|
+
- Rakefile
|
51
|
+
- lib/react_component.rb
|
52
|
+
- lib/react_component/engine.rb
|
53
|
+
- lib/react_component/sprockets.rb
|
54
|
+
- lib/react_component/version.rb
|
55
|
+
- lib/tasks/react_component_tasks.rake
|
56
|
+
homepage: http://github.com/amberbit/react_component
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.4.6
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Nicer DSL for your React components in Rails (instead of JSX)
|
80
|
+
test_files: []
|