Class: ReleasedCookbook
- Defined in:
- lib/mofa/released_cookbook.rb
Instance Attribute Summary
Attributes inherited from Cookbook
#cookbooks_url, #mofa_yml, #mofa_yml_local, #name, #pkg_dir, #pkg_name, #pkg_uri, #source_uri, #token, #type, #version
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#cleanup! ⇒ Object
————- /Interface Methods.
- #execute ⇒ Object
-
#initialize(cookbook_name_or_path) ⇒ ReleasedCookbook
constructor
A new instance of ReleasedCookbook.
-
#prepare ⇒ Object
————- Interface Methods.
Methods inherited from Cookbook
#autodetect_type, create, #error, #ok, #run, #say
Constructor Details
#initialize(cookbook_name_or_path) ⇒ ReleasedCookbook
3 4 5 6 7 8 |
# File 'lib/mofa/released_cookbook.rb', line 3 def initialize(cookbook_name_or_path) super() # TODO: this needs proper vaidation! @name = cookbook_name_or_path.split(/@/).first @version = cookbook_name_or_path.split(/@/).last end |
Instance Method Details
#cleanup ⇒ Object
22 23 24 25 26 |
# File 'lib/mofa/released_cookbook.rb', line 22 def cleanup say "Removing folder #{pkg_dir}...#{nl}" run "rm -r #{pkg_dir}" ok end |
#cleanup! ⇒ Object
————- /Interface Methods
30 31 32 33 34 35 36 37 |
# File 'lib/mofa/released_cookbook.rb', line 30 def cleanup! unless (Dir.entries("#{Mofa::Config.config['tmp_dir']}/.mofa") - %w{ . .. }).empty? say "Removing content of folder #{Mofa::Config.config['tmp_dir']}/.mofa" run "rm -r #{Mofa::Config.config['tmp_dir']}/.mofa/*" else say "Folder #{Mofa::Config.config['tmp_dir']}/.mofa is (already) clean." end end |
#execute ⇒ Object
17 18 19 20 |
# File 'lib/mofa/released_cookbook.rb', line 17 def execute # TODO: Download & unpack released cookbook # Important for guessing role runlists (when cookbook is an env-cookbook) end |