Sha256: c237357c34255990e7e347f5452f3958912a97499a33606137619de4e9efc730

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 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 get_md5sum(file)
      "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2-"
    end

    def get_sha256sum(file)
      "openssl sha256 #{escape(file)} | cut -d'=' -f2 | cut -c 2-"
    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

    def get_owner_user(file)
      "stat -f %Su #{escape(file)}"
    end

    def get_owner_group(file)
      "stat -f %Sg #{escape(file)}"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
specinfra-2.11.2 lib/specinfra/command/darwin/base/file.rb
specinfra-2.11.1 lib/specinfra/command/darwin/base/file.rb
specinfra-2.11.0 lib/specinfra/command/darwin/base/file.rb
specinfra-2.10.4 lib/specinfra/command/darwin/base/file.rb
specinfra-2.10.3 lib/specinfra/command/darwin/base/file.rb
specinfra-2.10.2 lib/specinfra/command/darwin/base/file.rb
specinfra-2.10.1 lib/specinfra/command/darwin/base/file.rb
specinfra-2.10.0 lib/specinfra/command/darwin/base/file.rb
specinfra-2.9.3 lib/specinfra/command/darwin/base/file.rb
specinfra-2.9.2 lib/specinfra/command/darwin/base/file.rb
specinfra-2.9.1 lib/specinfra/command/darwin/base/file.rb