Sha256: f787557af82aa2a91c2efe06f4975ebec79d23253b26e5e766d84a1352b7cee4

Contents?: true

Size: 980 Bytes

Versions: 5

Compression:

Stored size: 980 Bytes

Contents

namespace :shakapacker do
  desc "Verifies that bin/shakapacker is present"
  task :check_binstubs do
    verify_file_existance("bin/shakapacker", "bin/webpacker")
    verify_file_existance("bin/shakapacker-dev-server", "bin/webpacker-dev-server")
  end
end

def verify_file_existance(main_file, alternative_file)
  unless File.exist?(Rails.root.join(main_file))
    if File.exist?(Rails.root.join(alternative_file))
      Shakapacker.puts_deprecation_message(
        Shakapacker.short_deprecation_message(
          alternative_file,
          main_file
        )
      )
    else
      puts <<~MSG
        Couldn't find shakapacker binstubs!
        Possible solutions:
        - Ensure you have run `rails shakapacker:install`.
        - Run `rails shakapacker:binstubs` if you have already installed shakapacker.
        - Ensure the `bin` directory, `bin/shakapacker`, and `bin/shakapacker-dev-server` are not included in .gitignore.
      MSG
      exit!
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
shakapacker-7.0.2 lib/tasks/shakapacker/check_binstubs.rake
shakapacker-7.0.1 lib/tasks/shakapacker/check_binstubs.rake
shakapacker-7.0.0 lib/tasks/shakapacker/check_binstubs.rake
shakapacker-7.0.0.rc.2 lib/tasks/shakapacker/check_binstubs.rake
shakapacker-7.0.0.rc.1 lib/tasks/shakapacker/check_binstubs.rake