Last active
August 29, 2015 14:01
-
-
Save net1957/89afa5fe17c1f0bc4378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler' | |
Bundler.setup(:default) # set the load path | |
Bundler.require(:default) # require the gems | |
require 'logger' | |
module Lis | |
extend self | |
def listener | |
Listen.to('D:/Dvlt/ruby/projects/_tmp/listen/list', debug: 2, ignore!: /foobar/) do |modified, added, removed| | |
puts "modified absolute path: #{modified}" unless modified.empty? | |
puts "added absolute path: #{added}" unless added.empty? | |
puts "removed absolute path: #{removed}" unless removed.empty? | |
end | |
end | |
def start(listener = listener) | |
puts "env: LISTEN_GEM_DEBUGGING=#{ENV['LISTEN_GEM_DEBUGGING']}" | |
puts 'Listen: Running the monitor...' | |
listener.start | |
puts 'Listen: Started...' | |
sleep 60 | |
rescue Interrupt | |
listener.stop | |
puts 'User Interrupt...' | |
end | |
end | |
module Wdm | |
extend self | |
def listener | |
monitor = WDM::Monitor.new | |
monitor.watch_recursively('D:/Dvlt/ruby/projects/_tmp/listen/list') do |change| | |
puts "#{change.type.to_s.upcase}: '#{change.path}'" | |
end | |
monitor | |
end | |
def start(listener = listener) | |
puts 'Wdm: Running the monitor...' | |
thread = Thread.new { listener.run! } | |
sleep(60) | |
rescue Interrupt | |
puts 'User Interrupt...' | |
ensure | |
puts 'Stopping the monitor...' | |
listener.stop | |
thread.join | |
end | |
end | |
#Wdm.start | |
Lis.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\Dvlt\ruby\projects\_tmp\listen>gem env | |
RubyGems Environment: | |
- RUBYGEMS VERSION: 2.2.2 | |
- RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [i386-mingw32] | |
- INSTALLATION DIRECTORY: D:/program/dvlt/ruby/ruby193/lib/ruby/gems/1.9.1 | |
- RUBY EXECUTABLE: D:/program/dvlt/ruby/ruby193/bin/ruby.exe | |
- EXECUTABLE DIRECTORY: D:/program/dvlt/ruby/ruby193/bin | |
- SPEC CACHE DIRECTORY: C:/Users/serge/.gem/specs | |
- RUBYGEMS PLATFORMS: | |
- ruby | |
- x86-mingw32 | |
- GEM PATHS: | |
- D:/program/dvlt/ruby/ruby193/lib/ruby/gems/1.9.1 | |
- C:/Users/serge/.gem/ruby/1.9.1 | |
- GEM CONFIGURATION: | |
- :update_sources => true | |
- :verbose => true | |
- :backtrace => false | |
- :bulk_threshold => 1000 | |
- :sources => ["https://rubygems.org"] | |
- "install" => "--no-rdoc --no-ri --env-shebang" | |
- "update" => "--no-rdoc --no-ri --env-shebang" | |
- "benchmark" => false | |
- REMOTE SOURCES: | |
- https://rubygems.org | |
- SHELL PATH: | |
- C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common | |
- C:\Program Files (x86)\PC Connectivity Solution\ | |
- c:\Program Files (x86)\Intel\iCLS Client\ | |
- c:\Program Files\Intel\iCLS Client\ | |
- C:\WINDOWS\system32 | |
- C:\WINDOWS | |
- C:\WINDOWS\System32\Wbem | |
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\ | |
- C:\Program Files\Intel\Intel(R) Management Engine Components\DAL | |
- C:\Program Files\Intel\Intel(R) Management Engine Components\IPT | |
- C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL | |
- C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT | |
- C:\Program Files\nodejs\ | |
- D:\program\dvlt\Git\cmd | |
- D:\program\dvlt\Git\bin | |
- D:\program\dvlt\ruby\ruby193\bin | |
- D:\program\dvlt\ruby\tools\pik | |
- C:\Users\serge\AppData\Roaming\npm\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# # include at least one source and the gem | |
source 'https://rubygems.org' | |
ruby '1.9.3' | |
require 'rbconfig' | |
gem 'wdm', '>= 0.1.0' #if RbConfig::CONFIG['target_os'] =~ /mswin|mingw|cygwin/i | |
gem 'listen', github: 'guard/listen', branch: 'wmd_debugging' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT | |
remote: git://github.com/guard/listen.git | |
revision: d149494ceb15dd0d7475d8c42a6ecd88a5b0a299 | |
branch: wmd_debugging | |
specs: | |
listen (2.7.5) | |
celluloid (>= 0.15.2) | |
rb-fsevent (>= 0.9.3) | |
rb-inotify (>= 0.9) | |
GEM | |
remote: https://rubygems.org/ | |
specs: | |
celluloid (0.15.2) | |
timers (~> 1.1.0) | |
ffi (1.9.3-x86-mingw32) | |
rb-fsevent (0.9.4) | |
rb-inotify (0.9.4) | |
ffi (>= 0.5.0) | |
timers (1.1.0) | |
wdm (0.1.0) | |
PLATFORMS | |
x86-mingw32 | |
DEPENDENCIES | |
listen! | |
wdm (>= 0.1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\Dvlt\ruby\projects\_tmp\listen>ruby code.rb | |
I, [2014-05-17T23:56:34.945679 #9176] INFO -- : Celluloid loglevel set to: 0 | |
env: LISTEN_GEM_DEBUGGING=2 | |
Listen: Running the monitor... | |
I, [2014-05-17T23:56:34.957686 #9176] INFO -- : got change: [#<Pathname:D:/Dvlt/ruby/projects/_tmp/listen/list>, {:type | |
=>"Dir", :recursive=>true, :silence=>true}] | |
Listen: Started... | |
D:\Dvlt\ruby\projects\_tmp\listen> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment