Permalink
Browse files

Jared version 0.0.1 of rewrite

  • Loading branch information...
0 parents commit 665303857219fdd6fbede0c8be48d98e2496869b @cyberarm committed Feb 16, 2012
Showing with 159 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +4 −0 Gemfile
  3. +1 −0 Rakefile
  4. +8 −0 bin/jared
  5. +23 −0 jared.gemspec
  6. +60 −0 lib/jared.rb
  7. +56 −0 lib/jared/lib.rb
  8. +3 −0 lib/jared/version.rb
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in jared.gemspec
+gemspec
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+
+begin
+ require 'jared'
+rescue LoadError
+ require 'rubygems'
+ require 'jared'
+end
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "jared/version"
+
+Gem::Specification.new do |s|
+ s.name = "jared"
+ s.version = Jared::VERSION
+ s.authors = ["Cyber"]
+ s.email = ["matthewlikesrobots@gmail.com"]
+ s.homepage = "https://github.com/cyberarm/jared"
+ s.summary = "Ruby powered digital assistant"
+ s.description = "Ruby powered digital assistant"
+
+ s.rubyforge_project = "jared"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib", "bin"]
+
+ # s.add_development_dependency ""
+ s.add_runtime_dependency "green_shoes"
+end
@@ -0,0 +1,60 @@
+require 'etc'
+#require_relative "jared/lib.rb"
+require "jared/lib"
+
+begin
+ require "green_shoes"
+rescue LoadError
+ puts "Please install 'green_shoes' for more functionality"
+end
+
+class Jared
+ def self.time(t="now")
+ if t == "now"
+ puts "#{Time.now.strftime("%I:%M:%S%P")}"
+ end
+ end
+
+ def self.date
+ Helpers.date
+ end
+
+ def self.clock
+ begin
+ require "green_shoes"
+ Helpers.clock
+ rescue LoadError
+ puts "Error: Clock requires 'green_shoes'"
+ end
+ end
+
+end
+
+case ARGV[0]
+when "hi", "hello"
+
+when "view"
+ puts "View is not yet available."
+ #system("#{Dir.pwd}/#{ARGV[1]}")
+
+when "clock"
+ Jared.clock
+
+when "date"
+ Jared.date
+
+when "cal", "calendar"
+ puts "Calendar is not yet available."
+
+when "task"
+ puts "Task is not yet available."
+
+when "day"
+
+when ""
+
+when "time"
+ puts Jared.time
+else
+ Helpers.notfound
+end
@@ -0,0 +1,56 @@
+class Helpers
+ def self.clock
+ begin
+ require "green_shoes"
+ Shoes.app width: 300, height: 70, title: "Jared Clock" do
+ @clock = stack do
+ title "#{Time.now.strftime("%I:%M:%P")}"
+ end
+ every 0.5 do
+ @clock.clear do
+ title "#{Time.now.strftime("%I:%M:%S%P")}"
+ end
+ end
+ end
+ rescue LoadError
+ end
+ end
+
+ def self.date
+ if Time.now.strftime("%d") == "2"
+ puts "#{Time.now.strftime("%A the %dnd of %Y")}"
+ elsif Time.now.strftime("%d") == "22"
+ puts "#{Time.now.strftime("%A the %dnd of %Y")}"
+ elsif Time.now.strftime("%d") == "3"
+ puts "#{Time.now.strftime("%A the %drd of %Y")}"
+ elsif Time.now.strftime("%d") == "33"
+ puts "#{Time.now.strftime("%A the %drd of %Y")}"
+ else
+ puts "#{Time.now.strftime("%A the %dth of %Y")}"
+ end
+ puts "(#{Time.now.strftime("%m/%d/%Y")})"
+ end
+
+ def self.greeting
+ if Time.now.strftime("%H").to_i < "04".to_i
+ puts "Go tee bed."
+ elsif Time.now.strftime("%H").to_i < "07".to_i
+ puts "Yawn Zzzz"
+ elsif Time.now.strftime("%H").to_i < "12".to_i
+ puts "Morning, #{Etc.getlogin}"
+ elsif Time.now.strftime("%H").to_i < "16".to_i
+ puts "Afternoon, #{Etc.getlogin}"
+ elsif Time.now.strftime("%H").to_i < "20".to_i
+ puts "Evening, #{Etc.getlogin}"
+ elsif Time.now.strftime("%H").to_i < "22".to_i
+ puts "Ummm, good night, #{Etc.getlogin}"
+ puts "Its getting late, consider getting some rest."
+ elsif Time.now.strftime("%H").to_i < "24".to_i
+ puts "Zzzz"
+ end
+ end
+
+ def self.notfound
+ puts "Error: Command '#{ARGV[0]}' not found."
+ end
+end
@@ -0,0 +1,3 @@
+module Jared
+ VERSION = "0.0.1"
+end

0 comments on commit 6653038

Please sign in to comment.