Sha256: 97592c568ab9879a621db0de7eae3c2c5fe4dd9d895852392da34aadc427ad00

Contents?: true

Size: 771 Bytes

Versions: 3

Compression:

Stored size: 771 Bytes

Contents

WEBPACKER_APP_TEMPLATE_PATH = File.expand_path("../../install/template.rb", File.dirname(__FILE__))

if Webpacker.rails_less_than_42?
  namespace :rails do
    desc 'Redefined by Webpacker'
    task template: :environment do
      puts 'Adding environment for legacy apps'
    end
  end
end

namespace :webpacker do
  desc "Install webpacker in this application"
  task install: [:check_node, :check_yarn] do
    if Rails::VERSION::MAJOR >= 5
      exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
    elsif Rails::VERSION::MAJOR >= 4
      exec "#{RbConfig.ruby} ./bin/rake rails:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
    else
      exec "rake rails:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webpacker-legacy-0.1.2 lib/tasks/webpacker/install.rake
webpacker-legacy-0.1.1 lib/tasks/webpacker/install.rake
webpacker-legacy-0.1.0 lib/tasks/webpacker/install.rake