serverspec-extended-types 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjhlYTA0NzY0NDE2NGRlOTJkMTcwNGQ3NTcwOTI3NTQwZWQ4OTE0ZQ==
4
+ N2QzMDBhYzA5MjU0M2RkOTA3MGU1ZTgxNDFlMzg3ZWE4YWQyOWQ2OQ==
5
5
  data.tar.gz: !binary |-
6
- MDNiOTI1NDg4NzRjY2RhNGQ0YjRjNmQ4OGY2ZTNlMmI4MmFkMjFlMQ==
6
+ OWYxYTE2NGM5NmExZWNhY2JlYWZjNmZhYThlNDdjZTFiMzM4YTZjNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NThiNGVmZTM5NWY5Y2EyMDNjMzg3ZmVkNWVjN2RhYTZhMzQwMmMzNzQxOGFi
10
- OGQwNDQ1ZTMyNWY5MGFiNTU0MWE5NWVkZDk1OWUzNTNjMDRiNDNkMDU1MjBi
11
- Njc5YWJkNjg3MzlmNWVjYjQzZTQ1Nzc0MjI3ZTgwZTc2ODVkNDQ=
9
+ NTk1ZTA4NzQ4NzQ4YTM0YmQ4MTE0ZTQ5ZTEwNjgxZThhNzExODk0MGM4MDg0
10
+ MjcyN2NkNDRhMTJlNmE1ZGE4YmUxNTJmZGE3NDY2ZjQyM2E0YmEyZDA0Nzlk
11
+ ZDE2YjEzYjJlMTVjNTU5YWUyN2YzNzIwZjBjMzFhZmJhYWFlZGM=
12
12
  data.tar.gz: !binary |-
13
- MDJkMjhlOWUyMDg3ZTczZTA4M2Q5ZGVjOGE5Y2Y0NzJiODNjYjE1M2NiMDI3
14
- ZDY3ODA4NzlkNzVmOTU2ZDVmNjAxZjg1OTUwYzVhOGU5ZWM0Yzk2MmIwODdk
15
- MWFkMjE3NjRhYzljOGE4MTdhZjYwNzhhOTIyMzNjMDE5ODYyZjE=
13
+ ZTczY2FlZTQxZWUxNDkwNDVmMzA3MjA4MmU2YzIxMzdjZTQ3ODFjZTg2ODYx
14
+ YWMxNzU4ODE2Y2UxMTE0NWY0NTE5MjhiNWQwYjJhOTAyYTE2NTcwNzdjYzk4
15
+ NzgxYTZhYWZmMmRkNDQ1YjBmZTQ0NTFjZWFlZTY2M2ZkYTJlNmY=
data/CHANGES.md CHANGED
@@ -3,3 +3,7 @@
3
3
  ## 0.0.1 2015-03-14 Jason Antman <jason@jasonantman.com>
4
4
 
5
5
  * Initial release with bitlbee, http_get and virtualenv types
6
+
7
+ ## 0.0.2 2015-03-14 Jason Antman <jason@jasonantman.com>
8
+
9
+ * Minor bugfix in Serverspec::Types::Virtualenv#virtualenv?
data/README.md CHANGED
@@ -217,9 +217,9 @@ Test whether this appears to be a working venv
217
217
 
218
218
  Tests performed:
219
219
 
220
- * venv_path/bin/pip executable by root?
221
- * venv_path/bin/python executable by root?
222
- * venv_path/bin/activate executable by root?
220
+ * venv_path/bin/pip executable by owner?
221
+ * venv_path/bin/python executable by owner?
222
+ * venv_path/bin/activate readable by owner?
223
223
  * 'export VIRTUAL_ENV' in venv_path/bin/activate?
224
224
 
225
225
  ## Contributing
@@ -1,3 +1,3 @@
1
1
  module ServerspecExtendedTypes
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -15,9 +15,9 @@ module Serverspec::Type
15
15
  # Test whether this appears to be a working venv
16
16
  #
17
17
  # Tests performed:
18
- # - venv_path/bin/pip executable by root?
19
- # - venv_path/bin/python executable by root?
20
- # - venv_path/bin/activate executable by root?
18
+ # - venv_path/bin/pip executable by owner?
19
+ # - venv_path/bin/python executable by owner?
20
+ # - venv_path/bin/activate readable by owner?
21
21
  # - 'export VIRTUAL_ENV' in venv_path/bin/activate?
22
22
  #
23
23
  # @example
@@ -32,9 +32,9 @@ module Serverspec::Type
32
32
  python_path = ::File.join(@name, 'bin', 'python')
33
33
  act_path = ::File.join(@name, 'bin', 'activate')
34
34
  cmd = "grep -q 'export VIRTUAL_ENV' #{act_path}"
35
- @runner.check_file_is_executable(pip_path, 'root') and
36
- @runner.check_file_is_executable(python_path, 'root') and
37
- @runner.check_file_is_executable(act_path, 'root') and
35
+ @runner.check_file_is_executable(pip_path, 'owner') and
36
+ @runner.check_file_is_executable(python_path, 'owner') and
37
+ @runner.check_file_is_readable(act_path, 'owner') and
38
38
  @runner.run_command(cmd).exit_status.to_i == 0
39
39
  end
40
40
 
@@ -54,7 +54,7 @@ describe 'http_get()' do
54
54
  stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'myhost'))
55
55
  conn = double
56
56
  headers = double
57
- expect(headers).to receive(:[]=).with(:user_agent, 'Serverspec::Type::Http_Get/0.0.1 (https://github.com/jantman/serverspec-extended-types)')
57
+ expect(headers).to receive(:[]=).with(:user_agent, %r"Serverspec::Type::Http_Get/\d+\.\d+\.\d+ \(https://github.com/jantman/serverspec-extended-types\)")
58
58
  expect(conn).to receive(:headers).and_return(headers)
59
59
  expect(headers).to receive(:[]=).with(:Host, 'hostheader')
60
60
  expect(conn).to receive(:headers).and_return(headers)
@@ -16,36 +16,36 @@ describe 'Serverspec::Type#virtualenv' do
16
16
  context '#virtualenv?' do
17
17
  it 'checks all files' do
18
18
  v = virtualenv('/foo/bar')
19
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'root').and_return(true)
20
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'root').and_return(true)
21
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/activate', 'root').and_return(true)
19
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
20
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
21
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(true)
22
22
  res = Specinfra::CommandResult.new({:stdout => '', :stderr => '', :exit_signal => nil, :exit_status => 0 })
23
23
  expect(v.instance_variable_get(:@runner)).to receive(:run_command).once.ordered.with("grep -q 'export VIRTUAL_ENV' /foo/bar/bin/activate").and_return(res)
24
24
  expect(v.virtualenv?).to eq true
25
25
  end
26
26
  it 'returns false with missing pip' do
27
27
  v = virtualenv('/foo/bar')
28
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'root').and_return(false)
28
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(false)
29
29
  expect(v.virtualenv?).to eq false
30
30
  end
31
31
  it 'returns false with missing python' do
32
32
  v = virtualenv('/foo/bar')
33
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'root').and_return(true)
34
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'root').and_return(false)
33
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
34
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(false)
35
35
  expect(v.virtualenv?).to eq false
36
36
  end
37
37
  it 'returns false with missing activate' do
38
38
  v = virtualenv('/foo/bar')
39
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'root').and_return(true)
40
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'root').and_return(true)
41
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/activate', 'root').and_return(false)
39
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
40
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
41
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(false)
42
42
  expect(v.virtualenv?).to eq false
43
43
  end
44
44
  it 'returns false with invalid activate' do
45
45
  v = virtualenv('/foo/bar')
46
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'root').and_return(true)
47
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'root').and_return(true)
48
- expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/activate', 'root').and_return(true)
46
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
47
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
48
+ expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(true)
49
49
  res = Specinfra::CommandResult.new({:stdout => '', :stderr => '', :exit_signal => nil, :exit_status => 254 })
50
50
  expect(v.instance_variable_get(:@runner)).to receive(:run_command).once.ordered.with("grep -q 'export VIRTUAL_ENV' /foo/bar/bin/activate").and_return(res)
51
51
  expect(v.virtualenv?).to eq false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec-extended-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Antman