caleb-shorturl 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/ChangeLog +55 -0
  2. data/MIT-LICENSE +19 -0
  3. data/README +78 -0
  4. data/TODO +4 -0
  5. data/bin/shorturl +36 -0
  6. data/test/ts_all.rb +11 -0
  7. metadata +63 -0
data/ChangeLog ADDED
@@ -0,0 +1,55 @@
1
+ 0.8.4:
2
+ - Fixed support for RubyURL.com
3
+ - Added support for urlTea.com
4
+ - Added support for moourl.com
5
+
6
+ 0.7.0:
7
+ - Added shortify.com, 0rz.net
8
+ - Modified unit tests
9
+ - Started using CVS on RubyForge
10
+
11
+ 0.6.0:
12
+ - Changed the method for getting the URL for ln-s.net to use their
13
+ API. So basically, this means the new additional argument attribute
14
+ in the Service class is now useless, because no service uses it. I've
15
+ removed it along with the Hash#to_html_args method.
16
+ - Added d62.net, shiturl.com, littlink.com and clipurl.com
17
+
18
+ 0.5.0:
19
+ - Added two services: fyad.org and ln-s.net (thanks to Daniel
20
+ Dipaolo)
21
+ - Added an property to the Service class: args. This allows to give
22
+ additional arguments to services using the GET method (this was
23
+ needed by ln-s.net)
24
+ - Added a method to Hash to convert to an HTML arguments style
25
+ - Added a script called "shorturl" (duh) in the bin directory for
26
+ usage from the command line.
27
+
28
+ 0.4.0:
29
+ - Added minilink.org
30
+ - More tests for the Service class
31
+ - Changed the ArgumentError exception for an InvalidService exception in ShortURL.shorten
32
+ - Created examples/shorten.rb
33
+ - Added a stats task to the Rakefile. Requires code_statistics, provided by Rails.
34
+
35
+ 0.3.0:
36
+ - Added linktrim.com and shorterlink.com
37
+ - Replaced get_short_url and all the private class methods in favor of a Service class, which makes things clearer
38
+
39
+ 0.2.1:
40
+ - Added makeashorterlink.com and skinnylink.com
41
+ - Refactored get_short_url
42
+
43
+ 0.2.0:
44
+ - Added shorl.com, snipurl.com and metamark.net
45
+
46
+ 0.1.0:
47
+ - Refactored the tinyurl and rubyurl methods
48
+ - URI.extract to get URLs instead of regular expressions
49
+ - Added exception handling to get_short_url to return nil in case
50
+ of a network error
51
+ - More thorough unit tests
52
+ - Made tinyurl, rubyurl and get_short_url private class methods
53
+
54
+ 0.0.1:
55
+ - Initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2005, Vincent Foley
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README ADDED
@@ -0,0 +1,78 @@
1
+ = ShortURL 0.8.4
2
+
3
+ == Summary
4
+ ShortURL is a very simple library to use URL shortening services such as
5
+ RubyURL, urlTea, and TinyURL.
6
+
7
+ == Installation
8
+ ShortURL is available as a gem, installation is just like any other gem:
9
+ <tt>$ gem install shorturl</tt>
10
+
11
+ You can also download the tar.bz2 archive at
12
+ http://rubyforge.org/frs/?group_id=732 if you do not want to use the gem.
13
+
14
+ == Supported services
15
+ Here is the list of the services supported by ShortURL:
16
+ * http://rubyurl.com
17
+ * http://tinyurl.com
18
+ * http://shorl.com
19
+ * http://snipurl.com
20
+ * http://metamark.net
21
+ * http://makeashorterlink.com
22
+ * http://skinnylink.com
23
+ * http://linktrim.com
24
+ * http://shorterlink.com
25
+ * http://minilink.org
26
+ * http://ln-s.net
27
+ * http://fyad.org
28
+ * http://d62.net
29
+ * http://shiturl.com
30
+ * http://littlink.com
31
+ * http://clipurl.com
32
+ * http://shortify.com
33
+ * http://0rz.net
34
+ * http://moourl.com
35
+ * http://urltea.com
36
+
37
+ == Usage:
38
+ call-seq:
39
+ require "shorturl"
40
+ puts ShortURL.shorten("http://mypage.com")
41
+ puts ShortURL.shorten("http://mypage.com", :moourl)
42
+
43
+ The second parameter represents the service you want to use. These are:
44
+ * <tt>:rubyurl</tt>
45
+ * <tt>:tinyurl</tt>
46
+ * <tt>:shorl</tt>
47
+ * <tt>:snipurl</tt>
48
+ * <tt>:metamark</tt>
49
+ * <tt>:makeashorterlink</tt>
50
+ * <tt>:skinnylink</tt>
51
+ * <tt>:linktrim</tt>
52
+ * <tt>:shorterlink</tt>
53
+ * <tt>:minlink</tt>
54
+ * <tt>:lns</tt>
55
+ * <tt>:fyad</tt>
56
+ * <tt>:d62</tt>
57
+ * <tt>:shiturl</tt>
58
+ * <tt>:littlink</tt>
59
+ * <tt>:clipurl</tt>
60
+ * <tt>:shortify</tt>
61
+ * <tt>:orz</tt>
62
+ * <tt>:moourl</tt>
63
+ * <tt>:urltea</tt>
64
+
65
+
66
+ You can use <tt>ShortURL.valid_services</tt> to obtain a
67
+ list of the valid services (in case I forget to update the
68
+ documentation)
69
+
70
+ == Thanks
71
+ - Marcel Molina Jr., Devin Mullins for some ideas
72
+ - imperator from #ruby-lang (I don't know your real name, sorry) for
73
+ helping me with creating and uploading a RubyGem
74
+ - Daniel Dipaolo for telling me about ln-s.net and fyad.org
75
+
76
+ == Authors
77
+ - Vincent Foley (original developer)
78
+ - Robby Russell <robbyrussell@gmail.com>
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ = Todo
2
+
3
+ * Add more services
4
+ * Get input from people about what I should do
data/bin/shorturl ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "shorturl"
5
+
6
+ def usage
7
+ puts "Usage: #$0 <url> [<service>]"
8
+ puts "Available services:"
9
+ ShortURL.valid_services.each { |s| puts "\t#{s}" }
10
+ exit(-1)
11
+ end
12
+
13
+ def main
14
+ if ARGV.size < 1
15
+ usage
16
+ end
17
+
18
+ url = ARGV[0]
19
+ service = ARGV[1]
20
+
21
+ shorturl = if service.nil?
22
+ ShortURL.shorten(url)
23
+ else
24
+ if ShortURL.valid_services.include?(service.to_sym)
25
+ ShortURL.shorten(url, service.to_sym)
26
+ else
27
+ puts "Invalid service"
28
+ exit(-1)
29
+ end
30
+ end
31
+
32
+ puts shorturl
33
+
34
+ end
35
+
36
+ main
data/test/ts_all.rb ADDED
@@ -0,0 +1,11 @@
1
+ # ts_all.rb
2
+ #
3
+ # Created by Vincent Foley on 2005-06-01
4
+
5
+ $test_lib_dir = File.join(File.dirname(__FILE__))
6
+ $:.unshift($test_lib_dir)
7
+
8
+ require "test/unit"
9
+
10
+ require "tc_shorturl"
11
+ require "tc_service"
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: caleb-shorturl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.5
5
+ platform: ruby
6
+ authors:
7
+ - Robby Russell
8
+ autorequire: shorturl
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-16 00:00:00 -07:00
13
+ default_executable: shorturl
14
+ dependencies: []
15
+
16
+ description:
17
+ email: robby@planetargon.com
18
+ executables:
19
+ - shorturl
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - TODO
25
+ - MIT-LICENSE
26
+ - ChangeLog
27
+ files: []
28
+
29
+ has_rdoc: true
30
+ homepage: http://github.com/robbyrussell/shorturl/
31
+ licenses:
32
+ post_install_message:
33
+ rdoc_options:
34
+ - --title
35
+ - ShortURL Documentation
36
+ - --main
37
+ - README
38
+ - -S
39
+ - -N
40
+ - --all
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.3.5
59
+ signing_key:
60
+ specification_version: 2
61
+ summary: Shortens URLs using services such as RubyURL, urlTea, and TinyURL
62
+ test_files:
63
+ - test/ts_all.rb