gsearch 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/bin/google +7 -0
- data/bin/gsearch +7 -0
- data/google.gemspec +19 -0
- data/lib/google.rb +38 -0
- data/lib/google/version.rb +3 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8db38c4fd6e9a76d9e6e1549cc9dd18ef5924ecf
|
4
|
+
data.tar.gz: 93bb8458f855098e9f6493eb166324e531f310f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d37a34328a104a2fb88611fdcb465e6c542fd54baeb9be238361c4a2b16cf620ec4d60023225f18240a9b7832cb8cc8b6f606b5d375685eaa8ed9dd5222d2e9f
|
7
|
+
data.tar.gz: 0d4c667ccbe0c4fde5d15b5eb74152850efe86fc005b8afe56d4d9cee1916f5db68eaf60b3fc729f46b7d0f9ebcd75c33ef5a6bf0ff57c931c564526d07a5973
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 David William
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Google
|
2
|
+
|
3
|
+
Perform google searches from your terminal.
|
4
|
+
|
5
|
+
This gem is in a still immature but functional. For now, you will see only the results of the first page, but the second version will bring new features.
|
6
|
+
|
7
|
+
I love terminal. I think it is incredibly practical. While working, I would like to search something on google without leaving the terminal.
|
8
|
+
|
9
|
+
Once I find what I am looking for, I can visit the website or resource through the website.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
[sudo] gem install google
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
From the terminal, you can search for Ruby Programming Language:
|
18
|
+
|
19
|
+
$ google Ruby Programming Language
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
1. Fork it
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
25
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
27
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/google
ADDED
data/bin/gsearch
ADDED
data/google.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/google/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["David William"]
|
6
|
+
gem.email = ["david@webhall.com.br"]
|
7
|
+
gem.description = %q{Perform google searches from your terminal}
|
8
|
+
gem.summary = %q{Perform google searches from your terminal}
|
9
|
+
gem.homepage = "https://github.com/davidwilliam/google"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split("\n")
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "gsearch"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Google::VERSION
|
17
|
+
gem.add_dependency "mechanize", ">= 2.6.0"
|
18
|
+
gem.add_dependency "paint", ">= 0.8.5"
|
19
|
+
end
|
data/lib/google.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
require 'paint'
|
3
|
+
require "google/version"
|
4
|
+
|
5
|
+
module Google
|
6
|
+
|
7
|
+
def self.search
|
8
|
+
browser = Mechanize.new
|
9
|
+
|
10
|
+
criteria = ARGV
|
11
|
+
|
12
|
+
if criteria.size > 1
|
13
|
+
criteria = criteria.join(" ")
|
14
|
+
else
|
15
|
+
criteria = criteria.first
|
16
|
+
end
|
17
|
+
|
18
|
+
page = browser.get('http://google.com/')
|
19
|
+
form = page.form_with(:name => 'f')
|
20
|
+
form.q = criteria
|
21
|
+
result = form.submit
|
22
|
+
|
23
|
+
entries = result.search("li.g")
|
24
|
+
|
25
|
+
puts ""
|
26
|
+
puts Paint["Results for: #{criteria}", "#006699"]
|
27
|
+
puts ""
|
28
|
+
|
29
|
+
entries.each do |entry|
|
30
|
+
puts Paint[entry.search("h3.r").text, "#2ECCFA"]
|
31
|
+
puts Paint[entry.search("cite").text, "#A9E2F3"]
|
32
|
+
puts entry.search("span.st").text
|
33
|
+
puts Paint["http://google.com" + entry.search("h3.r").first.children.first.attributes["href"].value, "#045FB4"]
|
34
|
+
puts ""
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gsearch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David William
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mechanize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: paint
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.5
|
41
|
+
description: Perform google searches from your terminal
|
42
|
+
email:
|
43
|
+
- david@webhall.com.br
|
44
|
+
executables:
|
45
|
+
- google
|
46
|
+
- gsearch
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- .gitignore
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/google
|
56
|
+
- bin/gsearch
|
57
|
+
- google.gemspec
|
58
|
+
- lib/google.rb
|
59
|
+
- lib/google/version.rb
|
60
|
+
homepage: https://github.com/davidwilliam/google
|
61
|
+
licenses: []
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Perform google searches from your terminal
|
83
|
+
test_files: []
|