jared 0.0.7a3 → 0.0.7a4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/.gitignore +10 -8
  2. data/jared.gemspec +35 -35
  3. data/lib/jared/core/clock/init.rb +15 -0
  4. data/lib/jared/core/clock/lib/clock.rb +23 -0
  5. data/lib/jared/core/configure/init.rb +15 -0
  6. data/lib/jared/core/configure/lib/config.rb +60 -0
  7. data/lib/jared/core/create/init.rb +16 -0
  8. data/lib/jared/core/create/lib/create.rb +33 -0
  9. data/lib/jared/core/daemon/daemon.rb +104 -0
  10. data/lib/jared/core/daemon/init.rb +15 -0
  11. data/lib/jared/core/date/init.rb +15 -0
  12. data/lib/jared/core/date/lib/date.rb +45 -0
  13. data/lib/jared/core/greeter/init.rb +15 -0
  14. data/lib/jared/core/greeter/lib/greeting.rb +26 -0
  15. data/lib/jared/core/jamendo/init.rb +17 -0
  16. data/lib/jared/core/jamendo/lib/jamendo.rb +88 -0
  17. data/lib/jared/core/mail/init.rb +15 -0
  18. data/lib/jared/core/mail/lib/mail.rb +45 -0
  19. data/lib/jared/core/map/New File +0 -0
  20. data/lib/jared/core/map/init.rb +15 -0
  21. data/lib/jared/core/map/lib/map.rb +12 -0
  22. data/lib/jared/core/player/init.rb +15 -0
  23. data/lib/jared/core/player/lib/player.rb +33 -0
  24. data/lib/jared/core/stock/init.rb +17 -0
  25. data/lib/jared/core/stock/lib/stock.rb +34 -0
  26. data/lib/jared/core/tasks/init.rb +15 -0
  27. data/lib/jared/core/tasks/lib/task.rb +42 -0
  28. data/lib/jared/core/weather/init.rb +17 -0
  29. data/lib/jared/core/weather/lib/weather.rb +70 -0
  30. data/lib/jared/database.rb +59 -0
  31. data/lib/jared/jared.rb +22 -141
  32. data/lib/jared/logg.rb +15 -0
  33. data/lib/jared/models/task.rb +5 -5
  34. data/lib/jared/plugin.rb +35 -0
  35. data/lib/jared/plugins.rb +92 -0
  36. data/lib/jared/version.rb +2 -2
  37. data/lib/jared.rb +86 -77
  38. data/readme.md +14 -18
  39. metadata +34 -22
  40. data/lib/jared/helpers/calculator.rb +0 -8
  41. data/lib/jared/helpers/calendar.rb +0 -15
  42. data/lib/jared/helpers/clock.rb +0 -19
  43. data/lib/jared/helpers/config.rb +0 -46
  44. data/lib/jared/helpers/create.rb +0 -27
  45. data/lib/jared/helpers/date.rb +0 -41
  46. data/lib/jared/helpers/deamon.rb +0 -100
  47. data/lib/jared/helpers/define.rb +0 -8
  48. data/lib/jared/helpers/greeting.rb +0 -22
  49. data/lib/jared/helpers/jamendo.rb +0 -58
  50. data/lib/jared/helpers/mail.rb +0 -38
  51. data/lib/jared/helpers/map.rb +0 -10
  52. data/lib/jared/helpers/notfound.rb +0 -14
  53. data/lib/jared/helpers/player.rb +0 -29
  54. data/lib/jared/helpers/stock.rb +0 -21
  55. data/lib/jared/helpers/task.rb +0 -114
  56. data/lib/jared/helpers/weather.rb +0 -68
  57. data/lib/jared/lib.rb +0 -13
@@ -1,38 +0,0 @@
1
- class Helpers
2
- Lib.db
3
- # Checks Email on demand.
4
- def self.mail
5
- require 'gibberish'
6
- begin
7
- @user = User.first
8
- if @user.mail_username.blank?
9
- puts "Jared is not configured to check email."
10
- puts "Please run, 'jared config'"
11
- elsif @user.mail_password.blank?
12
- puts "Jared is not configured to check email."
13
- puts "Please run, 'jared config'"
14
- else
15
- cipher = Gibberish::AES.new(@user.mail_username)
16
- password = cipher.dec(@user.mail_password)
17
- Gmail.connect(@user.mail_username, password) do |gmail|
18
- if gmail.logged_in?
19
- puts "Google Mail"
20
- puts gmail.inbox.count(:unread).to_s + " Unread messages."
21
- gmail.inbox.emails(:unread).each do |email|
22
- email.unread!
23
- print "From:",email.sender[0].mailbox,"@", email.sender[0].host, ", Subject:",email.subject
24
- puts
25
- end
26
- else
27
- puts "Not logged in."
28
- end
29
- end
30
- end
31
- rescue => e
32
- if e.to_s.include?("mail_")
33
- puts "Jared is not configured to check email."
34
- puts "Please run, 'jared config' or click 'OK' on the popup."
35
- end
36
- end
37
- end
38
- end
@@ -1,10 +0,0 @@
1
- class Helpers
2
- #TODO: Get this working on windows.
3
- #
4
- # TODO: make command work it this: <em>jared map Texas, USA</em> instead of using gets.
5
- def self.map(place)
6
- @m = place.gsub(" ", "+")
7
- puts @m
8
- Launchy.open("http://maps.google.com/?q=#{@m}")
9
- end
10
- end
@@ -1,14 +0,0 @@
1
- class Helpers
2
- # Lists available commands.
3
- def self.notfound
4
- puts "Error: Command '#{ARGV[0]}' not found."
5
- puts "Hi, Hello - Jared Hi -Morning, #{Etc.getlogin}"
6
- puts "Create - Jared Create file index.html - Creates a File/Folder at curent location."
7
- puts "Time - Jared Time - 04:12pm"
8
- puts "Date - Jared Date - Tuesday the 22nd of December 2012"
9
- #puts "calc(ulator) - Jared Calc 22 / 2 - 11"
10
- puts "Task - Jared task - Opens a window listing tasks."
11
- puts "View - Jared View lib/lib.rb - Opens a file(e.g. Picture, document) in the system viewer."
12
- puts "Whereis - Jared Whereis - Opens the system default browser to Gmaps."
13
- end
14
- end
@@ -1,29 +0,0 @@
1
- require 'sys/uname'
2
- include Sys
3
-
4
- class Helpers
5
- def self.play(request='')
6
- unless Uname.sysname.include?('Windows')
7
- puts 'Your platform is not supported by green_shoes Video.'
8
- Kernel.exit
9
- end
10
- require 'green_shoes'
11
- Shoes.app title: 'JaredPlayer' do
12
- background gray..black, angle: 90
13
- $v = video request
14
- timer 1 do
15
- $v.play
16
- end
17
- button 'Play/Pause' do
18
- if $v.playing?
19
- $v.pause
20
- else
21
- $v.play
22
- end
23
- end
24
- button 'Stop' do
25
- $v.stop
26
- end
27
- end
28
- end
29
- end
@@ -1,21 +0,0 @@
1
- require 'stock_quote'
2
-
3
- class Helpers
4
- def self.stock(symbol='', mode='last')
5
- stock = StockQuote::Stock.quote("#{symbol}")
6
- puts "Stock data for: #{if stock.company.length == 0; raise "Invalid Stock. No stock data found for '#{symbol}'.";exit;else;stock.company;end}"
7
- if mode == 'last'
8
- puts "#{stock.last}"
9
- elsif mode == 'open'
10
- puts "#{stock.open}"
11
- elsif mode == 'close'
12
- puts "#{stock.y_close}"
13
- elsif mode == 'high'
14
- puts "#{stock.high}"
15
- elsif mode == 'low'
16
- puts "#{stock.low}"
17
- else
18
- puts "Mode: '#{mode}' not understood. try again."
19
- end
20
- end
21
- end
@@ -1,114 +0,0 @@
1
- class Helpers
2
- # Opens a Green Shoes app to manage tasks.
3
- def self.task
4
- Lib.db
5
- require "green_shoes"
6
- Shoes.app title: "Jared Tasks" do
7
- title "Tasks"
8
- button "add task" do
9
- Shoes.app title: "Add Task", width: 250, height: 400 do
10
- title "add task"
11
- stack do
12
- para "Task title:"
13
- @title = edit_line text: ""
14
- para "Task desciption:"
15
- @desciption = edit_box text: ""
16
- para "Task due date:"
17
- @due = edit_line text: ""
18
- button "Add Task" do
19
- new_task = Task.new(:title => @title.text, :desciption => @desciption.text, :due => Chronic.parse(@due.text))
20
- new_task.save!
21
- if new_task
22
- alert "added task"
23
- close
24
- else
25
- alert "failed to add task. Make sure you use a unique title."
26
- end
27
- end
28
- end
29
- end
30
- end
31
-
32
- button "Refresh" do
33
- $tasks_s.clear do
34
- $tasks_s = stack do
35
- task = Task.find(:all)
36
- task.each do |t|
37
- tagline t.title
38
- para t.desciption
39
- puts t.due.to_s
40
- puts Time.new(t.due.to_s)
41
- para "Due: " + Time.new(t.due.to_s).strftime("%B %d %Y")
42
- flow do
43
- button "Edit", state: "nil" do
44
- Shoes.app title: "Editing Task: #{t.title}", width: 250, height: 400 do
45
- title "edit task"
46
- stack do
47
- para "Task title:"
48
- @title = edit_line text: "#{t.title}"
49
- para "Task desciption:"
50
- @desciption = edit_box text: "#{t.desciption}"
51
- para "Task due date:"
52
- @due = edit_line text: "#{Time.new(t.due.to_s).strftime("%B %d %Y")}"
53
- button "update Task" do
54
- task = Task.find(t.id)
55
- @edit_task = task.update_attributes(:title => @title.text, :desciption => @desciption.text, :due => Chronic.parse(@due.text))
56
- close
57
- end
58
- end
59
- end
60
- end
61
- button "Delete" do
62
- delete = confirm "Deleting... Are you sure?"
63
- if delete == true
64
- Task.destroy(t.id)
65
- alert "removed #{t.title}"
66
- end
67
- end
68
- para
69
- end
70
- end
71
- end
72
- end
73
- end
74
-
75
- task = Task.find(:all)
76
- $tasks_s = stack do
77
- task.each do |t|
78
- tagline t.title
79
- para t.desciption
80
- para "Due: #{Time.new(t.due.to_s).strftime("%B %d %Y")}"
81
- flow do
82
- button "Edit", state: "nil" do
83
- Shoes.app title: "Editing Task: #{t.title}", width: 250, height: 400 do
84
- title "edit task"
85
- stack do
86
- para "Task title:"
87
- @title = edit_line text: "#{t.title}"
88
- para "Task desciption:"
89
- @desciption = edit_box text: "#{t.desciption}"
90
- para "Task due date:"
91
- @due = edit_line text: "#{Time.new(t.due.to_s).strftime("%B %d %Y")}"
92
- button "update Task" do
93
- task = Task.find(t.id)
94
- @edit_task = task.update_attributes(:title => @title.text, :desciption => @desciption.text, :due => Chronic.parse(@due.text))
95
- close
96
- end
97
- end
98
- end
99
- end
100
-
101
- button "Delete" do
102
- delete = confirm "Deleting... Are you sure?"
103
- if delete == true
104
- Task.destroy(t.id)
105
- alert "removed #{t.title}"
106
- end
107
- end
108
- para
109
- end
110
- end
111
- end
112
- end
113
- end
114
- end
@@ -1,68 +0,0 @@
1
- if Time.now.strftime("%a") == "Sun"
2
- $day = "Mon"
3
- $dn = "Monday"
4
- elsif Time.now.strftime("%a") == "Mon"
5
- $day = "Tue"
6
- $dn = "Tuesday"
7
- elsif Time.now.strftime("%a") == "Tue"
8
- $day = "Wed"
9
- $dn = "Wednesday"
10
- elsif Time.now.strftime("%a") == "Wed"
11
- $day = "Thu"
12
- $dn = "Thursday"
13
- elsif Time.now.strftime("%a") == "Thu"
14
- $day = "Fri"
15
- $dn = "Friday"
16
- elsif Time.now.strftime("%a") == "Fri"
17
- $day = "Sat"
18
- $dn = "Saturday"
19
- elsif Time.now.strftime("%a") == "Sat"
20
- $day = "Sun"
21
- $dn = "Sunday"
22
- end
23
- class Helpers
24
- Lib.db
25
- require_relative "../models/user.rb"
26
- @user = User.first
27
- # Checks weather.
28
- #
29
- # Usage: <em>jared weather (10001/today/tomorrow/forecast)</em>
30
- def self.weather(option=nil)
31
- begin
32
- weather = Weatherboy.new(@user.zip)
33
-
34
- if option == nil
35
- forecast = weather.current
36
- puts @user.zip.to_i.to_region
37
- puts forecast.temp_f + " Degrees Fahrenheit.", forecast.weather + ".", forecast.wind_mph + " mile per hour winds from the #{forecast.wind_dir}."
38
-
39
- elsif option == "today"
40
- weather.forecasts.each do |condition|
41
- if condition.title == 'Today'
42
- puts "#{condition.title}."
43
- puts " #{condition.text}"
44
- end
45
- end
46
-
47
- elsif option == "tomorrow"
48
- weather.forecasts.each do |condition|
49
- if condition.title == $dn
50
- puts "#{condition.title}."
51
- puts " #{condition.text}"
52
- end
53
- end
54
-
55
- elsif option == "forecast"
56
- weather.forecasts.each do |condition|
57
- puts "#{condition.title}."
58
- puts " #{condition.text}"
59
- puts
60
- end
61
- else
62
- puts "Unable to fetch weather due to argument error."
63
- end
64
- rescue SocketError
65
- puts "A connection error occurred fetching weather information."
66
- end
67
- end
68
- end
data/lib/jared/lib.rb DELETED
@@ -1,13 +0,0 @@
1
- # Lib file loads all Helpers and Models.
2
-
3
- class Lib
4
- # ActiveRecord DataBase connect
5
- def self.db
6
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => "#{Dir.home}/.jared.sqlite3")
7
- end
8
- end
9
-
10
- # Model files requires
11
- require_relative 'models/music.rb'
12
- require_relative 'models/task.rb'
13
- require_relative 'models/user.rb'