react_webpack_rails 0.1.0 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59c32fad93906a7fe5d5459d0bc091dcbdcda2c9
4
- data.tar.gz: 9800aa8218f61aa770932a13057a3e97ddebcbae
3
+ metadata.gz: 95002a306fa194b5eb678dca9b9837d366db9df0
4
+ data.tar.gz: e14adcbbec3aab1e87f6025718c111754fc40f96
5
5
  SHA512:
6
- metadata.gz: 8663103a400c5a87088b770923118b17d10de4f6c65bd7f4c13b4dac24eece013316f61ecb32bb4449adb69b94fc06264a6c195df0e770135da96848d3c59cca
7
- data.tar.gz: 5a77f4bc72ff1e6f3c14e46e0b809e38bd64ea0d834df209004aaeb1147b29ba8b7a059328e40762d8b42597b5c5ad7480a6e7f6f02324d68fd1fb7ebc7abcba
6
+ metadata.gz: 8c56369c886b81056e4d774ca417efc81f6a12cad2129b8df634c7cccb4b3f68848a43dcbf02c0d7122488c8255f13261f7be6925dd259878bf094dd6d0064fb
7
+ data.tar.gz: c7cda2c3749e953e5313ce232392906d2f7285f9b4a4dbd8e9db4f4b801c4c6c197793381f62f0f416d8ad239b7570079e3d5d099d4c4d5465b04f60232a729e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.2 (February 3, 2015)
2
+ * fix camelize_props
3
+ * allow camelize for AMS objects
4
+
5
+ ## 0.1.1 (February 2, 2015)
6
+ * fix for hot-reload mode
7
+
1
8
  ## 0.1.0 (January 27, 2015)
2
9
  * `config.react.camelize_props = true` will camelize `react_component` prop keys
3
10
  * Babel updated to version 6
data/README.md CHANGED
@@ -16,10 +16,6 @@ Execute:
16
16
 
17
17
  $ bundle
18
18
 
19
- Or install it yourself as:
20
-
21
- $ gem install react_webpack_rails
22
-
23
19
  Then run installation:
24
20
 
25
21
  $ rails g react_webpack_rails:install
@@ -75,7 +71,7 @@ By default, `react-webpack-rails` uses Babel Stage 1 - Proposal. If you want to
75
71
 
76
72
  ## Usage
77
73
  ##### Check [docs](https://github.com/netguru/react_webpack_rails/tree/master/docs) for detailed api description.
78
- ### to use hot-reloading add partial in your application.html.erb to `<body>`:
74
+ #### to use hot-reloading add partial in your application.html.erb to `<body>`:
79
75
  (it's not needed when you want to use just webpack in watch mode without hot-reloading)
80
76
  ```erb
81
77
  <%= render 'layouts/react_hot_assets' %>
@@ -101,7 +97,7 @@ const element = $('#my-element');
101
97
  renderComponent('customComponentName', {user_id: 1}, element);
102
98
  ```
103
99
 
104
- ### Development
100
+ ### Development environment
105
101
  Run webpack in watch mode using script:
106
102
 
107
103
  $ npm start
@@ -115,7 +111,7 @@ Or manually:
115
111
  $ webpack -w --config YOUR_CONFIG
116
112
 
117
113
 
118
- ### Production
114
+ ### Production environment
119
115
  Run webpack in production mode before compiling assets using script:
120
116
 
121
117
  $ npm run build
@@ -127,11 +123,10 @@ or manually:
127
123
  #### Deployment
128
124
  Check [docs/deployment.md](docs/deployment.md)
129
125
 
130
- ## Development
131
-
132
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
126
+ ## Gem development
133
127
 
134
- 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).
128
+ After checking out the repo, run `bundle exec rake setup:all` to install dependencies. Then, run `rake` to run the tests (includes gem, test app and node module).
129
+ Run `bundle exec rake -T` to check available development commands.
135
130
 
136
131
  ## Contributing
137
132
 
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ task default: 'test:all'
36
36
 
37
37
  namespace :setup do
38
38
  desc 'Prepare every environment'
39
- task all: [:gem, :rails3, :rails4] do
39
+ task all: [:node, :gem, :rails3, :rails4] do
40
40
  puts 'Prepared all, yay!'
41
41
  end
42
42
 
data/bin/setup CHANGED
@@ -2,8 +2,4 @@
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
 
5
- bundle install
6
- cd spec/rails3_dummy_app && bundle install && cd ..
7
- cd rails4_dummy_app && bundle install
8
-
9
- # Do any other automated setup that you need to do here
5
+ bundle exec rake setup:all
data/js/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '0.1.0';
1
+ export default '0.1.2';
@@ -14,7 +14,7 @@ module.exports = {
14
14
  key: 'jsx',
15
15
  test: /\.jsx?$/,
16
16
  exclude: /(node_modules)/,
17
- loader: 'babel'
17
+ loaders: ['babel']
18
18
  },
19
19
  {
20
20
  key: 'scss',
@@ -1,3 +1,3 @@
1
1
  module ReactWebpackRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -11,7 +11,8 @@ module ReactWebpackRails
11
11
  content_tag(html_tag, '', html_options, &block)
12
12
  end
13
13
 
14
- def react_component(name, props = {}, options = { ssr: false })
14
+ def react_component(name, raw_props = {}, options = { ssr: false })
15
+ props = raw_props.as_json
15
16
  props = camelize_props_key(props) if Rails.application.config.react.camelize_props
16
17
  react_element('react-component', { props: props, name: name }, options)
17
18
  end
@@ -24,7 +25,7 @@ module ReactWebpackRails
24
25
 
25
26
  def camelize_props_key(props)
26
27
  return props unless props.is_a?(Hash)
27
- props.each_with_object({}) do |h, (k, v)|
28
+ props.inject({}) do |h, (k, v)|
28
29
  h[k.to_s.camelize(:lower)] = v.is_a?(Hash) ? camelize_props_key(v) : v
29
30
  h
30
31
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-webpack-rails",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Js part of react_webpack_rails - webpack based React & Rails integration.",
5
5
  "main": "js/lib/index.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_webpack_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Gawlik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-01-27 00:00:00.000000000 Z
12
+ date: 2016-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler