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 replacingHanami::Application.preload!
withHanami.boot
-
Edit
spec/spec_helper.rb
, by addingHanami::Utils.require!("spec/support")
(optional) -
Edit
spec/features_helper.rb
, by replacingCapybara.app = Hanami::Container.new
withCapybara.app = Hanami.app
-
Edit
config.ru
, by replacingrun Hanami::Container.new
withrun Hanami.app
-
Edit each single application configuration (eg
apps/web/application.rb
) by replacingdigest
withfingerprint
inassets
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 fromHanami::Repository
instead of including it -
Edit all the entities (
lib/bookshelf/entities
) to inherit fromHanami::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
config/environment.rb
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
#
end
# 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
end
end
end
lib/bookshelf.rb
# This line is enough ;)
Hanami::Utils.require!("lib/bookshelf")
If you have any problem, don’t hesitate to look for help in chat.