Module: Mybot::Recipes
- Includes:
- Fmt
- Included in:
- Base
- Defined in:
- lib/mybot/recipes.rb
Constant Summary
Constants included
from Fmt
Fmt::WIDTH
Instance Method Summary
collapse
Methods included from Fmt
#asterisks, #colored, #print_cmd, #print_cmd!, #print_progress, #print_stderr, #print_stdout, #spaces
Instance Method Details
#load_recipe(r) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/mybot/recipes.rb', line 16
def load_recipe(r)
instance_eval(File.read(r), __FILE__, __LINE__)
rescue Exception => e
print_cmd! "warning", "cannot load #{r}", :magenta, :bold
puts e.message
e.backtrace.each do |line|
puts line
end
end
|
#load_recipes ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/mybot/recipes.rb', line 5
def load_recipes
(
Dir["Botfile"] +
Dir[File.join(HOME_PATH, ".mybot", "**", "*.rb")].flatten
).reject do |r|
!File.exists?(r)
end.each do |r|
self.load_recipe(r)
end
end
|