Sha256: 79d89abeb7909f72651cc0d10885f2d225a81a56026a5823f8dba26e9f754fb1

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

class Specinfra::Command::Darwin::Base::File < Specinfra::Command::Base::File
  class << self
    def check_is_accessible_by_user(file, user, access)
      "sudo -u #{user} -s /bin/test -#{access} #{file}"
    end

    def check_has_md5checksum(file, expected)
      "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
    end

    def check_has_sha256checksum(file, expected)
      "openssl sha256 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
    end

    def check_is_linked_to(link, target)
      "stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
    end

    def check_has_mode(file, mode)
      regexp = "^#{mode}$"
      "stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def check_is_owned_by(file, owner)
      regexp = "^#{owner}$"
      "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def check_is_grouped(file, group)
      regexp = "^#{group}$"
      "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
    end

    def get_mode(file)
      "stat -f%Lp #{escape(file)}"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta29 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta28 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta27 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta26 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta25 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta24 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta23 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta22 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta21 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta20 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta19 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta18 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta17 lib/specinfra/command/darwin/base/file.rb
specinfra-2.0.0.beta16 lib/specinfra/command/darwin/base/file.rb