LoginSignup
4
1

More than 5 years have passed since last update.

Hanami 1.3 ではhanami new . が正しく動く

Last updated at Posted at 2018-08-13

2018年8月8日にhanami 1.3.0.beta1がリリースとなりました。

個人的に嬉しい改良は、このバージョンから bundle exec hanami new . が期待通りに動くようになったことです。

vendor/bundle を使ってプロジェクトごとに必要な gem をインストールする主義の場合、これまでは、

  1. テンポラリディレクトリを作り、 ./vendor/bunle に hanami コマンドを実行するために必要な gem を bundle install
  2. テンポラリディレクトリ内で project_name を引数に bundle exec hanami new project_name
  3. project_name を本来の位置に移動

のような手順を踏む必要がありましたが、 hanami 1.3 以降は、作成するプロジェクト名に . を指定した場合、 rails と同様にカレントディレクトリの名前を利用するようになります。

hanami 1.2 までの場合

$ mkdir hanami12
$ cd hanami12
Gemfile
source 'https://rubygems.org'
gem 'hanami', '~> 1.2.0'
$ bundle --path vendor/bundle
$ bundle exec hanami new .
config/environment.rb
require 'bundler/setup'
require 'hanami/setup'
require 'hanami/model'
require_relative '../lib/.' # !!!
require_relative '../apps/web/application'
# <snip>
$ ls -a lib
./  ../  ..rb  entities/  mailers/  repositories/

hanami 1.3.beta1 の場合

$ mkdir hanami13
$ cd hanami13
Gemfile
source 'https://rubygems.org'
gem 'hanami', '~> 1.3.0.beta1'
$ bundle --path vendor/bundle
$ bundle exec hanami new .
config/environment.rb
require 'bundler/setup'
require 'hanami/setup'
require 'hanami/model'
require_relative '../lib/hanami13'
require_relative '../apps/web/application'
# <snip>
$ ls -a lib
./  ../  hanami13/  hanami13.rb
$ ls -a lib/hanami13
./  ../  entities/  mailers/  repositories/

関連リンク

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1