Sha256: b1cd594af2bc67d05a478977f2a9f53d6b66a6d840139d830375c83c2cc6fcf8

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

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

namespace :strada do
  desc "Install Strada into the app"
  task :install do
    if Rails.root.join("config/importmap.rb").exist?
      Rake::Task["strada:install:importmap"].invoke
    elsif Rails.root.join("package.json").exist?
      Rake::Task["strada:install:node"].invoke
    else
      puts "You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem."
    end
  end

  namespace :install do
    desc "Install Strada on an app running importmap-rails"
    task :importmap do
      run_strada_install_template "strada_with_importmap"
    end

    desc "Install Strada on an app running node"
    task :node do
      run_strada_install_template "strada_with_node"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
strada-rails-0.0.2 lib/tasks/strada_tasks.rake
strada-rails-0.0.1 lib/tasks/strada_tasks.rake