gitio 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/Gemfile +3 -0
- data/Rakefile +1 -0
- data/bin/gitio +22 -0
- data/gitio.gemspec +22 -0
- data/lib/gitio.rb +4 -0
- data/lib/gitio/version.rb +3 -0
- metadata +83 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/gitio
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
class GitIO < Thor
|
7
|
+
desc "shrink URL", "Shrinks a given URL using github's URL shortener, git.io"
|
8
|
+
method_option :name, :aliases => "-d", :desc => "Use a vanity name for the short link", :type => :string
|
9
|
+
def shrink(url)
|
10
|
+
vanity_name = options[:name]
|
11
|
+
response = Net::HTTP.post_form(URI.parse("http://git.io/"), {:url => url, :code => vanity_name})
|
12
|
+
|
13
|
+
case response
|
14
|
+
when Net::HTTPCreated then
|
15
|
+
puts response['location']
|
16
|
+
else
|
17
|
+
puts response.body
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
GitIO.start
|
data/gitio.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "gitio/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "gitio"
|
7
|
+
s.version = GitIO::VERSION
|
8
|
+
s.authors = ["Jonathan Baker"]
|
9
|
+
s.email = ["jonathanmbaker@me.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Shrinks URLs using the github URL shortener, git.io}
|
12
|
+
s.description = %q{Shrinks URLs using the github URL shortener, git.io}
|
13
|
+
|
14
|
+
s.rubyforge_project = "gitio"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "thor"
|
22
|
+
end
|
data/lib/gitio.rb
ADDED
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Jonathan Baker
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-11-11 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: thor
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: Shrinks URLs using the github URL shortener, git.io
|
34
|
+
email:
|
35
|
+
- jonathanmbaker@me.com
|
36
|
+
executables:
|
37
|
+
- gitio
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Rakefile
|
46
|
+
- bin/gitio
|
47
|
+
- gitio.gemspec
|
48
|
+
- lib/gitio.rb
|
49
|
+
- lib/gitio/version.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: ""
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project: gitio
|
78
|
+
rubygems_version: 1.3.7
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Shrinks URLs using the github URL shortener, git.io
|
82
|
+
test_files: []
|
83
|
+
|