Code Monkey home page Code Monkey logo

guard-rails's Introduction

Guard-rails is watching on your railses!

Gem Version Build Status Code Climate Test Coverage

Main repository

Currently, the official fork repository is at ranmocy/guard-rails. Please, come here and communicate with me.

Install

Please make sure to have Guard installed before continuing.

Add Guard::Rails to your Gemfile:

group :development do
  gem 'guard-rails', require: false
end

Add the default Guard::Rails template to your Guardfile by running:

$ guard init rails

Add options in Guardfile

guard :rails, port: 3000, host: '0.0.0.0' do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end

Now I can automatically restart your Rails development server as your files change!

Lots of fun options growing!

  • :daemon runs the server as a daemon, without any output to the terminal that started guard (default false)
  • :debugger enable the debugger in server. Requires ruby-debug gem. (default false)
  • :environment is the server environment (default development)
  • :force_run kills any process that's holding the listen port before attempting to (re)start Rails (default false)
  • :pid_file specify your pid_file (default tmp/pids/[RAILS_ENV].pid)
  • :host is where the server is hosted (default localhost)
  • :port is the server port number (default 3000)
  • :root lets you specify the Rails root, i.e. for using guard-rails to run a dummy app within an engine (try :root => '/spec/dummy').
  • :server the webserver engine to use (try :server => :thin)
  • :start_on_start will start the server when starting Guard (default true)
  • :timeout waits when restarting the Rails server, in seconds (default 30).
  • :zeus_plan the custom plan in zeus, only works when zeus option is true (default server)
  • :zeus support zeus to boost rails init speed (default false).
  • :CLI construct the runner command as you will! Will omit all options above except pid_file! (default rails server --pid tmp/pids/[RAILS_ENV].pid)

How-to

  • Multiple instances use pid_file option to run multiple instances with same rails_env.
  • Avoid multiple autoruns when editing by VIM and Emacs move the backup files to somewhere else or just ignore them in Guardfile.
  • Use binding.pry in Rails Actually you can't! See discussion here.

Philosophy

  • All Platforms MRI is the main test case. But will be tested under REE and JRuby.
  • Live on the edge Guard-Rails will be tested under Ruby 2.2.3 to 2.3.0 with newest gems.
  • Semantic Version

Contribute

The best way to contact me is the Issues and Pull Request system on GitHub. Currently the official fork repository is at ranmocy/guard-rails.

Please, post your issues or pull requests there. And I will be there as your call.

Contributors

  • Ranmocy Sheng
  • John Bintz
  • cablegram
  • Joel Moss
  • Sidney Burks
  • Paul Schyska
  • Adam Michel
  • Adib Saad
  • Cezary Baginski
  • Nathan Broadbent
  • Tim Preston
  • killphi
  • Michael
  • Benjamin Sullivan
  • Johnny Robeson
  • Peter Ragone
  • Grant Hutchins and Jonathan Mukai-Heidt
  • Everard Brown
  • Sho Kusano
  • Darrin Holst
  • Leo Lou
  • Luciano Sousa
  • Michel Pavan Macedo

Copyright

Guard-rails is under MIT license.

guard-rails's People

Contributors

adibsaad avatar bonsaiben avatar cablegram avatar darrinholst avatar e2 avatar joelmoss avatar johnbintz avatar killphi avatar l4u avatar mibamur avatar mmacedo avatar ndbroadbent avatar pcragone avatar ranmocy avatar rmm5t avatar rosylilly avatar sid137 avatar tehpeh avatar teitei-tk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

guard-rails's Issues

guard-rails and debugger

I'm probably missing something, but I can't seem to get debugger to work while using guard and guard-rails. Debugger works fine when running outside of guard like so:

bundle exec rails s

...but using guard, the "debugger" line is skipped over:

bundle exec guard =>
...
(rdb:1) Event Load (1.4ms) SELECT DISTINCT(occurred_at) FROM "events" ORDER BY occurred_at ASC LIMIT 1
Event Load (0.8ms) SELECT DISTINCT(occurred_at) FROM "events" ORDER BY occurred_at DESC LIMIT 1
...

I'm running a Rails 4.1.1 app and guard-rails 0.5.2 (latest at the time of this writing). I've tried passing "debugger: true" as an option and I do see "Debugger enabled" as a result. I've also tried switching from thin to webrick. Any thoughts would be appreciated!

guard-rails doesn't longer start as daemon after upgrade from 0.2.3 to 0.3.4

I have upgraded to guard-rails 0.3.4, now guard-rails does not longer start as daemon. Foreground works, but daemon mode not.

0.3.1 seems also okay, so this bug may be introduced when switching to spawn instead of shell on starting rails server.

OS: Fedora 18 64-bit (Linux)
Ruby: ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
Rails: 3.2.8
guard: 1.6.2
Guardfile (partial):

guard 'rails', :daemon => true, :force_run => true, :timeout => 10 do
  watch('Gemfile.lock')
  watch(%r{^(config/(initializers|environments)|lib)/.*})
  watch(%r{^config/*.rb})
end
´´´

Guardfile evaluation stopped by guard-rails until Ctrl+C is pressed

After updating guard-rails to 0.3.1 from 0.2.3, when starting Guard, it evaluates the Guardfile until the guard-rails section is reached, starts the server, and then stops evaluating the guardfile. If I press Ctrl+C in the terminal in which Guard is running, it stops the server, continues evaluating the Guardfile, and notifies me that Rails could not be started.

Rails 5.1 rake dev:cache interfering with restarting the puma server

With Rails 5.1 adding the rake dev:cache command. Code here
the default strategy of watch('tmp/caching-dev.txt') would fail when running rake dev:cache in another terminal window. As it would complain that the pid already exists. I looked into the implementation in the rails master branch and it turns out that by default it is removing the pid file on tmp/pids/server.pid. Adding this config to the guardfile fixed the issue. Is this a rails issue not respecting other pid files?

Correct Guardfile definition for Unicorn?

Hi,
I want to ensure the documentation on using guard rails with Unicorn is correct. I have the following setting in my Guardfile according to the instructions.

guard 'rails', :port => 5003, :environment => 'test', :server => :unicorn, :preloading => true do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end

However, I'm getting this:


22:18:36 - INFO - Guard is using TerminalTitle to send notifications.
22:18:36 - INFO - Guard::RSpec is running
22:18:36 - INFO - [Guard::Rails] will start unicorn on port 5003 in test.
22:18:36 - INFO - Starting Rails...

Exiting
/Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- rack/handler/unicorn (LoadError)
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/handler.rb:63:in `try_require'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/handler.rb:16:in `get'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:272:in `server'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.14/lib/rails/commands/server.rb:59:in `start'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.14/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.14/lib/rails/commands.rb:50:in `tap'
    from /Users/user123/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.14/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
22:19:06 - INFO - Rails NOT started, check your log files.

Any ideas what I'm doing wrong?

Feature Req - specify host in guard-rails

New versions of rails (4.2.2-beta-x and onward), will use an updated version of rack that loads the server on localhost:3000 (making only http://localhost:3000 accessible) instead of 0.0.0.0:3000 (which makes all hosts (192.168.2.1:300 as the wifi's address for example) configured on the development machine accessible). Prior to the update I could start my server and check the app out on various wifi-connected devices laying around. or access the app on a virtual machine's host. Now this default has changed.

could you create the option in the guard-rails part to specify a custom host for the app to listen to? like making it: guard 'rails', host: '0.0.0.0' do.

more info on this new rack can be found here.

Weird behaviour when saving with vim

If I save config/application.rb with vim, I get the following:

22:54:49 - DEBUG - Trying to run Guard::Rails#run_on_removals with ["config/application.rb", "config/4913"]

...and therefore I get the server restarted twice.

If I just touch the file, or I save it with another text editor, I get the correct behaviour.

Exception when running guard ThreadError: can't be called from trap context

I originally posted an issue on the guard project but I guess the issue is from guard-rails
guard/guard#653

The stack trace from running guard. (This suddenly happened today, this setup was working for 2+ months)

14:06:33 - DEBUG - Command execution: which notify-send
14:06:33 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
14:06:33 - INFO - Guard is using NotifySend to send notifications.
14:06:33 - INFO - Guard is using Tmux to send notifications.
14:06:33 - DEBUG - Command execution: tmux list-clients -F '#{client_tty}'
14:06:34 - DEBUG - Command execution: tmux list-clients -F '#{client_tty}'
14:06:34 - DEBUG - Command execution: tmux show -t /dev/pts/0
14:06:34 - INFO - Guard is using TerminalTitle to send notifications.
14:06:34 - DEBUG - Guard starts all plugins
14:06:34 - DEBUG - Hook :start_begin executed for Guard::Bundler
14:06:34 - DEBUG - Command execution: bundle check
14:06:34 - INFO - Bundle already up-to-date
14:06:34 - DEBUG - Hook :start_end executed for Guard::Bundler
14:06:34 - DEBUG - Hook :start_begin executed for Guard::Rails
14:06:34 - INFO - [Guard::Rails] will start the default web server on port 4040 in development.
14:06:34 - INFO - Starting Rails...
14:06:34 - DEBUG - Command execution: notify-send Starting Rails... Rails starting on port 4040 in development... -t 3000 -h int:transient:1 -i /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/$mages/pending.png -u low
14:06:34 - DEBUG - Command execution: tmux -V
14:06:34 - DEBUG - Command execution: tmux set -q status-left-bg yellow 

14:06:34 - ERROR - Guard::Rails failed to achieve its <start>, exception was:
> [#D5BB6C4DB1EE] ThreadError: can't be called from trap context
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:105:in `synchronize'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:105:in `within_preserved_state'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:39:in `stop'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/setuper.rb:219:in `block in _setup_signal_traps'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:55:in `call'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:55:in `pid_file'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:114:in `has_pid?'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:145:in `block in wait_for_no_pid'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:157:in `wait_for_pid_loop'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:145:in `wait_for_no_pid'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:24:in `stop'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails/runner.rb:33:in `restart'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails.rb:44:in `reload'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-rails-0.6.0/lib/guard/rails.rb:37:in `start'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:74:in `block in run_supervised_task'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:71:in `catch'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:71:in `run_supervised_task'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:22:in `block (2 levels) in run'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:150:in `block (3 levels) in _scoped_plugins'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:148:in `each'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:148:in `block (2 levels) in _scoped_plugins'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:147:in `catch'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:147:in `block in _scoped_plugins'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:145:in `each'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:145:in `_scoped_plugins'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:21:in `block in run'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/lumberjack-1.0.9/lib/lumberjack.rb:32:in `unit_of_work'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/runner.rb:20:in `run'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:28:in `block in start'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:108:in `block in within_preserved_state'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:105:in `synchronize'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:105:in `within_preserved_state'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/commander.rb:26:in `start'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/lib/guard/cli.rb:107:in `start'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/gems/guard-2.6.1/bin/guard:6:in `<top (required)>'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/bin/guard:23:in `load'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/bin/guard:23:in `<main>'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/bin/ruby_executable_hooks:15:in `eval'
> [#D5BB6C4DB1EE] /home/nadeem/.rvm/gems/ruby-2.1.2@app/bin/ruby_executable_hooks:15:in `<main>'
14:06:34 - INFO - Guard::Rails has just been fired
14:06:34 - DEBUG - Hook :start_begin executed for Guard::RSpec
14:06:34 - INFO - Guard::RSpec is running
14:06:34 - DEBUG - Hook :start_end executed for Guard::RSpec
14:06:34 - INFO - Guard is now watching at '/home/nadeem/work/app/server'

GuardFile

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :bundler do
  watch('Gemfile')
  # Uncomment next line if your Gemfile contains the `gemspec' command.
  # watch(/^.+\.gemspec/)
end

guard 'rails', :port => 4040 do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end


# Note: The cmd option is now required due to the increasing number of ways
#       rspec may be run, below are examples of the most common uses.
#  * bundler: 'bundle exec rspec'
#  * bundler binstubs: 'bin/rspec'
#  * spring: 'bin/rsspec' (This will use spring if running and you have
#                          installed the spring binstubs per the docs)
#  * zeus: 'zeus rspec' (requires the server to be started separetly)
#  * 'just' rspec: 'rspec'
guard :rspec, cmd: 'bundle exec rspec' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb')  { "spec" }

  # Rails example
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$})          { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
  watch('spec/rails_helper.rb')                       { "spec" }

  # Capybara features specs
  watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$})     { |m| "spec/features/#{m[1]}_spec.rb" }

  # Turnip features and steps
  watch(%r{^spec/acceptance/(.+)\.feature$})
  watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$})   { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end

Gemfile.lock

    guard (2.6.1)
      formatador (>= 0.2.4)
      listen (~> 2.7)
      lumberjack (~> 1.0)
      pry (>= 0.9.12)
      thor (>= 0.18.1)
    guard-bundler (2.0.0)
      bundler (~> 1.0)
      guard (~> 2.2)
    guard-rails (0.6.0)
      guard (~> 2.0)
    guard-rspec (4.3.1)
      guard (~> 2.1)
      rspec (>= 2.14, < 4.0)

Error when using the daemon option

I am using guard-rails with the daemon: true option set.

It starts up fine, but when accessing localhost:3000 from the browser I am getting an error: Errno::EACCES (Permission denied @ dir_initialize - /run/runc).

Everything runs ok when not using the daemon option. I'm using a gemset with RVM if that changes anything.

Versions:

$ gem info guard guard-rails rails

*** LOCAL GEMS ***

guard (2.15.0)
    Author: Thibaud Guillaume-Gentil
    Homepage: http://guardgem.org
    License: MIT
    Installed at: /home/coaxial/.rvm/gems/ruby-2.6.1@kersinki

    Guard keeps an eye on your file modifications

*** LOCAL GEMS ***

guard-rails (0.8.1)
    Authors: John Bintz, Wanzhang Sheng
    Homepage: https://github.com/ranmocy/guard-rails
    License: MIT
    Installed at: /home/coaxial/.rvm/gems/ruby-2.6.1@kersinki

    Guard your Rails to always be there.

*** LOCAL GEMS ***

rails (5.2.2.1)
    Author: David Heinemeier Hansson
    Homepage: http://rubyonrails.org
    License: MIT
    Installed at: /home/coaxial/.rvm/gems/ruby-2.6.1@kersinki

    Full-stack web application framework.

My guard:

guard 'rails', daemon: true do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end

Full trace:

Errno::EACCES (Permission denied @ dir_initialize - /run/runc):
  
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:194:in `initialize'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:194:in `new'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:194:in `watch'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:204:in `block in watch'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:196:in `each'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:196:in `watch'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:204:in `block in watch'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:196:in `each'
rb-inotify (0.10.0) lib/rb-inotify/notifier.rb:196:in `watch'
listen (3.1.5) lib/listen/adapter/linux.rb:32:in `_configure'
listen (3.1.5) lib/listen/adapter/base.rb:45:in `block in configure'
listen (3.1.5) lib/listen/adapter/base.rb:40:in `each'
listen (3.1.5) lib/listen/adapter/base.rb:40:in `configure'
listen (3.1.5) lib/listen/adapter/base.rb:63:in `start'
/home/coaxial/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/forwardable.rb:230:in `start'
listen (3.1.5) lib/listen/listener.rb:68:in `block in <class:Listener>'
listen (3.1.5) lib/listen/fsm.rb:121:in `instance_eval'
listen (3.1.5) lib/listen/fsm.rb:121:in `call'
listen (3.1.5) lib/listen/fsm.rb:91:in `transition_with_callbacks!'
listen (3.1.5) lib/listen/fsm.rb:57:in `transition'
listen (3.1.5) lib/listen/listener.rb:91:in `start'
activesupport (5.2.2.1) lib/active_support/evented_file_update_checker.rb:96:in `boot!'
activesupport (5.2.2.1) lib/active_support/evented_file_update_checker.rb:73:in `block in updated?'
activesupport (5.2.2.1) lib/active_support/evented_file_update_checker.rb:71:in `synchronize'
activesupport (5.2.2.1) lib/active_support/evented_file_update_checker.rb:71:in `updated?'
railties (5.2.2.1) lib/rails/application/finisher.rb:159:in `map'
railties (5.2.2.1) lib/rails/application/finisher.rb:159:in `block (2 levels) in <module:Finisher>'
activesupport (5.2.2.1) lib/active_support/reloader.rb:81:in `check!'
activesupport (5.2.2.1) lib/active_support/reloader.rb:63:in `run!'
actionpack (5.2.2.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.2.1) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.2.1) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.2.1) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.2.1) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.2.1) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.6) lib/rack/method_override.rb:22:in `call'
rack (2.0.6) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.2.1) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.0.6) lib/rack/sendfile.rb:111:in `call'
railties (5.2.2.1) lib/rails/engine.rb:524:in `call'
puma (3.12.1) lib/puma/configuration.rb:227:in `call'
puma (3.12.1) lib/puma/server.rb:660:in `handle_request'
puma (3.12.1) lib/puma/server.rb:474:in `process_client'
puma (3.12.1) lib/puma/server.rb:334:in `block in run'
puma (3.12.1) lib/puma/thread_pool.rb:135:in `block in spawn_thread'

Where to set server type & port?

Hi,
I'm newbie to guard. Where do I set the options for server & port? The instructions talk about the setting, but do I set them in my Guardfile or command line?

0.5.3 can't find rake; 0.5.2 works correctly

I get this error:

$ bundle exec guard
17:45:39 - INFO - Guard is using TerminalNotifier to send notifications.
17:45:39 - INFO - Guard is using TerminalTitle to send notifications.
17:45:39 - INFO - [Guard::Rails] will start the default web server on port 3000 in development.
17:45:39 - INFO - Starting Rails...

Could not find rake-10.3.2 in any of the sources
Run `bundle install` to install missing gems.
17:46:09 - INFO - Rails NOT started, check your log files.

17:46:09 - INFO - Guard is now watching at '/Users/dan/Dropbox/Documents/dev/chewy'
[1] guard(main)> 

My Guardfile looks like:

guard 'rails' do
  watch('Gemfile.lock')
  watch(%r{^(config|lib|app/validators)/.*})
end

When I change back to guard-rails 0.5.2, my server starts up correctly. In both cases, rake 10.3.2 is installed.

Server Options (Thin)

Hello,

I'm looking to use Guard to run "thin start --ssl". I can choose thin by setting :server => :thin but there doesn't seem to be a way to pass arguments to thin (or ideally a .yml)

Can't connect to master. Run zeus start first.

I am trying to use the zeus: true option

I am getting the error: Can't connect to master. Run zeus start first.

Zeus is installed globally, in the meantime I am using guard-zeus but i think using guard-rails with that doesnt have the server restart speed advantages.

[RAILS 6] Deprecation warning when specifying server

Code:

guard 'rails', server: 'puma', port: 3001 do
  watch('Gemfile.lock')
  watch(%r{^(config|lib)/.*})
end

Generates this warning on run:

DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead. (called from <main> at bin/rails:4)
=> Booting Puma
=> Rails 6.0.0 application starting in development 
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.5.6-p201), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3001
Use Ctrl-C to stop
14:06:55 - INFO - Rails started, pid 28504

Guard version 2.15.0

how to allow log to unlimited size

It stops showing the log and starts only showing:

14:50:50 - INFO - Reloading browser: app/views/whatever/index.html.slim

Is there an option to disable logging limit? (or could this have to do with ghosting issues w/ zeus and guard)

binding.pry doesn't work

When starting rails server on the console, I can add a binding.pry wherever I want it, hit reload, and then execution is halted at this line and I can interact with pry in the given context.

With Guard-Rails, this doesn't seem to work. The binding.pry is recognised, but simply omitted, which means that execution is continued without giving me the chance to interact with pry.

The output (which proves that binding.pry is recognised, see => 5: - binding.pry):


Frame number: 0/106

From: /Users/josh/Documents/Work/MuheimWebdesign/base/app/views/dashboards/show.html.slim @ line 5 ActionView::CompiledTemplates#_app_views_dashboards_show_html_slim__130432664906313828_70093845884840:

    1: h1
    2:   i.glyphicon.glyphicon-home
    3:   |Dashboards#show
    4: 
 => 5: - binding.pry

[1] base(#<#<Class:0x007f7ffd913c80>>) »  
  Rendered dashboards/show.html.slim within layouts/application (116.0ms)
  Rendered app/cells/mini_hub/show.html.slim (3.7ms)
Completed 200 OK in 255ms (Views: 230.1ms | ActiveRecord: 0.0ms)
  Rendered /Users/josh/.rvm/gems/ruby-2.0.0-p353@base/gems/xray-rails-0.1.12/app/views/_xray_bar.html.erb (8.8ms)
12:21:29 - INFO - Browser disconnected.
12:21:30 - INFO - Browser connected.
12:21:45 - INFO - Browser connected.

This question on stackoverflow asks the same, and is over a year old already:
http://stackoverflow.com/questions/14153585/guard-rails-not-providing-repl-for-binding-pry

It would be really useful to have the rails output and guard input in the same window, but without pry, I'm not able to do my work.

Thanks a lot for help.

maintainer request

Hi guys, I would be happy to help on maintaining this.

Thibaud had adviced to open an issue here on this matter.
Thanks,
Gregory

The dependency on version is incompatible with paper_trails version class

All of a sudden (after upgrading guard-rails) to latest version we get the following errors

Started GET "/" for 127.0.0.1 at 2013-02-25 11:25:13 +0100
Processing by PagesController#show as HTML
  Site Load (0.3ms)  SELECT "sites".* FROM "sites" WHERE "sites"."subdomain" = 'dev' LIMIT 1
  Page Load (0.3ms)  SELECT "pages".* FROM "pages" WHERE "pages"."site_id" = 1 AND "pages"."url" = '' LIMIT 1
  Version Load (0.4ms)  SELECT "versions".* FROM "versions" WHERE "versions"."item_id" = 1 AND "versions"."item_type" = 'Page' AND "versions"."published_at" = '2013-02-21 17:30:23.241998' ORDER BY created_at ASC, id ASC LIMIT 1
Completed 500 Internal Server Error in 6ms

NoMethodError (protected method `[]' called for "":Version):
  app/models/concerns/versionable.rb:69:in `published_version'
  app/controllers/pages_controller.rb:9:in `show'
  app/controllers/application_controller.rb:172:in `set_logger_site_id'
  app/controllers/application_controller.rb:178:in `set_logger_username'

Guard keeps restarting Rails

Every now and then Guard keeps restarting and stopping Rails repeatedly. I have to exit Guard and restart it to stop this problem. For instance when I run a Rake task to recreate the database and add sample data I get something like this:

>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
12:05:00 - INFO - Rails restarted, pid 4018

12:05:01 - INFO - Running annotate
Nothing annotated.
Route file annotated.
12:05:12 - INFO - Reloading browser: /assets/application.css
12:05:12 - INFO - Restarting Rails...

>> Stopping ...
Exiting
=> Booting Thin
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
12:05:21 - INFO - Rails restarted, pid 4057

12:05:21 - INFO - Running annotate
Nothing annotated.
Route file annotated.
12:05:32 - INFO - Reloading browser: /assets/application.css
12:05:32 - INFO - Restarting Rails...

>> Stopping ...
Exiting
=> Booting Thin
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
12:05:41 - INFO - Rails restarted, pid 4091

12:05:41 - INFO - Running annotate
Nothing annotated.
Route file annotated.
12:05:52 - INFO - Restarting Rails...

>> Stopping ...
Exiting
=> Booting Thin
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
12:06:01 - INFO - Rails restarted, pid 4124

illegal option -- u

This commit 883d0d7 breaks the gem on OS X. The env tool that comes with OS X 10.9.3 doesn't accept -u as an option. As a workaround, I symlinked genv from the coreutils package in Homebrew as env.

'zeus is not part of the bundle' using rbenv

~/c/r/tarjira git:master ❯❯❯ which zeus
/home/pablo/.rbenv/shims/zeus
~/c/r/tarjira git:master ❯❯❯ rbenv which zeus
/home/pablo/.rbenv/versions/2.1.1/bin/zeus
~/c/r/tarjira git:master ❯❯❯ ag 'zeus' Gemfile.lock   
~/c/r/tarjira git:master ❯❯❯
~/c/r/tarjira git:master ❯❯❯ ag 'zeus' Guardfile
guard 'rails', zeus: true do
~/c/r/tarjira git:master ❯❯❯ guard -P rails
....
/home/pablo/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/bundler-1.6.0/lib/bundler/rubygems_integration.rb:240:in `block in replace_gem': zeus is not part of the bundle. Add it to Gemfile. (Gem::LoadError)

I am also using rbenv-binstubs, so maybe the issue has to do with that. It basically allows me to run commands without having to prepend them with bundle exec. Though zeus runs fine since it's installed on the "global" install.

Spring integration

This is a feature request. I would love to see spring integration. It's similar to the Zeus support that you already have, but spring is newer and is directly part of the rails ecosystem (the github repo is owned by 'rails').

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.