Sha256: ea515ce7f7cd08d688e11045a7f4eb8d25b78a4aa6e22d78fb7d9763788631f4

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

require "cable_ready/installer"

# mutate working copy of development.rb to avoid bundle alerts
FileUtils.cp(development_path, development_working_path)

# add default_url_options to development.rb for Action Mailer
if defined?(ActionMailer)
  lines = development_working_path.readlines
  if lines.find { |line| line.include?("config.action_mailer.default_url_options") }
    say "⏩ Action Mailer default_url_options already defined. Skipping."
  else
    index = lines.index { |line| line =~ /^Rails.application.configure do/ }
    lines.insert index + 1, "  config.action_mailer.default_url_options = {host: \"localhost\", port: 3000}\n\n"
    development_working_path.write lines.join

    say "✅ Action Mailer default_url_options defined"
  end
end

# add default_url_options to development.rb for Action Controller
lines = development_working_path.readlines
if lines.find { |line| line.include?("config.action_controller.default_url_options") }
  say "⏩ Action Controller default_url_options already defined. Skipping."
else
  index = lines.index { |line| line =~ /^Rails.application.configure do/ }
  lines.insert index + 1, "  config.action_controller.default_url_options = {host: \"localhost\", port: 3000}\n"
  development_working_path.write lines.join

  say "✅ Action Controller default_url_options defined"
end

complete_step :development

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cable_ready-5.0.3 lib/install/development.rb
cable_ready-5.0.2 lib/install/development.rb
cable_ready-5.0.1 lib/install/development.rb
cable_ready-5.0.0 lib/install/development.rb
cable_ready-5.0.0.rc2 lib/install/development.rb
cable_ready-5.0.0.rc1 lib/install/development.rb
cable_ready-5.0.0.pre10 lib/install/development.rb