Skip to content

Commit

Permalink
use listen 1.3.1 patched
Browse files Browse the repository at this point in the history
patched directory_record.rb:177 for windows
  • Loading branch information
tka committed Dec 25, 2014
1 parent cd2028c commit 6de8969
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 12 deletions.
3 changes: 0 additions & 3 deletions lib/ruby/jruby/listen-1.1.6/lib/listen/version.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# !!! CHANGELOG moved to Github [releases](https://github.com/guard/listen/releases) page !!!


## 1.2.2 - Jun 17, 2013

### Bug fix

- Rescue all error on sha1_checksum generation. ([@thibaudgg][])

## 1.2.1 - Jun 11, 2013

### Improvement

- Ignore 'bundle' folder by default. ([@thibaudgg][])

## 1.2.0 - Jun 11, 2013

### Improvement

- [#124][] New `force_adapter` option, skip the `.listen_test` adapter test. ([@nicobrevin][])

## 1.1.6 - Jun 4, 2013

### Change
Expand Down Expand Up @@ -78,7 +99,7 @@

- [#98][] New method: `Listen.to!` which blocks the current thread. ([@rymai][])
- [#98][] New method: `Listen::Listener#start!` to start the listener and block the current thread. ([@martikaljuve][] & [@rymai][])
- [#95][] Make `Listen::Listener` capable of listening to multiple directories, deprecates `Listen::MultiListener`. ([@rymai][])
- [#95][] Make `Listen::Listener` capable of listening to multiple directories, deprecates `Listen::MultiListener`, defaults `Listener#relative_paths` to `true` when listening to a single directory (see [#131][]). ([@rymai][])
- [#85][] Compute the SHA1 sum only for regular files. ([@antifuchs][])
- New methods: `Listen::Adapter#pause`, `Listen::Adapter#unpause` and `Listen::Adapter#paused?`. ([@rymai][])
- Refactor `Listen::DirectoryRecord` internals. ([@rymai][])
Expand Down Expand Up @@ -310,6 +331,9 @@
[#118]: https://github.com/guard/listen/issues/118
[#120]: https://github.com/guard/listen/issues/120
[#122]: https://github.com/guard/listen/issues/122
[#124]: https://github.com/guard/listen/issues/124
[#131]: https://github.com/guard/listen/issues/131
[@21croissants]: https://github.com/21croissants
[@Maher4Ever]: https://github.com/Maher4Ever
[@ahoward]: https://github.com/ahoward
[@akerbos]: https://github.com/akerbos
Expand All @@ -329,14 +353,16 @@
[@napcs]: https://github.com/napcs
[@netzpirat]: https://github.com/netzpirat
[@nex3]: https://github.com/nex3
[@nicobrevin]: https://github.com/nicobrevin
[@nilbus]: https://github.com/nilbus
[@nysalor]: https://github.com/nysalor
[@piotr-sokolowski]: https://github.com/piotr-sokolowski
[@rehevkor5]: https://github.com/rehevkor5
[@rymai]: https://github.com/rymai
[@scottdavis]: https://github.com/scottdavis
[@sunaku]: https://github.com/sunaku
[@tarsolya]: https://github.com/tarsolya
[@textgoeshere]: https://github.com/textgoeshere
[@thibaudgg]: https://github.com/thibaudgg
[@vongruenigen]: https://github.com/vongruenigen
[@zanker]: https://github.com/zanker
[@zanker]: https://github.com/zanker
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Listen gem listens to file modifications and notifies you about the changes.
* OS-specific adapters for Mac OS X 10.6+, Linux, *BSD and Windows.
* Automatic fallback to polling if OS-specific adapter doesn't work.
* Detects file modification, addition and removal.
* Checksum comparison for modifications made under the same second.
* File content checksum comparison for modifications made under the same second.
* Allows supplying regexp-patterns to ignore and filter paths for better results.
* Tested on all Ruby environments via [Travis CI](https://travis-ci.org/guard/listen).

Expand All @@ -19,7 +19,7 @@ Still not implemented, pull requests are welcome.

* Symlinks support. [#25](https://github.com/guard/listen/issues/25)
* Signal handling. [#105](https://github.com/guard/listen/issues/105)
* Non-recursive directory scaning. [#111](https://github.com/guard/listen/issues/111)
* Non-recursive directory scanning. [#111](https://github.com/guard/listen/issues/111)

## Install

Expand Down Expand Up @@ -87,6 +87,7 @@ listener = listener.filter(/\.rb$/)
listener = listener.latency(0.5)
listener = listener.force_polling(true)
listener = listener.polling_fallback_message(false)
listener = listener.force_adapter(Listen::Adapters::Linux)
listener = listener.change(&callback)
listener.start
```
Expand Down Expand Up @@ -207,6 +208,9 @@ or via ["Object" API](#object-api) methods:
:latency => 0.5 # Set the delay (**in seconds**) between checking for changes
# default: 0.25 sec (1.0 sec for polling)

:force_adapter => Listen::Adapters::Linux # Force the use of a particular adapter class
# default: none

:force_polling => true # Force the use of the polling adapter
# default: none

Expand Down Expand Up @@ -276,6 +280,11 @@ want to force the use of the polling adapter, either use the `:force_polling` op
while initializing the listener or call the `#force_polling` method on your listener
before starting it.

It is also possible to force the use of a particular adapter, by using the `:force_adapter`
option. This option skips the usual adapter choosing mechanism and uses the given
adapter class instead. The adapter choosing mechanism requires write permission
to your watched directories and will needlessly load code, which isn't always desirable.

## Polling fallback

When a OS-specific adapter doesn't work the Listen gem automatically falls back to the polling adapter.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ class Adapter
# @return [Listen::Adapter] the chosen adapter
#
def self.select_and_initialize(directories, options = {}, &callback)
return Adapters::Polling.new(directories, options, &callback) if options.delete(:force_polling)
forced_adapter_class = options.delete(:force_adapter)
force_polling = options.delete(:force_polling)

if forced_adapter_class
forced_adapter_class.load_dependent_adapter
return forced_adapter_class.new(directories, options, &callback)
end

return Adapters::Polling.new(directories, options, &callback) if force_polling

OPTIMIZED_ADAPTERS.each do |adapter|
namespaced_adapter = Adapters.const_get(adapter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DirectoryRecord
attr_reader :directory, :paths, :sha1_checksums

# The default list of directories that get ignored by the listener.
DEFAULT_IGNORED_DIRECTORIES = %w[.rbx .bundle .git .svn log tmp vendor]
DEFAULT_IGNORED_DIRECTORIES = %w[.rbx .bundle .git .svn bundle log tmp vendor]

# The default list of files that get ignored by the listener.
DEFAULT_IGNORED_EXTENSIONS = %w[.DS_Store]
Expand Down Expand Up @@ -174,7 +174,7 @@ def fetch_changes(directories, options = {})
directories = directories.sort_by { |el| el.length }.reverse # diff sub-dir first

directories.each do |directory|
next unless directory[@directory] # Path is or inside directory
next unless directory[@directory] || directory[@directory.gsub(/\//,'\\') # Path is or inside directory, fix path on windows

detect_modifications_and_removals(directory, options)
detect_additions(directory, options)
Expand Down Expand Up @@ -344,7 +344,7 @@ def update_sha1_checksum(path)
#
def sha1_checksum(path)
Digest::SHA1.file(path).to_s
rescue Errno::EACCES, Errno::ENOENT, Errno::ENXIO, Errno::EOPNOTSUPP, Errno::EBADF
rescue
nil
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Listener
# @option options [Boolean] relative_paths whether or not to use relative-paths in the callback
# @option options [Boolean] force_polling whether to force the polling adapter or not
# @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it
# @option options [Class] force_adapter force the use of this adapter class, skipping usual adapter selection
#
# @yield [modified, added, removed] the changed files
# @yieldparam [Array<String>] modified the list of modified files
Expand Down Expand Up @@ -180,6 +181,21 @@ def force_polling(value)
self
end

# Sets whether to force the use of a particular adapter, rather than
# going through usual adapter selection process on start.
#
# @example Force use of Linux polling
# force_adapter Listen::Adapters::Linux
#
# @param [Class] adapter class to use for file system event notification.
#
# @return [Listen::Listener] the listener
#
def force_adapter(adapter_class)
@adapter_options[:force_adapter] = adapter_class
self
end

# Sets whether the paths in the callback should be
# relative or absolute.
#
Expand Down Expand Up @@ -235,6 +251,9 @@ def on_change(directories, options = {})
unless changes.values.all? { |paths| paths.empty? }
block.call(changes[:modified], changes[:added], changes[:removed])
end
rescue => ex
Kernel.warn "[Listen warning]: Change block raise an execption: #{$!}"
Kernel.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
end

private
Expand All @@ -254,7 +273,7 @@ def initialize_relative_paths_usage(options)
if directories.size > 1 && options[:relative_paths]
Kernel.warn "[Listen warning]: #{RELATIVE_PATHS_WITH_MULTIPLE_DIRECTORIES_WARNING_MESSAGE}"
end
@use_relative_paths = directories.one? && options.delete(:relative_paths) { true }
@use_relative_paths = directories.one? && options.delete(:relative_paths) { false }
end

# Build the directory record concurrently and initialize the adapter.
Expand Down
3 changes: 3 additions & 0 deletions lib/ruby/jruby/listen-1.3.1-patched/lib/listen/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Listen
VERSION = '1.3.1'
end

0 comments on commit 6de8969

Please sign in to comment.