Skip to content

Commit

Permalink
bean talker update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifiht committed Jan 18, 2024
1 parent af02867 commit 3984d61
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require "concurrent"
require "require_all"
#==========<[ Local Libs ]>==========#
require_rel "lib/*.rb"
require_rel "lib"

#@@@@@@ USERS MAY EDIT THEIR SETTINGS BELOW:
#[[[[[[ INITIALIZE CONFIG & ALL LIBRARY CLASSES HERE]]]]]]
Expand Down
36 changes: 29 additions & 7 deletions src/lib/bean_talker.rb
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
2 changes: 1 addition & 1 deletion src/manual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#| mainly with ad-hoc tasks, or schedulers like cron. ||
#\===============================================================//
require "beaneater"
require_relative "lib/lib_core_config"
require_relative "lib/app_settings"

# Get user settings
core_config = AppSettings.new
Expand Down

0 comments on commit 3984d61

Please sign in to comment.