bsw_dnet_install_util 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/Paraffin-3.6.2.0/Paraffin.exe +0 -0
- data/lib/elevate-1.3.0/elevate.exe +0 -0
- data/lib/path_fetcher.rb +70 -0
- data/lib/tools.rb +3 -0
- data/spec/path_fetcher_spec.rb +74 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a25462480c3839d7fb58553a8f694cc8881b0269
|
4
|
+
data.tar.gz: 77ea6b444b4d2c2b26f22c9d3978c20876e4380e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 69900ba45406a4be5931172d9527a93441320d4f65bfe3ec67f55b9ec0d775d251885da3651661961dd3d3cebfbec25935c23612c6349cb2f0a3470262560631
|
7
|
+
data.tar.gz: 61323d24c984666dbd6f953f68b6e50f666c5dc93fb3739c528f4eec7c94f0ea1b624a7d20e56e89338a5216896dc37076e31cfeda702460efe46d65c676f41d
|
Binary file
|
Binary file
|
data/lib/path_fetcher.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'zip'
|
3
|
+
|
4
|
+
module BswTech
|
5
|
+
module DnetInstallUtil
|
6
|
+
BASE_PATH = File.expand_path(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
PARAFFIN_VERSION = '3.6.2.0'
|
9
|
+
PARAFFIN_EXE = File.join BASE_PATH, "Paraffin-#{PARAFFIN_VERSION}", 'Paraffin.exe'
|
10
|
+
ELEVATE_VERSION = '1.3.0'
|
11
|
+
ELEVATE_EXE = File.join BASE_PATH, "elevate-#{ELEVATE_VERSION}", 'elevate.exe'
|
12
|
+
DOTNETINSTALLER_VERSION = '2.2'
|
13
|
+
DOTNET_INSTALLER_PATH = File.join BASE_PATH, "dotNetInstaller-#{DOTNETINSTALLER_VERSION}"
|
14
|
+
PSTOOLS_VERSION = '2.0'
|
15
|
+
PSTOOLS_PATH = File.join BASE_PATH, "pstools-#{PSTOOLS_VERSION}"
|
16
|
+
|
17
|
+
def self.ps_tools_base_path
|
18
|
+
if not Dir.exists? PSTOOLS_PATH
|
19
|
+
downloaded_zip = get_zip_file 'http://download.sysinternals.com/files/PSTools.zip',
|
20
|
+
'pstools.zip'
|
21
|
+
extract_zip downloaded_zip, PSTOOLS_PATH
|
22
|
+
File.delete downloaded_zip
|
23
|
+
else
|
24
|
+
puts "Using existing distro at #{PSTOOLS_PATH}"
|
25
|
+
end
|
26
|
+
PSTOOLS_PATH
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.dot_net_installer_base_path
|
30
|
+
if not Dir.exists? DOTNET_INSTALLER_PATH
|
31
|
+
downloaded_zip = get_zip_file 'http://code.dblock.org/downloads/dotnetinstaller/dotNetInstaller.2.2.zip',
|
32
|
+
'dotnetinstaller.zip'
|
33
|
+
extract_zip downloaded_zip, BASE_PATH
|
34
|
+
File.delete downloaded_zip
|
35
|
+
File.rename(File.join(BASE_PATH, 'dotNetInstaller 2.2'), DOTNET_INSTALLER_PATH)
|
36
|
+
else
|
37
|
+
puts "Using existing distro at #{DOTNET_INSTALLER_PATH}"
|
38
|
+
end
|
39
|
+
DOTNET_INSTALLER_PATH
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def self.extract_zip(downloaded_zip,base_path)
|
45
|
+
puts "Extracting ZIP to #{base_path}"
|
46
|
+
Zip::File.open downloaded_zip do |zipFile|
|
47
|
+
zipFile.each do |entry|
|
48
|
+
dir = File.join(base_path, File.dirname(entry.name))
|
49
|
+
FileUtils.mkpath dir
|
50
|
+
entry.extract(File.join(base_path, entry.name))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.get_zip_file(url, local_file)
|
56
|
+
uri = URI url
|
57
|
+
zip = File.join BASE_PATH, local_file
|
58
|
+
return zip if File.exist? zip
|
59
|
+
Net::HTTP.start uri.host, uri.port do |http|
|
60
|
+
puts "Downloading #{url} ..."
|
61
|
+
resp = http.get uri.request_uri
|
62
|
+
puts "Saving ZIP file to #{zip}"
|
63
|
+
open zip, "wb" do |file|
|
64
|
+
file.write resp.body
|
65
|
+
end
|
66
|
+
end
|
67
|
+
zip
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/tools.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
$: << File.expand_path(File.dirname(__FILE__) +"/../lib")
|
2
|
+
require 'rspec'
|
3
|
+
require 'path_fetcher'
|
4
|
+
|
5
|
+
describe BswTech::DnetInstallUtil do
|
6
|
+
after(:each) do
|
7
|
+
FileUtils::rm_rf 'lib/dotNetInstaller-2.2'
|
8
|
+
FileUtils::rm_rf 'lib/pstools-2.0'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should return the full path to paraffin exe in the GEM folder' do
|
12
|
+
# arrange
|
13
|
+
|
14
|
+
# act
|
15
|
+
result = BswTech::DnetInstallUtil::PARAFFIN_EXE
|
16
|
+
|
17
|
+
# assert
|
18
|
+
expect(result).to eq("#{BswTech::DnetInstallUtil::BASE_PATH}/Paraffin-3.6.2.0/Paraffin.exe")
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should return the full path to elevate.exe' do
|
22
|
+
# arrange
|
23
|
+
|
24
|
+
# act
|
25
|
+
result = BswTech::DnetInstallUtil::ELEVATE_EXE
|
26
|
+
|
27
|
+
# assert
|
28
|
+
expect(result).to eq("#{BswTech::DnetInstallUtil::BASE_PATH}/elevate-1.3.0/elevate.exe")
|
29
|
+
end
|
30
|
+
|
31
|
+
# http://code.dblock.org/downloads/dotnetinstaller/dotNetInstaller.2.2.zip
|
32
|
+
it 'should fetch and expand the DotNetInstaller distro inside the GEM directory and return the path' do
|
33
|
+
# arrange
|
34
|
+
|
35
|
+
# act
|
36
|
+
result = BswTech::DnetInstallUtil::dot_net_installer_base_path
|
37
|
+
fileExists = File.exist?(File.join result, "Bin", "InstallerLinker.exe")
|
38
|
+
|
39
|
+
# assert
|
40
|
+
expect(result).to eq("#{BswTech::DnetInstallUtil::BASE_PATH}/dotNetInstaller-2.2")
|
41
|
+
expect(fileExists).to be true
|
42
|
+
expect(File.exists?("#{BswTech::DnetInstallUtil::BASE_PATH}/dotnetinstaller.zip")).to be false
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should use the already fetched directory' do
|
46
|
+
# arrange
|
47
|
+
BswTech::DnetInstallUtil::dot_net_installer_base_path
|
48
|
+
allow(Net::HTTP).to receive(:start).and_throw("shouldn't be fetching this twice")
|
49
|
+
|
50
|
+
# act
|
51
|
+
result = BswTech::DnetInstallUtil::dot_net_installer_base_path
|
52
|
+
fileExists = File.exist?(File.join result, "Bin", "InstallerLinker.exe")
|
53
|
+
|
54
|
+
# assert
|
55
|
+
expect(result).to eq("#{BswTech::DnetInstallUtil::BASE_PATH}/dotNetInstaller-2.2")
|
56
|
+
expect(fileExists).to be true
|
57
|
+
expect(File.exists?("#{BswTech::DnetInstallUtil::BASE_PATH}/dotnetinstaller.zip")).to be false
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should fetch PsTools only once' do
|
61
|
+
# arrange
|
62
|
+
|
63
|
+
# act
|
64
|
+
result = BswTech::DnetInstallUtil::ps_tools_base_path
|
65
|
+
file_exists = File.exist?(File.join result, 'PsExec.exe')
|
66
|
+
allow(Net::HTTP).to receive(:start).and_throw("shouldn't be fetching this twice")
|
67
|
+
result = BswTech::DnetInstallUtil::ps_tools_base_path
|
68
|
+
|
69
|
+
# assert
|
70
|
+
expect(result).to eq("#{BswTech::DnetInstallUtil::BASE_PATH}/pstools-2.0")
|
71
|
+
expect(file_exists).to be true
|
72
|
+
expect(File.exists?("#{BswTech::DnetInstallUtil::BASE_PATH}/PSTools.zip")).to be false
|
73
|
+
end
|
74
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bsw_dnet_install_util
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brady Wied
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyzip
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: See summary
|
28
|
+
email: brady@bswtechconsulting.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/Paraffin-3.6.2.0/Paraffin.exe
|
34
|
+
- lib/elevate-1.3.0/elevate.exe
|
35
|
+
- lib/path_fetcher.rb
|
36
|
+
- lib/tools.rb
|
37
|
+
- spec/path_fetcher_spec.rb
|
38
|
+
homepage:
|
39
|
+
licenses:
|
40
|
+
- BSD
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options:
|
44
|
+
- "--inline-source"
|
45
|
+
- "--line-numbers"
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.2.3
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Paraffin and dotnetinstaller binaries
|
64
|
+
test_files:
|
65
|
+
- spec/path_fetcher_spec.rb
|