osx - Ruby for romance? How to update a script from itself -
My wife enjoys it when I use my Geek capabilities to be "romantic" so I installed Ruby script There was an idea to do on my Mac which send me quotes and small notes all day. I already thought that I am using GeekTool to run a script in the background and I will use growlnotify to display the message. Now what I need is one way to update the script from the web is that I change it. I basically do not know anything about Ruby other than how to interact with the console.
I have 2 goals: 1) There is an XML file with messages, it needs to be updated-enabled from the internet, but if it is local, it does not have a network connection. 2) If I see a bug or want to correct it, then update the script to the Internet.
Now I know that I can manually update the script on my Mac if I wanted to, but I thought it would be a good way to learn some more advanced Ruby.
The priority will be 1 XML file, if it changes, then a new version will be able to download
I already used HypriCote, is it a good way to go? ?
Note: What can I do to download a file and save it to a certain location?
Edit
If anyone is interested in the first version, then my wife's Mac is the MacBook, which is running Leopard (but Maybe 10.4, not 100% fixed).
You can find it in the scriptThe first version of the ps -> script does not really update itself, it just updates the message.xml file and all of that.
is required 'net / http' net :: HTTP.start ("your .webhost.com ") {| Http | Resp = http.get ("/ messages / messages.xml") open ("messages.xml", "wb") {| File | File.write (resp.body)}}
Something like this should be done. You can also download the Ruby script, then you can call.
exec ("ruby script2.rb") will execute any more rows in # script1
Comments
Post a Comment