landrush 1.1.0.beta.3 → 1.1.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d77ecf53a2c01d7b970262ad962f581b5f3b44c4
4
- data.tar.gz: ea67610f89e99e4a7b39610a2f154eb932ce25e3
3
+ metadata.gz: 4f14705abc9cca46ab6289380605e920f7d0b1b9
4
+ data.tar.gz: 9fec7c2e50cb5d6e5e006474320894bca04df10e
5
5
  SHA512:
6
- metadata.gz: 66834fc6e32258479ac9121bd7cee33ed7f177b6ffd2300866523f0263391991c048db3e136eb087a96f922915ffb6688793d0b87f148a8a58458a6c752977a7
7
- data.tar.gz: 091535496355c49f29dc937c3e3617cf5b955ac7046217df7c4a1aabb36e560f704e55894e77b0bf2c26d99aa25c4dd6aa13b6996a1a7f23346a499ee15631a1
6
+ metadata.gz: 4a6d04db3fbe1e996d3f71cf650793c6876436ad851d062428fc563ee8218de1f5ba3771611ecafc1d55b3c56bee2a64a0eacdace3581ae23ebbeb4b87b36dda
7
+ data.tar.gz: 43738660461e9f0b5c20aa7d43e46063ef5cadacc406799daeb927679666bdeb3cf806d5d5f18f5973a17eadef759390a87790ed184d626b40a214a7efa0f05f
@@ -54,24 +54,26 @@ module Landrush
54
54
  def update_network_adapter(ip, tld)
55
55
  # Need to defer loading to ensure cross OS compatibility
56
56
  require 'win32/registry'
57
- ensure_admin_privileges(__FILE__.to_s, ip, tld)
58
-
59
- network_name = get_network_name(ip)
60
- if network_name.nil?
61
- info("unable to determine network interface for #{ip}. DNS on host cannot be configured. Try manual configuration.")
62
- return
57
+ if admin_mode?
58
+ network_name = get_network_name(ip)
59
+ if network_name.nil?
60
+ info("unable to determine network interface for #{ip}. DNS on host cannot be configured. Try manual configuration.")
61
+ return
62
+ else
63
+ info("adding Landrush'es DNS server to network '#{network_name}' using DNS IP '#{ip}'' and search domain '#{tld}'")
64
+ end
65
+ network_guid = get_guid(network_name)
66
+ if network_guid.nil?
67
+ info("unable to determine network GUID for #{ip}. DNS on host cannot be configured. Try manual configuration.")
68
+ return
69
+ end
70
+ interface_path = INTERFACES + "\\{#{network_guid}}"
71
+ Win32::Registry::HKEY_LOCAL_MACHINE.open(interface_path, Win32::Registry::KEY_ALL_ACCESS) do |reg|
72
+ reg['NameServer'] = '127.0.0.1'
73
+ reg['Domain'] = tld
74
+ end
63
75
  else
64
- info("adding Landrush'es DNS server to network '#{network_name}' using DNS IP '#{ip}'' and search domain '#{tld}'")
65
- end
66
- network_guid = get_guid(network_name)
67
- if network_guid.nil?
68
- info("unable to determine network GUID for #{ip}. DNS on host cannot be configured. Try manual configuration.")
69
- return
70
- end
71
- interface_path = INTERFACES + "\\{#{network_guid}}"
72
- Win32::Registry::HKEY_LOCAL_MACHINE.open(interface_path, Win32::Registry::KEY_ALL_ACCESS) do |reg|
73
- reg['NameServer'] = '127.0.0.1'
74
- reg['Domain'] = tld
76
+ run_with_admin_privileges(__FILE__.to_s, ip, tld)
75
77
  end
76
78
  end
77
79
 
@@ -133,14 +135,10 @@ module Landrush
133
135
 
134
136
  # Makes sure that we have admin privileges and if nor starts a new shell with the required
135
137
  # privileges
136
- def ensure_admin_privileges(file, *args)
137
- unless admin_mode?
138
- require 'win32ole'
139
- shell = WIN32OLE.new('Shell.Application')
140
- shell.ShellExecute('ruby', "#{file} #{args.join(' ')}", nil, 'runas', 1)
141
- # need to exit current execution, changes will occur in new environment
142
- exit
143
- end
138
+ def run_with_admin_privileges(file, *args)
139
+ require 'win32ole'
140
+ shell = WIN32OLE.new('Shell.Application')
141
+ shell.ShellExecute('ruby', "#{file} #{args.join(' ')}", nil, 'runas', 1)
144
142
  end
145
143
 
146
144
  def info(msg)
@@ -1,3 +1,3 @@
1
1
  module Landrush
2
- VERSION = '1.1.0.beta.3'.freeze
2
+ VERSION = '1.1.0.beta.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: landrush
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.beta.3
4
+ version: 1.1.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Hinze