knife-santoku 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,8 @@ require 'chef/knife'
4
4
  module KnifeSantoku
5
5
  class Application
6
6
  def initialize(argv)
7
-
7
+ @active = false
8
+
8
9
  chef_conf_dir = ::Chef::Knife.chef_config_dir
9
10
 
10
11
  config_file = "#{chef_conf_dir}/../config/santoku-config.yml"
@@ -12,27 +13,28 @@ module KnifeSantoku
12
13
  after_file = "#{chef_conf_dir}/../config/santoku-after.rb"
13
14
  lib_folder = Pathname.new("#{chef_conf_dir}/../lib/santoku/")
14
15
 
16
+ if File.exists?(config_file) and (File.exists?(before_file) or File.exists?(after_file))
17
+ @active = true
18
+
19
+ config = AppConf.new
20
+ config.load(config_file)
15
21
 
16
- config = AppConf.new
17
- config.load(config_file)
18
-
19
-
20
- # load up notifiers & custom code out of lib
21
- #notifier = Notifier.new(config,lib_folder)
22
- notifier = ::KnifeSantoku::Notifier.new(config)
23
-
24
-
25
- # load up callbacks
26
- @before_callbacks = Callback.new(before_file, notifier, argv)
27
- @after_callbacks = Callback.new(after_file, notifier, argv)
22
+ # load up notifiers & custom code out of lib
23
+ #notifier = Notifier.new(config,lib_folder)
24
+ notifier = ::KnifeSantoku::Notifier.new(config)
25
+
26
+ # load up callbacks
27
+ @before_callbacks = Callback.new(before_file, notifier, argv)
28
+ @after_callbacks = Callback.new(after_file, notifier, argv)
29
+ end
28
30
  end
29
31
 
30
32
  def run_before_callbacks
31
- @before_callbacks.run
33
+ @before_callbacks.run if @active
32
34
  end
33
35
 
34
36
  def run_after_callbacks
35
- @after_callbacks.run
37
+ @after_callbacks.run if @active
36
38
  end
37
39
  end
38
40
  end
@@ -1,3 +1,3 @@
1
1
  module KnifeSantoku
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-santoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: