Class: Daneel::Scripts::Reload
- Inherits:
-
Daneel::Script
- Object
- Plugin
- Daneel::Script
- Daneel::Scripts::Reload
- Defined in:
- lib/daneel/scripts/reload.rb
Instance Attribute Summary
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from Daneel::Script
#accepts?, files, inherited, list
Methods inherited from Plugin
#initialize, #logger, requires_env
Constructor Details
This class inherits a constructor from Daneel::Plugin
Instance Method Details
#help ⇒ Object
21 22 23 24 25 |
# File 'lib/daneel/scripts/reload.rb', line 21 def help reload = {"reload" => "restarts and reloads #{robot.name}'s code"} update = {"update" => "updates #{robot.name}'s code from git and restarts"} in_git? ? reload.merge(update) : reload end |
#receive(room, message, user) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/daneel/scripts/reload.rb', line 8 def receive(room, , user) case .command when /^update$/ return unless in_git? system("cd #{root} && git pull origin master && bundle install") room.say "updated, brb" restart when /^reload$/ room.say "k, brb" restart end end |