filewatcher 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.rdoc +19 -17
  2. data/VERSION +1 -1
  3. data/lib/filewatcher.rb +5 -1
  4. metadata +6 -6
data/README.rdoc CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Simple file watcher. Monitors changes in files by polling.
4
4
 
5
+ = Install
6
+
7
+ Needs Ruby and Rubygems:
8
+
9
+ $ [sudo] gem install filewatcher
10
+
5
11
  = Command line utility
6
12
 
7
13
  Filewatcher scans filesystem and execute shell commands when files changes.
@@ -12,27 +18,28 @@ Where
12
18
  filename: filename(s) to scan.
13
19
  shell command: shell command to execute when file changes on disk.
14
20
 
15
- = Examples:
21
+ = Examples
16
22
 
17
23
  Run the echo command when the file myfile is changed:
18
24
 
19
25
  $ filewatcher "myfile" "echo 'myfile has changed'"
20
26
 
21
- Run the ruby script when it is changed:
27
+ Run any javascript in current folder when it is updated on Linux/OSX:
28
+ $ filewatcher *.js "node $FILENAME"
22
29
 
23
- $ filewatcher -e ruby-script.rb
30
+ In Windows Powershell:
24
31
 
25
- Works with ruby, perl, python and awk by detecting file extensions.
32
+ > filewatcher *.js "node %FILENAME%"
26
33
 
27
- At 2 seconds intervall check all files matching *.rb and ../src/*.rb, and run "ruby run_tests.rb".
34
+ Run the ruby script when it is changed:
28
35
 
29
- $ filewatcher -i 2 "*.rb ../src/*.rb" "ruby run_tests.rb"
36
+ $ filewatcher -e ruby-script.rb
30
37
 
31
- = Globbing
38
+ Works with ruby, perl, python and awk by detecting file extensions.
32
39
 
33
- Print a list of all files matching *.css at start and the:
40
+ Print a list of all files matching *.css first and the print filename when a file is beeing updated:
34
41
 
35
- $ filewatcher -l *.css
42
+ $ filewatcher -l *.css 'echo file: $FILENAME'
36
43
 
37
44
  = Available enviroment variables
38
45
 
@@ -43,8 +50,9 @@ has to be enclosed in single quotes. To run node whenever a javascript file is u
43
50
 
44
51
  The environment variables $FILEPATH and $FILEDIR is also available.
45
52
 
46
- Options:
47
- --interval, -i <f>: Interval to scan filesystem. Defaults to 0.5 seconds. (Default: 0.5)
53
+ = Command line options
54
+
55
+ --interval, -i <f>: Interval in seconds to scan filesystem. Defaults to 0.5 seconds.
48
56
  --exec, -e: Execute file as a script when file is updated.
49
57
  --recurse, -r <s>: Recurse into the directory, watching everything matching 'expression'
50
58
  --include, -n <s>: Include files (default: *)
@@ -53,12 +61,6 @@ Options:
53
61
  --version, -v: Print version and exit
54
62
  --help, -h: Show this message
55
63
 
56
- = Install
57
-
58
- sudo gem install filewatcher
59
-
60
- You need ruby and rubygems installed.
61
-
62
64
  = Ruby API
63
65
 
64
66
  Examples:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
data/lib/filewatcher.rb CHANGED
@@ -31,7 +31,11 @@ class FileWatcher
31
31
 
32
32
  def watch(sleep=1, &on_update)
33
33
  loop do
34
- Kernel.sleep sleep until file_updated?
34
+ begin
35
+ Kernel.sleep sleep until file_updated?
36
+ rescue SystemExit,Interrupt
37
+ Kernel.exit
38
+ end
35
39
  yield @updated_file
36
40
  end
37
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filewatcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000 Z
12
+ date: 2013-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thoughtbot-shoulda
16
- requirement: &70212885464580 !ruby/object:Gem::Requirement
16
+ requirement: &70294480940300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70212885464580
24
+ version_requirements: *70294480940300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &70212885464060 !ruby/object:Gem::Requirement
27
+ requirement: &70294480939160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.16.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70212885464060
35
+ version_requirements: *70294480939160
36
36
  description: Detect changes in files.
37
37
  email: thomas.flemming@gmail.com
38
38
  executables: