Permalink
Browse files

Update gem.watchr script

  • Loading branch information...
1 parent a65c9bc commit 563378d6a0d8fcb981f67ac2a9088b746b367ad6 @mynyml mynyml committed Feb 9, 2010
Showing with 10 additions and 20 deletions.
  1. +10 −20 gem.watchr
View
30 gem.watchr
@@ -1,32 +1,22 @@
# Run me with:
-#
# $ watchr gem.watchr
+def gemspec() Dir['*.gemspec'].first end
# --------------------------------------------------
-# Convenience Methods
+# Rules
# --------------------------------------------------
-def build(gemspec)
- system "gem build %s" % gemspec
- FileUtils.mv Dir['watchr-*.gem'], 'pkg/'
- puts
-end
+watch( gemspec ) { build }
# --------------------------------------------------
-# Watchr Rules
+# Signal Handling
# --------------------------------------------------
-watch( '^watchr.gemspec$' ) { |m| build m[0] }
+Signal.trap('QUIT') { build } # Ctrl-\
+Signal.trap('INT' ) { abort("\n") } # Ctrl-C
# --------------------------------------------------
-# Signal Handling
+# Helpers
# --------------------------------------------------
-# Ctrl-\
-Signal.trap('QUIT') do
- puts " --- Building Gem ---\n\n"
- build 'watchr.gemspec'
+def build
+ puts; system "gem build #{gemspec}"
+ FileUtils.mv( Dir['*.gem'], 'pkg/' )
end
-
-# Ctrl-C
-Signal.trap('INT') { abort("\n") }
-
-
-# vim:ft=ruby

0 comments on commit 563378d

Please sign in to comment.