downlow 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{downlow}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Quint"]
12
- s.date = %q{2010-02-19}
12
+ s.date = %q{2010-02-21}
13
13
  s.description = %q{Downlow provides an easy way to fetch files or archives and extract them with minimal hassle.}
14
14
  s.email = %q{aaron@quirkey.com}
15
15
  s.extra_rdoc_files = [
@@ -1,7 +1,7 @@
1
1
  require 'downlow/ext/pathname'
2
2
 
3
3
  module Downlow
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
 
6
6
  def self.get(url, *args)
7
7
  options = {}
@@ -17,6 +17,7 @@ module Downlow
17
17
  end
18
18
  data << u.read
19
19
  end
20
+ filename = filename.to_s.gsub(/\?(.*)$/,'')
20
21
  self.destination = destination.dirname + filename
21
22
  File.open(destination, 'w') {|f| f << data }
22
23
  @local_path = destination
@@ -91,6 +91,16 @@ class TestDownlowFetcher < Test::Unit::TestCase
91
91
  assert_equal @path, @fetcher.local_path
92
92
  end
93
93
 
94
+ should "strip query-string when determining file name" do
95
+ gist_url = "http://github.com/malsup/form/raw/master/jquery.form.js?v2.38"
96
+ FakeWeb.register_uri(:get, gist_url, :body => "I'm just a normal file")
97
+ @fetcher = Downlow::Http.new(gist_url, :tmp_dir => tmp_dir)
98
+ @path = @fetcher.fetch
99
+ assert @path.is_a?(Pathname)
100
+ assert @path.file?
101
+ assert_match(/jquery.form.js$/, @path.to_s)
102
+ end
103
+
94
104
  should "respect content-disposition headers" do
95
105
  gist_url = "http://gist.github.com/gists/290151/download"
96
106
  FakeWeb.register_uri(:get, gist_url, :response => fixture('gist_response'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: downlow
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
  - Aaron Quint
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-19 00:00:00 -05:00
12
+ date: 2010-02-21 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency