Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added funtionality to get app working. need to implement authlogic ap…

…i key
  • Loading branch information...
commit eb25d927232b6e8778c3516a8ad5a1f562396b0c 1 parent 858f594
@mgornick authored
View
2  Gemfile
@@ -1,4 +1,4 @@
source :rubygems
-
+gem "activeresource"
gem "growl_notify"
View
13 Gemfile.lock
@@ -1,12 +1,25 @@
GEM
remote: http://rubygems.org/
specs:
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ builder (3.0.0)
growl_notify (0.0.3)
rb-appscript
+ i18n (0.6.0)
+ multi_json (1.0.3)
rb-appscript (0.6.1)
PLATFORMS
ruby
DEPENDENCIES
+ activeresource
growl_notify
View
7 config.rb
@@ -1,7 +0,0 @@
-require 'growl_notify'
-
-GrowlNotify.config do |config|
- config.notifications = ["Compass Application", "Someother Notification"]
- config.default_notifications = ["Compass Application"]
- config.application_name = "My Application" #this shows up in the growl applications list in systems settings
-end
View
13 lib/config.rb
@@ -0,0 +1,13 @@
+require 'growl_notify'
+
+GrowlNotify.config do |config|
+ config.notifications = ["OneThingApp", "Daily Things"]
+ config.default_notifications = ["OneThingApp"]
+ config.application_name = "OneThngApp" #this shows up in the growl applications list in systems settings
+end
+
+require 'notification'
+require 'timer'
+
+# remote resources
+require 'task'
View
14 lib/notification.rb
@@ -0,0 +1,14 @@
+require 'growl_notify'
+
+class Notification
+
+ attr_accessor :message
+
+ def initialize(message)
+ @message = message
+ end
+
+ def save
+ GrowlNotify.very_low(:title => "My one thing for today is", :description => message)
+ end
+end
View
24 lib/timer.rb
@@ -0,0 +1,24 @@
+class Timer
+ attr_accessor :message
+
+ def initialize(message)
+ @message = message
+ end
+
+ # loop and send a growl notification on a random amount of time
+ def save
+ send_notification
+
+ while(true)
+ wait_time_between_notify = (rand * 100).to_i
+ puts "Waiting: #{wait_time_between_notify} seconds"
+ sleep wait_time_between_notify
+ send_notification
+ end
+ end
+
+ def send_notification
+ notify = Notification.new(message)
+ notify.save
+ end
+end
View
4 models/task.rb
@@ -0,0 +1,4 @@
+class Task < ActiveResource::Base
+ self.site = 'http://localhost:3000/'
+ self.user = "mgornick@inventables.com"
+end
View
13 notification.rb
@@ -1,13 +0,0 @@
-require 'growl_notify'
-
-class Notification
-
- attr_accessor :message
- def initialize(message = "OneThing Reminder")
- @message = message
- end
-
- def save
- GrowlNotify.very_low(:title => message, :description => 'Man that was cool')
- end
-end
View
32 start.rb
@@ -1,3 +1,31 @@
-#!/usr/bin/ruby
+#!/Users/mattgornick/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
-puts "HI"
+$LOAD_PATH << './lib'
+$LOAD_PATH << './models'
+
+require 'rubygems'
+require 'active_resource'
+require 'config'
+
+tasks = Task.find(:all)
+task = tasks.first
+
+description = ARGV[0] || "test"
+
+if task.action_taken == "unfinished"
+ if task.created_at.today? # need to update existing task
+ today_task = task
+ else # close out old task and start the new task
+ task.action_taken = "finished"
+ todays_task = Task.new
+ task.save
+ end
+ todays_task.description = description
+ todays_task.save
+else
+ Task.create(:description => description)
+end
+
+t = Task.find(:all).first.description
+timer = Timer.new(t)
+timer.save
Please sign in to comment.
Something went wrong with that request. Please try again.