fs-watch 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +13 -0
  2. data/bin/fs-watch +17 -0
  3. data/lib/fs_watch.rb +9 -0
  4. metadata +69 -0
@@ -0,0 +1,13 @@
1
+ # fs-watch
2
+
3
+ ## Description
4
+
5
+ Script to watch files and directories for changes and execute a command. (OSX Only)
6
+ Similar to dnotify from linux.
7
+
8
+ ## Installation
9
+ $ gem install fs-watch
10
+
11
+ ## Usage
12
+ $ fs-watch [dirsToWatch...] "echo 'execute me when something happens'"
13
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fs_watch'
3
+
4
+ if ARGV.size >= 2
5
+ dirs = ARGV[0..-2]
6
+ cmd = ARGV.last
7
+ Signal.trap("INT") { exit }
8
+
9
+ fs_watch = FsWatch.new
10
+ fs_watch.watch_directories dirs
11
+ fs_watch.cmd = cmd
12
+ fs_watch.start
13
+ else
14
+ puts "Usage: "
15
+ puts %{ $ fs-watch [directoriesToWatch] "echo 'command to run'" }
16
+ exit(1)
17
+ end
@@ -0,0 +1,9 @@
1
+ require 'fsevent'
2
+
3
+ class FsWatch < FSEvent
4
+ attr_accessor :cmd
5
+
6
+ def on_change(directories)
7
+ system self.cmd
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fs-watch
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: "0.2"
6
+ platform: ruby
7
+ authors:
8
+ - Johannes Wagener
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-09-26 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: ruby-fsevent
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: " Script to watch files and directories for changes and execute a command. (OSX Only)\n Similar to dnotify from linux.\n Usage: \n $ fs-watch [dirsToWatch...] \"echo 'execute me when something happens'\"\n"
28
+ email:
29
+ - johannes@wagener.cc
30
+ executables:
31
+ - fs-watch
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - README.md
38
+ - bin/fs-watch
39
+ - lib/fs_watch.rb
40
+ has_rdoc: true
41
+ homepage: http://johannes.wagener.cc
42
+ licenses:
43
+ - MIT
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.3.6
61
+ requirements: []
62
+
63
+ rubyforge_project: fs-watch
64
+ rubygems_version: 1.6.2
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Script to watch files and directories for changes and execute a command (OSX only)
68
+ test_files: []
69
+