Sha256: b332065a76035b19f1467c732e72bf7d6b8e58cc96c5e089301b591bd7e83442

Contents?: true

Size: 965 Bytes

Versions: 47

Compression:

Stored size: 965 Bytes

Contents

module SpecInfra
  module Command
    class FreeBSD < Base
      def check_enabled(service, level=3)
        "service -e | grep -- #{escape(service)}"
      end

      def check_installed(package, version=nil)
        if version
          "pkg_info -I #{escape(package)}-#{escape(version)}"
        else
          "pkg_info -Ix #{escape(package)}"
        end
      end

      def check_listening(port)
        regexp = ":#{port} "
        "sockstat -46l -p #{port} | grep -- #{escape(regexp)}"
      end

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

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

      def install(package)
        "pkg_add -r install #{package}"
      end

      def get_package_version(package, opts=nil)
        "pkg_info -Ix #{escape(package)} | cut -f 1 -w | sed -n 's/^#{escape(package)}-//p'"
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
specinfra-1.22.1 lib/specinfra/command/freebsd.rb
specinfra-1.22.0 lib/specinfra/command/freebsd.rb
specinfra-1.21.0 lib/specinfra/command/freebsd.rb
specinfra-1.20.0 lib/specinfra/command/freebsd.rb
specinfra-1.19.0 lib/specinfra/command/freebsd.rb
specinfra-1.18.4 lib/specinfra/command/freebsd.rb
specinfra-1.18.3 lib/specinfra/command/freebsd.rb
specinfra-1.18.2 lib/specinfra/command/freebsd.rb
specinfra-1.18.1 lib/specinfra/command/freebsd.rb
specinfra-1.18.0 lib/specinfra/command/freebsd.rb
specinfra-1.17.0 lib/specinfra/command/freebsd.rb
specinfra-1.16.0 lib/specinfra/command/freebsd.rb
specinfra-1.15.1 lib/specinfra/command/freebsd.rb
specinfra-1.15.0 lib/specinfra/command/freebsd.rb
specinfra-1.14.0 lib/specinfra/command/freebsd.rb
specinfra-1.13.1 lib/specinfra/command/freebsd.rb
specinfra-1.13.0 lib/specinfra/command/freebsd.rb
specinfra-1.12.0 lib/specinfra/command/freebsd.rb
specinfra-1.11.0 lib/specinfra/command/freebsd.rb
specinfra-1.10.0 lib/specinfra/command/freebsd.rb