specinfra 2.0.0.beta15 → 2.0.0.beta16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/specinfra.rb +1 -1
  3. data/lib/specinfra/command/aix/base/file.rb +15 -13
  4. data/lib/specinfra/command/aix/base/group.rb +5 -3
  5. data/lib/specinfra/command/aix/base/package.rb +7 -5
  6. data/lib/specinfra/command/aix/base/port.rb +5 -3
  7. data/lib/specinfra/command/aix/base/service.rb +7 -5
  8. data/lib/specinfra/command/aix/base/user.rb +10 -8
  9. data/lib/specinfra/command/arch/base/file.rb +4 -2
  10. data/lib/specinfra/command/arch/base/package.rb +17 -15
  11. data/lib/specinfra/command/arch/base/service.rb +3 -1
  12. data/lib/specinfra/command/base.rb +70 -68
  13. data/lib/specinfra/command/base/cron.rb +8 -6
  14. data/lib/specinfra/command/base/file.rb +94 -92
  15. data/lib/specinfra/command/base/group.rb +8 -6
  16. data/lib/specinfra/command/base/host.rb +18 -16
  17. data/lib/specinfra/command/base/mail_alias.rb +5 -3
  18. data/lib/specinfra/command/base/package.rb +36 -34
  19. data/lib/specinfra/command/base/port.rb +7 -5
  20. data/lib/specinfra/command/base/process.rb +10 -9
  21. data/lib/specinfra/command/base/routing_table.rb +6 -4
  22. data/lib/specinfra/command/base/service.rb +19 -17
  23. data/lib/specinfra/command/base/user.rb +24 -22
  24. data/lib/specinfra/command/darwin/base/file.rb +35 -33
  25. data/lib/specinfra/command/darwin/base/package.rb +12 -10
  26. data/lib/specinfra/command/darwin/base/port.rb +5 -3
  27. data/lib/specinfra/command/darwin/base/service.rb +7 -5
  28. data/lib/specinfra/command/debian/base/package.rb +16 -14
  29. data/lib/specinfra/command/debian/base/service.rb +5 -3
  30. data/lib/specinfra/command/fedora/base/service.rb +7 -6
  31. data/lib/specinfra/command/fedora/v15/service.rb +3 -1
  32. data/lib/specinfra/command/freebsd/base/file.rb +8 -6
  33. data/lib/specinfra/command/freebsd/base/package.rb +13 -11
  34. data/lib/specinfra/command/freebsd/base/port.rb +5 -3
  35. data/lib/specinfra/command/freebsd/base/service.rb +4 -2
  36. data/lib/specinfra/command/freebsd/v10/package.rb +13 -11
  37. data/lib/specinfra/command/gentoo/base/package.rb +4 -2
  38. data/lib/specinfra/command/gentoo/base/service.rb +9 -7
  39. data/lib/specinfra/command/linux/base/file.rb +10 -8
  40. data/lib/specinfra/command/linux/base/interface.rb +13 -11
  41. data/lib/specinfra/command/linux/base/iptables.rb +9 -7
  42. data/lib/specinfra/command/linux/base/kernel_module.rb +4 -2
  43. data/lib/specinfra/command/linux/base/lxc_container.rb +7 -5
  44. data/lib/specinfra/command/linux/base/selinux.rb +9 -7
  45. data/lib/specinfra/command/linux/base/zfs.rb +3 -1
  46. data/lib/specinfra/command/nixos/base/package.rb +12 -10
  47. data/lib/specinfra/command/nixos/base/service.rb +3 -1
  48. data/lib/specinfra/command/openbsd/base/file.rb +31 -29
  49. data/lib/specinfra/command/openbsd/base/interface.rb +8 -13
  50. data/lib/specinfra/command/openbsd/base/mail_alias.rb +4 -2
  51. data/lib/specinfra/command/openbsd/base/package.rb +10 -8
  52. data/lib/specinfra/command/openbsd/base/port.rb +4 -2
  53. data/lib/specinfra/command/openbsd/base/service.rb +7 -5
  54. data/lib/specinfra/command/openbsd/base/user.rb +8 -6
  55. data/lib/specinfra/command/opensuse/base/service.rb +3 -1
  56. data/lib/specinfra/command/plamo/base/package.rb +7 -5
  57. data/lib/specinfra/command/plamo/base/service.rb +6 -4
  58. data/lib/specinfra/command/redhat/base/file.rb +5 -3
  59. data/lib/specinfra/command/redhat/base/package.rb +14 -12
  60. data/lib/specinfra/command/redhat/base/service.rb +4 -2
  61. data/lib/specinfra/command/redhat/base/yumrepo.rb +7 -5
  62. data/lib/specinfra/command/redhat/v5/iptables.rb +7 -5
  63. data/lib/specinfra/command/redhat/v7/service.rb +3 -1
  64. data/lib/specinfra/command/smartos/base/package.rb +10 -8
  65. data/lib/specinfra/command/smartos/base/service.rb +7 -5
  66. data/lib/specinfra/command/solaris/base/cron.rb +8 -6
  67. data/lib/specinfra/command/solaris/base/file.rb +15 -13
  68. data/lib/specinfra/command/solaris/base/group.rb +5 -3
  69. data/lib/specinfra/command/solaris/base/host.rb +7 -5
  70. data/lib/specinfra/command/solaris/base/ipfilter.rb +4 -2
  71. data/lib/specinfra/command/solaris/base/ipnat.rb +5 -3
  72. data/lib/specinfra/command/solaris/base/package.rb +7 -5
  73. data/lib/specinfra/command/solaris/base/port.rb +9 -7
  74. data/lib/specinfra/command/solaris/base/service.rb +14 -13
  75. data/lib/specinfra/command/solaris/base/user.rb +10 -8
  76. data/lib/specinfra/command/solaris/base/zfs.rb +3 -1
  77. data/lib/specinfra/command/solaris/v10/file.rb +33 -31
  78. data/lib/specinfra/command/solaris/v10/group.rb +4 -2
  79. data/lib/specinfra/command/solaris/v10/host.rb +9 -7
  80. data/lib/specinfra/command/solaris/v10/package.rb +7 -5
  81. data/lib/specinfra/command/solaris/v10/user.rb +8 -6
  82. data/lib/specinfra/command/suse/base/package.rb +14 -12
  83. data/lib/specinfra/command/suse/base/service.rb +4 -2
  84. data/lib/specinfra/command/ubuntu/base/ppa.rb +11 -9
  85. data/lib/specinfra/command/ubuntu/base/service.rb +4 -2
  86. data/lib/specinfra/command/windows/base.rb +11 -10
  87. data/lib/specinfra/command/windows/base/feature.rb +11 -9
  88. data/lib/specinfra/command/windows/base/file.rb +72 -71
  89. data/lib/specinfra/command/windows/base/group.rb +7 -5
  90. data/lib/specinfra/command/windows/base/host.rb +18 -16
  91. data/lib/specinfra/command/windows/base/hot_fix.rb +13 -11
  92. data/lib/specinfra/command/windows/base/iis_app_pool.rb +11 -9
  93. data/lib/specinfra/command/windows/base/iis_website.rb +26 -24
  94. data/lib/specinfra/command/windows/base/package.rb +7 -5
  95. data/lib/specinfra/command/windows/base/port.rb +11 -9
  96. data/lib/specinfra/command/windows/base/process.rb +5 -3
  97. data/lib/specinfra/command/windows/base/registry_key.rb +36 -35
  98. data/lib/specinfra/command/windows/base/scheduled_task.rb +6 -4
  99. data/lib/specinfra/command/windows/base/service.rb +21 -19
  100. data/lib/specinfra/command/windows/base/user.rb +16 -14
  101. data/lib/specinfra/runner.rb +1 -2
  102. data/lib/specinfra/version.rb +1 -1
  103. data/spec/command/base_spec.rb +12 -4
  104. data/spec/command/module/systemd_spec.rb +14 -4
  105. data/spec/command/redhat/interface_spec.rb +1 -1
  106. metadata +1 -2
  107. data/lib/specinfra/command/smartos/tmp.rb +0 -8
@@ -1,22 +1,24 @@
1
1
  class Specinfra::Command::Debian::Base::Package < Specinfra::Command::Linux::Base::Package
2
- def check_is_installed(package, version=nil)
3
- escaped_package = escape(package)
4
- if version
5
- cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{escape(version)}$'"
6
- else
7
- cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep -E '^(install|hold) ok installed$'"
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ escaped_package = escape(package)
5
+ if version
6
+ cmd = "dpkg-query -f '${Status} ${Version}' -W #{escaped_package} | grep -E '^(install|hold) ok installed #{escape(version)}$'"
7
+ else
8
+ cmd = "dpkg-query -f '${Status}' -W #{escaped_package} | grep -E '^(install|hold) ok installed$'"
9
+ end
10
+ cmd
8
11
  end
9
- cmd
10
- end
11
12
 
12
- alias :check_is_installed_by_apt :check_is_installed
13
+ alias :check_is_installed_by_apt :check_is_installed
13
14
 
14
- def install(package)
15
- "apt-get -y install #{package}"
16
- end
15
+ def install(package)
16
+ "apt-get -y install #{package}"
17
+ end
17
18
 
18
- def get_version(package, opts=nil)
19
- "dpkg-query -f '${Status} ${Version}' -W #{package} | sed -n 's/^install ok installed //p'"
19
+ def get_version(package, opts=nil)
20
+ "dpkg-query -f '${Status} ${Version}' -W #{package} | sed -n 's/^install ok installed //p'"
21
+ end
20
22
  end
21
23
  end
22
24
 
@@ -1,6 +1,8 @@
1
1
  class Specinfra::Command::Debian::Base::Service < Specinfra::Command::Linux::Base::Service
2
- def check_is_enabled(service, level=3)
3
- # Until everything uses Upstart, this needs an OR.
4
- "ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}' || grep 'start on' /etc/init/#{escape(service)}.conf"
2
+ class << self
3
+ def check_is_enabled(service, level=3)
4
+ # Until everything uses Upstart, this needs an OR.
5
+ "ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}' || grep 'start on' /etc/init/#{escape(service)}.conf"
6
+ end
5
7
  end
6
8
  end
@@ -1,10 +1,11 @@
1
1
  class Specinfra::Command::Fedora::Base::Service < Specinfra::Command::Redhat::Base::Service
2
- def self.create
3
- if os[:release].to_i < 15
4
- self.new
5
- else
6
- Specinfra::Command::Fedora::V15::Service.new
2
+ class << self
3
+ def create
4
+ if os[:release].to_i < 15
5
+ self
6
+ else
7
+ Specinfra::Command::Fedora::V15::Service
8
+ end
7
9
  end
8
10
  end
9
11
  end
10
-
@@ -1,3 +1,5 @@
1
1
  class Specinfra::Command::Fedora::V15::Service < Specinfra::Command::Fedora::Base::Service
2
- include Specinfra::Command::Module::Systemd
2
+ class << self
3
+ include Specinfra::Command::Module::Systemd
4
+ end
3
5
  end
@@ -1,10 +1,12 @@
1
1
  class Specinfra::Command::Freebsd::Base::File < Specinfra::Command::Base::File
2
- def check_has_mode(file, mode)
3
- regexp = "^#{mode}$"
4
- "stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}"
5
- end
2
+ class << self
3
+ def check_has_mode(file, mode)
4
+ regexp = "^#{mode}$"
5
+ "stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}"
6
+ end
6
7
 
7
- def get_mode(file)
8
- "stat -f%Lp #{escape(file)}"
8
+ def get_mode(file)
9
+ "stat -f%Lp #{escape(file)}"
10
+ end
9
11
  end
10
12
  end
@@ -1,17 +1,19 @@
1
1
  class Specinfra::Command::Freebsd::Base::Package < Specinfra::Command::Base::Package
2
- def check_is_installed(package, version=nil)
3
- if version
4
- "pkg_info -I #{escape(package)}-#{escape(version)}"
5
- else
6
- "pkg_info -Ix #{escape(package)}"
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ if version
5
+ "pkg_info -I #{escape(package)}-#{escape(version)}"
6
+ else
7
+ "pkg_info -Ix #{escape(package)}"
8
+ end
7
9
  end
8
- end
9
10
 
10
- def install(package)
11
- "pkg_add -r install #{package}"
12
- end
11
+ def install(package)
12
+ "pkg_add -r install #{package}"
13
+ end
13
14
 
14
- def get_version(package, opts=nil)
15
- "pkg_info -Ix #{escape(package)} | cut -f 1 -w | sed -n 's/^#{escape(package)}-//p'"
15
+ def get_version(package, opts=nil)
16
+ "pkg_info -Ix #{escape(package)} | cut -f 1 -w | sed -n 's/^#{escape(package)}-//p'"
17
+ end
16
18
  end
17
19
  end
@@ -1,6 +1,8 @@
1
1
  class Specinfra::Command::Freebsd::Base::Port < Specinfra::Command::Base::Port
2
- def check_is_listening(port, options={})
3
- regexp = ":#{port} "
4
- "sockstat -46l -p #{port} | grep -- #{escape(regexp)}"
2
+ class << self
3
+ def check_is_listening(port, options={})
4
+ regexp = ":#{port} "
5
+ "sockstat -46l -p #{port} | grep -- #{escape(regexp)}"
6
+ end
5
7
  end
6
8
  end
@@ -1,5 +1,7 @@
1
1
  class Specinfra::Command::Freebsd::Base::Service < Specinfra::Command::Base::Service
2
- def check_is_enabled(service, level=3)
3
- "service -e | grep -- #{escape(service)}"
2
+ class << self
3
+ def check_is_enabled(service, level=3)
4
+ "service -e | grep -- #{escape(service)}"
5
+ end
4
6
  end
5
7
  end
@@ -1,17 +1,19 @@
1
1
  class Specinfra::Command::Freebsd::V10::Package < Specinfra::Command::Freebsd::Base::Package
2
- def check_is_installed(package, version=nil)
3
- if version
4
- "pkg query %v #{escape(package)} | grep -- #{escape(version)}"
5
- else
6
- "pkg info #{escape(package)}"
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ if version
5
+ "pkg query %v #{escape(package)} | grep -- #{escape(version)}"
6
+ else
7
+ "pkg info #{escape(package)}"
8
+ end
7
9
  end
8
- end
9
10
 
10
- def install(package)
11
- "pkg install -y #{package}"
12
- end
11
+ def install(package)
12
+ "pkg install -y #{package}"
13
+ end
13
14
 
14
- def get_version(package, opts=nil)
15
- "pkg query %v #{escape(package)}"
15
+ def get_version(package, opts=nil)
16
+ "pkg query %v #{escape(package)}"
17
+ end
16
18
  end
17
19
  end
@@ -1,5 +1,7 @@
1
1
  class Specinfra::Command::Gentoo::Base::Package < Specinfra::Command::Linux::Base::Package
2
- def check_is_installed(package, version=nil)
3
- "eix #{escape(package)} --installed"
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ "eix #{escape(package)} --installed"
5
+ end
4
6
  end
5
7
  end
@@ -1,11 +1,13 @@
1
1
  class Specinfra::Command::Gentoo::Base::Service < Specinfra::Command::Linux::Base::Service
2
- def check_is_enabled(service, level=3)
3
- regexp = "^\\s*#{service}\\s*|\\s*\\(boot\\|default\\)"
4
- "rc-update show | grep -- #{escape(regexp)}"
5
- end
6
-
7
- def check_is_running(service)
8
- "/etc/init.d/#{escape(service)} status"
2
+ class << self
3
+ def check_is_enabled(service, level=3)
4
+ regexp = "^\\s*#{service}\\s*|\\s*\\(boot\\|default\\)"
5
+ "rc-update show | grep -- #{escape(regexp)}"
6
+ end
7
+
8
+ def check_is_running(service)
9
+ "/etc/init.d/#{escape(service)} status"
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -1,13 +1,15 @@
1
1
  class Specinfra::Command::Linux::Base::File < Specinfra::Command::Base::File
2
- def check_is_accessible_by_user(file, user, access)
3
- "su -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
4
- end
2
+ class << self
3
+ def check_is_accessible_by_user(file, user, access)
4
+ "su -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
5
+ end
5
6
 
6
- def check_is_immutable(file)
7
- check_attribute(file, 'i')
8
- end
7
+ def check_is_immutable(file)
8
+ check_attribute(file, 'i')
9
+ end
9
10
 
10
- def check_attribute(file, attribute)
11
- "lsattr -d #{escape(file)} 2>&1 | awk '$1~/^-*#{escape(attribute)}-*$/ {exit 0} {exit 1}'"
11
+ def check_attribute(file, attribute)
12
+ "lsattr -d #{escape(file)} 2>&1 | awk '$1~/^-*#{escape(attribute)}-*$/ {exit 0} {exit 1}'"
13
+ end
12
14
  end
13
15
  end
@@ -1,17 +1,19 @@
1
1
  class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Interface
2
- def get_speed_of(name)
3
- "ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'"
4
- end
2
+ class << self
3
+ def get_speed_of(name)
4
+ "ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'"
5
+ end
5
6
 
6
- def check_has_ipv4_address(interface, ip_address)
7
- ip_address = ip_address.dup
8
- if ip_address =~ /\/\d+$/
9
- ip_address << " "
10
- else
11
- ip_address << "/"
7
+ def check_has_ipv4_address(interface, ip_address)
8
+ ip_address = ip_address.dup
9
+ if ip_address =~ /\/\d+$/
10
+ ip_address << " "
11
+ else
12
+ ip_address << "/"
13
+ end
14
+ ip_address.gsub!(".", "\\.")
15
+ "ip addr show #{interface} | grep 'inet #{ip_address}'"
12
16
  end
13
- ip_address.gsub!(".", "\\.")
14
- "ip addr show #{interface} | grep 'inet #{ip_address}'"
15
17
  end
16
18
  end
17
19
 
@@ -1,10 +1,12 @@
1
1
  class Specinfra::Command::Linux::Base::Iptables < Specinfra::Command::Base::Iptables
2
- def check_has_rule(rule, table=nil, chain=nil)
3
- cmd = "iptables"
4
- cmd += " -t #{escape(table)}" if table
5
- cmd += " -S"
6
- cmd += " #{escape(chain)}" if chain
7
- cmd += " | grep -- #{escape(rule)}"
8
- cmd
2
+ class << self
3
+ def check_has_rule(rule, table=nil, chain=nil)
4
+ cmd = "iptables"
5
+ cmd += " -t #{escape(table)}" if table
6
+ cmd += " -S"
7
+ cmd += " #{escape(chain)}" if chain
8
+ cmd += " | grep -- #{escape(rule)}"
9
+ cmd
10
+ end
9
11
  end
10
12
  end
@@ -1,5 +1,7 @@
1
1
  class Specinfra::Command::Linux::Base::KernelModule < Specinfra::Command::Base::KernelModule
2
- def check_is_loaded(name)
3
- "lsmod | grep ^#{name}"
2
+ class << self
3
+ def check_is_loaded(name)
4
+ "lsmod | grep ^#{name}"
5
+ end
4
6
  end
5
7
  end
@@ -1,9 +1,11 @@
1
1
  class Specinfra::Command::Linux::Base::LxcContainer < Specinfra::Command::Base::LxcContainer
2
- def check_exists(container)
3
- "lxc-ls -1 | grep -w #{escape(container)}"
4
- end
2
+ class << self
3
+ def check_exists(container)
4
+ "lxc-ls -1 | grep -w #{escape(container)}"
5
+ end
5
6
 
6
- def check_is_running(container)
7
- "lxc-info -n #{escape(container)} -s | grep -w RUNNING"
7
+ def check_is_running(container)
8
+ "lxc-info -n #{escape(container)} -s | grep -w RUNNING"
9
+ end
8
10
  end
9
11
  end
@@ -1,11 +1,13 @@
1
1
  class Specinfra::Command::Linux::Base::Selinux < Specinfra::Command::Base::Selinux
2
- def check_has_mode(mode)
3
- cmd = ""
4
- cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled"
5
- cmd += "getenforce | grep -i -- #{escape(mode)} "
6
- cmd += "&& grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
7
- cmd += ")" if mode == "disabled"
8
- cmd
2
+ class << self
3
+ def check_has_mode(mode)
4
+ cmd = ""
5
+ cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled"
6
+ cmd += "getenforce | grep -i -- #{escape(mode)} "
7
+ cmd += "&& grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
8
+ cmd += ")" if mode == "disabled"
9
+ cmd
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -1,3 +1,5 @@
1
1
  class Specinfra::Command::Linux::Base::Zfs < Specinfra::Command::Base::Zfs
2
- include Specinfra::Command::Module::Zfs
2
+ class << self
3
+ include Specinfra::Command::Module::Zfs
4
+ end
3
5
  end
@@ -1,15 +1,17 @@
1
1
  class Specinfra::Command::Nixos::Base::Package < Specinfra::Command::Linux::Base::Package
2
- def check_is_installed(package, version=nil)
3
- if version
4
- "nix-store -q --references /var/run/current-system/sw | grep #{escape(package)}-#{escape(version)}"
5
- else
6
- "nix-store -q --references /var/run/current-system/sw | grep #{escape(package)}"
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ if version
5
+ "nix-store -q --references /var/run/current-system/sw | grep #{escape(package)}-#{escape(version)}"
6
+ else
7
+ "nix-store -q --references /var/run/current-system/sw | grep #{escape(package)}"
8
+ end
7
9
  end
8
- end
9
10
 
10
- alias :check_is_installed_by_nix :check_is_installed
11
+ alias :check_is_installed_by_nix :check_is_installed
11
12
 
12
- def install(package)
13
- "nix-env -i #{package}"
14
- end
13
+ def install(package)
14
+ "nix-env -i #{package}"
15
+ end
16
+ end
15
17
  end
@@ -1,3 +1,5 @@
1
1
  class Specinfra::Command::Nixos::Base::Service < Specinfra::Command::Linux::Base::Service
2
- include Specinfra::Command::Module::Systemd
2
+ class << self
3
+ include Specinfra::Command::Module::Systemd
4
+ end
3
5
  end
@@ -1,39 +1,41 @@
1
1
  class Specinfra::Command::Openbsd::Base::File < Specinfra::Command::Base::File
2
- def check_has_md5checksum(file, expected)
3
- regexp = "^#{expected}"
4
- "cksum -qa md5 #{escape(file)} | grep -w #{escape(regexp)}"
5
- end
2
+ class << self
3
+ def check_has_md5checksum(file, expected)
4
+ regexp = "^#{expected}"
5
+ "cksum -qa md5 #{escape(file)} | grep -w #{escape(regexp)}"
6
+ end
6
7
 
7
- def check_has_sha256checksum(file, expected)
8
- regexp = "^#{expected}"
9
- "cksum -qa sha256 #{escape(file)} | grep -w #{escape(regexp)}"
10
- end
8
+ def check_has_sha256checksum(file, expected)
9
+ regexp = "^#{expected}"
10
+ "cksum -qa sha256 #{escape(file)} | grep -w #{escape(regexp)}"
11
+ end
11
12
 
12
- def check_is_linked_to(link, target)
13
- "stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
14
- end
13
+ def check_is_linked_to(link, target)
14
+ "stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
15
+ end
15
16
 
16
- def check_has_mode(file, mode)
17
- regexp = "^#{mode}$"
18
- "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
19
- end
17
+ def check_has_mode(file, mode)
18
+ regexp = "^#{mode}$"
19
+ "stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
20
+ end
20
21
 
21
- def check_is_owned_by(file, owner)
22
- regexp = "^#{owner}$"
23
- "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
24
- end
22
+ def check_is_owned_by(file, owner)
23
+ regexp = "^#{owner}$"
24
+ "stat -f %Su #{escape(file)} | grep -- #{escape(regexp)}"
25
+ end
25
26
 
26
- def check_is_grouped(file, group)
27
- regexp = "^#{group}$"
28
- "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
29
- end
27
+ def check_is_grouped(file, group)
28
+ regexp = "^#{group}$"
29
+ "stat -f %Sg #{escape(file)} | grep -- #{escape(regexp)}"
30
+ end
30
31
 
31
- def check_is_mounted(path)
32
- regexp = "on #{path} "
33
- "mount | grep #{escape(regexp)}"
34
- end
32
+ def check_is_mounted(path)
33
+ regexp = "on #{path} "
34
+ "mount | grep #{escape(regexp)}"
35
+ end
35
36
 
36
- def get_mode(file)
37
- "stat -f%Lp #{escape(file)}"
37
+ def get_mode(file)
38
+ "stat -f%Lp #{escape(file)}"
39
+ end
38
40
  end
39
41
  end