-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,36 @@ | ||
require "yaml" | ||
require "app_settings.rb" | ||
require "beaneater" | ||
require "shiki_gram" | ||
require "app_settings" | ||
|
||
class BeanTalker | ||
@@config_hash = YAML.load(File.read("#{Dir.home}/.config/shikigami/config.yml")) | ||
tube.put ARGV[0] | ||
|
||
def self.exists?(key) | ||
return @@config_hash.has_key?(key) | ||
def initialize(mod_name) | ||
@mod_name = mod_name # Declare the name of the module, NOTE: | ||
# Module names MUST match their parent folder inside the 'modules' subdir | ||
# Any module should be able to talk to any other by referencing this name | ||
# All modules may talk to the 'core' via the tube of the same name ("core") | ||
core_config = AppSettings.new | ||
beanstalk_host = core_config.get("beanstalk_host") | ||
beanstalk_port = core_config.get("beanstalk_port") | ||
@beanstalk = Beaneater.new("#{beanstalk_host}\:#{beanstalk_port}") | ||
@all_tubes = @beanstalk.tubes.all | ||
@tube = @beanstalk.tubes[@mod_name] | ||
end | ||
|
||
def get(key) | ||
return @@config_hash[key] | ||
def send_msg(msg, to) | ||
postman = ShikiGram.new | ||
mail = postman.wrap_msg(msg) | ||
if @all_tubes.route = @beanstalk.tubes[to] | ||
route.put(mail) | ||
end | ||
end | ||
|
||
def recv_msg(msg) | ||
puts "not implemented" | ||
end | ||
|
||
def shut_up | ||
@beanstalk.close | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters