Sign in to follow this  
smitty1276

Detecting file changes + real-time FTP sync

Recommended Posts

OK, I'm working on some web stuff with ruby/rails. I want to be able to edit everything locally, and have some software that sits in the background and quietly detects any file changes and FTPs those files to a remote server, so that I am effectively editing those remote files on my local machine. 1) Does anyone know of any good, free software that does that? 2) If not, is there any reason why it is a bad idea? 3) If not, what would be the best way to watch a folder and all subfolders for file changes? Is there a single win32 hook that will handle that?

Share this post


Link to post
Share on other sites
So, nobody knows of anything like this? I would have thought that gamedev would have enough web guys that someone would know... it seems like something that a lot of people would want, so I assumed it was out there.

I found a few that look crappy. :-)

Share this post


Link to post
Share on other sites
1) No, not off hand.
2) Because it'd involve fairly regular polling of a potentially large file system, because the remote file might have changed and you'd be overwriting those changes...
3) Why watch? You're doing the editing...


Any reason a run of the mill source control system isn't sufficient for your needs? Checkout, edit, check in. They're designed for this sort of thing and will handle all the nitty-gritty with updating, locking, versioning, diffs.... Any semi-sane IDE will have a plugin so it's two clicks to "save to CVS" (or publish to webserver) rather than two clicks to save to disk...

Share this post


Link to post
Share on other sites
Quote:
Original post by smitty1276
So, nobody knows of anything like this? I would have thought that gamedev would have enough web guys that someone would know... it seems like something that a lot of people would want, so I assumed it was out there.


Choose versioning software and create repository: Subversion, CVS, PerForce, ....

Find a suitable automated build system, such as Rake.

Define your test host server.

Then it works like this.

You commit things to repository. That's where source code is maintain. Your build system contains a hook that watches these changes. Whenever they occur, they check out entire project, make a clean build, run all the tests, and deploy it to test server. If any errors occur, they e-mail you the report. If build is successful, and all tests pass, the build tool deploys your application to test server. Then it runs set of tests to make sure deployment works.

When you need to make a live deployment then, you simply run the deployment on live server.

This has been the staple web development environment for a while now for all platforms.

Share this post


Link to post
Share on other sites
Quote:
Original post by Telastyn
1) No, not off hand.
2) Because it'd involve fairly regular polling of a potentially large file system, because the remote file might have changed and you'd be overwriting those changes...
3) Why watch? You're doing the editing...

Any reason a run of the mill source control system isn't sufficient for your needs? ...


Hmmm.. regarding number 2 , I was thinking less of "polling" a large file system and more along the lines of hooking into a system api or something that would tell me when something is saved.

The only reason I'm asking is because I am dealing with a host that doesn't have cvs or svn, so I thought it would be interesting to just synchronize via ftp--and faster... sometimes a cvs or svn commit takes a while. I also didn't want to have to explicitly send all of the files I change... I realize that I'm doing the editing, but sometimes I make a few small changes to several files and it's just a bit of a pain and time consuming to update. I would rather it happen automatically as I hit 'save' and not have to worry about it later. I realize that this would be a problem in a team situation, but this is just me dealing with this.

Ultimately, it isn't a big deal, but I thought it would be convenient. :-)

Quote:
Original post by Telastyn
Choose versioning software and create repository: Subversion, CVS, PerForce, ...
Find a suitable automated build system, such as Rake. Define your test host server. Then it works like this....

Yeah, but I'm doing a Facebook app, and it's a bit of a pain to point the callback URL all over the place. I wanted to just have it always point to the
remote server, which IS the test server and which ultimately will be the live server.

Again, I'm not working in any formal environment here. :-)

Share this post


Link to post
Share on other sites
Well, there's always rsync and perhaps rdiff...

They do a blind write, but try to transfer minimal amount of data. It's about as good as it gets.

But it's hard to say who here has authority. Why do you need to poll, if you are sending the files? How will files change remotely when you're the only one updating them?

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Why do you need to poll, if you are sending the files? How will files change remotely when you're the only one updating them?


They won't. That's sort of my point. What I want, basically, is to be able to edit files on my local machine and have what is functionally a real-time mirror on the remote server.

I can go and manually ftp all of the changed files everytime I make a small change and want to hit refresh on the browser. I would just prefer that I don't have to do that... I would rather change a line of rhtml or ruby, hit save, then reload the page in my browser and know that the remote server already has the correct file.

Long story short, I was hoping that I could have the app running on the remote machine, but have a development experience that was almost exactly the same as if I were running it on my local machine--without SSH and vim. :-)


Share this post


Link to post
Share on other sites
Under Windows you would probably use FindFirstChangeNotification, FindNextChangeNotification, and one of the WaitFor...Object functions.
A search for "obtaining directory change notifications" will return an example in the MSDN. I believe these techniques can be applied to a single file.
This method does not poll.
I hope this helps.

Shawn

Share this post


Link to post
Share on other sites
Quote:
Original post by ShawnO
Under Windows you would probably use FindFirstChangeNotification, FindNextChangeNotification, and one of the WaitFor...Object functions.
A search for "obtaining directory change notifications" will return an example in the MSDN. I believe these techniques can be applied to a single file.
This method does not poll.

Oh... nice. More importantly, it doesn't have to be applied to a single file and can be used to watch an entire tree.

Thanks... I might write a script to try that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this