jmazzi-turl 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ = Turl
2
+
3
+ This is a CLI for generating tinyurls.
4
+
5
+ == Usage:
6
+
7
+ $ turl "http://example.com"
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ abort("Usage: turl 'url'") if ARGV.length == 0
4
+ require File.dirname(__FILE__)+'/../lib/tiny_url'
5
+ require 'optparse'
6
+
7
+ options = {}
8
+ opts = OptionParser.new
9
+ opts.on('-c', '--copy-to-clipboard') { options[:copy] = true }
10
+ opts.parse!()
11
+
12
+ output = TinyUrl.create(ARGV.last, options[:copy])
13
+ puts output if output
@@ -0,0 +1,15 @@
1
+ require 'net/http'
2
+ module TinyUrl
3
+ class << self
4
+ def create(url, copy)
5
+ uri = 'http://tinyurl.com/api-create.php?url=' + url
6
+ uri = URI.parse(uri)
7
+ tiny_url = Net::HTTP.get_response(uri).body
8
+ if copy
9
+ system("/bin/echo -n '#{tiny_url}' | pbcopy")
10
+ return
11
+ end
12
+ return tiny_url
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__)+'/../lib/tweet'
2
+ require 'expectations'
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jmazzi-turl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Justin Mazzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-24 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: ""
17
+ email: hh@mailheist.com
18
+ executables:
19
+ - turl
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/tiny_url.rb
26
+ - bin/turl
27
+ - README.rdoc
28
+ - test/test_helper.rb
29
+ has_rdoc: false
30
+ homepage: http://r00tshell.com
31
+ post_install_message:
32
+ rdoc_options: []
33
+
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ requirements: []
49
+
50
+ rubyforge_project:
51
+ rubygems_version: 1.2.0
52
+ signing_key:
53
+ specification_version: 2
54
+ summary: Generate a tinyurl from the command line.
55
+ test_files: []
56
+