githubtip 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +13 -0
- data/Rakefile +2 -0
- data/bin/githubtip +5 -0
- data/githubtip.gemspec +21 -0
- data/lib/githubtip.rb +24 -0
- data/lib/githubtip/version.rb +3 -0
- metadata +63 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Github Tips
|
2
|
+
===========
|
3
|
+
|
4
|
+
This simple Gem will fetch a random Tip from [Github Tips](https://github.com/tips "Github Tips") and print it in your terminal.
|
5
|
+
|
6
|
+
To use this, just run <tt>githubtip</tt>
|
7
|
+
|
8
|
+

|
9
|
+
|
10
|
+
|
11
|
+
XoXo,
|
12
|
+
|
13
|
+
Nicolás Hock Isaza - nhocki@gmail.com
|
data/Rakefile
ADDED
data/bin/githubtip
ADDED
data/githubtip.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "githubtip/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "githubtip"
|
7
|
+
s.version = Githubtip::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Nicolás Hock Isaza"]
|
10
|
+
s.email = ["nhocki@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Simple gem that prints a github tip on your terminal}
|
13
|
+
s.description = %q{Simple gem that prints a github tip on your terminal}
|
14
|
+
|
15
|
+
s.rubyforge_project = "githubtip"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/lib/githubtip.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
|
5
|
+
module Github
|
6
|
+
|
7
|
+
module Tip
|
8
|
+
|
9
|
+
def self.fetch
|
10
|
+
url = URI.parse("https://github.com/tips")
|
11
|
+
req = Net::HTTP::Get.new(url.path)
|
12
|
+
req.add_field("Accept", "text/javascript")
|
13
|
+
req.add_field("X-Requested-With", "XMLHttpRequest")
|
14
|
+
http = Net::HTTP.new(url.host, url.port)
|
15
|
+
http.use_ssl = true
|
16
|
+
res = http.start do |httpp|
|
17
|
+
httpp.request(req)
|
18
|
+
end
|
19
|
+
# Removes the html tags
|
20
|
+
res.body.gsub(/(<[^>]+>| |\n|\r| &)/,"")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: githubtip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Nicol\xC3\xA1s Hock Isaza"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-15 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Simple gem that prints a github tip on your terminal
|
17
|
+
email:
|
18
|
+
- nhocki@gmail.com
|
19
|
+
executables:
|
20
|
+
- githubtip
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- Gemfile
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/githubtip
|
31
|
+
- githubtip.gemspec
|
32
|
+
- lib/githubtip.rb
|
33
|
+
- lib/githubtip/version.rb
|
34
|
+
homepage: ""
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project: githubtip
|
57
|
+
rubygems_version: 1.7.2
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Simple gem that prints a github tip on your terminal
|
61
|
+
test_files: []
|
62
|
+
|
63
|
+
has_rdoc:
|