Cannot use most CLI commands in a Rails app with Hanami slices
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start by running the reproduction and tracing the CLI entry point for hanami g slice, especially how it discovers the Hanami app. Compare that behavior with the app defined in config/initializers/load_hanami.rb rather than config/app.rb; done means generating a slice works in this Rails setup without moving the app definition, with regression coverage for the scenario.
Written by the indexing model from the issue text.
Description
Describe the bug
We are working to incrementally migrate a Rails application to Hanami, gradually replacing an area of the Rails code with its own dedicated slice as we go (taking this post as inspiration and a template). As such, we have Hanami stuff in slices/**/* and config/initializers/load_hanami.rb, but nothing in config/app.rb.
To Reproduce
rails new ibis
cd ibis
bundle add hanami
cat << END_INITIALIZER > config/initializers/load_hanami.rb
require 'hanami'
module IbisHanami
class App < Hanami::App
prepare_container { |container| container.autoloader.ignore('app') }
end
end
Hanami.boot
END_INITIALIZER
mkdir -p slices/osprey
cat << END_SLICE > slices/osprey/my_class.rb
module Osprey
class MyClass
def call = 'Hello from slice!'
end
end
END_SLICE
hanami g slice pigeon # does not generate a new slice, instead gives the usage docs for creating a new Hanami app
Expected behavior
It would be nice if there were a way to use the convenient CLI commands in applications that use hanami, but define their Hanami::App somewhere other than config/app.rb
My environment
- Ruby version: 3.4
- OS: I have seen this on both Mac OS and Linux
- Dominant language
- Ruby
- Stars
- 33
- Forks
- 55
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 1
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hanami/hanami-cli
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
hanami/hanami-cli#449 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
hanami/hanami-cli#450 ·
-
MariaDB supportOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
hanami/hanami-cli#448 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
hanami/hanami-cli#418 ·
-
JRuby supportOpen
Difficulty 5/5 Over a week Newbie friendliness 35/100
hanami/hanami-cli#411 ·
All issues in hanami/hanami-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
FreeCAD/homebrew-freecad#870 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
OSCON 2016Opencontent
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rubyevents/rubyevents#2148 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
we-promise/sure#3838 · 2 comments ·
Maintainers usually reply within 1 day