PageRankr 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.bundle/config ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_DISABLE_SHARED_GEMS: "1"
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.2@page_rankr --create
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :gemcutter
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ PageRankr (1.5.0)
5
+ nokogiri (>= 1.4.1)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ nokogiri (1.4.3.1)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ PageRankr!
17
+ nokogiri (>= 1.4.1)
data/PageRankr.gemspec CHANGED
@@ -1,11 +1,8 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ require File.expand_path("../lib/page_rankr/version", __FILE__)
5
2
 
6
3
  Gem::Specification.new do |s|
7
4
  s.name = %q{PageRankr}
8
- s.version = "1.4.3"
5
+ s.version = PageRankr::VERSION
9
6
 
10
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
8
  s.authors = ["Allen Madsen"]
@@ -16,36 +13,14 @@ Gem::Specification.new do |s|
16
13
  "LICENSE.md",
17
14
  "README.md"
18
15
  ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "CHANGELOG.md",
23
- "LICENSE.md",
24
- "PageRankr.gemspec",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION",
28
- "lib/page_rankr.rb",
29
- "lib/page_rankr/backlinks.rb",
30
- "lib/page_rankr/backlinks/alexa.rb",
31
- "lib/page_rankr/backlinks/alltheweb.rb",
32
- "lib/page_rankr/backlinks/altavista.rb",
33
- "lib/page_rankr/backlinks/backlink.rb",
34
- "lib/page_rankr/backlinks/bing.rb",
35
- "lib/page_rankr/backlinks/google.rb",
36
- "lib/page_rankr/backlinks/yahoo.rb",
37
- "lib/page_rankr/ranks.rb",
38
- "lib/page_rankr/ranks/alexa.rb",
39
- "lib/page_rankr/ranks/google.rb",
40
- "lib/page_rankr/ranks/google/checksum.rb",
41
- "lib/page_rankr/ranks/rank.rb",
42
- "lib/page_rankr/tracker.rb",
43
- "run.rb"
44
- ]
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files`.split("\n").map{|f| f =~ /^spec\/(.*)/ ? $1 : nil}.compact
19
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
45
20
  s.homepage = %q{http://github.com/blatyo/page_rankr}
46
21
  s.rdoc_options = ["--charset=UTF-8"]
47
22
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.3.7}
23
+ s.rubygems_version = %q{1.5.0}
49
24
  s.summary = %q{Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts}
50
25
 
51
26
  if s.respond_to? :specification_version then
@@ -54,14 +29,11 @@ Gem::Specification.new do |s|
54
29
 
55
30
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
31
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.1"])
57
- s.add_development_dependency(%q<yard>, [">= 0"])
58
32
  else
59
33
  s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
60
- s.add_dependency(%q<yard>, [">= 0"])
61
34
  end
62
35
  else
63
36
  s.add_dependency(%q<nokogiri>, [">= 1.4.1"])
64
- s.add_dependency(%q<yard>, [">= 0"])
65
37
  end
66
38
  end
67
39
 
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Provides an easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts.
4
4
 
5
+ Check out a little [web app][1] I wrote up that uses it or look at the [source][2].
6
+
7
+ [1]: http://isitpopular.heroku.com
8
+ [2]: http://github.com/blatyo/is_it_popular
9
+
5
10
  ## Get it!
6
11
 
7
12
  gem install PageRankr
data/lib/page_rankr.rb CHANGED
@@ -1,6 +1,6 @@
1
- require File.join("page_rankr", "tracker")
2
- require File.join("page_rankr", "backlinks")
3
- require File.join("page_rankr", "ranks")
1
+ require File.join(File.dirname(__FILE__), "page_rankr", "tracker")
2
+ require File.join(File.dirname(__FILE__), "page_rankr", "backlinks")
3
+ require File.join(File.dirname(__FILE__), "page_rankr", "ranks")
4
4
 
5
5
  module PageRankr
6
6
  class << self
@@ -0,0 +1,17 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ module PageRankr
5
+ class Backlink
6
+ attr_reader :backlinks
7
+ alias_method :tracked, :backlinks
8
+
9
+ def initialize(site)
10
+ @backlinks = clean Nokogiri::HTML(open url(site)).at(xpath).to_s
11
+ end
12
+
13
+ def clean(backlink_count)
14
+ backlink_count.gsub(/[a-zA-Z,\s\(\)]/, '').to_i
15
+ end
16
+ end
17
+ end
@@ -1,18 +1,13 @@
1
- require File.join("page_rankr", "backlinks", "backlink")
2
- require File.join("page_rankr", "backlinks", "alexa")
3
- require File.join("page_rankr", "backlinks", "alltheweb")
4
- require File.join("page_rankr", "backlinks", "altavista")
5
- require File.join("page_rankr", "backlinks", "bing")
6
- require File.join("page_rankr", "backlinks", "google")
7
- require File.join("page_rankr", "backlinks", "yahoo")
1
+ require File.join(File.dirname(__FILE__), "backlink")
2
+ require File.join(File.dirname(__FILE__), "backlinks", "alexa")
3
+ require File.join(File.dirname(__FILE__), "backlinks", "alltheweb")
4
+ require File.join(File.dirname(__FILE__), "backlinks", "altavista")
5
+ require File.join(File.dirname(__FILE__), "backlinks", "bing")
6
+ require File.join(File.dirname(__FILE__), "backlinks", "google")
7
+ require File.join(File.dirname(__FILE__), "backlinks", "yahoo")
8
8
 
9
9
  module PageRankr
10
10
  class Backlinks < Tracker
11
11
  alias_method :backlink_trackers, :site_trackers
12
-
13
- def initialize
14
- super
15
- @site_trackers.delete(:backlink)
16
- end
17
12
  end
18
13
  end
@@ -1,14 +1,18 @@
1
1
  require 'cgi'
2
+ require 'json'
2
3
 
3
4
  module PageRankr
4
5
  class Backlinks < Tracker
5
6
  class Google < Backlink
6
- def url(site)
7
- "http://www.google.com/search?q=link%3A%22#{CGI.escape(site)}%22"
7
+
8
+ # overloaded to use Google's AJAX search API
9
+ # http://code.google.com/apis/ajaxsearch/documentation/
10
+ def initialize(site)
11
+ @backlinks = clean JSON.parse( open( url(site)).read )["responseData"]["cursor"]["estimatedResultCount"].to_s
8
12
  end
9
13
 
10
- def xpath
11
- "//div[@id='resultStats']/text()"
14
+ def url(site)
15
+ "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=1&q=link%3A#{CGI.escape(site)}"
12
16
  end
13
17
  end
14
18
  end
@@ -0,0 +1,6 @@
1
+ module PageRankr
2
+ class Rank
3
+ attr_reader :rank
4
+ alias_method :tracked, :rank
5
+ end
6
+ end
@@ -1,14 +1,9 @@
1
- require File.join("page_rankr", "ranks", "rank")
2
- require File.join("page_rankr", "ranks", "alexa")
3
- require File.join("page_rankr", "ranks", "google")
1
+ require File.join(File.dirname(__FILE__), "rank")
2
+ require File.join(File.dirname(__FILE__), "ranks", "alexa")
3
+ require File.join(File.dirname(__FILE__), "ranks", "google")
4
4
 
5
5
  module PageRankr
6
6
  class Ranks < Tracker
7
7
  alias_method :rank_trackers, :site_trackers
8
-
9
- def initialize
10
- super
11
- @site_trackers.delete(:rank)
12
- end
13
8
  end
14
9
  end
@@ -1,5 +1,5 @@
1
1
  require "open-uri"
2
- require File.join("page_rankr", "ranks", "google", "checksum")
2
+ require File.join(File.dirname(__FILE__), "google", "checksum")
3
3
 
4
4
  module PageRankr
5
5
  class Ranks < Tracker
@@ -0,0 +1,3 @@
1
+ module PageRankr
2
+ VERSION = "1.5.0"
3
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 4
8
- - 3
9
- version: 1.4.3
7
+ - 5
8
+ - 0
9
+ version: 1.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Allen Madsen
@@ -32,19 +32,6 @@ dependencies:
32
32
  version: 1.4.1
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: yard
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
- version: "0"
46
- type: :development
47
- version_requirements: *id002
48
35
  description: Easy way to retrieve Google Page Rank, Alexa Rank, and backlink counts
49
36
  email: blatyo@gmail.com
50
37
  executables: []
@@ -55,30 +42,34 @@ extra_rdoc_files:
55
42
  - LICENSE.md
56
43
  - README.md
57
44
  files:
45
+ - .bundle/config
58
46
  - .document
59
47
  - .gitignore
48
+ - .rvmrc
60
49
  - CHANGELOG.md
50
+ - Gemfile
51
+ - Gemfile.lock
61
52
  - LICENSE.md
62
53
  - PageRankr.gemspec
63
54
  - README.md
64
55
  - Rakefile
65
56
  - VERSION
66
57
  - lib/page_rankr.rb
58
+ - lib/page_rankr/backlink.rb
67
59
  - lib/page_rankr/backlinks.rb
68
60
  - lib/page_rankr/backlinks/alexa.rb
69
61
  - lib/page_rankr/backlinks/alltheweb.rb
70
62
  - lib/page_rankr/backlinks/altavista.rb
71
- - lib/page_rankr/backlinks/backlink.rb
72
63
  - lib/page_rankr/backlinks/bing.rb
73
64
  - lib/page_rankr/backlinks/google.rb
74
65
  - lib/page_rankr/backlinks/yahoo.rb
66
+ - lib/page_rankr/rank.rb
75
67
  - lib/page_rankr/ranks.rb
76
68
  - lib/page_rankr/ranks/alexa.rb
77
69
  - lib/page_rankr/ranks/google.rb
78
70
  - lib/page_rankr/ranks/google/checksum.rb
79
- - lib/page_rankr/ranks/rank.rb
80
71
  - lib/page_rankr/tracker.rb
81
- - run.rb
72
+ - lib/page_rankr/version.rb
82
73
  has_rdoc: true
83
74
  homepage: http://github.com/blatyo/page_rankr
84
75
  licenses: []
@@ -1,19 +0,0 @@
1
- require 'nokogiri'
2
- require 'open-uri'
3
-
4
- module PageRankr
5
- class Backlinks < Tracker
6
- class Backlink
7
- attr_reader :backlinks
8
- alias_method :tracked, :backlinks
9
-
10
- def initialize(site)
11
- @backlinks = clean Nokogiri::HTML(open url(site)).at(xpath).to_s
12
- end
13
-
14
- def clean(backlink_count)
15
- backlink_count.gsub(/[a-zA-Z,\s\(\)]/, '').to_i
16
- end
17
- end
18
- end
19
- end
@@ -1,8 +0,0 @@
1
- module PageRankr
2
- class Ranks < Tracker
3
- class Rank
4
- attr_reader :rank
5
- alias_method :tracked, :rank
6
- end
7
- end
8
- end
data/run.rb DELETED
@@ -1,3 +0,0 @@
1
- $:.unshift "./lib/"
2
- require 'page_rankr'
3
- PageRankr.ranks("www.hoptoad.com")