pulse-downloader 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pulse/downloader/file_downloader.rb +22 -2
- data/lib/pulse/downloader/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1d8d3d5f2814c1744f58c8a09b118a478b2d1d3f1e92a66df86fd4352284fe4
|
4
|
+
data.tar.gz: 3384a0e37e73e237edf8cd9a2fbdac640473408b7c8e523b8a43ea80529a0680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee7a13ba93ca48c4306d6cede31c17753610c3496277830a8a5e4bb37b17e141ac231c37ce0bb5166d66db6f7fe6c969e20d8c85d758c3225b5d2b021035ce30
|
7
|
+
data.tar.gz: 6e2999c3df8cbbe876743c10396d59cd8d6c0b1f9723090b910f6594fdd11d0290e30a903b6238e49c36b51fd6f40f04542748c85fcfb34835cdb5f42fb7ab5f
|
data/Gemfile.lock
CHANGED
@@ -45,12 +45,32 @@ module Pulse
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def compute_file_link(file_path)
|
48
|
-
if file_path
|
48
|
+
if section?(file_path)
|
49
|
+
raise 'invalid download path'
|
50
|
+
elsif absolute?(file_path)
|
51
|
+
file_path
|
52
|
+
elsif relative?(file_path)
|
49
53
|
"#{url}/#{file_path}"
|
50
54
|
else
|
51
|
-
file_path
|
55
|
+
"#{url}/#{file_path}"
|
52
56
|
end
|
53
57
|
end
|
58
|
+
|
59
|
+
def absolute?(file_path)
|
60
|
+
file_path.include?('http://') ||
|
61
|
+
file_path.include?('https://') ||
|
62
|
+
file_path.include?('ftp://') ||
|
63
|
+
file_path.include?('sftp://')||
|
64
|
+
file_path.include?('file://')
|
65
|
+
end
|
66
|
+
|
67
|
+
def relative?(file_path)
|
68
|
+
file_path[0] == '/'
|
69
|
+
end
|
70
|
+
|
71
|
+
def section?(file_path)
|
72
|
+
file_path[0] == '#'
|
73
|
+
end
|
54
74
|
end
|
55
75
|
end
|
56
76
|
end
|