react-rails 0.4.1.1 → 0.5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NGMyMTU3NGYyZDZjNTFhMzc5NzcxMmE2MmI4ODAyMjYxMmJkNTc4YQ==
5
+ data.tar.gz: !binary |-
6
+ NWIwNzZjMWQyMzEwNzA1YTdlYjUyZjQxNDExMTY3MzE5OTZhNjYxMw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NThiYjdiYmViZDYzODgwZDE2M2QzMWQwYzg4YjkzNGNhYWQ2ZWYyMTJhNjFj
10
+ M2U2YWNkNzkzZDE0MDI1ZDIyMWZhN2Y3OGM3OWUxNWRkMzMxOWUwMzhmZTM1
11
+ ZmM2ZWY5ZmExY2Y0ZWY0MTZmYTkwMjc3MzNkODZhZjQ3MjVlMGY=
12
+ data.tar.gz: !binary |-
13
+ ODJjMzU5MDdmODg4ZjY4MmE5MzliZjY3OTM1N2Y5Y2ZjNmE5ZjYzYTZjM2Q4
14
+ MzA4OGQ2MDhlZTU0ZGUzOWY0ZDJiNTI2ZDE1NTdkYWI0YzU2MjQwNzYwMTlj
15
+ NTczNDYyODc4MmVjZTNjOTg0NGJhNDc3NTAzYzNhNWNlOTNmYTE=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # react-rails [![Build Status](https://travis-ci.org/facebook/react-rails.png)](https://travis-ci.org/facebook/react-rails)
1
+ # react-rails [![Build Status](https://travis-ci.org/facebook/react-rails.png)](https://travis-ci.org/facebook/react-rails) [![Code Climate](https://codeclimate.com/github/facebook/react-rails.png)](https://codeclimate.com/github/facebook/react-rails)
2
2
 
3
3
  react-rails is a ruby gem which makes it easier to use [React](http://facebook.github.io/react/) and [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) in your Ruby on Rails application.
4
4
 
@@ -25,7 +25,7 @@ gem 'react-rails', '~> 0.4.1.0'
25
25
 
26
26
  ### react.js
27
27
 
28
- In order to use React client-side in your application, you must make sure the browser requests it. One way to do that is to drop `react.js` into `app/assets/javascript/` and by default your applcation manifest will pick it up. There are downsides to this approach, so we made it even easier. Once you have `react-rails` installed, you can just require react directly in your manifest:
28
+ In order to use React client-side in your application, you must make sure the browser requests it. One way to do that is to drop `react.js` into `app/assets/javascript/` and by default your applcation manifest will pick it up. There are downsides to this approach, so we made it even easier. Once you have `react-rails` installed, you can just add a line into your config file (see Configuring) and require react directly in your manifest:
29
29
 
30
30
  You can `require` it in your manifest:
31
31
 
@@ -51,6 +51,8 @@ To transform your JSX into JS, simply create `.js.jsx` files, and ensure that th
51
51
 
52
52
  ## Configuring
53
53
 
54
+ ### Variants
55
+
54
56
  There are 2 variants available. `:development` gives you the unminified version of React. This provides extra debugging and error prevention. `:production` gives you the minified version of React which strips out comments and helpful warnings, and minifies.
55
57
 
56
58
  ```ruby
@@ -65,4 +67,26 @@ MyApp::Application.configure do
65
67
  end
66
68
  ```
67
69
 
70
+ ### Add-ons
71
+
72
+ Beginning with React v0.5, there is another type of build. This build ships with some "add-ons" that might be useful - [take a look at the React documentation for details](http://facebook.github.io/react/docs/addons.html). In order to make these available, we've added another configuration (which defaults to `false`).
73
+
74
+ ```ruby
75
+ MyApp::Application.configure do
76
+ config.react.addons = true
77
+ end
78
+ ```
79
+
80
+
81
+ ## CoffeeScript
82
+
83
+ It is possible to use JSX with CoffeeScript. The caveat is that you will still need to include the docblock. Since CoffeeScript doesn't allow `/* */` style comments, we need to do something a little different. We also need to embed JSX inside backticks so CoffeeScript ignores the syntax it doesn't understand. Here's an example:
84
+
85
+ ```coffee
86
+ ###* @jsx React.DOM ###
87
+
88
+ Component = React.createClass
89
+ render: ->
90
+ `<ExampleComponent videos={this.props.videos} />`
91
+ ```
68
92
 
@@ -6,7 +6,11 @@ module React
6
6
  module JSX
7
7
  def self.context
8
8
  # TODO: create React::Source::contents_for
9
- contents = File.read(React::Source.bundled_path_for('JSXTransformer.js'))
9
+ contents =
10
+ # If execjs uses therubyracer, there is no 'global'. Make sure
11
+ # we have it so JSX script can work properly.
12
+ 'var global = global || this;' +
13
+ File.read(React::Source.bundled_path_for('JSXTransformer.js'))
10
14
  @context ||= ExecJS.compile(contents)
11
15
  end
12
16
 
@@ -14,11 +14,13 @@ module React
14
14
  # common mistakes. These are all stripped out in the minified build.
15
15
  if variant = app.config.react.variant || ::Rails.env.test?
16
16
  variant ||= :development
17
+ addons = app.config.react.addons || false
18
+
17
19
  # Copy over the variant into a path that sprockets will pick up.
18
20
  # We'll always copy to 'react.js' so that no includes need to change.
19
21
  # We'll also always copy of JSXTransformer.js
20
22
  tmp_path = app.root.join('tmp/react-rails')
21
- filename = 'react' + (variant == :production ? '.min.js' : '.js')
23
+ filename = 'react' + (addons ? '-with-addons' : '') + (variant == :production ? '.min.js' : '.js')
22
24
  FileUtils.mkdir_p(tmp_path)
23
25
  FileUtils.cp(::React::Source.bundled_path_for(filename),
24
26
  tmp_path.join('react.js'))
@@ -2,7 +2,7 @@ module React
2
2
  module Rails
3
3
  # Version numbers will track react-source, but we'll add another level so
4
4
  # that we can increment, but have some amount of stability.
5
- VERSION = '0.4.1.1'
5
+ VERSION = '0.5.1.0'
6
6
  end
7
7
  end
8
8
 
metadata CHANGED
@@ -1,96 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-rails
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.4.1.1
4
+ version: 0.5.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Paul O’Shannessy
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-12-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
- version_requirements: !ruby/object:Gem::Requirement
15
+ requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - '>='
17
+ - - ! '>='
19
18
  - !ruby/object:Gem::Version
20
19
  version: 1.2.2
21
- none: false
22
- requirement: !ruby/object:Gem::Requirement
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.2
27
- none: false
28
- prerelease: false
29
- type: :development
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
32
36
  version_requirements: !ruby/object:Gem::Requirement
33
37
  requirements:
34
- - - '>='
38
+ - - ! '>='
35
39
  - !ruby/object:Gem::Version
36
40
  version: '0'
37
- none: false
41
+ - !ruby/object:Gem::Dependency
42
+ name: coffee-rails
38
43
  requirement: !ruby/object:Gem::Requirement
39
44
  requirements:
40
- - - '>='
45
+ - - ! '>='
41
46
  - !ruby/object:Gem::Version
42
47
  version: '0'
43
- none: false
44
- prerelease: false
45
48
  type: :development
46
- - !ruby/object:Gem::Dependency
47
- name: execjs
49
+ prerelease: false
48
50
  version_requirements: !ruby/object:Gem::Requirement
49
51
  requirements:
50
- - - '>='
52
+ - - ! '>='
51
53
  - !ruby/object:Gem::Version
52
54
  version: '0'
53
- none: false
55
+ - !ruby/object:Gem::Dependency
56
+ name: execjs
54
57
  requirement: !ruby/object:Gem::Requirement
55
58
  requirements:
56
- - - '>='
59
+ - - ! '>='
57
60
  - !ruby/object:Gem::Version
58
61
  version: '0'
59
- none: false
60
- prerelease: false
61
62
  type: :runtime
62
- - !ruby/object:Gem::Dependency
63
- name: rails
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
- version: '3.1'
69
- none: false
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
70
71
  requirement: !ruby/object:Gem::Requirement
71
72
  requirements:
72
- - - '>='
73
+ - - ! '>='
73
74
  - !ruby/object:Gem::Version
74
75
  version: '3.1'
75
- none: false
76
- prerelease: false
77
76
  type: :runtime
78
- - !ruby/object:Gem::Dependency
79
- name: react-source
77
+ prerelease: false
80
78
  version_requirements: !ruby/object:Gem::Requirement
81
79
  requirements:
82
- - - '='
80
+ - - ! '>='
83
81
  - !ruby/object:Gem::Version
84
- version: 0.4.1
85
- none: false
82
+ version: '3.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: react-source
86
85
  requirement: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - '='
89
88
  - !ruby/object:Gem::Version
90
- version: 0.4.1
91
- none: false
92
- prerelease: false
89
+ version: 0.5.1
93
90
  type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.5.1
94
97
  description: Compile your JSX on demand or precompile for production.
95
98
  email:
96
99
  - paul@oshannessy.com
@@ -98,38 +101,37 @@ executables: []
98
101
  extensions: []
99
102
  extra_rdoc_files: []
100
103
  files:
101
- - lib/react-rails.rb
102
- - lib/react/jsx.rb
103
- - lib/react/rails.rb
104
104
  - lib/react/jsx/template.rb
105
+ - lib/react/jsx.rb
105
106
  - lib/react/rails/engine.rb
106
107
  - lib/react/rails/railstie.rb
107
108
  - lib/react/rails/version.rb
109
+ - lib/react/rails.rb
110
+ - lib/react-rails.rb
108
111
  - README.md
109
112
  - LICENSE
110
113
  homepage: https://github.com/facebook/react-rails
111
114
  licenses:
112
115
  - APL 2.0
113
- post_install_message:
116
+ metadata: {}
117
+ post_install_message:
114
118
  rdoc_options: []
115
119
  require_paths:
116
120
  - lib
117
121
  required_ruby_version: !ruby/object:Gem::Requirement
118
122
  requirements:
119
- - - '>='
123
+ - - ! '>='
120
124
  - !ruby/object:Gem::Version
121
125
  version: '0'
122
- none: false
123
126
  required_rubygems_version: !ruby/object:Gem::Requirement
124
127
  requirements:
125
- - - '>='
128
+ - - ! '>='
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
128
- none: false
129
131
  requirements: []
130
- rubyforge_project:
131
- rubygems_version: 1.8.24
132
- signing_key:
133
- specification_version: 3
132
+ rubyforge_project:
133
+ rubygems_version: 2.1.0
134
+ signing_key:
135
+ specification_version: 4
134
136
  summary: React/JSX adapter for the Ruby on Rails asset pipeline.
135
137
  test_files: []