Sha256: 73226eab892c94e8392e9f53dd04ad97dab29a4541e9504462a7a6154aabc775

Contents?: true

Size: 1.18 KB

Versions: 55

Compression:

Stored size: 1.18 KB

Contents

module SpecInfra
  module Command
    class Darwin < Base
      def check_file_md5checksum(file, expected)
        "openssl md5 #{escape(file)} | cut -d'=' -f2 | cut -c 2- | grep -E ^#{escape(expected)}$"
      end

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

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

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

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

      def check_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 check_access_by_user(file, user, access)
        "sudo -u #{user} -s /bin/test -#{access} #{file}"
      end

      def install(package)
        cmd = "brew install '#{package}'"
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
specinfra-1.8.0 lib/specinfra/command/darwin.rb
specinfra-1.7.0 lib/specinfra/command/darwin.rb
specinfra-1.6.0 lib/specinfra/command/darwin.rb
specinfra-1.5.1 lib/specinfra/command/darwin.rb
specinfra-1.5.0 lib/specinfra/command/darwin.rb
specinfra-1.4.0 lib/specinfra/command/darwin.rb
specinfra-1.3.0 lib/specinfra/command/darwin.rb
specinfra-1.2.1 lib/specinfra/command/darwin.rb
specinfra-1.2.0 lib/specinfra/command/darwin.rb
specinfra-1.1.1 lib/specinfra/command/darwin.rb
specinfra-1.1.0 lib/specinfra/command/darwin.rb
specinfra-1.0.5 lib/specinfra/command/darwin.rb
specinfra-1.0.4 lib/specinfra/command/darwin.rb
specinfra-1.0.3 lib/specinfra/command/darwin.rb
specinfra-1.0.2 lib/specinfra/command/darwin.rb
specinfra-1.0.1 lib/specinfra/command/darwin.rb
specinfra-1.0.0 lib/specinfra/command/darwin.rb
specinfra-0.8.0 lib/specinfra/command/darwin.rb
specinfra-0.7.3 lib/specinfra/command/darwin.rb
specinfra-0.7.2 lib/specinfra/command/darwin.rb