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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4ccd3d1c479a04e020fc78586ee67d7a576f30c
4
- data.tar.gz: b460a6963c951e32e0553968c1e2bc0240c3e34a
3
+ metadata.gz: 984a06acb85284e918de174680caf56447f1bbdf
4
+ data.tar.gz: 36ac020e260f26fa8b61ec053ada82c362633de6
5
5
  SHA512:
6
- metadata.gz: 9cee01638202876298db6523b2f194ee8d51f7aa225a3962d5d33d198a751e873cc1fc6d80466276de6826f15c792d2ada4c88168a04b80c3b2dd13ec3d30807
7
- data.tar.gz: e59ecec3df7a937202157385a848a0d4394e179a488f7defb1bd303a16adcc5a4bb35e1193c4e602b2a14a5991807f4557b5cf4a447c7b2736aa3779dd53745b
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] # 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
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
- + `lib/tasks/assets.rake`: rake task that generates your JavaScript bundles for production.
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
 
@@ -93,7 +93,7 @@ module ReactOnRails
93
93
  end
94
94
 
95
95
  def add_bootstrap_sprockets_to_gemfile
96
- gem("bootstrap-sass")
96
+ append_to_file("Gemfile", "gem 'bootstrap-sass'\n")
97
97
  end
98
98
 
99
99
  def add_bootstrap_sprockets_to_application_js
@@ -10,12 +10,20 @@ module ReactOnRails
10
10
 
11
11
  def copy_heroku_deployment_files
12
12
  base_path = "heroku_deployment"
13
- %w(.buildpacks Procfile).each { |file| copy_file("#{base_path}/#{file}", file) }
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
- production_gems = "# For Heroku deployment\ngem 'rails_12factor', group: :production\n"
18
- append_to_file("Gemfile", production_gems)
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, ruby) if options.ruby_linters? -%>
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 unicorn -p $PORT -c ./config/unicorn.rb
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
@@ -1,3 +1,3 @@
1
1
  module ReactOnRails
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  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.2
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-12 00:00:00.000000000 Z
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.4.8
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.