Skip to content

Instantly share code, notes, and snippets.

@brendanstennett
Created April 30, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brendanstennett/aad056f077c5b70880e7 to your computer and use it in GitHub Desktop.
Save brendanstennett/aad056f077c5b70880e7 to your computer and use it in GitHub Desktop.
Docker+Fig+Guard
#!/bin/bash
trap "kill 0" SIGINT SIGTERM EXIT
listen -f 0.0.0.0:4000 &
docker exec -it myproject_web_1 bundle exec guard -o 10.0.2.2:4000
guard :rspec, cmd: 'rspec' do
watch(%r{spec/(.+)_spec.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{lib/(.+).rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
watch(%r{app/(.+).rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{app/(.*)(.erb|.haml)$}) { |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" }
end
@thecatwasnot
Copy link

I got the host IP figured out (umm, not enough coffee that day I guess).

For newer versions of guard/listen you need to also pass -r on the listen command. And unfortunately in listen 2.10.0 I'm getting an error, which appears to be fixed on guard/listen master.
Here's what I ended up with: https://gist.github.com/thecatwasnot/9dde2e100ccad19660cf
Ubuntu 14.04 -> Vagrant(CoreOS) -> docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment