Giter Club home page Giter Club logo

reloader's Introduction

Hanami 🌸

The web, with simplicity.

Version

This branch contains the code for hanami 2.0.x.

Frameworks

Hanami is a full-stack Ruby web framework. It's made up of smaller, single-purpose libraries.

This repository is for the full-stack framework, which provides the glue that ties all the parts together:

These components are designed to be used independently or together in a Hanami application.

Status

Gem Version CI Depfu

Installation

Hanami supports Ruby (MRI) 3.0+

gem install hanami

Usage

hanami new bookshelf
cd bookshelf && bundle
bundle exec hanami server # visit http://localhost:2300

Please follow along with the Getting Started guide.

Donations

You can give back to Open Source, by supporting Hanami development via GitHub Sponsors.

Supporters

Contact

Community

We strive for an inclusive and helpful community. We have a Code of Conduct to handle controversial cases. In general, we expect you to be nice with other people. Our hope is for a great software and a great Community.

Contributing Open Source Helpers

  1. Fork it ( https://github.com/hanami/hanami/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

In addition to contributing code, you can help to triage issues. This can include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to subscribe to hanami on CodeTriage.

Tests

To run all test suite:

$ bundle exec rake

To run all the unit tests:

$ bundle exec rspec spec/unit

To run all the integration tests:

$ bundle exec rspec spec/integration

To run a single test:

$ bundle exec rspec path/to/spec.rb

Development Requirements

  • Ruby >= 3.0
  • Bundler
  • Node.js (MacOS)

Versioning

Hanami uses Semantic Versioning 2.0.0

Copyright

Copyright © 2014 Hanami Team – Released under MIT License.

reloader's People

Contributors

jodosha avatar mereghost avatar timriley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reloader's Issues

Environment loading misbehaving

Heya @jodosha !

I've been testing this for the past few days and what I noticed is that if I run my tests using guard (which I usually do) the first environment loaded by dotenv will be used for all guards.

What I think might benefit us in the future is creating a group for hanami server kinda like that:

group :server do
  guard "rack", port: ENV["HANAMI_PORT"] || 2300 do
    watch(%r{config/*})
    watch(%r{lib/*})
    watch(%r{apps/*})
  end
end

And then the command to start the server should be guard -g server. That should isolate the server from the test but would need to warn users that the server could be started alongside with their tests.

Another solution would be generating a new file (maybe .server.guardfile) and pass it to guard guard -G file to ensure that nothing unexpected happens and requires no user action.

Glob patterns and improper regex in Guardfile

The lines

watch(%r{config/*})
watch(%r{lib/*})

use glob pattern syntax inside a regex.

For instance, the glob pattern config/* matches the string "config", followed by a "/", followed by any characters, which seems like the intended behavior. However %r{} defines a regex in ruby and the regex config/* matches the string "config" followed by 0 or more occurrences of "/".

Essentially these two lines are equivalent to searching for the strings "config" and "lib" respectively. You can verify this by making any file in the root of the app that contains the word "lib" or "config" (such as "liberty.txt") and seeing that when that file is saved, the server restarts.

In addition, the .+..+..+ pattern in

watch(%r{app/templates/.+..+..+})
watch(%r{slices/.+/templates/.+..+..+})

will match:

  • any character one or more times followed by
  • any character followed by
  • any character one or more times followed by
  • any character followed by
  • any character one or more times

Essentially, any 5 or more characters will match .+..+..+, since to match a literal . character in regex, you have to escape it \.

See official Guardfile examples in the guard repository.

Command "hanami generate reloader" unavailable

Hi,

It looks like the gem is not loaded every time. I added a puts in two files, and it works when I do hanami server:

$ hanami server
Hi, this is hanami-reloader.rb
Hi, this is cli.rb
Requiring /home/malina/prog/test/lib
[2017-12-08 15:03:42] INFO  WEBrick 1.3.1
[2017-12-08 15:03:42] INFO  ruby 2.4.2 (2017-09-14) [x86_64-linux]
[2017-12-08 15:03:42] INFO  WEBrick::HTTPServer#start: pid=8365 port=2300
^C[2017-12-08 15:03:46] INFO  going to shutdown ...
[2017-12-08 15:03:46] INFO  WEBrick::HTTPServer#start done.

But no such luck with hanami generate reloader:

$ hanami generate reloader
Commands:
  hanami generate action APP ACTION                     # Generate an action for app
  hanami generate app APP                               # Generate an app
  hanami generate mailer MAILER                         # Generate a mailer
  hanami generate migration MIGRATION                   # Generate a migration
  hanami generate model MODEL                           # Generate a model
  hanami generate secret [APP]                          # Generate session secret

This is with version 0.2.0.

Exclude folders from being watched

I am attempting to integrate webpack into hanami app which uses hanami-reloader.

My webpack configuration in development mode uses webpack-dev-server with hot module reloading, which triggers page reload on js source code changes. Since at the same time hanami-reloader triggers Rack restart, page reload triggered from webpack reloads the page while server is inaccessible and results in "This site can’t be reached" message from browser.

Is it possible to somehow tell reloader to ignore file changes in specific folders? In my case I would exclude js source files handled by webpack so no Rack reload would trigger.

Could not find gem `guard-puma` when after `hanami new` on 2.0.0.rc1

When I ran hanami new blog, cd'd into the project directory, and ran hanami server, I got:

Could not find gem 'guard-puma' in locally installed gems.
Run `bundle install` to install missing gems.      

The Gemfile contains that gem under :development group, so running bundle install fixed the issue. But the hanami new output said it already ran Bundler install, so I expected it to already install all the necessary gems.

0.3.0 is not released on RubyGems

https://rubygems.org/gems/hanami-reloader - last version available on RubyGems is 0.2.1. This also makes instructions from readme result in an error

Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Could not find gem 'hanami-reloader (~> 0.3)' in any of the gem sources listed in your Gemfile.

Byebug and Guard

Hi,

I have a problem with debugging, guard just doesn't allow to type normally at byebug breakpoint. Is there any ways to fix that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.