Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues #10 and #12 #13

Merged
merged 10 commits into from
Dec 4, 2019
Merged

Fix issues #10 and #12 #13

merged 10 commits into from
Dec 4, 2019

Conversation

eoinkelly
Copy link
Contributor

This fixes issues #10 and #12 in under Rails 6

@@ -1,6 +1,9 @@
source_paths.unshift(File.dirname(__FILE__))

run "mv app/assets app/frontend"
run "mkdir app/assets"
run "mv app/frontend/config app/assets/config"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moves app/assets/config/manifest.js back to the place Sprockets requires it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that just Sprockets? I did find putting things in app/frontend to be by far the most brittle part of this template, so I wonder if we should just stick with Rails defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprockets hard codes this path. rails/sprockets-rails#369 is open to see if it can be made customisable. I take your point on the defaults. I'm loathe to give it up because the default feels gross but accepting the default might be the most pragmatic.

# The block passed to "after_bundle" seems to run after `bundle install`
# but also after `webpacker:install` and after Rails has initialized the git
# repo
after_bundle do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff is a bit messy but basically I moved lots of commands inside the after_bundle hook. This allowed me to remove our git repo setup and our call to webpacker:install.

@@ -23,7 +23,7 @@
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
Dir[Rails.root.join("spec", "support", "**", "*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rubocop has changed it's mind about separators because / is normalised by Ruby to be whatever the separator on the platform is (e.g. it becomes \ on Windows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 TIL

Copy link

@louise-r-blue louise-r-blue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a Webpacker ManifestPlugin

route 'root "home#index"'
route %Q(mount Sidekiq::Web => "/sidekiq" # monitoring console\n)
route "require 'sidekiq/web'"
route <<-EO_ROUTES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that since this route definition includes three different routes:

  1. Lighthouse workaround
  2. Sidekiq/web
  3. root route

I think we should probably define these with three different route definitions, so that they are inherently three different routes

@@ -1,5 +1,5 @@
namespace :test do
task :coverage do
task coverage: :environment do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does loading the environment influence the coverage at all? I was under the impression that simplecov needed to be loaded before the application to corrrectly calculate the coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I did this because rubocop yelled at me about it. I take your point about coverage tho. I'll look into this.

@@ -23,7 +23,7 @@
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
Dir[Rails.root.join("spec", "support", "**", "*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 TIL

@@ -1,6 +1,9 @@
source_paths.unshift(File.dirname(__FILE__))

run "mv app/assets app/frontend"
run "mkdir app/assets"
run "mv app/frontend/config app/assets/config"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that just Sprockets? I did find putting things in app/frontend to be by far the most brittle part of this template, so I wonder if we should just stick with Rails defaults.

@eoinkelly eoinkelly merged commit a7ec3a6 into master Dec 4, 2019
@eoinkelly eoinkelly deleted the fix-sprockets-install-error branch December 4, 2019 23:28
This was referenced Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants