react_on_rails 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/docs/additional_reading/heroku_deployment.md +4 -2
- data/lib/generators/react_on_rails/bootstrap_generator.rb +1 -1
- data/lib/generators/react_on_rails/heroku_deployment_generator.rb +11 -3
- data/lib/generators/react_on_rails/install_generator.rb +8 -2
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/linters.rake.tt +1 -1
- data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +1 -1
- data/lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb +15 -0
- data/lib/react_on_rails/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 984a06acb85284e918de174680caf56447f1bbdf
|
4
|
+
data.tar.gz: 36ac020e260f26fa8b61ec053ada82c362633de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5093d94e30d8a8a049127ee0da9f83c79197c89738447663a377bbb6cfd81719b75fa2433d5e4cd63214fcc294b17986e8dcd3f4ecaf691331206fd4038e332b
|
7
|
+
data.tar.gz: 8adc548734d303cc2776f1e5069b6d72c38c0fcef45cc06f502d6e41696496984260c68543162ce7a0793216615354c525df181a78979fb7ba5fe2d604e97b23
|
data/README.md
CHANGED
@@ -203,10 +203,11 @@ Usage:
|
|
203
203
|
rails generate react_on_rails:install [options]
|
204
204
|
|
205
205
|
Options:
|
206
|
-
-R, [--redux], [--no-redux]
|
207
|
-
-S, [--server-rendering], [--no-server-rendering]
|
208
|
-
-j, [--skip-js-linters], [--no-skip-js-linters]
|
209
|
-
-L, [--ruby-linters], [--no-ruby-linters]
|
206
|
+
-R, [--redux], [--no-redux] # Install Redux gems and Redux version of Hello World Example
|
207
|
+
-S, [--server-rendering], [--no-server-rendering] # Add necessary files and configurations for server-side rendering
|
208
|
+
-j, [--skip-js-linters], [--no-skip-js-linters] # Skip installing JavaScript linting files
|
209
|
+
-L, [--ruby-linters], [--no-ruby-linters] # Install ruby linting files, tasks, and configs
|
210
|
+
-H, [--heroku-deployment], [--no-heroku-deployment] # Install files necessary for deploying to Heroku
|
210
211
|
|
211
212
|
Runtime options:
|
212
213
|
-f, [--force] # Overwrite files that already exist
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# Heroku Deployment
|
2
2
|
The generator has created the necessary files and gems for deployment to Heroku. If you have installed manually, you will need to provide these files yourself:
|
3
3
|
|
4
|
-
+ `Procfile`: used by Heroku and Foreman to start the server
|
4
|
+
+ `Procfile`: used by Heroku and Foreman to start the Puma server
|
5
5
|
+ `.buildpacks`: used to install Ruby and Node environments
|
6
6
|
+ `12factor` gem: required by Heroku
|
7
|
-
+ `
|
7
|
+
+ `'puma'` gem: recommended Heroku webserver
|
8
|
+
+ `config/puma.rb`: Puma webserver config file
|
9
|
+
+ `lib/tasks/assets.rake`: This rake task file is provided by the generator regardless of whether the user chose Heroku Deployment as an option. It is highlighted here because it is helpful to understand that this task is what generates your JavaScript bundles in production.
|
8
10
|
|
9
11
|
## How to Deploy
|
10
12
|
|
@@ -10,12 +10,20 @@ module ReactOnRails
|
|
10
10
|
|
11
11
|
def copy_heroku_deployment_files
|
12
12
|
base_path = "heroku_deployment"
|
13
|
-
%w(.buildpacks
|
13
|
+
%w(.buildpacks
|
14
|
+
Procfile
|
15
|
+
config/puma.rb).each { |file| copy_file("#{base_path}/#{file}", file) }
|
14
16
|
end
|
15
17
|
|
16
18
|
def add_heroku_production_gems
|
17
|
-
|
18
|
-
|
19
|
+
gem_text = <<-GEMS.strip_heredoc
|
20
|
+
|
21
|
+
# For Heroku deployment
|
22
|
+
gem 'rails_12factor', group: :production
|
23
|
+
gem 'puma', group: :production
|
24
|
+
|
25
|
+
GEMS
|
26
|
+
append_to_file("Gemfile", gem_text)
|
19
27
|
end
|
20
28
|
end
|
21
29
|
end
|
@@ -27,8 +27,14 @@ module ReactOnRails
|
|
27
27
|
default: false,
|
28
28
|
desc: "Install ruby linting files, tasks, and configs",
|
29
29
|
aliases: "-L"
|
30
|
+
# --ruby-linters
|
31
|
+
class_option :heroku_deployment,
|
32
|
+
type: :boolean,
|
33
|
+
default: false,
|
34
|
+
desc: "Install files necessary for deploying to Heroku",
|
35
|
+
aliases: "-H"
|
30
36
|
|
31
|
-
def run_generators
|
37
|
+
def run_generators # rubocop:disable Metrics/CyclomaticComplexity
|
32
38
|
return unless installation_prerequisites_met?
|
33
39
|
warn_if_nvm_is_not_installed
|
34
40
|
invoke "react_on_rails:base"
|
@@ -37,7 +43,7 @@ module ReactOnRails
|
|
37
43
|
invoke "react_on_rails:js_linters" unless options.skip_js_linters?
|
38
44
|
invoke "react_on_rails:ruby_linters" if options.ruby_linters?
|
39
45
|
invoke "react_on_rails:bootstrap"
|
40
|
-
invoke "react_on_rails:heroku_deployment"
|
46
|
+
invoke "react_on_rails:heroku_deployment" if options.heroku_deployment?
|
41
47
|
end
|
42
48
|
|
43
49
|
private
|
@@ -76,7 +76,7 @@ if %w(development test).include? Rails.env
|
|
76
76
|
<%- end -%>
|
77
77
|
|
78
78
|
<%- enabled_linters = [] -%>
|
79
|
-
<%- enabled_linters << %i(rubocop
|
79
|
+
<%- enabled_linters << %i(rubocop ruby) if options.ruby_linters? -%>
|
80
80
|
<%- enabled_linters << %i(js scss) unless options.skip_js_linters? -%>
|
81
81
|
task lint: <%= enabled_linters.flatten %> do
|
82
82
|
puts "Completed all linting"
|
@@ -1 +1 @@
|
|
1
|
-
web: bundle exec
|
1
|
+
web: bundle exec puma -C config/puma.rb
|
@@ -0,0 +1,15 @@
|
|
1
|
+
workers Integer(ENV["WEB_CONCURRENCY"] || 2)
|
2
|
+
threads_count = Integer(ENV["MAX_THREADS"] || 5)
|
3
|
+
threads threads_count, threads_count
|
4
|
+
|
5
|
+
preload_app!
|
6
|
+
|
7
|
+
rackup DefaultRackup
|
8
|
+
port ENV["PORT"] || 3000
|
9
|
+
environment ENV["RACK_ENV"] || "development"
|
10
|
+
|
11
|
+
on_worker_boot do
|
12
|
+
# Worker specific setup for Rails 4.1+
|
13
|
+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
|
14
|
+
ActiveRecord::Base.establish_connection
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- lib/generators/react_on_rails/templates/client/README.md
|
199
199
|
- lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks
|
200
200
|
- lib/generators/react_on_rails/templates/heroku_deployment/Procfile
|
201
|
+
- lib/generators/react_on_rails/templates/heroku_deployment/config/puma.rb
|
201
202
|
- lib/generators/react_on_rails/templates/js_linters/client/.eslintignore
|
202
203
|
- lib/generators/react_on_rails/templates/js_linters/client/.eslintrc
|
203
204
|
- lib/generators/react_on_rails/templates/js_linters/client/.jscsrc
|
@@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
248
|
version: '0'
|
248
249
|
requirements: []
|
249
250
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.5.0
|
251
252
|
signing_key:
|
252
253
|
specification_version: 4
|
253
254
|
summary: Rails with react server rendering with webpack.
|