Skip to main content

Netlify

to run in your site's root directory
View template source
gem "perron" unless File.read("Gemfile").include?("perron")

after_bundle do
  unless File.exist?("config/initializers/perron.rb")
    rails_command "perron:install"
  end

create_file "netlify.toml", <<~TOML
[build]
  command = "bundle install && bin/rails perron:build"
  publish = "output"

  [build.environment]
    RAILS_ENV = "production"
    RUBY_VERSION = "4.0.0"
[context.production.environment]
  PERRON_HOST = "yourdomain.com"
  PERRON_PROTOCOL = "https"
TOML
end

This snippet adds a configuration file for Netlify deployments. The netlify.toml file defines how your site should be built and deployed on Netlify. It specifies a custom build command, sets the output directory and configures environment variables including the Ruby version and Rails environment.