mvndownload 0.0.1 → 0.0.2
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 +4 -4
- data/lib/mvndownload.rb +5 -32
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a96648c236430444ee570f447655ff09e4cd6e
|
4
|
+
data.tar.gz: 8848643e0bca1667cb035089592aee54a31bc7c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa92be6997abcd07e584705dcae7139220b19a64c7bf993bcace679184bda432b9ec9af774f8b0b874b312ad9c143834ebe68d3de8dfd595b8c5fc259b502869
|
7
|
+
data.tar.gz: d87b0192052ceb28c868fab03422729806682cd88eb4356ee605c5a170311d72f5542803b53cf3607b2489127a91c0f8c927e6d6e99a9ad20c3f03b54e8ef5ea
|
data/lib/mvndownload.rb
CHANGED
@@ -3,35 +3,7 @@ require 'fileutils'
|
|
3
3
|
require 'digest/md5'
|
4
4
|
require 'sys/filesystem'
|
5
5
|
|
6
|
-
# Maven download class
|
7
6
|
class Mvndownload
|
8
|
-
# Perform a download from a maven type repository.
|
9
|
-
# Allows for configuration of basic auth credentials and proxy
|
10
|
-
# settings. Will also perform pre-emptive free space checks to
|
11
|
-
# ensure enough space to complete the download.
|
12
|
-
#
|
13
|
-
# Example:
|
14
|
-
# Mvndownload.download(:source => "http://my.repo.com/repo/myfile.war",
|
15
|
-
# :destination => "/path/to/download",
|
16
|
-
# :filename => "myfile.war",
|
17
|
-
# :username => "myrepouser",
|
18
|
-
# :password => "myrepopassword",
|
19
|
-
# :proxyhost => "proxy.mynet.net",
|
20
|
-
# :proxyport => "8080",
|
21
|
-
# :proxyuser => "myproxyuser",
|
22
|
-
# :proxypass => "myproxypass")
|
23
|
-
#
|
24
|
-
# Arguments:
|
25
|
-
# source: (Uri)
|
26
|
-
# destination: (Path)
|
27
|
-
# filename: (String) Optional, defaults to the source filename
|
28
|
-
# username: (String) Optional, user for authenticating with source
|
29
|
-
# password: (String) Optional, password for authenticating with source
|
30
|
-
# proxyhost: (String) Optional, hostname for proxy connection
|
31
|
-
# proxyport: (Integer) Optional, port for proxy connection
|
32
|
-
# proxyuser: (String) Optional, username for proxy authentication
|
33
|
-
# proxypass: (String) Optional, password for proxy authentication
|
34
|
-
|
35
7
|
def self.md5_check(source, destination, sourcemd5 = false, destinationmd5 = false)
|
36
8
|
smd5 = nil
|
37
9
|
dmd5 = nil
|
@@ -69,16 +41,17 @@ class Mvndownload
|
|
69
41
|
req.basic_auth(user, pass)
|
70
42
|
end
|
71
43
|
begin
|
72
|
-
Net::HTTP.new(uri.host, uri.port, p_addr, p_port, p_user, p_pass)
|
73
|
-
|
44
|
+
h = Net::HTTP.new(uri.host, uri.port, p_addr, p_port, p_user, p_pass)
|
45
|
+
h.use_ssl = uri.scheme == 'https'
|
46
|
+
h.start do |http|
|
74
47
|
http.request req do |response|
|
75
48
|
parent = File.dirname dest
|
76
49
|
stat = Sys::Filesystem.stat(parent)
|
77
50
|
bytes_available = stat.block_size * stat.blocks_available
|
78
51
|
|
79
52
|
if ( response.content_length() != nil )
|
80
|
-
|
81
|
-
|
53
|
+
if ((response['content-length'].to_i *2) > bytes_available)
|
54
|
+
raise RuntimeError,"Not enough disk space to download the file to " + parent
|
82
55
|
end
|
83
56
|
end
|
84
57
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mvndownload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Foucha
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This gem allows you to download a file. However, it will also check
|
15
15
|
to see if a MD5 file exists at the source and compare against the destination for
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
42
|
rubyforge_project:
|
43
|
-
rubygems_version: 2.
|
43
|
+
rubygems_version: 2.4.5
|
44
44
|
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: Gem to download files from maven type repositories
|