datahunter 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 27b50c600165b2628c5e20d29b61b62802c76013
4
- data.tar.gz: 1a43ff8e7266b0230d18b31f47440312345e5698
3
+ metadata.gz: 873effc1aa6786f498eba71ccdd378f5adb167c7
4
+ data.tar.gz: 62571df969ff8f4e232eea3216c75f8f9ce6b8b9
5
5
  SHA512:
6
- metadata.gz: 1d8a85e31ed63becdfc72f9df8db0d2bef78751d89d4d79c3e8a348146de4baaaa4af2af36870aa356f598d4854be39614509bb002483630a7f5493f78557791
7
- data.tar.gz: f154349edacb0813c3233db16b54272fe489e555402f4e88f5621a7797f4402671506226e648d84276475b9969f80eaeb94bda8894af22c7da66c829288580c3
6
+ metadata.gz: 256d849adde211bf48f28f786dd3b7915e62efa8ce9adf53c08ae42825862678fa08035386eb169e3c497d94d7ba4c48ac33f997586a422f08ba045dec0a7325
7
+ data.tar.gz: 072a4c38ecd4f13c21381c8f76390696042832e8992f15b8107ab9de0216c7f37758bc126ae54a6b55bcfdcb86df55d2e9fcd3de5eb00f17608ce43b47a7da1c
@@ -48,7 +48,7 @@ module Datahunter
48
48
  end
49
49
 
50
50
  dl = dl.to_i
51
- Datahunter.download_file(resources[dl]["url"], resources[dl]["format"])
51
+ Datahunter.download_file(resources[dl]["url"], resources[dl]["format"], dataset["uri"])
52
52
  end
53
53
 
54
54
  ## Messages: feedback and excuses
@@ -78,13 +78,19 @@ module Datahunter
78
78
  end
79
79
  end
80
80
 
81
- def self.download_file url, format=""
81
+ def self.download_file url, format="", alt_url=""
82
82
  if format == "HTML"
83
83
  Launchy.open(url, options = {})
84
84
  else
85
85
  puts "Start downloading..."
86
86
  Downloadr::HTTP.download(url)
87
87
  puts "Your file has been downloaded, try to $ ls ;D".colorize(:green)
88
+ Datahunter.print_excuse_and_alternative_url_message alt_url
88
89
  end
89
90
  end
91
+
92
+ def self.print_excuse_and_alternative_url_message alt_url=""
93
+ puts "If this is not the file you expected, it's maybe because publisher don't always keep the metadata up-to-date. We try to clean most of uri's and check the url. Anyway you may be able to download your file by hand here:"
94
+ puts "#{alt_url}".colorize(:blue)
95
+ end
90
96
  end
@@ -1,3 +1,3 @@
1
1
  module Datahunter
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datahunter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terpo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler