Class: Dk::Pkg::Validate
- Inherits:
-
Object
- Object
- Dk::Pkg::Validate
- Includes:
- Task
- Defined in:
- lib/dk-pkg/validate.rb
Defined Under Namespace
Modules: TestHelpers
Instance Method Summary collapse
Instance Method Details
#run! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dk-pkg/validate.rb', line 14 def run! # validate that a manifest path has been set, so we can parse it if params[MANIFEST_PATH_PARAM_NAME].to_s.empty? raise ArgumentError, "no #{MANIFEST_PATH_PARAM_NAME.inspect} param set" end if !cmd("test -e #{params[MANIFEST_PATH_PARAM_NAME]}").success? cmd! "touch #{params[MANIFEST_PATH_PARAM_NAME]}" if param?(MANIFEST_MODE_PARAM_NAME) cmd! "chmod #{params[MANIFEST_MODE_PARAM_NAME]} " \ "#{params[MANIFEST_PATH_PARAM_NAME]}" end if param?(MANIFEST_OWNER_PARAM_NAME) cmd! "chown #{params[MANIFEST_OWNER_PARAM_NAME]} " \ "#{params[MANIFEST_PATH_PARAM_NAME]}" end end serialized_pkgs = cmd!("cat #{params[MANIFEST_PATH_PARAM_NAME]}").stdout set_param INSTALLED_PKGS_PARAM_NAME, Manifest.deserialize(serialized_pkgs) end |