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.
Files changed (6) hide show
  1. data/README.md +7 -1
  2. data/bin/dl +2 -1
  3. data/lib/dl/dl.rb +8 -4
  4. data/lib/dl.rb +1 -1
  5. metadata +2 -3
  6. 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
@@ -19,6 +19,7 @@ Usage:
19
19
 
20
20
  Where [options] are:
21
21
  EOS
22
+ opt :raw, "Don't save downloaded data to disk, simply print it to standard output."
22
23
  end
23
24
 
24
- Dl::download ARGV[0]
25
+ Dl::download ARGV[0], opts[:raw]
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
- File.new(filename, 'w').write(response.body)
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
@@ -3,5 +3,5 @@ require 'patron'
3
3
  require 'dl/dl'
4
4
 
5
5
  module Dl
6
- VERSION = "0.1.0"
6
+ VERSION = "1.0.0"
7
7
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
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-15 00:00:00 Z
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
data/Changelog DELETED
@@ -1,9 +0,0 @@
1
- = 0.0.1 4/10/11
2
-
3
- * Initial release
4
-
5
- * Doesn't do anything, yet
6
-
7
- = 0.0.2 4/10/11
8
-
9
- * Actually does something, but only outputs raw data