specinfra 2.0.0.beta42 → 2.0.0.beta43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ce10ce518d56b4792e183aaba73a154413af76b
4
- data.tar.gz: 434a2c4affa297c0cc0e44a9a800922d7c48599c
3
+ metadata.gz: a06b77b911ce755c1986e00e888fe05daba5f26a
4
+ data.tar.gz: 254bfa7133035990605a1de17e1fa50875903bc7
5
5
  SHA512:
6
- metadata.gz: 9447f91943ff1390a4a947d2459c921c0ab1705f2328da3152cf0ef9757512d339f5c4080ac9144220373ead8e68d98be4ba4f2b7c6208135ca58e6238ff29f5
7
- data.tar.gz: bacc3ae0e859cfb985845866fd7d28a4766358550d3d7f074c0397e65724e2d96883550d2f36d8f7c23505ab2d70213127ab1989b55585c5f0656284c37fda4b
6
+ metadata.gz: 207c342c8bed16c798138c5123084bbf188de49372dc2ff6247798daa954da5ac152514c0ae68b1337e20801ef07110a9a06b8d3da213afa54c5b93e0da9d7ea
7
+ data.tar.gz: f43b065d0ec5f6126e04e50089dcdd19b74c3ea343acf325c19fde9976878b8f4ac2ba5b26f27282ff9abed8c07d00c5ee6b10bd633f9d9aa0fa001e30ec8d51
@@ -74,7 +74,7 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
74
74
 
75
75
  def check_is_mounted(path)
76
76
  regexp = "on #{path} "
77
- "mount | grep -w -- #{escape(regexp)}"
77
+ "mount | grep -- '#{escape(regexp)}'"
78
78
  end
79
79
 
80
80
  def get_mode(file)
@@ -93,6 +93,14 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
93
93
  "stat -c %N #{escape(link)} | egrep -e \"-> .#{escape(target)}.\""
94
94
  end
95
95
 
96
+ def check_is_link(link)
97
+ "test -L #{escape(link)}"
98
+ end
99
+
100
+ def get_link_target(link)
101
+ "readlink -f #{escape(link)}"
102
+ end
103
+
96
104
  def get_mtime(file)
97
105
  "stat -c %Y #{escape(file)}"
98
106
  end
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.0.0.beta42"
2
+ VERSION = "2.0.0.beta43"
3
3
  end
@@ -2,52 +2,55 @@ require 'spec_helper'
2
2
 
3
3
  set :os, { :family => nil }
4
4
 
5
- describe 'File related commands' do
6
- after do
7
- property[:os_by_host] = nil
8
- end
5
+ describe get_command(:check_file_is_directory, '/tmp') do
6
+ it { should eq 'test -d /tmp' }
7
+ end
9
8
 
10
- context get_command(:check_file_is_directory, '/tmp') do
11
- it { should eq 'test -d /tmp' }
12
- end
9
+ describe get_command(:change_file_mode, '/tmp', '0644') do
10
+ it { should eq 'chmod 0644 /tmp' }
11
+ end
13
12
 
14
- context get_command(:change_file_mode, '/tmp', '0644') do
15
- it { should eq 'chmod 0644 /tmp' }
16
- end
13
+ describe get_command(:change_file_owner, '/tmp', 'root') do
14
+ it { should eq 'chown root /tmp' }
15
+ end
17
16
 
18
- context get_command(:change_file_owner, '/tmp', 'root') do
19
- it { should eq 'chown root /tmp' }
20
- end
17
+ describe get_command(:change_file_owner, '/tmp', 'root', 'root') do
18
+ it { should eq 'chown root:root /tmp' }
19
+ end
21
20
 
22
- context get_command(:change_file_owner, '/tmp', 'root', 'root') do
23
- it { should eq 'chown root:root /tmp' }
24
- end
21
+ describe get_command(:change_file_group, '/tmp', 'root') do
22
+ it { should eq 'chgrp root /tmp' }
23
+ end
24
+
25
+ describe get_command(:create_file_as_directory, '/tmp') do
26
+ it { should eq 'mkdir -p /tmp' }
27
+ end
25
28
 
26
- context get_command(:change_file_group, '/tmp', 'root') do
27
- it { should eq 'chgrp root /tmp' }
28
- end
29
+ describe get_command(:get_file_owner_user, '/tmp') do
30
+ it { should eq 'stat -c %U /tmp' }
31
+ end
29
32
 
30
- context get_command(:create_file_as_directory, '/tmp') do
31
- it { should eq 'mkdir -p /tmp' }
32
- end
33
+ describe get_command(:get_file_owner_group, '/tmp') do
34
+ it { should eq 'stat -c %G /tmp' }
35
+ end
33
36
 
34
- context get_command(:get_file_owner_user, '/tmp') do
35
- it { should eq 'stat -c %U /tmp' }
36
- end
37
+ describe get_command(:move_file, '/src', '/dest') do
38
+ it { should eq 'mv /src /dest' }
39
+ end
37
40
 
38
- context get_command(:get_file_owner_group, '/tmp') do
39
- it { should eq 'stat -c %G /tmp' }
40
- end
41
+ describe get_command(:link_file_to, '/link', '/target') do
42
+ it { should eq 'ln -s /target /link' }
43
+ end
41
44
 
42
- context get_command(:move_file, '/src', '/dest') do
43
- it { should eq 'mv /src /dest' }
44
- end
45
+ describe get_command(:remove_file, '/tmp') do
46
+ it { should eq 'rm -rf /tmp' }
47
+ end
45
48
 
46
- context get_command(:link_file_to, '/link', '/target') do
47
- it { should eq 'ln -s /target /link' }
48
- end
49
+ describe get_command(:check_file_is_link, '/tmp') do
50
+ it { should eq 'test -L /tmp' }
51
+ end
49
52
 
50
- context get_command(:remove_file, '/tmp') do
51
- it { should eq 'rm -rf /tmp' }
52
- end
53
+ describe get_command(:get_file_link_target, '/tmp') do
54
+ it { should eq 'readlink -f /tmp' }
53
55
  end
56
+
@@ -1,5 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
+ set :os, { :family => nil }
4
+
3
5
  describe get_command(:get_user_uid, 'foo') do
4
6
  it { should eq 'id -u foo' }
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta42
4
+ version: 2.0.0.beta43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh