Class: Emeril::Publisher
- Inherits:
-
Object
- Object
- Emeril::Publisher
- Includes:
- Logging
- Defined in:
- lib/emeril/publisher.rb
Overview
Takes a path to a cookbook and pushes it up to the Community Site.
Defined Under Namespace
Classes: LoggingUI, SharePlugin
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Publisher
constructor
Creates a new instance.
-
#run ⇒ Object
Prepares a sandbox copy of the cookbook and uploads it to the Community Site.
Constructor Details
#initialize(options = {}) ⇒ Publisher
Creates a new instance.
36 37 38 39 40 41 42 43 |
# File 'lib/emeril/publisher.rb', line 36 def initialize( = {}) @logger = [:logger] @source_path = .fetch(:source_path, Dir.pwd) @name = .fetch(:name) { raise ArgumentError, ":name must be set" } @category = [:category] @knife_class = .fetch(:knife_class, SharePlugin) validate_chef_config! end |
Instance Method Details
#run ⇒ Object
Prepares a sandbox copy of the cookbook and uploads it to the Community Site.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/emeril/publisher.rb', line 48 def run sandbox_path = sandbox_cookbook share = knife_class.new share.ui = logging_ui(share.ui) share.config[:cookbook_path] = sandbox_path share.name_args = [name, category] share.run ensure FileUtils.remove_dir(sandbox_path) end |