Permalink
Browse files

Removed Rails dependencies, added Date require

  • Loading branch information...
1 parent e267e25 commit 1537881085f257a401a6c78cb6a741a46903f173 @rtoohil committed May 6, 2012
Showing with 11 additions and 2 deletions.
  1. +4 −0 README.markdown
  2. +7 −2 readinglist_to_instapaper.rb
View
@@ -21,3 +21,7 @@ A couple of notes: I'm not a great Rubyist, so this code is probably cringe-incu
That should pretty much be it. Open up Safari and add something to the Reading List. A few seconds later, you should see a little Growl popup (assuming you have Growl installed) that tells you if it succeeded to add the article.
I'll clean this up as I go. Please feel free to add issues or pull requests. I have little idea what I'm doing, but I'll do my best to incorporate them.
+
+## Revisions
+* Mar 31, 2012: Initial Commit
+* May 6, 2012: Removed rails dependency and cleaned up DateTime usage. I think.
@@ -5,9 +5,12 @@
require 'uri'
require 'ruby_gntp'
require 'nokogiri-plist'
+require 'date'
# Our last run
-lastrun = Time.at(0).to_datetime.to_s
+# Setting this to epoch time in case this is our first time
+# or we don't have a last run file
+lastrun = Time.at(0).to_s
# Our last run file
# Store it on dropbox if you want to have it sync across computers
@@ -18,6 +21,8 @@
lastrun = File.open(File.expand_path(lastrun_file), 'rb').read
end
+# The real last run, which will either be epoch time
+# or the content of the last run file
lastrun_dt = DateTime.parse(lastrun)
# Instapaper API stuff
@@ -88,5 +93,5 @@
# Only write out when we have links, so that we don't save a file every
# time a bookmark changes
if ( links.length > 0 )
- File.open(File.expand_path(lastrun_file), 'w') {|f| f.write(Time.now.to_datetime) }
+ File.open(File.expand_path(lastrun_file), 'w') {|f| f.write(DateTime.now.to_s) }
end

0 comments on commit 1537881

Please sign in to comment.