Skip to content

Commit

Permalink
Document optional configuration for bundle caching with ReactOnRailsP…
Browse files Browse the repository at this point in the history
…ro (shakacode#1370)

* document optional configuration for bundle caching with ReactOnRailsPro
* set rubocop version
Co-authored-by: Justin Gordon <[email protected]>
  • Loading branch information
Judahmeek authored May 11, 2021
1 parent 36502b8 commit e327a02
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ AllCops:

Naming/FileName:
Exclude:
- 'Gemfile'
- '**/Gemfile'
- '**/Rakefile'

Layout/LineLength:
Max: 120
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.development_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ group :development, :test do
gem "pry-doc"
gem "pry-rails"
gem "pry-rescue"
gem "rubocop", require: false
gem "rubocop", "1.14.0", require: false
gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
gem "scss_lint", require: false
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Rake will automatically load any *.rake files inside of the "rakelib" folder
# See rakelib/

tasks = %w[run_rspec lint]
tasks = %w[lint run_rspec]
prepare_for_ci = %w[node_package dummy_apps]

if ENV["USE_COVERALLS"] == "TRUE"
Expand Down
7 changes: 5 additions & 2 deletions docs/basics/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ ReactOnRails.configure do |config|
# If that file exists, React on Rails thinks that you'll use the rails/webpacker bin/webpack compiler.
config.build_production_command = "RAILS_ENV=production bin/webpack"

# Alternatively, you can also specify a module containing a class method `call`
# Alternatively, you can also specify a module containing a class method `call`
# In this example, the module BuildProductionCommand would have a class method `call`.
# See bottom for an example of the BuildProductionCommand module.
# config.build_production_command = BuildProductionCommand

# If you wish to utilize ReactOnRailsPro production bundle caching logic, then use
# config.build_production_command = ReactOnRailsPro::AssetsPrecompile
# and be sure to check ReactOnRailsPro's configuration documentation!

################################################################################
################################################################################
# SERVER RENDERING OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def print_helpful_message
# From https://github.com/rails/rails/blob/4c940b2dbfb457f67c6250b720f63501d74a45fd/railties/lib/rails/generators/rails/app/app_generator.rb
def app_name
@app_name ||= (defined_app_const_base? ? defined_app_name : File.basename(destination_root))
.tr('\\', "").tr(". ", "_")
.tr("\\", "").tr(". ", "_")
end

def defined_app_name
Expand Down
17 changes: 10 additions & 7 deletions lib/react_on_rails/locales/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@ def file(name)
end

def locale_files
# rubocop:disable Layout/IndentationWidth, Style/RedundantBegin
@locale_files ||= begin
if i18n_yml_dir.present?
Dir["#{i18n_yml_dir}/**/*.yml"]
else
ReactOnRails::Utils.truthy_presence(
Rails.application && Rails.application.config.i18n.load_path
).presence
end
if i18n_yml_dir.present?
Dir["#{i18n_yml_dir}/**/*.yml"]
else
ReactOnRails::Utils.truthy_presence(
Rails.application && Rails.application.config.i18n.load_path
).presence
end
end

# rubocop:enable Layout/IndentationWidth, Style/RedundantBegin
end

def i18n_dir
Expand Down
14 changes: 7 additions & 7 deletions spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ GEM
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
parallel (1.20.1)
parser (3.0.0.0)
parser (3.0.1.1)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
Expand Down Expand Up @@ -208,7 +208,7 @@ GEM
ffi (~> 1.0)
rdoc (6.3.0)
regexp_parser (2.1.1)
rexml (3.2.4)
rexml (3.2.5)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
Expand All @@ -230,17 +230,17 @@ GEM
rspec-support (3.10.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.11.0)
rubocop (1.14.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.5.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-ast (1.5.0)
parser (>= 3.0.1.1)
rubocop-performance (1.10.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
Expand Down Expand Up @@ -345,7 +345,7 @@ DEPENDENCIES
rspec-rails
rspec-retry
rspec_junit_formatter
rubocop
rubocop (= 1.14.0)
rubocop-performance
rubocop-rspec
sass-rails
Expand Down

0 comments on commit e327a02

Please sign in to comment.