Permalink
Browse files

Templates

  • Loading branch information...
1 parent e8824e9 commit 8da5b79a0b1e5da52fb22bf6f487b56d2194486c @victorcoder committed Apr 5, 2012
Showing with 19 additions and 4 deletions.
  1. +13 −4 lib/guard/go.rb
  2. +6 −0 lib/guard/go/templates/Guardfile
View
@@ -7,6 +7,17 @@ module Guard
class Go < Guard::Guard
attr_reader :options, :runner
+ DEFAULT_OPTIONS = {
+ :go_file => 'app.go'
+ }
+
+ def initialize(watchers = [], options = {})
+ super(watchers, options)
+
+ @options = DEFAULT_OPTIONS.merge(options)
+ @runner = ::Guard::RackRunner.new(@options)
+ end
+
# Call once when Guard starts. Please override initialize method to init stuff.
# @raise [:task_has_failed] when start has failed
def start
@@ -20,11 +31,9 @@ def run_all
def run_on_change(paths)
UI.info "Restarting Go..."
if runner.restart
- UI.info "Rack restarted, pid #{runner.pid}"
- Notifier.notify("Rack restarted on port #{options[:port]}.", :title => "Rack restarted!", :image => :success)
+ UI.info "Go restarted, pid #{runner.pid}"
else
- UI.info "Rack NOT restarted, check your log files."
- Notifier.notify("Rack NOT restarted, check your log files.", :title => "Rack NOT restarted!", :image => :failed)
+ UI.info "Go NOT restarted, check your log files."
end
end
@@ -0,0 +1,6 @@
+# Add files and commands to this file, like the example:
+# watch(%r{file/path}) { `command(s)` }
+#
+guard 'go' do
+ watch('app.go')
+end

0 comments on commit 8da5b79

Please sign in to comment.