Skip to content

Commit

Permalink
add quote for zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
linyows committed Aug 7, 2013
1 parent 3064033 commit 281e12c
Show file tree
Hide file tree
Showing 26 changed files with 77 additions and 77 deletions.
20 changes: 10 additions & 10 deletions lib/serverspec/commands/base.rb
Expand Up @@ -79,7 +79,7 @@ def check_listening(port)

def check_listening_with_protocol(port, protocol)
regexp = "^#{protocol} .*:#{port} "
"netstat -tunl | grep -- #{escape(regexp)}"
"netstat -tunl | grep -- '#{escape(regexp)}'"
end

def check_running(service)
Expand Down Expand Up @@ -111,11 +111,11 @@ def check_file_contain(file, expected_pattern)
end

def check_file_md5checksum(file, expected)
"md5sum #{escape(file)} | grep -iw -- ^#{escape(expected)}"
"md5sum #{escape(file)} | grep -iw -- '^#{escape(expected)}'"
end

def check_file_sha256checksum(file, expected)
"sha256sum #{escape(file)} | grep -iw -- ^#{escape(expected)}"
"sha256sum #{escape(file)} | grep -iw -- '^#{escape(expected)}'"
end

def check_file_contain_within(file, expected_pattern, from=nil, to=nil)
Expand All @@ -127,17 +127,17 @@ def check_file_contain_within(file, expected_pattern, from=nil, to=nil)

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

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

def check_grouped(file, group)
regexp = "^#{group}$"
"stat -c %G #{escape(file)} | grep -- #{escape(regexp)}"
"stat -c %G #{escape(file)} | grep -- '#{escape(regexp)}'"
end

def check_cron_entry(user, entry)
Expand All @@ -154,7 +154,7 @@ def check_link(link, target)
end

def check_installed_by_gem(name, version=nil)
cmd = "gem list --local | grep -w -- ^#{escape(name)}"
cmd = "gem list --local | grep -w -- '^#{escape(name)}'"
if ! version.nil?
cmd = "#{cmd} | grep -w -- #{escape(version)}"
end
Expand All @@ -168,7 +168,7 @@ def check_installed_by_npm(name, version=nil)
end

def check_installed_by_pecl(name, version=nil)
cmd = "pecl list | grep -w -- ^#{escape(name)}"
cmd = "pecl list | grep -w -- '^#{escape(name)}'"
if ! version.nil?
cmd = "#{cmd} | grep -w -- #{escape(version)}"
end
Expand All @@ -181,12 +181,12 @@ def check_belonging_group(user, group)

def check_gid(group, gid)
regexp = "^#{group}"
"getent group | grep -w -- #{escape(regexp)} | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
"getent group | grep -w -- '#{escape(regexp)}' | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
end

def check_uid(user, uid)
regexp = "^uid=#{uid}("
"id #{escape(user)} | grep -- #{escape(regexp)}"
"id #{escape(user)} | grep -- '#{escape(regexp)}'"
end

def check_login_shell(user, path_to_shell)
Expand Down
2 changes: 1 addition & 1 deletion spec/darwin/group_spec.rb
Expand Up @@ -13,7 +13,7 @@

describe group('root') do
it { should have_gid 0 }
its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
its(:command) { should eq "getent group | grep -w -- '\\^root' | cut -f 3 -d ':' | grep -w -- 0" }
end

describe group('root') do
Expand Down
8 changes: 4 additions & 4 deletions spec/darwin/package_spec.rb
Expand Up @@ -4,7 +4,7 @@

describe package('jekyll') do
it { should be_installed.by('gem') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll'" }
end

describe package('invalid-gem') do
Expand All @@ -13,7 +13,7 @@

describe package('jekyll') do
it { should be_installed.by('gem').with_version('1.1.1') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll | grep -w -- 1.1.1" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll' | grep -w -- 1.1.1" }
end

describe package('jekyll') do
Expand Down Expand Up @@ -41,7 +41,7 @@

describe package('mongo') do
it { should be_installed.by('pecl') }
its(:command) { should eq "pecl list | grep -w -- ^mongo" }
its(:command) { should eq "pecl list | grep -w -- '^mongo'" }
end

describe package('invalid-pecl') do
Expand All @@ -50,7 +50,7 @@

describe package('mongo') do
it { should be_installed.by('pecl').with_version('1.4.1') }
its(:command) { should eq "pecl list | grep -w -- ^mongo | grep -w -- 1.4.1" }
its(:command) { should eq "pecl list | grep -w -- '^mongo' | grep -w -- 1.4.1" }
end

describe package('mongo') do
Expand Down
4 changes: 2 additions & 2 deletions spec/darwin/port_spec.rb
Expand Up @@ -13,12 +13,12 @@

describe port(80) do
it { should be_listening.with("tcp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^tcp\\ .\\*:80\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^tcp\\ .\\*:80\\ \'' }
end

describe port(123) do
it { should be_listening.with("udp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^udp\\ .\\*:123\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^udp\\ .\\*:123\\ \'' }
end

describe port(80) do
Expand Down
2 changes: 1 addition & 1 deletion spec/darwin/user_spec.rb
Expand Up @@ -22,7 +22,7 @@

describe user('root') do
it { should have_uid 0 }
its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
its(:command) { should eq "id root | grep -- '\\^uid\\=0\\('" }
end

describe user('root') do
Expand Down
10 changes: 5 additions & 5 deletions spec/debian/file_spec.rb
Expand Up @@ -67,7 +67,7 @@

describe file('/etc/passwd') do
it { should be_mode 644 }
its(:command) { should eq "stat -c %a /etc/passwd | grep -- \\^644\\$" }
its(:command) { should eq "stat -c %a /etc/passwd | grep -- '\\^644\\$'" }
end

describe file('/etc/passwd') do
Expand All @@ -76,7 +76,7 @@

describe file('/etc/passwd') do
it { should be_owned_by 'root' }
its(:command) { should eq "stat -c %U /etc/passwd | grep -- \\^root\\$" }
its(:command) { should eq "stat -c %U /etc/passwd | grep -- '\\^root\\$'" }
end

describe file('/etc/passwd') do
Expand All @@ -85,7 +85,7 @@

describe file('/etc/passwd') do
it { should be_grouped_into 'root' }
its(:command) { should eq "stat -c %G /etc/passwd | grep -- \\^root\\$" }
its(:command) { should eq "stat -c %G /etc/passwd | grep -- '\\^root\\$'" }
end

describe file('/etc/passwd') do
Expand Down Expand Up @@ -373,7 +373,7 @@

describe file('/etc/services') do
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
its(:command) { should eq "md5sum /etc/services | grep -iw -- ^35435ea447c19f0ea5ef971837ab9ced" }
its(:command) { should eq "md5sum /etc/services | grep -iw -- '^35435ea447c19f0ea5ef971837ab9ced'" }
end

describe file('invalid-file') do
Expand All @@ -382,7 +382,7 @@

describe file('/etc/services') do
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
its(:command) { should eq "sha256sum /etc/services | grep -iw -- ^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
its(:command) { should eq "sha256sum /etc/services | grep -iw -- '^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a'" }
end

describe file('invalid-file') do
Expand Down
2 changes: 1 addition & 1 deletion spec/debian/group_spec.rb
Expand Up @@ -13,7 +13,7 @@

describe group('root') do
it { should have_gid 0 }
its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
its(:command) { should eq "getent group | grep -w -- '\\^root' | cut -f 3 -d ':' | grep -w -- 0" }
end

describe group('root') do
Expand Down
8 changes: 4 additions & 4 deletions spec/debian/package_spec.rb
Expand Up @@ -13,7 +13,7 @@

describe package('jekyll') do
it { should be_installed.by('gem') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll'" }
end

describe package('invalid-gem') do
Expand All @@ -22,7 +22,7 @@

describe package('jekyll') do
it { should be_installed.by('gem').with_version('1.1.1') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll | grep -w -- 1.1.1" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll' | grep -w -- 1.1.1" }
end

describe package('jekyll') do
Expand Down Expand Up @@ -50,7 +50,7 @@

describe package('mongo') do
it { should be_installed.by('pecl') }
its(:command) { should eq "pecl list | grep -w -- ^mongo" }
its(:command) { should eq "pecl list | grep -w -- '^mongo'" }
end

describe package('invalid-pecl') do
Expand All @@ -59,7 +59,7 @@

describe package('mongo') do
it { should be_installed.by('pecl').with_version('1.4.1') }
its(:command) { should eq "pecl list | grep -w -- ^mongo | grep -w -- 1.4.1" }
its(:command) { should eq "pecl list | grep -w -- '^mongo' | grep -w -- 1.4.1" }
end

describe package('mongo') do
Expand Down
4 changes: 2 additions & 2 deletions spec/debian/port_spec.rb
Expand Up @@ -13,12 +13,12 @@

describe port(80) do
it { should be_listening.with("tcp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^tcp\\ .\\*:80\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^tcp\\ .\\*:80\\ \'' }
end

describe port(123) do
it { should be_listening.with("udp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^udp\\ .\\*:123\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^udp\\ .\\*:123\\ \'' }
end

describe port(80) do
Expand Down
2 changes: 1 addition & 1 deletion spec/debian/user_spec.rb
Expand Up @@ -22,7 +22,7 @@

describe user('root') do
it { should have_uid 0 }
its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
its(:command) { should eq "id root | grep -- '\\^uid\\=0\\('" }
end

describe user('root') do
Expand Down
10 changes: 5 additions & 5 deletions spec/gentoo/file_spec.rb
Expand Up @@ -67,7 +67,7 @@

describe file('/etc/passwd') do
it { should be_mode 644 }
its(:command) { should eq "stat -c %a /etc/passwd | grep -- \\^644\\$" }
its(:command) { should eq "stat -c %a /etc/passwd | grep -- '\\^644\\$'" }
end

describe file('/etc/passwd') do
Expand All @@ -76,7 +76,7 @@

describe file('/etc/passwd') do
it { should be_owned_by 'root' }
its(:command) { should eq "stat -c %U /etc/passwd | grep -- \\^root\\$" }
its(:command) { should eq "stat -c %U /etc/passwd | grep -- '\\^root\\$'" }
end

describe file('/etc/passwd') do
Expand All @@ -85,7 +85,7 @@

describe file('/etc/passwd') do
it { should be_grouped_into 'root' }
its(:command) { should eq "stat -c %G /etc/passwd | grep -- \\^root\\$" }
its(:command) { should eq "stat -c %G /etc/passwd | grep -- '\\^root\\$'" }
end

describe file('/etc/passwd') do
Expand Down Expand Up @@ -373,7 +373,7 @@

describe file('/etc/services') do
it { should match_md5checksum '35435ea447c19f0ea5ef971837ab9ced' }
its(:command) { should eq "md5sum /etc/services | grep -iw -- ^35435ea447c19f0ea5ef971837ab9ced" }
its(:command) { should eq "md5sum /etc/services | grep -iw -- '^35435ea447c19f0ea5ef971837ab9ced'" }
end

describe file('invalid-file') do
Expand All @@ -382,7 +382,7 @@

describe file('/etc/services') do
it { should match_sha256checksum '0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a' }
its(:command) { should eq "sha256sum /etc/services | grep -iw -- ^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a" }
its(:command) { should eq "sha256sum /etc/services | grep -iw -- '^0c3feee1353a8459f8c7d84885e6bc602ef853751ffdbce3e3b6dfa1d345fc7a'" }
end

describe file('invalid-file') do
Expand Down
2 changes: 1 addition & 1 deletion spec/gentoo/group_spec.rb
Expand Up @@ -13,7 +13,7 @@

describe group('root') do
it { should have_gid 0 }
its(:command) { should eq "getent group | grep -w -- \\^root | cut -f 3 -d ':' | grep -w -- 0" }
its(:command) { should eq "getent group | grep -w -- '\\^root' | cut -f 3 -d ':' | grep -w -- 0" }
end

describe group('root') do
Expand Down
8 changes: 4 additions & 4 deletions spec/gentoo/package_spec.rb
Expand Up @@ -13,7 +13,7 @@

describe package('jekyll') do
it { should be_installed.by('gem') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll'" }
end

describe package('invalid-gem') do
Expand All @@ -22,7 +22,7 @@

describe package('jekyll') do
it { should be_installed.by('gem').with_version('1.1.1') }
its(:command) { should eq "gem list --local | grep -w -- ^jekyll | grep -w -- 1.1.1" }
its(:command) { should eq "gem list --local | grep -w -- '^jekyll' | grep -w -- 1.1.1" }
end

describe package('jekyll') do
Expand Down Expand Up @@ -50,7 +50,7 @@

describe package('mongo') do
it { should be_installed.by('pecl') }
its(:command) { should eq "pecl list | grep -w -- ^mongo" }
its(:command) { should eq "pecl list | grep -w -- '^mongo'" }
end

describe package('invalid-pecl') do
Expand All @@ -59,7 +59,7 @@

describe package('mongo') do
it { should be_installed.by('pecl').with_version('1.4.1') }
its(:command) { should eq "pecl list | grep -w -- ^mongo | grep -w -- 1.4.1" }
its(:command) { should eq "pecl list | grep -w -- '^mongo' | grep -w -- 1.4.1" }
end

describe package('mongo') do
Expand Down
4 changes: 2 additions & 2 deletions spec/gentoo/port_spec.rb
Expand Up @@ -13,12 +13,12 @@

describe port(80) do
it { should be_listening.with("tcp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^tcp\\ .\\*:80\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^tcp\\ .\\*:80\\ \'' }
end

describe port(123) do
it { should be_listening.with("udp") }
its(:command) { should eq 'netstat -tunl | grep -- \\^udp\\ .\\*:123\\ ' }
its(:command) { should eq 'netstat -tunl | grep -- \'\\^udp\\ .\\*:123\\ \'' }
end

describe port(80) do
Expand Down
2 changes: 1 addition & 1 deletion spec/gentoo/user_spec.rb
Expand Up @@ -22,7 +22,7 @@

describe user('root') do
it { should have_uid 0 }
its(:command) { should eq "id root | grep -- \\^uid\\=0\\(" }
its(:command) { should eq "id root | grep -- '\\^uid\\=0\\('" }
end

describe user('root') do
Expand Down

0 comments on commit 281e12c

Please sign in to comment.