Sha256: 4efd8e7692b0b7383f416117e7546df00fa1d10655323893aa495b7192f15ead

Contents?: true

Size: 1.33 KB

Versions: 19

Compression:

Stored size: 1.33 KB

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 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 check_link(link, target)
        "stat -f%Y #{escape(link)} | grep -- #{escape(target)}"
      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

19 entries across 19 versions & 1 rubygems

Version Path
specinfra-1.27.5 lib/specinfra/command/freebsd.rb
specinfra-1.27.4 lib/specinfra/command/freebsd.rb
specinfra-1.27.3 lib/specinfra/command/freebsd.rb
specinfra-1.27.2 lib/specinfra/command/freebsd.rb
specinfra-1.27.1 lib/specinfra/command/freebsd.rb
specinfra-1.27.0 lib/specinfra/command/freebsd.rb
specinfra-1.26.0 lib/specinfra/command/freebsd.rb
specinfra-1.25.8 lib/specinfra/command/freebsd.rb
specinfra-1.25.7 lib/specinfra/command/freebsd.rb
specinfra-1.25.6 lib/specinfra/command/freebsd.rb
specinfra-1.25.5 lib/specinfra/command/freebsd.rb
specinfra-1.25.4 lib/specinfra/command/freebsd.rb
specinfra-1.25.3 lib/specinfra/command/freebsd.rb
specinfra-1.25.2 lib/specinfra/command/freebsd.rb
specinfra-1.25.1 lib/specinfra/command/freebsd.rb
specinfra-1.25.0 lib/specinfra/command/freebsd.rb
specinfra-1.24.0 lib/specinfra/command/freebsd.rb
specinfra-1.23.1 lib/specinfra/command/freebsd.rb
specinfra-1.23.0 lib/specinfra/command/freebsd.rb