react_rails_webpack 1.0.3 → 1.1.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
  SHA1:
3
- metadata.gz: c189456f50861b52bdb07739afce550cbb2b078a
4
- data.tar.gz: 63fdbed97a9edc51789f136c2bd7e1b883b79bfd
3
+ metadata.gz: 195d4ed6a5da6fb44246c755535be02aa38eccd3
4
+ data.tar.gz: 316c5a00aec3b4894739637884cc94939499ae77
5
5
  SHA512:
6
- metadata.gz: 05eb488af3291d896b840f7a36462311ae1508da41cc42646c34c2537ee460745de6ecca167681c0af5ef1f9fbc01f148a94d5ba88a9581e5044aec7560a2c6c
7
- data.tar.gz: 376c419af4f100e235b278de9891ee3d6ad141e4260d33186ab9ea4ad268e3d2da6e5b2666a3cfc5279dbee4ba81b3fd20e2e792eace275c9d29f2d31b95229a
6
+ metadata.gz: 9e481e80ac9f68dc57120a38a2d0065b3abab6c6a7df8e5138d05a3b7fb38fbe4ee89674a8e7b6a98f275704060fc828da3e6f9334db2c3898fe136c6f5155e2
7
+ data.tar.gz: 891a05c9e757fbb2a2c84a1f495ca4ec763d5bc2e7f5ab453084965d5022adcdf38c6a2e58284d055394c9422d7c51b3abf31a4e11d95c19da868e3f4afe4966
data/.gitignore CHANGED
@@ -7,4 +7,6 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- /lib/react_rails_webpack/client/node_modules
10
+ /lib/react_rails_webpack/client/node_modules
11
+ .flooignore
12
+ .floo
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # ReactRailsWebpack
2
2
 
3
- A set of Rails generators that create all the necessary boilerplate code for integrating React, Webpack, and Redux libraries into Rails 4.0+ apps.
3
+ A set of Rails generators that create all the necessary boilerplate code (with examples) for integrating React, Webpack, and Redux libraries into Rails 4.0+ apps.
4
+
5
+ ## Key Features
6
+
7
+ 1. Use any packages from the npm ecosystem
8
+ 2. Automatically setup working demo examples so you can jump into React immediately
9
+ 3. Development server for React components will live update your changes to any device on your local network (including phones)
4
10
 
5
11
  ## Quick Start
6
12
 
@@ -12,7 +18,6 @@ A set of Rails generators that create all the necessary boilerplate code for int
12
18
  4. Run `rails g react_rails_webpack:install` ([further explanation of what this does](#generating-the-integration))
13
19
  5. Run `npm run install`
14
20
  6. Run `npm run build`
15
- 7. Set the dev server hostname ([instructions](#setting-the-dev-server-hostname))
16
21
 
17
22
  ### Add example page
18
23
 
@@ -22,11 +27,12 @@ A set of Rails generators that create all the necessary boilerplate code for int
22
27
 
23
28
  ### Suggested Development Workflow
24
29
 
25
- 1. Write and test new components by running the webpack dev server with the command `npm run start` (note: the base html page for the webpack dev server is based on the html provided to `context.defaultTemplate` in [the webpack.config.js file](lib/react_rails_webpack/client/webpack.config.js))
26
- 2. Add any components you want to spin up with the `react_component` helper in Rails to [the available components file](lib/react_rails_webpack/client/src/app/availableComponents.js) ([further explanation](#creating-and-using-your-own-components))
27
- 3. Run the `npm run build` command to compile your javascript files and add them to the Rails assets folder
28
- 4. Add calls to the `react_component` helper method in your Rails app to render your React components in views
29
- 5. Make sure they still work, repeat steps 1-5 until satisfied
30
+ 1. Write the code for your React components in the [client/src/components](lib/react_rails_webpack/client/src/components) directory
31
+ 2. Test your new components with live reloading by running the webpack dev server with the command `npm run start` (note: the base html page for the webpack dev server is based on the html provided to `context.defaultTemplate` in [the webpack.config.js file](lib/react_rails_webpack/client/webpack.config.js))
32
+ 3. Add any components you want to spin up with the `react_component` helper in Rails to [the available components file](lib/react_rails_webpack/client/src/app/availableComponents.js) ([further explanation](#creating-and-using-your-own-components))
33
+ 4. Run the `npm run build` command to compile your javascript files and add them to the Rails assets folder
34
+ 5. Add calls to the `react_component` helper method in your Rails app to render your React components in views
35
+ 6. Make sure they still work, repeat steps 1-5 until satisfied
30
36
 
31
37
  ## About
32
38
 
@@ -34,13 +40,13 @@ When I looked over the available gems for react/rails integrations, none of them
34
40
 
35
41
  ### Pros:
36
42
 
37
- - Webpack integration
43
+ - [Webpack](https://webpack.github.io/) integration
38
44
  - Hot-reloading webpack development server
39
45
  - Ability to see dev server output on any computer (or mobile device) on your network
40
- - Built-in redux integration
46
+ - Built-in [redux](http://redux.js.org/) integration
41
47
  - Generators provide example code for basic react components and react-redux components
42
48
  - Highly customizable
43
- - Ability to use any npm packages that you could use on a static front-end app
49
+ - Ability to use any [npm](https://www.npmjs.com/) packages that you could use on a static front-end app
44
50
 
45
51
  ### Cons:
46
52
 
@@ -58,15 +64,11 @@ And then execute:
58
64
 
59
65
  $ bundle
60
66
 
61
- Or install it yourself as:
62
-
63
- $ gem install react_rails_webpack
64
-
65
67
  ## Requirements
66
68
 
67
69
  - [Rails](http://rubyonrails.org/) 4.0+
68
- - [node](https://nodejs.org/) (tested on 4.2.2)
69
- - [npm](https://www.npmjs.com/) (tested on 3.4.0)
70
+ - [node](https://nodejs.org/) (tested on 4.2.2 and 5.4.1)
71
+ - [npm](https://www.npmjs.com/) (tested on 3.4.0 and 3.5.3)
70
72
 
71
73
  ## Generating the Integration
72
74
 
@@ -83,23 +85,13 @@ This will setup a basic react integration with some example components (one stan
83
85
 
84
86
  Then set the dev server hostname ([instructions](#setting-the-dev-server-hostname)).
85
87
 
86
- ## Setting the dev server hostname
87
-
88
- Then go to [the client/environment.json file](lib/react_rails_webpack/client/environment.json) and fill in your computer's network name. If you're using a Mac, to find out what your computer's network name is, you can go to `System Preferences`, and then the `Sharing` menu, and you should see it in the `Computer Name` field. `environment.json` should end up looking something like this:
89
-
90
- ```
91
- {
92
- "hostname": "my_mac.local"
93
- }
94
- ```
95
-
96
88
  ## Generating an Example Page
97
89
 
98
90
  If you want to setup an example page in your Rails app that uses the provided React components, run:
99
91
 
100
92
  $ rails g react_rails_webpack:create_example_page
101
93
 
102
- Then run the rails server and go to [the greeting page](localhost:3000/greeting) to see everything in action.
94
+ Then run the rails server and go to [the greeting page](http://localhost:3000/greeting) to see everything in action.
103
95
 
104
96
  ## Creating and using your own components
105
97
 
@@ -150,7 +142,7 @@ Will add a [trailblazer](https://github.com/apotonick/trailblazer) cell for reac
150
142
 
151
143
  ## Working with the Webpack Dev Server
152
144
 
153
- `npm run start` will start a webpack development server with hot reloading that is completely independent of your Rails app. You can see the output of this server on any computer or mobile device on your local network by going to `hostname:3000` (replace `hostname` with whatever you set it to in the `hostname.json` file).
145
+ `npm run start` will start a webpack development server with hot reloading that is completely independent of your Rails app. You can see the output of this server on any computer or mobile device on your local network by going to `computer-name.local:3000` (replace `computer-name.local` with [whatever you set hostname to](#setting-the-dev-server-hostname) in the `environment.json` file).
154
146
 
155
147
  ## Gotchas
156
148
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "hostname": "YOUR_COMPUTERS_NAME_ON_YOUR_NETWORK.local"
2
+ "hostname": "<<<LOCALHOST_NAME>>>.local"
3
3
  }
@@ -32,6 +32,13 @@ module ReactRailsWebpack
32
32
  end
33
33
  end
34
34
 
35
+ def set_environment_hostname
36
+ localhost_name = `scutil --get LocalHostName`.strip
37
+ puts "Setting localhost name to #{localhost_name}..."
38
+
39
+ gsub_file 'client/environment.json', /<<<LOCALHOST_NAME>>>/, localhost_name
40
+ end
41
+
35
42
  def add_webpack_asset_inclusion
36
43
  puts 'Adding asset includes...'
37
44
  # Add webpack folder to application asset paths
@@ -69,8 +76,6 @@ module ReactRailsWebpack
69
76
  puts
70
77
  puts "Done! Now #{"make sure you have node and npm installed".red.bold}, and then #{"run the".red.bold} #{"npm run install".white.bold} #{"and".red.bold} #{"npm run build".white.bold} #{"commands".red.bold} to finish setting up."
71
78
  puts
72
- puts "Also, #{"don't forget to set your hostname".red.bold} in the #{"client/environment.json".white.bold} file. Instructions for this can be found here: #{"https://github.com/neurodynamic/react_rails_webpack#setting-the-dev-server-hostname".blue}"
73
- puts
74
79
  puts "-" * `tput cols`.to_i # print line of dashes
75
80
  puts
76
81
  end
@@ -1,3 +1,3 @@
1
1
  module ReactRailsWebpack
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_rails_webpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neurodynamic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails