filebin 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,9 +2,9 @@
2
2
 
3
3
  filebin is a CLI to http://filebin.ca
4
4
  Example: filebin -f <pic.png>
5
-
6
5
  Options:
7
- -f, --file <file> Path to file
6
+ -f, --file <file> Use a file for input
7
+ -s, --short Return a shortend URL
8
8
  -h, --help Show this message
9
9
 
10
10
  == Copyright
data/Rakefile CHANGED
@@ -52,9 +52,9 @@ Rake::RDocTask.new do |rdoc|
52
52
  rdoc.title = "filebin #{version}"
53
53
  rdoc.rdoc_files.include('README*')
54
54
  rdoc.rdoc_files.include('lib/**/*.rb')
55
- #rdoc.options += [
56
- # '-N',
57
- # '-f', 'darkfish',
58
- #]
55
+ rdoc.options += [
56
+ '-N',
57
+ # '-f', 'darkfish',
58
+ ]
59
59
  end
60
60
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -9,7 +9,6 @@ require 'net/http'
9
9
  require 'hpricot'
10
10
 
11
11
  class Filebin
12
- attr_reader :link
13
12
  # This method takes a hash containing the variables in the POST
14
13
  # request.
15
14
  #
@@ -37,13 +36,17 @@ class Filebin
37
36
  @link = $1
38
37
  end
39
38
 
39
+ # Returns the link to the uploaded file.
40
+ def link
41
+ @link
42
+ end
43
+
44
+ # Returns a shortened link to the uploaded file.
40
45
  def short_link
41
- headers = {'Content-Type' => 'text/xml'}
42
- xml = "<link><website_url>#{@link}</website_url></link>"
43
- res = Net::HTTP.start('rubyurl.com') do |http|
44
- http.post("/api/links", xml, headers)
45
- end
46
- doc = Hpricot(res.body)
47
- doc.at('/permalink').inner_html
48
- end
46
+ clnt = HTTPClient.new
47
+ res = clnt.get('http://is.gd/api.php', {:longurl => @link} ).content
48
+ doc = Hpricot(res)
49
+ doc.html
50
+ end
51
+
49
52
  end
@@ -8,6 +8,6 @@ describe "Filebin" do
8
8
 
9
9
  it "returns a shortened verison of the link" do
10
10
  fbin = Filebin.new("path" => __FILE__)
11
- fbin.short_link.should match(/rubyurl.com\/\w+/)
11
+ fbin.short_link.should match(/is.gd\/\w+/)
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filebin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - dougsko
@@ -9,39 +14,45 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-20 00:00:00 -05:00
17
+ date: 2010-05-19 00:00:00 -04:00
13
18
  default_executable: filebin
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: httpclient
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: hpricot
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
33
41
  version: "0"
34
- version:
42
+ type: :runtime
43
+ version_requirements: *id002
35
44
  - !ruby/object:Gem::Dependency
36
45
  name: httpclient
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
40
48
  requirements:
41
49
  - - ">="
42
50
  - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
43
53
  version: "0"
44
- version:
54
+ type: :runtime
55
+ version_requirements: *id003
45
56
  description: Command line interface to filebin.ca
46
57
  email: dougtko@gmail.com
47
58
  executables:
@@ -74,18 +85,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
85
  requirements:
75
86
  - - ">="
76
87
  - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
77
90
  version: "0"
78
- version:
79
91
  required_rubygems_version: !ruby/object:Gem::Requirement
80
92
  requirements:
81
93
  - - ">="
82
94
  - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
83
97
  version: "0"
84
- version:
85
98
  requirements: []
86
99
 
87
100
  rubyforge_project:
88
- rubygems_version: 1.3.5
101
+ rubygems_version: 1.3.6
89
102
  signing_key:
90
103
  specification_version: 3
91
104
  summary: Command line interface to filebin.ca