gh-trending 1.0.3 → 1.0.4
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/gh-trending.gemspec +0 -1
- data/lib/gh-trending.rb +0 -0
- data/lib/gh_trending.rb +0 -0
- data/lib/gh_trending/developer.rb +0 -0
- data/lib/gh_trending/developers.rb +4 -21
- data/lib/gh_trending/parsers/developers_parser.rb +14 -7
- data/lib/gh_trending/parsers/html_changed_error.rb +0 -0
- data/lib/gh_trending/parsers/parser.rb +0 -0
- data/lib/gh_trending/parsers/parser_arguments.rb +0 -0
- data/lib/gh_trending/parsers/repos_parser.rb +2 -2
- data/lib/gh_trending/repositories.rb +4 -21
- data/lib/gh_trending/repository.rb +0 -0
- data/lib/gh_trending/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90549233f98874ce3911b5bd831f7886320c720f
|
4
|
+
data.tar.gz: 328e14821f558ec1b19997b5c75d672c83c74117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa9127dd8ad145077967c58bfd9b823fab9191d35926e43ac017eda1463aa932209d4d74c4b0a792fd7e46bdc748b0bba2a2cc44f283d73f478a769fd2d2f7cd
|
7
|
+
data.tar.gz: e14cb73b13d31fe42b645b85bd0823a896c575cf350729363d7280ed8ba463312acf232f31d0bf94ad56e7c021c920dc81d319040ef06e1d18171b57bc94d6a5
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/gh-trending.gemspec
CHANGED
data/lib/gh-trending.rb
CHANGED
File without changes
|
data/lib/gh_trending.rb
CHANGED
File without changes
|
File without changes
|
@@ -6,28 +6,11 @@ require 'gh_trending/developer'
|
|
6
6
|
module Gh
|
7
7
|
module Trending
|
8
8
|
# Returns an array of representation of the trending developers in github.
|
9
|
-
# Usage example: Gh::Trending::Developers.new.get(language: 'ruby')
|
10
9
|
class Developers
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@developers_list = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def get(*args)
|
19
|
-
parse_args = Gh::Trending::Parsers::ParserArguments.new(*args)
|
20
|
-
developers_list.clear
|
21
|
-
|
22
|
-
developers_list.push *@parser.parse(parse_args).to_a.compact
|
23
|
-
end
|
24
|
-
|
25
|
-
def [](idx)
|
26
|
-
developers_list[idx]
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_h
|
30
|
-
developers_list.map(&:to_h)
|
10
|
+
def self.get(**args)
|
11
|
+
parser = Gh::Trending::Parsers::DevelopersParser.new
|
12
|
+
parse_args = Gh::Trending::Parsers::ParserArguments.new(**args)
|
13
|
+
parser.parse(parse_args).to_a.compact
|
31
14
|
end
|
32
15
|
end
|
33
16
|
end
|
@@ -3,10 +3,9 @@ module Gh
|
|
3
3
|
module Parsers
|
4
4
|
# Parses the trending developers page
|
5
5
|
class DevelopersParser < Parser
|
6
|
-
LIST_WITH_DEVS_NODES_HTML_CLASS = 'ol.
|
7
|
-
H2_WITH_DEVELOPER_NAME = 'h2.user-leaderboard-list-name'.freeze
|
6
|
+
LIST_WITH_DEVS_NODES_HTML_CLASS = 'ol.list-style-none'.freeze
|
8
7
|
ANCHOR_WITH_HOT_REPOSITORY = 'a.repo-snipit'.freeze
|
9
|
-
SPAN_WITH_FULL_NAME = 'span.
|
8
|
+
SPAN_WITH_FULL_NAME = 'span.text-gray'.freeze
|
10
9
|
REGEXP_FOR_FULLNAME = /\((.+)\)/
|
11
10
|
|
12
11
|
def parse(parser_args)
|
@@ -44,22 +43,30 @@ module Gh
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def get_profile_url(dev_node)
|
47
|
-
parsed_url = dev_node.search(
|
48
|
-
.
|
46
|
+
parsed_url = dev_node.search('div.d-flex')[0]
|
47
|
+
.search('div.mx-2')[1]
|
48
|
+
.search('h2')[0]
|
49
49
|
.search('a')[0]
|
50
50
|
.attributes['href']
|
51
51
|
.value
|
52
|
+
|
52
53
|
build_github_url(parsed_url)
|
53
54
|
end
|
54
55
|
|
55
56
|
def get_hot_repository_url(dev_node)
|
56
|
-
parsed_url = dev_node.search(
|
57
|
+
parsed_url = dev_node.search('div.d-flex')[0]
|
58
|
+
.search(ANCHOR_WITH_HOT_REPOSITORY)[0]
|
57
59
|
.attributes['href'].value
|
58
60
|
build_github_url(parsed_url)
|
59
61
|
end
|
60
62
|
|
61
63
|
def get_full_name(dev_node)
|
62
|
-
span_with_full_name = dev_node.search(
|
64
|
+
span_with_full_name = dev_node.search('div.d-flex')[0]
|
65
|
+
.search('div.mx-2')[1]
|
66
|
+
.search('h2')[0]
|
67
|
+
.search('a')[0]
|
68
|
+
.search(SPAN_WITH_FULL_NAME)
|
69
|
+
|
63
70
|
return nil if span_with_full_name.empty?
|
64
71
|
|
65
72
|
match = span_with_full_name
|
File without changes
|
File without changes
|
File without changes
|
@@ -54,11 +54,11 @@ module Gh
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def get_language(repo_node)
|
57
|
-
repo_node.search(SPAN_WITH_LANGUAGE).text.strip
|
57
|
+
repo_node.search(SPAN_WITH_LANGUAGE)[0].text.strip
|
58
58
|
end
|
59
59
|
|
60
60
|
def get_stars(repo_node)
|
61
|
-
string_with_stars = repo_node.search(
|
61
|
+
string_with_stars = repo_node.search("div.f6")[0].search("a.muted-link")[0].text.strip
|
62
62
|
# Github shows the string "1,263 stars this week"
|
63
63
|
# Lets strip only the number.
|
64
64
|
string_with_stars.gsub!(',', '')
|
@@ -7,28 +7,11 @@ require 'gh_trending/parsers/html_changed_error'
|
|
7
7
|
module Gh
|
8
8
|
module Trending
|
9
9
|
# Returns an array of representation of the trending repositories in github.
|
10
|
-
# Usage example: Gh::Trending::Repositories.new.get(language: 'ruby')
|
11
10
|
class Repositories
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@repos_list = []
|
17
|
-
end
|
18
|
-
|
19
|
-
def get(*args)
|
20
|
-
parse_args = Gh::Trending::Parsers::ParserArguments.new(*args)
|
21
|
-
repos_list.clear
|
22
|
-
|
23
|
-
repos_list.push *@parser.parse(parse_args).to_a.compact
|
24
|
-
end
|
25
|
-
|
26
|
-
def [](idx)
|
27
|
-
repos_list[idx]
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_h
|
31
|
-
repos_list.map(&:to_h)
|
11
|
+
def self.get(**args)
|
12
|
+
parser = Gh::Trending::Parsers::ReposParser.new
|
13
|
+
parse_args = Gh::Trending::Parsers::ParserArguments.new(**args)
|
14
|
+
parser.parse(parse_args).to_a.compact
|
32
15
|
end
|
33
16
|
end
|
34
17
|
end
|
File without changes
|
data/lib/gh_trending/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-trending
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- luispcosta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: faker
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
description: "\n Fetches the trending repositories and developers from the github's
|
98
84
|
trending page.\n\n You can also filter the trending repositories and developers
|
99
85
|
by your favorite language and by time period\n (last day, last week and last
|
@@ -147,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
133
|
version: '0'
|
148
134
|
requirements: []
|
149
135
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.6.
|
136
|
+
rubygems_version: 2.6.13
|
151
137
|
signing_key:
|
152
138
|
specification_version: 4
|
153
139
|
summary: Fetch trending repositories/developers from the github's trending page
|