Comments (5)
Hi @asilano, thank you for this report!
I've just tried to replicate this. Here's what I did:
(1) Create a brand new hanami app: hanami new my_app
(using the 2.0.3 release).
(2) Update the Gemfile to the following, and then run bundle update
# frozen_string_literal: true
source "https://rubygems.org"
gem "hanami", github: "hanami/hanami", branch: "main"
gem "hanami-router", github: "hanami/router", branch: "main"
gem "hanami-controller", github: "hanami/controller", branch: "main"
gem "hanami-validations", github: "hanami/validations", branch: "main"
gem "dry-monads"
gem "dry-types", "~> 1.0", ">= 1.6.1"
gem "puma"
gem "rake"
group :development, :test do
gem "dotenv"
end
group :cli, :development do
gem "hanami-reloader", github: "hanami/reloader", branch: "main"
end
group :cli, :development, :test do
gem "hanami-rspec", github: "hanami/rspec", branch: "main"
end
group :development do
gem "guard-puma", "~> 0.8"
end
group :test do
gem "rack-test"
end
(3) Enter the hanami console with bundle exec hanami console
(4) Access the Dry::Monads::Do
constant, like your example. And for me, it seems to work fine:
~/src/scratch/my_app
❯ be hanami console
my_app[development]> require "dry-monads"
=> true
my_app[development]> Dry::Monads::Do
=> Dry::Monads::Do
my_app[development]>
I wonder if there's something different about your app or your environment that might be causing this issue?
Would you mind trying the steps I outlined above and seeing how you go?
Thanks!
from hanami.
Hey @timriley , thanks for taking a look. (Saw you at Brighton Ruby, btw - hence me kicking the hanami tyres a bit!)
Your sample app works fine. In fact, it also works if I change the hanami gems to be ~> 2.1.0.beta
, so it doesn't even look like a version change is the cause. I'll go ahead and push my app - it's pretty small at the moment - and link it in here in case there's anything obvious that's up with it.
One thing that's interesting to me is that the fresh new app opens its console "quietly":
❯ be hanami console
my_app[development]>
...but when I launch the console on my app-in-progress, I get what looks like a pry location.
❯ bundle exec hanami c
From: /Users/chrishowlett/.gem/ruby/3.1.4/gems/hanami-cli-2.1.0.beta1/lib/hanami/cli/commands/app/console.rb:49 Hanami::CLI::Commands::App::Command::Environment#call:
44: err.puts "`#{engine}' is not bundled. Please run `bundle add #{engine}' and retry."
45: exit(1)
46: end
47:
48: console_engine.start
=> 49: end
50:
51: private
52:
53: def resolve_engine(engine, opts)
54: if engine
exalted[development]>
Is that expected?
from hanami.
Here's the repo where I'm having problems. https://github.com/asilano/hanami-exalted
from hanami.
Thanks for the extra detail, @asilano! And for sharing your app code too.
I just hopped in and took a look. Firstly, I was actually getting a crash inside pry when I was trying to run the console for the first time:
❯ be hanami console
bundler: failed to load command: hanami (/Users/tim/.local/share/rtx/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/bin/hanami)
/Users/tim/.local/share/rtx/installs/ruby/3.2.0/lib/ruby/gems/3.2.0/gems/pry-0.13.1/lib/pry/code.rb:342:in `<class:Code>': undefined method `=~' for class `Pry::Code' (NameError)
This looked to be something that was fixed in v0.14.0 of pry: pry/pry@b548784
So then I removed the version specified from the pry entry in your Gemfile
and ran bundle update pry pry-byebug --conservative
, which allowed the console to boot nicely:
❯ be hanami console
exalted[development]>
And just to double check, I confirmed that dry-monads seems to be fine here:
exalted[development]> require "dry/monads"
=> true
exalted[development]> Dry::Monads::Do
=> Dry::Monads::Do
exalted[development]>
Here's the git diff after this experiment:
diff --git a/Gemfile b/Gemfile
index dc126fc..95c65c3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -25,7 +25,7 @@ gem "oj"
group :development, :test do
gem "dotenv"
- gem "pry", '~> 0.13.1'
+ gem "pry"
gem "pry-byebug"
end
diff --git a/Gemfile.lock b/Gemfile.lock
index cdedafa..1d1d559 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -187,7 +187,7 @@ GEM
shellany (~> 0.0)
oj (3.16.1)
pg (1.5.4)
- pry (0.13.1)
+ pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
@@ -281,7 +281,7 @@ DEPENDENCIES
hanami-webconsole (~> 2.1.0.beta)
oj
pg
- pry (~> 0.13.1)
+ pry
pry-byebug
puma
rack-test
If you follow that pry upgrade, does your Hanami console look right again?
BTW, very happy to hear my Hanami words at Brighton Ruby encouraged you to take a look! ❤️ Hopefully we can get you over these few little hitches and can keep you moving again 😄
from hanami.
Hurrah, that sorts it out. An in turn points out that the similar looking error I was seeing on my web app was due to a different, and easily fixed, bug of my own writing. I am up and running again!
Now, I just need to re-pick-up what I was doing with these monads...
Thanks for your help!
from hanami.
Related Issues (20)
- Automatically adjust database URL in test mode HOT 3
- Custom MIME types are not working HOT 14
- Add `Slice.source_dir` method
- Add `Slice.app?` method
- Set ROM inflector be the same as the Hanami app inflector HOT 2
- Slice ROM setup with slice-specific database
- Expand default set of Sequel extensions HOT 5
- Configure db/ and structs/ directories not to be auto-registered
- Inside providers, add a `slice` alias for `target` HOT 13
- Incorrect name attribute handling in fields_for_collection helper when base name provided
- Label form helper errors when provided a symbol
- Offer to improve API Docs and Guides for FormFor helper HOT 2
- Load db provider if config dir exists
- Log SQL queries
- Automatically include ROM extension for operations used inside Hanami apps HOT 4
- MissingActionError should show relative path instead of absolute path for suggested action
- Allow additional gateways to be configured by user in standard :db provider
- Allow custom connection options to be configured in :db provider
- Register nested relations
- Logger stream in development defaults to $stdout, when it should be log/development.log HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hanami.