pulse-downloader 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bee880729f0af4203d680eb78a1c3f0375137f14b4647e707ae6d4445e0cdd21
4
- data.tar.gz: 504e7020e0af6291d7b39ba06f03fd40b23baae1c39263a5e0906982fdb38212
3
+ metadata.gz: f1d8d3d5f2814c1744f58c8a09b118a478b2d1d3f1e92a66df86fd4352284fe4
4
+ data.tar.gz: 3384a0e37e73e237edf8cd9a2fbdac640473408b7c8e523b8a43ea80529a0680
5
5
  SHA512:
6
- metadata.gz: e32fb830552f65170cdf26a2a13789cb058843df064ef2da2f393ad91cb8e5b06c741885bd7d6d665021bb2eb17ef7157ade02cd03b9218bfe4f753a798100d9
7
- data.tar.gz: 39186157cbe4cff6c91e7a9d9b2424af1720563f18c9ca4ceb438e1bbe854de743b1677525cc57495393a080b72bfcd2e5aeceb78f37bd0f0efb5bcdfd0a755e
6
+ metadata.gz: ee7a13ba93ca48c4306d6cede31c17753610c3496277830a8a5e4bb37b17e141ac231c37ce0bb5166d66db6f7fe6c969e20d8c85d758c3225b5d2b021035ce30
7
+ data.tar.gz: 6e2999c3df8cbbe876743c10396d59cd8d6c0b1f9723090b910f6594fdd11d0290e30a903b6238e49c36b51fd6f40f04542748c85fcfb34835cdb5f42fb7ab5f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pulse-downloader (0.1.1)
4
+ pulse-downloader (0.1.2)
5
5
  active_attr (~> 0.15)
6
6
  httparty (~> 0.18)
7
7
  nokogiri (~> 1.10.9)
@@ -45,12 +45,32 @@ module Pulse
45
45
  end
46
46
 
47
47
  def compute_file_link(file_path)
48
- if file_path[0] == '/'
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
@@ -1,5 +1,5 @@
1
1
  module Pulse
2
2
  module Downloader
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulse-downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22