jared 0.0.7a4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile.lock +18 -0
  3. data/jared.gemspec +21 -36
  4. data/lib/jared/cli.rb +19 -0
  5. data/lib/jared/logg.rb +14 -15
  6. data/lib/jared/plugin.rb +61 -35
  7. data/lib/jared/plugin_list.rb +16 -0
  8. data/lib/jared/setup.rb +5 -0
  9. data/lib/jared/setup_generator.rb +42 -0
  10. data/lib/jared/version.rb +2 -2
  11. data/lib/jared.rb +11 -86
  12. data/license.md +7 -0
  13. data/pkg/jared-0.1.0.gem +0 -0
  14. data/readme.md +9 -79
  15. metadata +24 -275
  16. data/.gitignore +0 -10
  17. data/Gemfile +0 -4
  18. data/Rakefile +0 -1
  19. data/lib/jared/core/clock/init.rb +0 -15
  20. data/lib/jared/core/clock/lib/clock.rb +0 -23
  21. data/lib/jared/core/configure/init.rb +0 -15
  22. data/lib/jared/core/configure/lib/config.rb +0 -60
  23. data/lib/jared/core/create/init.rb +0 -16
  24. data/lib/jared/core/create/lib/create.rb +0 -33
  25. data/lib/jared/core/daemon/daemon.rb +0 -104
  26. data/lib/jared/core/daemon/init.rb +0 -15
  27. data/lib/jared/core/date/init.rb +0 -15
  28. data/lib/jared/core/date/lib/date.rb +0 -45
  29. data/lib/jared/core/greeter/init.rb +0 -15
  30. data/lib/jared/core/greeter/lib/greeting.rb +0 -26
  31. data/lib/jared/core/jamendo/init.rb +0 -17
  32. data/lib/jared/core/jamendo/lib/jamendo.rb +0 -88
  33. data/lib/jared/core/mail/init.rb +0 -15
  34. data/lib/jared/core/mail/lib/mail.rb +0 -45
  35. data/lib/jared/core/map/New File +0 -0
  36. data/lib/jared/core/map/init.rb +0 -15
  37. data/lib/jared/core/map/lib/map.rb +0 -12
  38. data/lib/jared/core/player/init.rb +0 -15
  39. data/lib/jared/core/player/lib/player.rb +0 -33
  40. data/lib/jared/core/stock/init.rb +0 -17
  41. data/lib/jared/core/stock/lib/stock.rb +0 -34
  42. data/lib/jared/core/tasks/init.rb +0 -15
  43. data/lib/jared/core/tasks/lib/task.rb +0 -42
  44. data/lib/jared/core/weather/init.rb +0 -17
  45. data/lib/jared/core/weather/lib/weather.rb +0 -70
  46. data/lib/jared/database.rb +0 -59
  47. data/lib/jared/jared.rb +0 -22
  48. data/lib/jared/models/music.rb +0 -2
  49. data/lib/jared/models/task.rb +0 -5
  50. data/lib/jared/models/user.rb +0 -5
  51. data/lib/jared/plugins.rb +0 -92
  52. data/spec/spec_helper.rb +0 -4
  53. data/spec/template.rb +0 -10
  54. data/spec/tests/date_spec.rb +0 -9
  55. data/spec/tests/greeting_spec.rb +0 -10
  56. data/spec/tests/jamendo_spec.rb +0 -10
  57. data/spec/tests/mail_spec.rb +0 -10
  58. data/spec/tests/map_spec.rb +0 -12
  59. data/spec/tests/player_spec.rb +0 -10
  60. data/spec/tests/stock_spec.rb +0 -10
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 686286a2848d334e7d4c3c396bf9e3bcf9f603cb
4
+ data.tar.gz: 4496e87abbb44516d1610ac95cc9f873af2630e7
5
+ SHA512:
6
+ metadata.gz: 2fbb964ff11a9fe012b52b6d48bf17d6046b139f595c4209ebf5c64160f68c9647a230aa10a47b1f654cc869fcb0fd64832c36864f0e038a9a4dae21760e3afe
7
+ data.tar.gz: 81c07f37bac23b954241edece73cbb05b347754146edb20c6d5c625e9d54d2b00ed459a9a6b6ebe2a5675928f1bf2de3920bbd733ef171ec8483e03fa663527f
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jared (0.1.0)
5
+ multi_json
6
+ slop
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ multi_json (1.10.1)
12
+ slop (3.6.0)
13
+
14
+ PLATFORMS
15
+ x86-mingw32
16
+
17
+ DEPENDENCIES
18
+ jared!
data/jared.gemspec CHANGED
@@ -1,36 +1,21 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "jared/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "jared"
7
- s.version = Jared::VERSION
8
- s.authors = ["Cyber"]
9
- s.email = ["matthewlikesrobots@gmail.com"]
10
- s.homepage = "https://github.com/cyberarm/jared"
11
- s.summary = "Ruby powered digital assistant"
12
- s.description = "Ruby powered digital assistant"
13
-
14
- s.rubyforge_project = "jared"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib", "bin"]
20
-
21
- s.add_runtime_dependency "stock_quote"
22
- s.add_runtime_dependency "green_shoes"
23
- s.add_runtime_dependency "gstreamer"
24
- s.add_runtime_dependency "versionomy"
25
- s.add_runtime_dependency "chronic"
26
- s.add_runtime_dependency "sys-uname"
27
- s.add_runtime_dependency "activerecord"
28
- s.add_runtime_dependency "sqlite3"
29
- s.add_runtime_dependency "launchy"
30
- s.add_runtime_dependency 'weatherboy'
31
- s.add_runtime_dependency 'area'
32
- s.add_runtime_dependency 'gmail'
33
- s.add_runtime_dependency 'gibberish'
34
- s.add_runtime_dependency 'faster_require'
35
- s.add_runtime_dependency 'json'
36
- end
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jared/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jared"
7
+ s.version = Jared::VERSION
8
+ s.authors = ["cyberarm"]
9
+ s.email = ["matthewlikesrobots@gmail.com"]
10
+ s.homepage = "https://github.com/cyberarm/jared"
11
+ s.summary = "Ruby powered digital assistant"
12
+ s.description = "Ruby powered digital assistant"
13
+
14
+ s.files = Dir["**/**/*.*"]# `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib", "bin"]
18
+
19
+ s.add_runtime_dependency "multi_json"
20
+ s.add_runtime_dependency "thor"
21
+ end
data/lib/jared/cli.rb ADDED
@@ -0,0 +1,19 @@
1
+ module Jared
2
+ class CLI < Thor
3
+ desc 'version', "shows version"
4
+ def version
5
+ puts "Jared version #{Jared::VERSION}"
6
+ end
7
+
8
+ Jared::PluginList.new.parse['plugins'].each do |plugin|
9
+ if Gem.find_files(plugin['rubygem_name']).count >= 1
10
+ desc plugin['command'], plugin['description']
11
+ define_method plugin['command'] do |*args|
12
+ require plugin['rubygem_name']
13
+ args, opts = Thor::Arguments.split(args)
14
+ invoke Module.const_get(plugin['main_class']), args, opts, :invoked_via_subcommand => true
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/jared/logg.rb CHANGED
@@ -1,15 +1,14 @@
1
- module Logg
2
- def log
3
- Logg.logger
4
- end
5
-
6
- # Global, memoized, lazy initialized instance of a logger
7
- def self.logger
8
- if File.exists?("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log")
9
- @file = File.open("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log", 'a')
10
- @logger ||= Logger.new(@file)
11
- else
12
- @logger ||= Logger.new("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log")
13
- end
14
- end
15
- end
1
+ module Logg
2
+ def log
3
+ Logg.logger
4
+ end
5
+
6
+ def self.logger
7
+ if File.exists?("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log")
8
+ @file = File.open("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log", 'a')
9
+ @logger ||= Logger.new(@file)
10
+ else
11
+ @logger ||= Logger.new("#{Dir.home}/.jared/logs/#{Time.new.strftime('%m-%d-%y-%H')}-debug.log")
12
+ end
13
+ end
14
+ end
data/lib/jared/plugin.rb CHANGED
@@ -1,35 +1,61 @@
1
- module Jared
2
- module Plugin
3
- class << self
4
- attr_accessor :configuration
5
- end
6
-
7
- def self.config
8
- self.configuration ||= Configuration.new
9
- yield(configuration)
10
- end
11
-
12
- class Configuration
13
- attr_accessor :name
14
- attr_accessor :description
15
- attr_accessor :author
16
- attr_accessor :author_email
17
- attr_accessor :homepage
18
- attr_accessor :sourcecode
19
- attr_accessor :command
20
- attr_accessor :arguments
21
- attr_accessor :usage
22
- attr_accessor :main_require
23
- attr_accessor :platform
24
- attr_accessor :version
25
- attr_accessor :jared_version
26
-
27
- def initialize
28
- end
29
- end
30
-
31
- def self.version
32
- "1.0.0"
33
- end
34
- end
35
- end
1
+ module Jared
2
+ class Plugin
3
+ attr_reader :plugin, :description, :version, :command, :main_class,
4
+ :jared_version, :rubygem, :rubygem_name, :github, :github_repo,
5
+ :ruby_platform, :platform
6
+
7
+ def initialize
8
+ yield(self)
9
+ end
10
+
11
+ def plugin= name
12
+ @plugin = name
13
+ end
14
+
15
+ def description= string
16
+ @description = string ||= ""
17
+ end
18
+
19
+ def version= string
20
+ @version = string
21
+ end
22
+
23
+ def command= string
24
+ @command = string
25
+ end
26
+
27
+ def main_class= string
28
+ @main_class = string
29
+ end
30
+
31
+ def jared_version= string
32
+ @jared_version = string
33
+ end
34
+
35
+ def rubygem= boolean
36
+ @rubygem = boolean ||= false
37
+ end
38
+
39
+ def rubygem_name= string
40
+ @rubygem_name = string ||= ""
41
+ end
42
+
43
+ def github= boolean
44
+ @github = boolean ||= false
45
+ end
46
+
47
+ def github_repo= string
48
+ @github_repo = string ||= ""
49
+ end
50
+
51
+ def ruby_platform= string
52
+ # ruby, cruby, jruby, or rbx
53
+ @ruby_platform = string ||= "ruby"
54
+ end
55
+
56
+ def platform= string
57
+ # windows, linux, mac, unix, or a blank string for any platform.
58
+ @platform = ""
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,16 @@
1
+ module Jared
2
+ class PluginList
3
+ def initialize
4
+ @file = "#{Dir.home}/.jared/data/jared-plugins.json"
5
+ end
6
+
7
+ def fetch
8
+ list = open('https://raw.githubusercontent.com/cyberarm/jared-plugins/master/jared-plugins.json').read
9
+ File.open(@file, 'w') {|file| file.write list}
10
+ end
11
+
12
+ def parse
13
+ MultiJson.load(File.open(@file).read)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ require_relative "setup_generator"
2
+ require_relative "plugin_list"
3
+
4
+ Jared::SetupGenerator.new.setup_directories
5
+ Jared::PluginList.new.fetch
@@ -0,0 +1,42 @@
1
+ module Jared
2
+ class SetupGenerator
3
+ def setup_directories
4
+ create_jared_directory
5
+ create_logger_directory
6
+ create_data_directory
7
+ create_plugins_directory
8
+ end
9
+
10
+ # Jared lives here
11
+ def create_jared_directory
12
+ if File.exists?("#{Dir.home}/.jared") && File.directory?("#{Dir.home}/.jared")
13
+ else
14
+ Dir.mkdir("#{Dir.home}/.jared")
15
+ end
16
+ end
17
+
18
+ # Jared writes his logs here
19
+ def create_logger_directory
20
+ if File.exists?("#{Dir.home}/.jared/logs") && File.directory?("#{Dir.home}/.jared/logs")
21
+ else
22
+ Dir.mkdir("#{Dir.home}/.jared/logs")
23
+ end
24
+ end
25
+
26
+ # Jared stores various data here
27
+ def create_data_directory
28
+ if File.exists?("#{Dir.home}/.jared/data") && File.directory?("#{Dir.home}/.jared/data")
29
+ else
30
+ Dir.mkdir("#{Dir.home}/.jared/data")
31
+ end
32
+ end
33
+
34
+ # plugins store their data here
35
+ def create_plugins_directory
36
+ if File.exists?("#{Dir.home}/.jared/plugins") && File.directory?("#{Dir.home}/.jared/plugins")
37
+ else
38
+ Dir.mkdir("#{Dir.home}/.jared/plugins")
39
+ end
40
+ end
41
+ end
42
+ end
data/lib/jared/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jared
2
- VERSION = "0.0.7a4"
3
- end
2
+ VERSION = "1.0.0"
3
+ end
data/lib/jared.rb CHANGED
@@ -1,86 +1,11 @@
1
- #!/bin/ruby
2
- s=Time.now
3
- require "json"
4
- require 'logger'
5
- require "open-uri"
6
- require 'fileutils'
7
- require 'versionomy'
8
- require_relative 'jared/version'
9
-
10
- if File.exists?("#{Dir.home}/.jared") && File.directory?("#{Dir.home}/.jared")
11
- else
12
- FileUtils.mkdir("#{Dir.home}/.jared")
13
- end
14
-
15
- if File.exists?("#{Dir.home}/.jared/logs") && File.directory?("#{Dir.home}/.jared/logs")
16
- else
17
- FileUtils.mkdir("#{Dir.home}/.jared/logs")
18
- end
19
-
20
- if File.exists?("#{Dir.home}/.jared/db") && File.directory?("#{Dir.home}/.jared/db")
21
- else
22
- FileUtils.mkdir("#{Dir.home}/.jared/db")
23
- end
24
-
25
- if File.exists?("#{Dir.home}/.jared/plugins") && File.directory?("#{Dir.home}/.jared/plugins")
26
- else
27
- FileUtils.mkdir("#{Dir.home}/.jared/plugins")
28
- end
29
-
30
- require_relative "jared/logg"
31
- include Logg
32
-
33
- log.info "Loaded logger."
34
- log.info "Using Jared version: #{Jared::VERSION}"
35
- Thread.new do
36
- info=open("http://rubygems.org/api/v1/gems/jared.json").read
37
- json=JSON.parse(info)
38
- current_version = Versionomy.parse(Jared::VERSION)
39
-
40
- web_version = Versionomy.parse(json['version'])
41
- if current_version < web_version
42
- log.info "A new version of Jared is available on RubyGems."
43
- puts "A new version of Jared is available on RubyGems."
44
- end
45
- end
46
-
47
- require_relative "jared/database"
48
- log.info "Loading Database..."
49
- Lib.db
50
- log.info "Loaded Database."
51
-
52
- require_relative "jared/plugins"
53
- log.info "Loading plugins..."
54
- @plugins=Plugins::Load.new.load_all
55
- log.info "Loaded plugins."
56
-
57
- if User.first.blank?
58
- require 'green_shoes'
59
- new_user = User.new(:name => "#{Etc.getlogin}", :zip => "10001", :music => 'classical')
60
- log.info "Creating new user: #{new_user.inspect}"
61
- new_user.save
62
- log.info "Created new user: #{new_user.inspect}"
63
- c=confirm "Setup Jared?\nSetting up Jared will enable it\n to retrieve personalized data for you."
64
- if c == true
65
- require 'jared/core/config'
66
- Action::Configure.new.config
67
- else
68
- alert "Run: 'jared config' to setup later."
69
- log.info "Skipped initial setup."
70
- end
71
- end
72
-
73
- if Music.first.blank?
74
- jrd = Music.new(:status => "Ready", :now_playing => "", :now_playing_author => "")
75
- jrd.save
76
- if jrd
77
- else
78
- log.error 'Failed to create Music!'
79
- end
80
- end
81
-
82
- f=Time.now
83
- @load_time = f-s
84
- log.info "Main dependencies took #{@load_time} seconds to load."
85
-
86
- require_relative "jared/jared"
1
+ require "thor"
2
+ require "logger"
3
+ require "multi_json"
4
+ require "open-uri"
5
+ require_relative 'jared/version'
6
+ require_relative 'jared/setup'
7
+ require_relative 'jared/plugin_list'
8
+ require_relative 'jared/logg'
9
+ require_relative 'jared/cli'
10
+
11
+ Jared::CLI.start(ARGV)
data/license.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2013 cyberarm
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file
data/readme.md CHANGED
@@ -1,83 +1,13 @@
1
- # Jared - Ruby Powered Digital Assistant (RDA)
2
- ## What is Jared?
3
- Jared is a ruby program that in the hopefully near future will be useful for:
4
- * Creating and managing your tasks
5
- * Checking your email
6
- * Playing your preferred music
7
- * Creating skeleton project files
8
- * Understand spoken commands (in the distant future)
9
- * Other miscellaneous actions
1
+ # Jared - Ruby powered Digital Assistant (RDA)
2
+ Jared is a plugin-based application for managing your life,
3
+ at its core is just a bunch of plugins.
4
+ In the future I hope to have enough plugins for Jared to be able to function similar to Jarvis, but that is a ways off.
5
+ Jared has a few built-in plugins (See wiki page [plugins](https://wiki.github.com/cyberarm/jared/plugins)).
10
6
 
11
- Jared's goal is to be a reality of Jarvis from the film, Ironman.
12
-
13
- However, thats a _long_ ways down the road.
14
7
  ## Install Jared
15
- You can get the lasest stable release on RubyGems via *gem install jared*
16
-
17
- ## Usage
18
-
19
- ### Clock
20
- Opens a digital clock in a Green Shoes app.
21
-
22
- Usage: jared clock
23
-
24
- ### Day
25
- Puts current day.
26
-
27
- Usage: Jared day
28
-
29
- Tuesday
30
-
31
- ### Deamon
32
- Run mail/task/appointment check every 60 seconds.
33
-
34
- Usage: jared deamon (mail/task/cal(endar))
35
-
36
- (if there is no second argument it'll check all three every 60 seconds.)
37
-
38
- ### Date
39
- Puts the current date.
40
-
41
- Usage: jared date
42
-
43
- Wednesday the 22nd of February 2012
44
-
45
- (02/22/2012)
46
-
47
- ### Mail
48
- Checks Gmail for new mails.
49
-
50
- Usage: jared mail
51
-
52
- ### Task
53
- Manage your tasks.
54
-
55
- Opens a Green Shoes window for managing Tasks.
56
-
57
- Usage: jared task
58
-
59
- ### Time
60
- puts the current time
61
-
62
- Usage: jared time
63
-
64
- 05:21 am
65
-
66
- ### Weather
67
- Check you local weather information.
68
-
69
- Usage: jared weather (today/tomorrow/forecast)
70
-
71
-
72
- ### Whereis
73
- Opens Gmaps in default browser.
8
+ You can get the latest stable release on RubyGems via *gem install jared*
74
9
 
75
- Usage: jared whereis "Mt. st helens"
76
-
77
- ### View
78
- Opens the file in the system viewer.
79
-
80
- Usage: jared view jared.rb
10
+ You can get the latest incomplete-feature release on RubyGems via *gem install jared --pre*
81
11
 
82
- ## Contribute
83
- [Wiki](http://github.com/cyberarm/jared/wiki/Contribute)
12
+ ## Want to contribute?
13
+ Please see the wiki page about [contributing](http://github.com/cyberarm/jared/wiki/Contribute).