Sha256: 71ac9718efbbeef89c280caa2d060fbae140ed6d7e8d20da0ccf5d652dc7081c
Contents?: true
Size: 968 Bytes
Versions: 90
Compression:
Stored size: 968 Bytes
Contents
require 'itamae-mitsurin' module ItamaeMitsurin module Resource class Link < Base define_attribute :action, default: :create define_attribute :link, type: String, default_name: true define_attribute :to, type: String, required: true define_attribute :force, type: [TrueClass, FalseClass], default: false def pre_action case @current_action when :create attributes.exist = true end end def set_current_attributes current.exist = run_specinfra(:check_file_is_link, attributes.link) if current.exist current.to = run_specinfra(:get_file_link_target, attributes.link).stdout.strip end end def action_create(options) unless run_specinfra(:check_file_is_linked_to, attributes.link, attributes.to) run_specinfra(:link_file_to, attributes.link, attributes.to, force: attributes.force) end end end end end
Version data entries
90 entries across 47 versions & 1 rubygems