Sha256: 52ad9ce4cc8a71737bdd7ed7b8276d1f2fbce7c4eadbd2ba69ec9b70bbc58e8c

Contents?: true

Size: 877 Bytes

Versions: 12

Compression:

Stored size: 877 Bytes

Contents

def run_stimulus_install_template(path) system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/#{path}.rb",  __dir__)}" end

namespace :stimulus do
  desc "Install Stimulus into the app"
  task :install do
    if defined?(Webpacker::Engine)
      Rake::Task["stimulus:install:webpacker"].invoke
    elsif defined?(Importmap)
      Rake::Task["stimulus:install:asset_pipeline"].invoke
    else
      puts "You must either be running Webpacker or importmap-rails to use this gem."
    end
  end

  namespace :install do
    desc "Install Stimulus on the app with the asset pipeline"
    task :asset_pipeline do
      run_stimulus_install_template "stimulus_with_asset_pipeline"
    end

    desc "Install Stimulus on the app with webpacker"
    task :webpacker do
      run_stimulus_install_template "stimulus_with_webpacker"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
stimulus-rails-0.3.11 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.10 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.9 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.8 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.7 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.6 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.5 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.4 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.3 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.2 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.1 lib/tasks/stimulus_tasks.rake
stimulus-rails-0.3.0 lib/tasks/stimulus_tasks.rake