Sha256: de4813be6a23151e3af1d0bd020973785fd7c2bb71260dba7fa37df1380e4bf3

Contents?: true

Size: 1.13 KB

Versions: 154

Compression:

Stored size: 1.13 KB

Contents

class Specinfra::Command::Freebsd::Base::File < Specinfra::Command::Base::File
  class << self
    def check_is_grouped(file, group)
      regexp = "^#{group}$"
      "stat -f%Sg #{escape(file)} | grep -- #{escape(regexp)}"
    end

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

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

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

    def check_has_mode(file, mode)
      "test `stat -f%Mp%Lp #{escape(file)} | sed 's/^0*//'` -eq #{escape(mode)}"
    end

    def get_mode(file)
      "stat -f%Mp%Lp #{escape(file)} | sed 's/^0*//'"
    end

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

    def get_mtime(file)
      "stat -f%m #{escape(file)}"
    end

    def get_size(file)
      "stat -f%z #{escape(file)}"
    end

    def get_sha256sum(file)
        "sha256 #{escape(file)} | cut -d ' ' -f 4"
    end

    def get_md5sum(file)
        "md5 #{escape(file)} | cut -d ' ' -f 4"
    end
  end
end

Version data entries

154 entries across 154 versions & 1 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.90.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.90.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.89.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.88.2 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.88.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.88.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.87.2 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.87.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.87.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.86.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.85.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.85.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.84.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.84.0 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.83.4 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.83.3 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.83.2 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.83.1 lib/specinfra/command/freebsd/base/file.rb
specinfra-2.83.0 lib/specinfra/command/freebsd/base/file.rb