V1.3: v0.9.0

  • Use Ruby 2.3+

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

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

  • Edit config/environment.rb as shown below

  • Edit lib/bookshelf.rb as shown below

  • Edit spec/spec_helper.rb, by replacing Hanami::Application.preload! with Hanami.boot

  • Edit spec/spec_helper.rb, by adding Hanami::Utils.require!("spec/support") (optional)

  • Edit spec/features_helper.rb, by replacing Capybara.app = Hanami::Container.new with Capybara.app = Hanami.app

  • Edit config.ru, by replacing run Hanami::Container.new with run Hanami.app

  • Edit each single application configuration (eg apps/web/application.rb) by replacing digest with fingerprint in assets block(s)

  • Remove custom subclasses of Hanami::Model::Coercer (if any), as PostgreSQL types are now natively supported

  • Edit all the repositories (lib/bookshelf/repositories) to inherit from Hanami::Repository instead of including it

  • Edit all the entities (lib/bookshelf/entities) to inherit from Hanami::Entity instead of including it

  • Edit all the repositories by moving the class level methods to instance level

  • Update all the repositories with the new syntax

  • Edit all the entities by removing .attributes


require 'bundler/setup'
require 'hanami/setup'
require 'hanami/model' # Add this line
require_relative '../lib/bookshelf'
require_relative '../apps/web/application'

# This used to be `Hanami::Container.configure`, now it must be `Hanami.configure`
Hanami.configure do
  mount Web::Application, at: '/'

  # This is a new block
  # Cut and paste the contents of `Hanami::Model.configure` from lib/bookshelf.rb
  model do

    # This used to be:
    #   adapter type: :sql, url: ENV['DATABASE_URL']
    adapter :sql, ENV['DATABASE_URL']

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

    # Mapping block isn't supported anymore

  # This is a new block
  # Cut and paste the contents of `Hanami::Mailer.configure` from lib/bookshelf.rb
  mailer do

    # Adjust the new layer `root` location
    root Hanami.root.join("lib", "bookshelf", "mailers")

    delivery do
      development :test
      test        :test
      # production :smtp, address: ENV['SMTP_PORT'], port: 1025


# This line is enough ;)

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