landrush 1.1.0.beta.2 → 1.1.0.beta.3

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: 89f28bf5fa282162cba9dc132f50560eb81c75d9
4
- data.tar.gz: 25859eb10f91b1c228f8c4b0e80db1a6f27b664f
3
+ metadata.gz: d77ecf53a2c01d7b970262ad962f581b5f3b44c4
4
+ data.tar.gz: ea67610f89e99e4a7b39610a2f154eb932ce25e3
5
5
  SHA512:
6
- metadata.gz: b407b73d6ad43a9c40407d31e2512526180044f82705d7434476f8e22be53cec32ec8748edb4ef63890355365917eb1a5290dfc1016ae026da7784ff12cc3f7e
7
- data.tar.gz: db40198c92d2efc3933ca00e9339ceba69c7f607d5118a438d0d2c9614ba2a183914ce3f26b5c028515d60e936fd6b132ef19698218732fa773f2b94678dae07
6
+ metadata.gz: 66834fc6e32258479ac9121bd7cee33ed7f177b6ffd2300866523f0263391991c048db3e136eb087a96f922915ffb6688793d0b87f148a8a58458a6c752977a7
7
+ data.tar.gz: 091535496355c49f29dc937c3e3617cf5b955ac7046217df7c4a1aabb36e560f704e55894e77b0bf2c26d99aa25c4dd6aa13b6996a1a7f23346a499ee15631a1
@@ -100,7 +100,7 @@ module Landrush
100
100
  # machine.config.vm.networks is an array of two elements. The first containing the type as symbol, the second is a
101
101
  # hash containing other config data which varies between types
102
102
  def static_private_network_ip
103
- # select all staticlly defined private network ip
103
+ # select all statically defined private network ip
104
104
  private_networks = machine.config.vm.networks.select {|network| :private_network == network[0] && !network[1][:ip].nil?}
105
105
  .map {|network| network[1][:ip]}
106
106
  if machine.config.landrush.host_ip_address.nil?
@@ -5,8 +5,9 @@ module Landrush
5
5
  class << self
6
6
  attr_writer :sudo, :config_dir
7
7
 
8
- def configure_visibility_on_host(env, *_args)
8
+ def configure_visibility_on_host(env, _ip, tld)
9
9
  @env = env
10
+ @tld = tld
10
11
  if contents_match?
11
12
  info 'Host DNS resolver config looks good.'
12
13
  else
@@ -38,7 +39,7 @@ module Landrush
38
39
  end
39
40
 
40
41
  def config_file
41
- config_dir.join(@env.vagrantfile.config.landrush.tld)
42
+ config_dir.join(@tld)
42
43
  end
43
44
 
44
45
  def contents_match?
@@ -4,12 +4,13 @@ module Landrush
4
4
  class ConfigureVisibilityOnHost
5
5
  class << self
6
6
  def configure_visibility_on_host(env, ip, tld)
7
- env[:host].capability(:install_dnsmasq) unless env[:host].capability(:dnsmasq_installed)
8
- env[:host].capability(:create_dnsmasq_config, ip, tld)
9
- env[:host].capability(:restart_dnsmasq)
10
- rescue Vagrant::Errors::CapabilityNotFound
11
- env[:ui].info('Unable to automatically configure your host. Check the documentation for manual ' \
12
- 'instructions to configure the visibility on the host.')
7
+ env.host.capability(:install_dnsmasq) unless env.host.capability(:dnsmasq_installed)
8
+ env.host.capability(:create_dnsmasq_config, ip, tld)
9
+ env.host.capability(:restart_dnsmasq)
10
+ rescue Vagrant::Errors::CapabilityNotFound => e
11
+ env.ui.info("Your host was detected as '#{e.extra_data[:cap]}' for which the host capability " \
12
+ "'#{e.extra_data[:cap]}' is not available.")
13
+ env.ui.info('Check the documentation for the manual instructions to configure the visibility on the host.')
13
14
  end
14
15
  end
15
16
  end
@@ -31,14 +31,14 @@ module Landrush
31
31
 
32
32
  unless wired_autoconfig_service_running?
33
33
  info('starting \'Wired AutoConfig\' service')
34
- if self.class.admin_mode?
34
+ if admin_mode?
35
35
  `net start dot3svc`
36
36
  else
37
37
  require 'win32ole'
38
38
  shell = WIN32OLE.new('Shell.Application')
39
39
  shell.ShellExecute('net', 'start dot3svc', nil, 'runas', 1)
40
40
  end
41
- service_has_started = self.retry(tries: 5, sleep: 1) do
41
+ service_has_started = Landrush::Util::Retry.retry(tries: 5, sleep: 1) do
42
42
  wired_autoconfig_service_running?
43
43
  end
44
44
  unless service_has_started
@@ -144,7 +144,7 @@ module Landrush
144
144
  end
145
145
 
146
146
  def info(msg)
147
- @env[:ui].info("[landrush] #{msg}") unless @env.nil?
147
+ @env.ui.info("[landrush] #{msg}") unless @env.nil?
148
148
  end
149
149
 
150
150
  def wired_autoconfig_service_running?
@@ -1,7 +1,7 @@
1
1
  module Landrush
2
2
  module Util
3
- module Retry
4
- def retry(opts=nil)
3
+ class Retry
4
+ def self.retry(opts=nil)
5
5
  opts = {tries: 1}.merge(opts || {})
6
6
  n = 0
7
7
  while n < opts[:tries]
@@ -1,3 +1,3 @@
1
1
  module Landrush
2
- VERSION = '1.1.0.beta.2'.freeze
2
+ VERSION = '1.1.0.beta.3'.freeze
3
3
  end
@@ -23,7 +23,7 @@ module Landrush
23
23
  # also disable 'sudo'
24
24
  ConfigureVisibilityOnHost.stubs(:sudo).returns('')
25
25
 
26
- ConfigureVisibilityOnHost.configure_visibility_on_host(env)
26
+ ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', 'vagrant.test')
27
27
 
28
28
  Dir["#{dir}/*"].empty?.must_equal false
29
29
  File.exist?(File.join(dir, 'vagrant.test')).must_equal true
@@ -41,8 +41,7 @@ module Landrush
41
41
  # also disable 'sudo'
42
42
  ConfigureVisibilityOnHost.stubs(:sudo).returns('')
43
43
 
44
- env.vagrantfile.config.landrush.tld = 'foo.bar'
45
- ConfigureVisibilityOnHost.configure_visibility_on_host(env)
44
+ ConfigureVisibilityOnHost.configure_visibility_on_host(env, '42.42.42.42', 'foo.bar')
46
45
 
47
46
  Dir["#{dir}/*"].empty?.must_equal false
48
47
  File.exist?(File.join(dir, 'foo.bar')).must_equal true
@@ -22,7 +22,7 @@ module Landrush
22
22
  skip('Only supported on Linux') unless Vagrant::Util::Platform.linux?
23
23
  File.exist?(TEST_CONFIG).must_equal false
24
24
 
25
- Landrush::Cap::Linux::ConfigureVisibilityOnHost.configure_visibility_on_host(fake_environment, TEST_IP, TEST_TLD)
25
+ Landrush::Cap::Linux::ConfigureVisibilityOnHost.configure_visibility_on_host(Vagrant::Environment.new, TEST_IP, TEST_TLD)
26
26
 
27
27
  File.exist?(TEST_CONFIG).must_equal true
28
28
  Pathname(TEST_CONFIG).read.must_equal CONFIG
@@ -1,20 +1,12 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
- class DummyClass
4
- include Landrush::Util::Retry
5
- end
6
-
7
3
  module Landrush
8
4
  module Util
9
5
  describe Retry do
10
- before do
11
- @dummy = DummyClass.new
12
- end
13
-
14
6
  describe 'retry' do
15
7
  it 'retries the provided block up to the specified count' do
16
8
  retries = 0
17
- result = @dummy.retry(tries: 2) do
9
+ result = Retry.retry(tries: 2) do
18
10
  retries += 1
19
11
  false
20
12
  end
@@ -24,7 +16,7 @@ module Landrush
24
16
 
25
17
  it 'does not retry if \'true\' is returned' do
26
18
  retries = 0
27
- result = @dummy.retry(tries: 2) do
19
+ result = Retry.retry(tries: 2) do
28
20
  retries += 1
29
21
  true
30
22
  end
@@ -35,7 +27,7 @@ module Landrush
35
27
  it 'does sleep between executions if requested' do
36
28
  retries = 0
37
29
  t1 = Time.now
38
- result = @dummy.retry(tries: 1, sleep: 1) do
30
+ result = Retry.retry(tries: 1, sleep: 1) do
39
31
  retries += 1
40
32
  false
41
33
  end
@@ -31,8 +31,7 @@ end
31
31
  def fake_environment(options = {enabled: true})
32
32
  # For the home_path we want the base Vagrant directory
33
33
  vagrant_test_home = Pathname(Landrush::Server.working_dir).parent.parent
34
- env = Vagrant::Environment.new
35
- {machine: fake_machine(options), host: env.host, ui: FakeUI.new, home_path: vagrant_test_home}
34
+ {machine: fake_machine(options), ui: FakeUI.new, home_path: vagrant_test_home}
36
35
  end
37
36
 
38
37
  class FakeUI
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: landrush
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.beta.2
4
+ version: 1.1.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Hinze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubydns