[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

win 32 utils changenotify

lrlebron@gmail.com

12/15/2006 2:55:00 AM

I just downloaded and installed the win32utils installer. When I try to
run the sample script provide in changenotify.txt

require "win32/changenotify"
include Win32

# Wait for any writes to files in the C:\ drive.
filter = ChangeNotify::LAST_WRITE
cn = ChangeNotify.new("C:\\",true,filter)
cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action

}

I get the following error.

:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/win32/ipc.so: invalid
attribute name `recursive?' (NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from cjsample.rb:1

What am I doing wrong?

thanks,

Luis

7 Answers

Daniel Berger

12/15/2006 3:45:00 AM

0


lrlebron@gmail.com wrote:
> I just downloaded and installed the win32utils installer. When I try to
> run the sample script provide in changenotify.txt
>
> require "win32/changenotify"
> include Win32
>
> # Wait for any writes to files in the C:\ drive.
> filter = ChangeNotify::LAST_WRITE
> cn = ChangeNotify.new("C:\\",true,filter)
> cn.wait{ |s|
> puts "Something changed"
> puts "File: " + s.file_name
> puts "Action: " + s.action
>
> }
>
> I get the following error.
>
> :/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/win32/ipc.so: invalid
> attribute name `recursive?' (NameError)
> from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
> from cjsample.rb:1
>
> What am I doing wrong?

You'll need to upgrade to 0.4.2. You can either build from source or
download the .so file directly, rename it to "changenotify.so", and
install it under c:\ruby\lib\ruby\1.8\i386-mswin32\win32.

The .zip file is at
http://rubyforge.org/frs/download.php/14978/win32-changenotify...
The .so file is at
http://rubyforge.org/frs/download.php/14979/changenotif...

Regards,

Dan

lrlebron@gmail.com

12/15/2006 4:01:00 AM

0

I downloaded the file and renamed it according to your instructions but
I am still getting the same error.


Luis
Daniel Berger wrote:
> lrlebron@gmail.com wrote:
> > I just downloaded and installed the win32utils installer. When I try to
> > run the sample script provide in changenotify.txt
> >
> > require "win32/changenotify"
> > include Win32
> >
> > # Wait for any writes to files in the C:\ drive.
> > filter = ChangeNotify::LAST_WRITE
> > cn = ChangeNotify.new("C:\\",true,filter)
> > cn.wait{ |s|
> > puts "Something changed"
> > puts "File: " + s.file_name
> > puts "Action: " + s.action
> >
> > }
> >
> > I get the following error.
> >
> > :/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/win32/ipc.so: invalid
> > attribute name `recursive?' (NameError)
> > from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > `require'
> > from cjsample.rb:1
> >
> > What am I doing wrong?
>
> You'll need to upgrade to 0.4.2. You can either build from source or
> download the .so file directly, rename it to "changenotify.so", and
> install it under c:\ruby\lib\ruby\1.8\i386-mswin32\win32.
>
> The .zip file is at
> http://rubyforge.org/frs/download.php/14978/win32-changenotify...
> The .so file is at
> http://rubyforge.org/frs/download.php/14979/changenotif...
>
> Regards,
>
> Dan

Daniel Berger

12/15/2006 4:21:00 AM

0

lrlebron@gmail.com wrote:
> Daniel Berger wrote:
>> lrlebron@gmail.com wrote:
>>> I just downloaded and installed the win32utils installer. When I try to
>>> run the sample script provide in changenotify.txt
>>>
>>> require "win32/changenotify"
>>> include Win32
>>>
>>> # Wait for any writes to files in the C:\ drive.
>>> filter = ChangeNotify::LAST_WRITE
>>> cn = ChangeNotify.new("C:\\",true,filter)
>>> cn.wait{ |s|
>>> puts "Something changed"
>>> puts "File: " + s.file_name
>>> puts "Action: " + s.action
>>>
>>> }
>>>
>>> I get the following error.
>>>
>>> :/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/win32/ipc.so: invalid
>>> attribute name `recursive?' (NameError)
>>> from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
>>> `require'
>>> from cjsample.rb:1
>>>
>>> What am I doing wrong?
>> You'll need to upgrade to 0.4.2. You can either build from source or
>> download the .so file directly, rename it to "changenotify.so", and
>> install it under c:\ruby\lib\ruby\1.8\i386-mswin32\win32.
>>
>> The .zip file is at
>> http://rubyforge.org/frs/download.php/14978/win32-changenotify...
>> The .so file is at
>> http://rubyforge.org/frs/download.php/14979/changenotif...
>>
>> Regards,
>>
>> Dan
>
> I downloaded the file and renamed it according to your instructions but
> I am still getting the same error.

Whoops. Download the latest win32-ipc and build from source or install
the .so file in the same directory as before.

Source file: http://rubyforge.org/frs/download.php/2757/win32-ipc...

Shared object:
http://rubyforge.org/frs/download.php/4...

Regards,

Dan

lrlebron@gmail.com

12/15/2006 4:37:00 AM

0

Thanks,

I acutally found out that I had 2 copies of changenotify.so in the ruby
folder. After deleting the older one it is working.

It works but it exits after a file change. Is it possible to
continuously monitor the folder?


thanks

Luis

Daniel Berger wrote:
> lrlebron@gmail.com wrote:
> > Daniel Berger wrote:
> >> lrlebron@gmail.com wrote:
> >>> I just downloaded and installed the win32utils installer. When I try to
> >>> run the sample script provide in changenotify.txt
> >>>
> >>> require "win32/changenotify"
> >>> include Win32
> >>>
> >>> # Wait for any writes to files in the C:\ drive.
> >>> filter = ChangeNotify::LAST_WRITE
> >>> cn = ChangeNotify.new("C:\\",true,filter)
> >>> cn.wait{ |s|
> >>> puts "Something changed"
> >>> puts "File: " + s.file_name
> >>> puts "Action: " + s.action
> >>>
> >>> }
> >>>
> >>> I get the following error.
> >>>
> >>> :/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/win32/ipc.so: invalid
> >>> attribute name `recursive?' (NameError)
> >>> from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> >>> `require'
> >>> from cjsample.rb:1
> >>>
> >>> What am I doing wrong?
> >> You'll need to upgrade to 0.4.2. You can either build from source or
> >> download the .so file directly, rename it to "changenotify.so", and
> >> install it under c:\ruby\lib\ruby\1.8\i386-mswin32\win32.
> >>
> >> The .zip file is at
> >> http://rubyforge.org/frs/download.php/14978/win32-changenotify...
> >> The .so file is at
> >> http://rubyforge.org/frs/download.php/14979/changenotif...
> >>
> >> Regards,
> >>
> >> Dan
> >
> > I downloaded the file and renamed it according to your instructions but
> > I am still getting the same error.
>
> Whoops. Download the latest win32-ipc and build from source or install
> the .so file in the same directory as before.
>
> Source file: http://rubyforge.org/frs/download.php/2757/win32-ipc...
>
> Shared object:
> http://rubyforge.org/frs/download.php/4...
>
> Regards,
>
> Dan

Daniel Berger

12/15/2006 4:51:00 AM

0

lrlebron@gmail.com wrote:
> Thanks,
>
> I acutally found out that I had 2 copies of changenotify.so in the ruby
> folder. After deleting the older one it is working.
>
> It works but it exits after a file change. Is it possible to
> continuously monitor the folder?

Sure thing:

cn.wait{ |s|
puts "Something changed"
puts "File: " + s.file_name
puts "Action: " + s.action
} while true

Regards,

Dan

lrlebron@gmail.com

12/15/2006 5:20:00 AM

0

Thanks for the help. I am still getting the following error when a file
event occurs.

Something changed
win32change.rb:11: undefined method `file_name' for #<Array:0x2cab5c8>
(NoMethodError)
from win32change.rb:9:in `wait'
from win32change.rb:9

Here's the script I am using.


Luis


Daniel Berger wrote:
> lrlebron@gmail.com wrote:
> > Thanks,
> >
> > I acutally found out that I had 2 copies of changenotify.so in the ruby
> > folder. After deleting the older one it is working.
> >
> > It works but it exits after a file change. Is it possible to
> > continuously monitor the folder?
>
> Sure thing:
>
> cn.wait{ |s|
> puts "Something changed"
> puts "File: " + s.file_name
> puts "Action: " + s.action
> } while true
>
> Regards,
>
> Dan

Daniel Berger

12/15/2006 5:25:00 AM

0

lrlebron@gmail.com wrote:
> Thanks for the help. I am still getting the following error when a file
> event occurs.
>
> Something changed
> win32change.rb:11: undefined method `file_name' for #<Array:0x2cab5c8>
> (NoMethodError)
> from win32change.rb:9:in `wait'
> from win32change.rb:9

Try this one:

cn.wait{ |arr|
arr.each{ |info|
p info.file_name
p info.action
}
} while true

Regards,

Dan