Class: ReleasedCookbook
- Defined in:
- lib/mofa/released_cookbook.rb
Instance Attribute Summary collapse
-
#pkg_dir ⇒ Object
Returns the value of attribute pkg_dir.
-
#pkg_name ⇒ Object
Returns the value of attribute pkg_name.
Attributes inherited from Cookbook
#cookbooks_url, #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
Returns a new instance of ReleasedCookbook.
5 6 7 8 9 10 |
# File 'lib/mofa/released_cookbook.rb', line 5 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 Attribute Details
#pkg_dir ⇒ Object
Returns the value of attribute pkg_dir.
2 3 4 |
# File 'lib/mofa/released_cookbook.rb', line 2 def pkg_dir @pkg_dir end |
#pkg_name ⇒ Object
Returns the value of attribute pkg_name.
3 4 5 |
# File 'lib/mofa/released_cookbook.rb', line 3 def pkg_name @pkg_name end |
Instance Method Details
#cleanup ⇒ Object
24 25 26 27 28 |
# File 'lib/mofa/released_cookbook.rb', line 24 def cleanup say "Removing folder #{pkg_dir}...#{nl}" run "rm -r #{pkg_dir}" ok end |
#cleanup! ⇒ Object
————- /Interface Methods
32 33 34 35 36 37 38 39 |
# File 'lib/mofa/released_cookbook.rb', line 32 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
19 20 21 22 |
# File 'lib/mofa/released_cookbook.rb', line 19 def execute # TODO: Download & unpack released cookbook # Important for guessing role runlists (when cookbook is an env-cookbook) end |