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 binstubs path in webpacker:check_binstubs rake task #990

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tasks/webpacker.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tasks = {
"webpacker:clobber" => "Removes the webpack compiled output directory",
"webpacker:check_node" => "Verifies if Node.js is installed",
"webpacker:check_yarn" => "Verifies if Yarn is installed",
"webpacker:check_binstubs" => "Verifies that bin/webpack & bin/webpack-dev-server are present",
"webpacker:check_binstubs" => "Verifies that webpack & webpack-dev-server are present",
"webpacker:verify_install" => "Verifies if Webpacker is installed",
"webpacker:yarn_install" => "Support for older Rails versions. Install all JavaScript dependencies as specified via Yarn",
"webpacker:install:react" => "Installs and setup example React component",
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/webpacker/check_binstubs.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace :webpacker do
desc "Verifies that bin/webpack & bin/webpack-dev-server are present."
desc "Verifies that webpack & webpack-dev-server are present."
task :check_binstubs do
unless File.exist?("bin/webpack") && File.exist?("bin/webpack-dev-server")
unless Bundler.which("webpack") && Bundler.which("webpack-dev-server")
$stderr.puts "webpack binstubs not found.\n"\
"Have you run rails webpacker:install ?\n"\
"Make sure the bin directory or binstubs are not included in .gitignore\n"\
Expand Down
6 changes: 5 additions & 1 deletion test/rake_tasks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def test_rake_tasks
output = Dir.chdir(test_app_path) { `rake -T` }
assert_includes output, "webpacker"
assert_includes output, "webpacker:check_binstubs"
assert_includes output, "webpacker:check_binstubs"
assert_includes output, "webpacker:check_node"
assert_includes output, "webpacker:check_yarn"
assert_includes output, "webpacker:clobber"
Expand All @@ -18,6 +17,11 @@ def test_rake_tasks
assert_includes output, "webpacker:verify_install"
end

def test_rake_task_webpacker_check_binstubs
output = Dir.chdir(test_app_path) { `rake webpacker:check_binstubs 2>&1` }
refute_includes output, "webpack binstubs not found."
end

private
def test_app_path
File.expand_path("test_app", __dir__)
Expand Down