Class: KnifeSantoku::Application
- Inherits:
-
Object
- Object
- KnifeSantoku::Application
- Defined in:
- lib/knife_santoku/application.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Application
constructor
A new instance of Application.
- #run_after_callbacks ⇒ Object
- #run_before_callbacks ⇒ Object
Constructor Details
#initialize(argv) ⇒ Application
Returns a new instance of Application.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/knife_santoku/application.rb', line 6 def initialize(argv) @active = false chef_conf_dir = ::Chef::Knife.chef_config_dir config_file = "#{chef_conf_dir}/../config/santoku-config.yml" before_file = "#{chef_conf_dir}/../config/santoku-before.rb" after_file = "#{chef_conf_dir}/../config/santoku-after.rb" lib_folder = Pathname.new("#{chef_conf_dir}/../lib/santoku/") if File.exists?(config_file) and (File.exists?(before_file) or File.exists?(after_file)) @active = true config = AppConf.new config.load(config_file) # load up notifiers & custom code out of lib #notifier = Notifier.new(config,lib_folder) notifier = ::KnifeSantoku::Notifier.new(config) # load up callbacks @before_callbacks = Callback.new(before_file, notifier, argv) @after_callbacks = Callback.new(after_file, notifier, argv) end end |
Instance Method Details
#run_after_callbacks ⇒ Object
36 37 38 |
# File 'lib/knife_santoku/application.rb', line 36 def run_after_callbacks @after_callbacks.run if @active end |
#run_before_callbacks ⇒ Object
32 33 34 |
# File 'lib/knife_santoku/application.rb', line 32 def run_before_callbacks @before_callbacks.run if @active end |