repack 2.4.2 → 2.4.3

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: 8e2c8f08f5c1c53363908ec95a4d2a691face35e
4
- data.tar.gz: cb18f8b80a71ac2e459e554adcda3699a65a0ba4
3
+ metadata.gz: 78e6d267ffffc3eb51afc386a1382b1cfac43af7
4
+ data.tar.gz: 2d022dd91e66595577ef17c986a70fab98f49266
5
5
  SHA512:
6
- metadata.gz: 171b0c4119583830faed0d30422e2519f082f44ea179c3aff6cdc236ba470455e2917d855cb3fe0c98a991f907e831951c11518231c7456deb6ed49f5db3219d
7
- data.tar.gz: f5a5220c5eeaf2e6a6db31fc426495e8bc45bb8ddd0bdcb7646a9297ba940485f1acc6a34b2e694fcac67e0e0b0385101e5c671e498ab0a58ef7d1123626e8d4
6
+ metadata.gz: e55d2f339db2928a36ea29e268586b1f5b3c34d069e745ed85631cee858f83e8576fb5bac66f5b7ed6578030b939af8ff716db596e249808dab91ce133e3521c
7
+ data.tar.gz: fb8c3b0fa4df2d90d88e232cfec6ccf63f506a2d915753b9125cbd1464570bf2dacdb50b1f8c764b6f87c6f233306becb08082a58b266f2d4e229483de1cb2ab
@@ -1,4 +1 @@
1
- # Run Rails & Webpack concurrently
2
- # Example file from webpack-rails gem
3
- rails: bundle exec rails server
4
- webpack: ./node_modules/.bin/webpack-dev-server --config config/webpack.config.js
1
+ web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router';
3
+ import { handleLogout } from '../actions/auth';
4
+ import { connect } from 'react-redux';
5
+
6
+ class BootstrapNavbar extends React.Component {
7
+ logout = (e) => {
8
+ e.preventDefault();
9
+ this.props.dispatch(handleLogout());
10
+ }
11
+
12
+ authLinks = () =>{
13
+ let { auth } = this.props;
14
+ if(auth && auth.isAuthenticated) {
15
+ return(
16
+ <li> <a href='#' onClick={this.logout}>Logout</a> </li>
17
+ )
18
+ } else {
19
+ return(<li> <Link to='/login'>Login</Link> </li>);
20
+ }
21
+ }
22
+
23
+ render() {
24
+ return(
25
+ <nav className="navbar navbar-default">
26
+ <div className="container-fluid">
27
+ <div className="navbar-header">
28
+ <button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
29
+ <span className="sr-only">Toggle navigation</span>
30
+ <span className="icon-bar"></span>
31
+ <span className="icon-bar"></span>
32
+ <span className="icon-bar"></span>
33
+ </button>
34
+ <a className="navbar-brand" href="#">Brand</a>
35
+ </div>
36
+
37
+ <div className="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
38
+ <ul className="nav navbar-nav navbar-right">
39
+ { this.authLinks() }
40
+ </ul>
41
+ </div>
42
+ </div>
43
+ </nav>
44
+ );
45
+ }
46
+ }
47
+
48
+ const mapStateToProps = (state) => {
49
+ return { auth: state.auth }
50
+ }
51
+
52
+ export default connect(mapStateToProps)(BootstrapNavbar);
@@ -3,7 +3,7 @@ import { Link } from 'react-router';
3
3
  import { handleLogout } from '../actions/auth';
4
4
  import { connect } from 'react-redux';
5
5
 
6
- class Navbar extends React.Component {
6
+ class MaterialNavbar extends React.Component {
7
7
  logout = (e) => {
8
8
  e.preventDefault();
9
9
  this.props.dispatch(handleLogout());
@@ -42,4 +42,4 @@ const mapStateToProps = (state) => {
42
42
  return { auth: state.auth }
43
43
  }
44
44
 
45
- export default connect(mapStateToProps)(Navbar);
45
+ export default connect(mapStateToProps)(MaterialNavbar);
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { connect } from 'react-redux';
3
+ import { refreshLogin } from '../actions/auth';
4
+ import FlashMessage from '../components/FlashMessage';
5
+ import { clearFlash } from '../actions/flash';
6
+
7
+ class App extends React.Component {
8
+ componentDidMount() {
9
+ this.props.dispatch(refreshLogin());
10
+ }
11
+
12
+ componentDidUpdate() {
13
+ this.props.dispatch(clearFlash());
14
+ }
15
+
16
+ render() {
17
+ let { auth, children } = this.props;
18
+
19
+ return(
20
+ <div>
21
+ <div style={{ marginBottom: '30px' }}>
22
+ <FlashMessage />
23
+ </div>
24
+ <div className='container'>
25
+ { children }
26
+ </div>
27
+ </div>
28
+ );
29
+ }
30
+ }
31
+
32
+ export default connect()(App);
33
+
@@ -47,8 +47,10 @@ module Repack
47
47
  def copy_webpack_conf
48
48
  copy_file "webpack.config.js", "config/webpack.config.js"
49
49
  if yes?('Are you going to be deploying to heroku? (yes \ no)')
50
- puts 'copying heroku webpack config!'
50
+ puts 'Copying Heroku Webpack Config!'
51
51
  copy_file "webpack.config.heroku.js", "config/webpack.config.heroku.js"
52
+ puts 'Adding Basic Puma Proc File'
53
+ copy_file "Procfile", 'Procfile'
52
54
  end
53
55
  end
54
56
 
@@ -131,6 +133,7 @@ module Repack
131
133
  end
132
134
  end
133
135
  end
136
+
134
137
  def add_to_gitignore
135
138
  append_to_file ".gitignore" do
136
139
  <<-EOF.strip_heredoc
@@ -141,23 +144,27 @@ module Repack
141
144
  end
142
145
  end
143
146
 
144
- def install_yarn
145
- if yes?('Do you want to global install and use yarn as your package manager? (yes / no)')
146
- @yarn_installed = true
147
- run "npm install yarn -g"
148
- end
149
- end
150
-
151
- def run_package_manager_install
152
- if @yarn_installed
153
- run "yarn install" if yes?("Would you like us to run 'yarn install' for you?")
154
- else
155
- run "npm install" if yes?("Would you like us to run 'npm install' for you?")
156
- end
157
- end
158
-
159
147
  def finishing_god_move
160
148
  if options[:god]
149
+ nav_template = ask('Frontend Framework: 1) Materialize, 2) Bootstrap, 3) None').strip
150
+ case nav_template
151
+ when 1
152
+ copy_file "boilerplate/god_mode/components/MaterialNavbar.js", "client/components/Navbar.js"
153
+ when 2
154
+ copy_file "boilerplate/god_mode/components/BootstrapNavbar.js", "client/components/Navbar.js"
155
+ when 3
156
+ puts 'No Navbar template, all the components are ready for you to implement however you want.'
157
+ else
158
+ puts 'Wrong template choice, try again!'
159
+ finishing_god_move
160
+ end
161
+
162
+ if nav_template == '3'
163
+ copy_file "boilerplate/god_mode/containers/NoNavApp.js", "client/containers/App.js"
164
+ else
165
+ copy_file "boilerplate/god_mode/containers/App.js", "client/containers/App.js"
166
+ end
167
+
161
168
  copy_file "boilerplate/router_redux/application.js", "client/application.js"
162
169
  copy_file "boilerplate/god_mode/routes.js", "client/routes.js"
163
170
  copy_file "boilerplate/router_redux/store.js", "client/store.js"
@@ -169,7 +176,6 @@ module Repack
169
176
  copy_file "boilerplate/god_mode/components/Login.js", "client/components/Login.js"
170
177
  copy_file "boilerplate/god_mode/components/SignUp.js", "client/components/SignUp.js"
171
178
  copy_file "boilerplate/god_mode/components/Loading.js", "client/components/Loading.js"
172
- copy_file "boilerplate/god_mode/containers/App.js", "client/containers/App.js"
173
179
  copy_file "boilerplate/god_mode/reducers/auth.js", "client/reducers/auth.js"
174
180
  copy_file "boilerplate/god_mode/reducers/flash.js", "client/reducers/flash.js"
175
181
  copy_file "boilerplate/god_mode/reducers/index.js", "client/reducers/index.js"
@@ -209,24 +215,38 @@ respond_to :json
209
215
  end
210
216
 
211
217
  def whats_next
218
+ if options[:god]
219
+ puts <<-EOF.strip_heredoc
220
+ ██████╗ ██████╗ ██████╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ ███████╗███╗ ██╗ █████╗ ██████╗ ██╗ ███████╗██████╗
221
+ ██╔════╝ ██╔═══██╗██╔══██╗ ████╗ ████║██╔═══██╗██╔══██╗██╔════╝ ██╔════╝████╗ ██║██╔══██╗██╔══██╗██║ ██╔════╝██╔══██╗
222
+ ██║ ███╗██║ ██║██║ ██║ ██╔████╔██║██║ ██║██║ ██║█████╗ █████╗ ██╔██╗ ██║███████║██████╔╝██║ █████╗ ██║ ██║
223
+ ██║ ██║██║ ██║██║ ██║ ██║╚██╔╝██║██║ ██║██║ ██║██╔══╝ ██╔══╝ ██║╚██╗██║██╔══██║██╔══██╗██║ ██╔══╝ ██║ ██║
224
+ ╚██████╔╝╚██████╔╝██████╔╝ ██║ ╚═╝ ██║╚██████╔╝██████╔╝███████╗ ███████╗██║ ╚████║██║ ██║██████╔╝███████╗███████╗██████╔╝
225
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚══════╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝╚═════╝
226
+
227
+ Note: If you chose a frontend framework you still need to install and configure that gem in your project.
228
+
229
+ EOF
230
+ end
212
231
  puts <<-EOF.strip_heredoc
213
232
  We've set up the basics of repack for you, but you'll still
214
233
  need to:
215
- 1. Add an element with an id of 'app' to your layout
216
- 2. To disable hot module replacement remove <script src="http://localhost:3808/webpack-dev-server.js"></script> from layout
217
- 3. Run 'yarn run dev_server' to run the webpack-dev-server
218
- 4. Run 'bundle exec rails s' to run the rails server (both servers must be running)
219
- 5. If you are using react-router and want to sync server routes add:
220
- get '*unmatched_route', to: <your client controller>#<default action>
221
- This must be the very last route in your routes.rb file
222
- e.g. get '*unmatched_route', to: 'home#index'
234
+ 1. run yarn install or npm install depending on what package manager you are using
235
+ 2. Add an element with an id of 'app' to your layout
236
+ 3. To disable hot module replacement remove <script src="http://localhost:3808/webpack-dev-server.js"></script> from layout
237
+ 4. Run 'yarn run dev_server' to run the webpack-dev-server
238
+ 5. Run 'bundle exec rails s' to run the rails server (both servers must be running)
239
+ 6. If you are using react-router or god mode and want to sync server routes add:
240
+ get '*unmatched_route', to: <your client controller>#<default action>
241
+ This must be the very last route in your routes.rb file
242
+ e.g. get '*unmatched_route', to: 'home#index'
223
243
  FOR HEROKU DEPLOYS:
224
244
  1. yarn run heroku-setup
225
245
  2. Push to heroku the post-build hook will take care of the rest
226
246
  See the README.md for this gem at
227
247
  https://github.com/cottonwoodcoding/repack/blob/master/README.md
228
248
  for more info.
229
- Thanks for using repack!
249
+ Thanks for using Repack!
230
250
  EOF
231
251
  end
232
252
  end
@@ -1,3 +1,3 @@
1
1
  module Repack
2
- VERSION = "2.4.2"
2
+ VERSION = "2.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Jungst
@@ -43,12 +43,14 @@ files:
43
43
  - example/boilerplate/application.js
44
44
  - example/boilerplate/god_mode/actions/auth.js
45
45
  - example/boilerplate/god_mode/actions/flash.js
46
+ - example/boilerplate/god_mode/components/BootstrapNavbar.js
46
47
  - example/boilerplate/god_mode/components/FlashMessage.js
47
48
  - example/boilerplate/god_mode/components/Loading.js
48
49
  - example/boilerplate/god_mode/components/Login.js
49
- - example/boilerplate/god_mode/components/Navbar.js
50
+ - example/boilerplate/god_mode/components/MaterialNavbar.js
50
51
  - example/boilerplate/god_mode/components/SignUp.js
51
52
  - example/boilerplate/god_mode/containers/App.js
53
+ - example/boilerplate/god_mode/containers/NoNavApp.js
52
54
  - example/boilerplate/god_mode/controllers/api/users_controller.rb
53
55
  - example/boilerplate/god_mode/reducers/auth.js
54
56
  - example/boilerplate/god_mode/reducers/flash.js