onchange 0.0.1.alpha-java
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.
- data/Doubleshot +40 -0
- data/README.md +4 -0
- data/ext/java/OnChange.java +38 -0
- data/target/onchange.jar +0 -0
- data/test/helper.rb +5 -0
- data/test/public_file_handler_spec.rb +11 -0
- metadata +90 -0
data/Doubleshot
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Doubleshot.new do |config|
|
4
|
+
|
5
|
+
config.project = "onchange"
|
6
|
+
config.group = "org.substantiality"
|
7
|
+
config.version = "0.0.1.alpha"
|
8
|
+
|
9
|
+
if ENV["TRAVIS"]
|
10
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/groups/public/"
|
11
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/apache/"
|
12
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/sonatype/"
|
13
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/codehaus-snapshots/"
|
14
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/shadows/central-m1/"
|
15
|
+
config.mvn_repository "http://maven.mirrors.travis-ci.org/nexus/content/repositories/central/"
|
16
|
+
else
|
17
|
+
config.mvn_repository "https://nexus.codehaus.org/content/groups/public/"
|
18
|
+
config.mvn_repository "https://oss.sonatype.org/content/groups/public/"
|
19
|
+
config.mvn_repository "http://mirrors.ibiblio.org/pub/mirrors/maven2"
|
20
|
+
config.mvn_repository "http://repo1.maven.org/maven2"
|
21
|
+
end
|
22
|
+
|
23
|
+
config.development do
|
24
|
+
config.jar "org.jruby:jruby:jar:1.7.0"
|
25
|
+
end
|
26
|
+
|
27
|
+
config.gemspec do |spec|
|
28
|
+
spec.summary = "OnChange is a File System Monitor for JRuby/Java"
|
29
|
+
spec.description = <<-DESCRIPTION
|
30
|
+
OnChange is a File System Monitor for JRuby/Java similar to the Listen
|
31
|
+
or Watchr gems. Since the underlying library used is Java7's WatchService,
|
32
|
+
it's Ruby support is limited to JRuby, and you must be running Java7.
|
33
|
+
DESCRIPTION
|
34
|
+
spec.homepage = "https://github.com/sam/onchange"
|
35
|
+
spec.author = "Sam Smoot"
|
36
|
+
spec.email = "ssmoot@gmail.com"
|
37
|
+
spec.license = "MIT-LICENSE"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
package org.substantiality;
|
2
|
+
|
3
|
+
import java.io.IOException;
|
4
|
+
import java.nio.file.*;
|
5
|
+
import java.util.HashMap;
|
6
|
+
import java.util.Map;
|
7
|
+
|
8
|
+
import static java.nio.file.StandardWatchEventKinds.*;
|
9
|
+
|
10
|
+
public class OnChange {
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Main program.
|
14
|
+
* * @param args Command line arguments - dirs to watch.
|
15
|
+
* * @throws IOException in case of I/O problems.
|
16
|
+
* * @throws InterruptedException in case the thread was interrupted during watchService.take().
|
17
|
+
*/
|
18
|
+
public static void main(final String... args) throws IOException, InterruptedException {
|
19
|
+
final FileSystem fileSystem = FileSystems.getDefault();
|
20
|
+
try (final WatchService watchService = fileSystem.newWatchService()) {
|
21
|
+
final Map<WatchKey, Path> keyMap = new HashMap<WatchKey, Path>();
|
22
|
+
for (final String arg : args.length > 0 ? args : new String[]{"."}) {
|
23
|
+
final Path path = Paths.get(arg);
|
24
|
+
keyMap.put(path.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY), path);
|
25
|
+
}
|
26
|
+
WatchKey watchKey;
|
27
|
+
do {
|
28
|
+
watchKey = watchService.take();
|
29
|
+
final Path eventDir = keyMap.get(watchKey);
|
30
|
+
for (final WatchEvent<?> event : watchKey.pollEvents()) {
|
31
|
+
final WatchEvent.Kind kind = event.kind();
|
32
|
+
final Path eventPath = (Path) event.context();
|
33
|
+
System.out.println(eventDir + ": " + event.kind() + ": " + event.context());
|
34
|
+
}
|
35
|
+
} while (watchKey.reset());
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
data/target/onchange.jar
ADDED
Binary file
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: onchange
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
prerelease: 6
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Sam Smoot
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: doubleshot
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
22
|
+
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
29
|
+
none: false
|
30
|
+
prerelease: false
|
31
|
+
type: :development
|
32
|
+
description: ! ' OnChange is a File System Monitor for JRuby/Java similar to the
|
33
|
+
Listen
|
34
|
+
|
35
|
+
or Watchr gems. Since the underlying library used is Java7''s WatchService,
|
36
|
+
|
37
|
+
it''s Ruby support is limited to JRuby, and you must be running Java7.
|
38
|
+
|
39
|
+
'
|
40
|
+
email: ssmoot@gmail.com
|
41
|
+
executables: []
|
42
|
+
extensions: []
|
43
|
+
extra_rdoc_files: []
|
44
|
+
files:
|
45
|
+
- test/helper.rb
|
46
|
+
- test/public_file_handler_spec.rb
|
47
|
+
- !binary |-
|
48
|
+
RG91Ymxlc2hvdA==
|
49
|
+
- !binary |-
|
50
|
+
UkVBRE1FLm1k
|
51
|
+
- ext/java/OnChange.java
|
52
|
+
- target/onchange.jar
|
53
|
+
homepage: https://github.com/sam/onchange
|
54
|
+
licenses:
|
55
|
+
- MIT-LICENSE
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --line-numbers
|
59
|
+
- --main
|
60
|
+
- README.textile
|
61
|
+
- --title
|
62
|
+
- onchange Documentation
|
63
|
+
- lib
|
64
|
+
- README.textile
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
- target
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: !binary |-
|
73
|
+
MA==
|
74
|
+
none: false
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - !binary |-
|
78
|
+
Pg==
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.3.1
|
81
|
+
none: false
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.24
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: OnChange is a File System Monitor for JRuby/Java
|
88
|
+
test_files:
|
89
|
+
- test/helper.rb
|
90
|
+
- test/public_file_handler_spec.rb
|