keyword_ranking 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +24 -0
- data/Gemfile +3 -7
- data/Gemfile.lock +30 -0
- data/LICENSE +20 -0
- data/README.markdown +1 -1
- data/Rakefile +46 -2
- data/VERSION +1 -0
- data/keyword_ranking.gemspec +36 -17
- data/lib/keyword_ranking.rb +4 -2
- data/spec/keyword_ranking_spec.rb +15 -6
- data/spec/spec.opts +1 -4
- data/spec/spec_helper.rb +9 -0
- metadata +43 -38
- data/CHANGELOG +0 -1
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
gemcutter (0.6.1)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.4.0)
|
8
|
+
gemcutter (>= 0.1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rubyforge (>= 2.0.0)
|
11
|
+
json_pure (1.4.6)
|
12
|
+
nokogiri (1.4.3.1)
|
13
|
+
rspec (2.0.0.beta.19)
|
14
|
+
rspec-core (= 2.0.0.beta.19)
|
15
|
+
rspec-expectations (= 2.0.0.beta.19)
|
16
|
+
rspec-mocks (= 2.0.0.beta.19)
|
17
|
+
rspec-core (2.0.0.beta.19)
|
18
|
+
rspec-expectations (2.0.0.beta.19)
|
19
|
+
diff-lcs (>= 1.1.2)
|
20
|
+
rspec-mocks (2.0.0.beta.19)
|
21
|
+
rubyforge (2.0.4)
|
22
|
+
json_pure (>= 1.1.7)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
jeweler
|
29
|
+
nokogiri
|
30
|
+
rspec (>= 1.3.0)
|
data/LICENSE
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Crowd Interactive
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Use this gem to calculate the keyword ranking for *Bing*, *Yahoo* or *Google* as follows:
|
4
4
|
|
5
|
-
|
5
|
+
Ranking.new(:keyword => 'one keyword', :url => 'www.mydomain.com', :limit => 100).from_google
|
6
6
|
|
7
7
|
##Note
|
8
8
|
|
data/Rakefile
CHANGED
@@ -1,2 +1,46 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "keyword_ranking"
|
8
|
+
gem.summary = %Q{Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google}
|
9
|
+
gem.description = %Q{Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google}
|
10
|
+
gem.email = "luisalberto.velasco@crowdint.com"
|
11
|
+
gem.homepage = "http://github.com/crowdint/keyword_ranking"
|
12
|
+
gem.authors = ["Luis Velasco"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
task :spec => :check_dependencies
|
22
|
+
|
23
|
+
begin
|
24
|
+
require 'reek/adapters/rake_task'
|
25
|
+
Reek::RakeTask.new do |t|
|
26
|
+
t.fail_on_error = true
|
27
|
+
t.verbose = false
|
28
|
+
t.source_files = 'lib/**/*.rb'
|
29
|
+
end
|
30
|
+
rescue LoadError
|
31
|
+
task :reek do
|
32
|
+
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "keyword_ranking #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.2
|
data/keyword_ranking.gemspec
CHANGED
@@ -1,37 +1,56 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{keyword_ranking}
|
5
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.2"
|
6
9
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">=
|
8
|
-
s.authors = ["Luis
|
9
|
-
s.date = %q{2010-08-
|
10
|
-
s.description = %q{
|
11
|
-
s.email = %q{
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Luis Velasco"]
|
12
|
+
s.date = %q{2010-08-19}
|
13
|
+
s.description = %q{Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google}
|
14
|
+
s.email = %q{luisalberto.velasco@crowdint.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.markdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"keyword_ranking.gemspec",
|
28
|
+
"lib/keyword_ranking.rb",
|
29
|
+
"spec/keyword_ranking_spec.rb",
|
30
|
+
"spec/spec.opts",
|
31
|
+
"spec/spec_helper.rb"
|
32
|
+
]
|
14
33
|
s.homepage = %q{http://github.com/crowdint/keyword_ranking}
|
15
|
-
s.rdoc_options = ["--
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
16
35
|
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{keyword_ranking}
|
18
36
|
s.rubygems_version = %q{1.3.7}
|
19
|
-
s.summary = %q{
|
37
|
+
s.summary = %q{Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"spec/keyword_ranking_spec.rb"
|
41
|
+
]
|
20
42
|
|
21
43
|
if s.respond_to? :specification_version then
|
22
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
45
|
s.specification_version = 3
|
24
46
|
|
25
47
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.
|
27
|
-
s.add_development_dependency(%q<bundler>, [">= 0.9.26"])
|
48
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
28
49
|
else
|
29
|
-
s.add_dependency(%q<
|
30
|
-
s.add_dependency(%q<bundler>, [">= 0.9.26"])
|
50
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
31
51
|
end
|
32
52
|
else
|
33
|
-
s.add_dependency(%q<
|
34
|
-
s.add_dependency(%q<bundler>, [">= 0.9.26"])
|
53
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
35
54
|
end
|
36
55
|
end
|
37
56
|
|
data/lib/keyword_ranking.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'nokogiri'
|
2
3
|
require 'net/http'
|
3
4
|
|
@@ -24,7 +25,8 @@ class Ranking
|
|
24
25
|
|
25
26
|
def from
|
26
27
|
validate_options
|
27
|
-
Finder.
|
28
|
+
@finder ||= Finder.new
|
29
|
+
@finder.find(@options)
|
28
30
|
end
|
29
31
|
|
30
32
|
def method_missing(method, *args, &block)
|
@@ -47,7 +49,7 @@ end
|
|
47
49
|
|
48
50
|
class Finder
|
49
51
|
|
50
|
-
def
|
52
|
+
def find(options) #keyword, url, limit, engine, res_per_page
|
51
53
|
options[:keyword].gsub!(/\s/, '+')
|
52
54
|
request_url, results_selector, cite_selector = case options[:engine].to_sym
|
53
55
|
when :bing
|
@@ -1,9 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
# describe "KeywordRanking" do
|
4
|
+
# it "fails" do
|
5
|
+
# fail "hey buddy, you should probably rename this file and start specing for real"
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# # $LOAD_PATH << File.expand_path('../../lib' , __FILE__)
|
11
|
+
# #
|
12
|
+
# # require 'rubygems'
|
13
|
+
# # require 'bundler'
|
14
|
+
# # Bundler.setup(:development)
|
15
|
+
# # require 'keyword_ranking'
|
7
16
|
|
8
17
|
module FinderSpecHelper
|
9
18
|
class Finder
|
data/spec/spec.opts
CHANGED
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,90 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keyword_ranking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
|
-
- Luis
|
13
|
+
- Luis Velasco
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-19 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
27
35
|
type: :development
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.26
|
34
|
-
version:
|
35
|
-
description: Create keyword rankings from the 3 major search engines
|
36
|
-
email: whizkas@hotmail.com
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google
|
38
|
+
email: luisalberto.velasco@crowdint.com
|
37
39
|
executables: []
|
38
40
|
|
39
41
|
extensions: []
|
40
42
|
|
41
43
|
extra_rdoc_files:
|
42
|
-
- CHANGELOG
|
43
44
|
- LICENSE
|
44
45
|
- README.markdown
|
45
|
-
- lib/keyword_ranking.rb
|
46
46
|
files:
|
47
|
-
-
|
47
|
+
- .gitignore
|
48
48
|
- Gemfile
|
49
|
+
- Gemfile.lock
|
49
50
|
- LICENSE
|
50
51
|
- README.markdown
|
51
52
|
- Rakefile
|
53
|
+
- VERSION
|
54
|
+
- keyword_ranking.gemspec
|
52
55
|
- lib/keyword_ranking.rb
|
53
56
|
- spec/keyword_ranking_spec.rb
|
54
57
|
- spec/spec.opts
|
55
|
-
-
|
58
|
+
- spec/spec_helper.rb
|
56
59
|
has_rdoc: true
|
57
60
|
homepage: http://github.com/crowdint/keyword_ranking
|
58
61
|
licenses: []
|
59
62
|
|
60
63
|
post_install_message:
|
61
64
|
rdoc_options:
|
62
|
-
- --
|
63
|
-
- --inline-source
|
64
|
-
- --title
|
65
|
-
- Keyword_ranking
|
66
|
-
- --main
|
67
|
-
- README
|
65
|
+
- --charset=UTF-8
|
68
66
|
require_paths:
|
69
67
|
- lib
|
70
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
71
70
|
requirements:
|
72
71
|
- - ">="
|
73
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
74
76
|
version: "0"
|
75
|
-
version:
|
76
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
77
79
|
requirements:
|
78
80
|
- - ">="
|
79
81
|
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
82
86
|
requirements: []
|
83
87
|
|
84
|
-
rubyforge_project:
|
85
|
-
rubygems_version: 1.3.
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.3.7
|
86
90
|
signing_key:
|
87
91
|
specification_version: 3
|
88
|
-
summary:
|
89
|
-
test_files:
|
90
|
-
|
92
|
+
summary: Ruby library to get the ranking of a url based on a keyword in Bing, Yahoo or Google
|
93
|
+
test_files:
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
- spec/keyword_ranking_spec.rb
|
data/CHANGELOG
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
v1.0. First draft
|