dl 0.1.0 → 1.0.0
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.
- data/README.md +7 -1
- data/bin/dl +2 -1
- data/lib/dl/dl.rb +8 -4
- data/lib/dl.rb +1 -1
- metadata +2 -3
- data/Changelog +0 -9
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
Dl is a super-simple file downloading utility, similar to wget/curl.
|
2
2
|
|
3
|
-
It will download the given url to a file.
|
3
|
+
It will download the given url to a file unless given the `--raw` option, in which case it will simply print the url's contents to the standard output.
|
4
4
|
|
5
5
|
gem install dl
|
6
|
+
|
7
|
+
Try
|
8
|
+
|
9
|
+
dl --help
|
10
|
+
|
11
|
+
to see how to use it.
|
data/bin/dl
CHANGED
data/lib/dl/dl.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
module Dl
|
2
|
-
def self.download(url)
|
2
|
+
def self.download(url, raw = false)
|
3
3
|
session = Patron::Session.new
|
4
4
|
|
5
5
|
puts "Downloading #{url}..."
|
6
6
|
|
7
7
|
response = session.get url
|
8
|
-
filename = response.url.split('/').pop
|
9
8
|
|
10
|
-
puts "Downloaded to file #{filename}!"
|
11
9
|
|
12
|
-
|
10
|
+
if raw == true
|
11
|
+
puts response.body
|
12
|
+
else
|
13
|
+
filename = response.url.split('/').pop
|
14
|
+
puts "Downloaded to file #{filename}!"
|
15
|
+
File.new(filename, 'w').write(response.body)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/dl.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Szymanski
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-16 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: patron
|
@@ -44,7 +44,6 @@ extra_rdoc_files: []
|
|
44
44
|
|
45
45
|
files:
|
46
46
|
- .gitignore
|
47
|
-
- Changelog
|
48
47
|
- Gemfile
|
49
48
|
- Gemfile.lock
|
50
49
|
- README.md
|