V1.3: v1.0.0


  • Edit Gemfile, by changing Hanami version: gem 'hanami', '~> 1.0'

  • Edit Gemfile, by changing Hanami Model version: gem 'hanami-model', '~> 1.0'

  • Edit Gemfile, by removing Bundler: gem 'bundler' can be deleted

  • Add config/boot.rb as shown below

  • Edit config/environment.rb as shown below

  • Edit lib/bookshelf.rb as shown below

  • Edit all the applications to remove the logger settings. Eg. apps/web/application.rb

  • Edit the project using Hanami.logger instead of application level loggers. Eg. Web.logger

config/boot.rb

require_relative './environment'
Hanami.boot

This file can be used to boot your project from external commands. For instance to use it with Sidekiq.

config/environment.rb

require 'bundler/setup'
require 'hanami/setup'
require 'hanami/model'
require_relative '../lib/bookshelf'
require_relative '../apps/web/application'

Hanami.configure do
  mount Web::Application, at: '/'

  model do
    adapter :sql, ENV['DATABASE_URL']

    migrations 'db/migrations'
    schema     'db/schema.sql'
  end

  mailer do
    # Make sure this folder exists, or delete this row.
    root Hanami.root.join("lib", "bookshelf", "mailers")

    # This has changed. It used to be a block, now it's a setting
    delivery :test
  end

  # These two blocks are new.
  # They MUST be after the general settings like `mount`, `model`, `mailer`.
  environment :development do
    # See: http://guides.hanamirb.org/projects/logging/
    logger level: :info
  end

  environment :production do
    logger level: :info, formatter: :json

    mailer do
      delivery :smtp, address: ENV['SMTP_HOST'], port: ENV['SMTP_PORT']
    end
  end
end

lib/bookshelf.rb

module Bookshelf
end

If you have any problem, don’t hesitate to look for help in chat.