class Jobshop::CanaryBuilder

Public Instance Methods

bin_jobshop() click to toggle source

Make a phony `bin/jobshop` file

# File lib/generators/jobshop/canary/canary_generator.rb, line 20
def bin_jobshop
  FileUtils.touch("bin/jobshop")
end
db_migrate() click to toggle source

The db/migrate folder isn't created automatically.

# File lib/generators/jobshop/canary/canary_generator.rb, line 12
def db_migrate
  unless Dir.exist?("db/migrate")
    say_status :create, "db/migrate"
    Dir.mkdir("db/migrate")
  end
end
dev_cert() click to toggle source
# File lib/generators/jobshop/canary/canary_generator.rb, line 47
def dev_cert
  FileUtils.mkdir_p(".ssl")

  key_file = Pathname.pwd.join("../../.ssl/jobshop.test.key.pem")
  cert_file = Pathname.pwd.join("../../.ssl/jobshop.test.cert.pem")

  unless key_file.file? && cert_file.file?
    Dir.chdir("../..") do
      Jobshop::Generators::DevCertGenerator.start
    end
  end

  FileUtils.cp(key_file, ".ssl")
  FileUtils.cp(cert_file, ".ssl")
end
expose_mailer_previews() click to toggle source
# File lib/generators/jobshop/canary/canary_generator.rb, line 24
    def expose_mailer_previews
      # Mailer previews don't really play nice with Engines so in the canary app
      # we create an initializer to expose them properly.
      initializer "jobshop_expose_mailer_previews.rb", <<~INITIALIZER
        if Rails.env.development?
          Rails.application.configure do
            config.action_mailer.preview_path = "\#{Jobshop::Engine.root}/spec/mailers"
          end
        end
      INITIALIZER
    end
localhost_tld_length() click to toggle source
# File lib/generators/jobshop/canary/canary_generator.rb, line 36
    def localhost_tld_length
      # This allows us to easily use the localhost hostname in development.
      initializer "jobshop_tld_length.rb", <<~INITIALIZER
        if Rails.env.development? || Rails.env.test?
          Rails.application.configure do
            config.action_dispatch.tld_length = 0
          end
        end
      INITIALIZER
    end
readme() click to toggle source
# File lib/generators/jobshop/canary/canary_generator.rb, line 7
def readme
  # Do not generate README.md
end