Skip to content

Commit

Permalink
Run webpacker:info in Rails.root
Browse files Browse the repository at this point in the history
This is resolution to problems that occur with a mounted Rails engine.
With one of these you would want to run `rake app:webpacker:info` and
have it run against the Rails app you'd be mounting in (normally in
test/dummy) however it would incorrectly run in the root directory -
where you probably don't want to have webpacker and webpacker-dev-server
installed.
  • Loading branch information
kevindew committed Oct 3, 2018
1 parent 7f09ba8 commit 4b0ed13
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/tasks/webpacker/info.rake
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ require "webpacker/version"
namespace :webpacker do
desc "Provide information on Webpacker's environment"
task :info do
$stdout.puts "Ruby: #{`ruby --version`}"
$stdout.puts "Rails: #{Rails.version}"
$stdout.puts "Webpacker: #{Webpacker::VERSION}"
$stdout.puts "Node: #{`node --version`}"
$stdout.puts "Yarn: #{`yarn --version`}"
Dir.chdir(Rails.root) do
$stdout.puts "Ruby: #{`ruby --version`}"
$stdout.puts "Rails: #{Rails.version}"
$stdout.puts "Webpacker: #{Webpacker::VERSION}"
$stdout.puts "Node: #{`node --version`}"
$stdout.puts "Yarn: #{`yarn --version`}"

$stdout.puts "\n"
$stdout.puts "@rails/webpacker: \n#{`npm list @rails/webpacker version`}"
$stdout.puts "\n"
$stdout.puts "@rails/webpacker: \n#{`npm list @rails/webpacker version`}"

$stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
$stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
$stdout.puts "Is bin/yarn present?: #{File.exist? 'bin/yarn'}"
$stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
$stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
$stdout.puts "Is bin/yarn present?: #{File.exist? 'bin/yarn'}"
end
end
end

0 comments on commit 4b0ed13

Please sign in to comment.