Sha256: 6ada909d40a1b436fdfb6ef49d30d69670cb9b0157462159d629adf42345973b

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

APP_JS_ROOT = Rails.root.join("app/assets/javascripts")
CABLE_CONFIG_PATH = Rails.root.join("config/cable.yml")

say "Import turbo-rails in existing app/assets/javascripts/application.js"
append_to_file APP_JS_ROOT.join("application.js"), %(import "@hotwired/turbo-rails"\n)

if CABLE_CONFIG_PATH.exist?
  say "Enable redis in bundle"
  uncomment_lines "Gemfile", %(gem 'redis')

  say "Switch development cable to use redis"
  gsub_file CABLE_CONFIG_PATH.to_s, /development:\n\s+adapter: async/, "development:\n  adapter: redis\n  url: redis://localhost:6379/1"
else
  say 'ActionCable config file (config/cable.yml) is missing. Uncomment "gem \'redis\'" in your Gemfile and create config/cable.yml to use the Turbo Streams broadcast feature.'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
turbo-rails-0.7.2 lib/install/turbo_with_asset_pipeline.rb
turbo-rails-0.7.1 lib/install/turbo_with_asset_pipeline.rb
turbo-rails-0.7.0 lib/install/turbo_with_asset_pipeline.rb