Skip to content
Browse files

Merge pull request #2 from aussiegeek/notifications

Show notifications when uploading and on success/failure
  • Loading branch information...
2 parents ad3926a + 67d513e commit 744702bc872c9c6f29ba33e2d8b18d6388c47073 @nistude committed
Showing with 24 additions and 4 deletions.
  1. +24 −4 lib/guard/knife.rb
View
28 lib/guard/knife.rb
@@ -79,19 +79,39 @@ def knife_options
end
def upload_cookbook(cookbook)
- system("knife cookbook upload #{cookbook} #{knife_options}")
+ ::Guard::Notifier.notify("Uploading cookbook #{cookbook}")
+ if system("knife cookbook upload #{cookbook} #{knife_options}")
+ ::Guard::Notifier.notify("Cookbook #{cookbook} uploaded")
+ else
+ ::Guard::Notifier.notify("Cookbook #{cookbook} failed to upload")
+ end
end
def upload_databag(data_bag, item)
- system("knife data bag from file #{data_bag} #{item} #{knife_options}")
+ ::Guard::Notifier.notify("Uploading databag #{data_bag}")
+ if system("knife data bag from file #{data_bag} #{item} #{knife_options}")
+ ::Guard::Notifier.notify("Data bag #{data_bag} upload")
+ else
+ ::Guard::Notifier.notify("Data bag #{data_bag} failed to upload")
+ end
end
def upload_environment(environment)
- system("knife environment from file #{environment} #{knife_options}")
+ ::Guard::Notifier.notify("Uploading environment #{environment}")
+ if system("knife environment from file #{environment} #{knife_options}")
+ ::Guard::Notifier.notify("Environment #{environment} uploaded")
+ else
+ ::Guard::Notifier.notify("Environment #{environment} failed to upload")
+ end
end
def upload_role(role)
- system("knife role from file #{role} #{knife_options}")
+ ::Guard::Notifier.notify("Uploading role #{role}")
+ if system("knife role from file #{role} #{knife_options}")
+ ::Guard::Notifier.notify("Role #{role} uploaded")
+ else
+ ::Guard::Notifier.notify("Role #{role} upload failed")
+ end
end
end
end

0 comments on commit 744702b

Please sign in to comment.
Something went wrong with that request. Please try again.