Code reloading allows us to edit code and see the changes with a browser refresh, without needing to stop and restart the server.
This is a development-only feature.
shotgun Ruby gem to reload the code as-needed.
New generated projects have this entry in their
group :development do # Code reloading # See: http://hanamirb.org/guides/1.0/projects/code-reloading gem 'shotgun' end
shotgun requires that the current environment supports
JRuby and Windows don't support it.
If this is your case,
shotgun is not compatible with your development environment, then you can remove that entry from the
Gemfile or start the server with the
Hanami doesn't implement code reloading in its core.
The framework doesn't know about this feature, it just uses Ruby to load the code and execute it. It's
shotgun that makes code reloading possible, by wrapping Hanami projects' code.
shotgun is only enabled in development, all the other environments don't have this code reloading feature.
By excluding this feature from the core of the framework, we make sure that Hanami projects don't mess with Ruby's code loading mechanisms in production.
In other words, once the code is loaded in production, it isn't changed anymore.