Sha256: fe321ce2778851fd2d72f1992bfd48ceb97e8c7f6830264f29ab165cccce26bf

Contents?: true

Size: 750 Bytes

Versions: 29

Compression:

Stored size: 750 Bytes

Contents

if (cable_config_path = Rails.root.join("config/cable.yml")).exist?
  say "Enable redis in bundle"

  gemfile_content = File.read(Rails.root.join("Gemfile"))
  pattern = /gem ['"]redis['"]/

  if gemfile_content.match?(pattern)
    uncomment_lines "Gemfile", pattern
  else
    append_file "Gemfile", "\n# Use Redis for Action Cable"
    gem 'redis', '~> 4.0'
  end

  run_bundle

  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

29 entries across 29 versions & 2 rubygems

Version Path
turbo-rails-1.3.0 lib/install/turbo_needs_redis.rb
turbo-rails-1.1.1 lib/install/turbo_needs_redis.rb
turbo-rails-1.1.0 lib/install/turbo_needs_redis.rb
turbo-rails-1.0.1 lib/install/turbo_needs_redis.rb
turbo-rails-1.0.0 lib/install/turbo_needs_redis.rb
turbo-rails-0.9.1 lib/install/turbo_needs_redis.rb
turbo-rails-0.9.0 lib/install/turbo_needs_redis.rb
turbo-rails-0.8.3 lib/install/turbo_needs_redis.rb
turbo-rails-0.8.2 lib/install/turbo_needs_redis.rb