repocrawler 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/repocrawler/crawler.rb +10 -9
- data/lib/repocrawler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61cddf36b5cfde9736ab07938e3ccab3c60fe534
|
4
|
+
data.tar.gz: bb6453f2e6f0c773221d2d0a010a47ebab36d775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9388ed7ad3a1c9844cb465d2a5c03606cdb69bcca78f2053de00d96b4f2f2e5b885aba588ef92b397f0c070d19bb5da7d718832e755d94ad5b414d82405d7db2
|
7
|
+
data.tar.gz: 964d35d8da298e377a573a70fa5c68ae568f951cf150a5cce5bf65ca5398d13b61ce25e1cbe577da32e94c7953574f40e7746f0dbbfb8c59eb0b424745571237
|
data/lib/repocrawler/crawler.rb
CHANGED
@@ -9,12 +9,13 @@ require 'open-uri'
|
|
9
9
|
module Repos
|
10
10
|
|
11
11
|
class GithubData
|
12
|
-
def initialize(repo_user, repo_name, github_password
|
12
|
+
def initialize(repo_user, repo_name, github_token, github_password, github_account, user_agent)
|
13
13
|
@GITHUB_README_URL = "https://raw.githubusercontent.com/#{repo_user}/#{repo_name}/master"
|
14
14
|
@GITHUB_API_BASE_URL = "https://api.github.com/repos/#{repo_user}/#{repo_name}"
|
15
|
-
@access_token =
|
16
|
-
@github_password = github_password
|
17
|
-
@
|
15
|
+
@access_token = github_token
|
16
|
+
@github_password = github_password
|
17
|
+
@github_account = github_account
|
18
|
+
@user_agent = user_agent
|
18
19
|
@repo_user = repo_user
|
19
20
|
@repo_name = repo_name
|
20
21
|
end
|
@@ -112,7 +113,7 @@ module Repos
|
|
112
113
|
|
113
114
|
# get the date of the last commit
|
114
115
|
def get_last_commits_days
|
115
|
-
github = Github.new basic_auth: "#{
|
116
|
+
github = Github.new basic_auth: "#{@github_account}:#{@github_password}"
|
116
117
|
|
117
118
|
commit = github.repos.commits.list(@repo_user, @repo_name).to_ary[0].to_hash['commit']['author']['date']
|
118
119
|
last_commit = (Date.today - Date.parse(commit)).to_i
|
@@ -216,8 +217,8 @@ module Repos
|
|
216
217
|
end
|
217
218
|
|
218
219
|
class RubyToolBoxData
|
219
|
-
def initialize(gem_name)
|
220
|
-
@user_agent =
|
220
|
+
def initialize(gem_name, user_agent)
|
221
|
+
@user_agent = user_agent
|
221
222
|
@RUBY_TOOLBOX_BASE_URL = "https://www.ruby-toolbox.com/projects/"
|
222
223
|
@RANKING_PATH = "//div[@class='teaser-bar']//li[last()-1]//a"
|
223
224
|
@gem_name = gem_name
|
@@ -239,8 +240,8 @@ module Repos
|
|
239
240
|
end
|
240
241
|
|
241
242
|
class StackOverflow
|
242
|
-
def initialize(gem_name)
|
243
|
-
@STACKOVERFLOW_API = "https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=creation&q=#{gem_name}&site=stackoverflow&key=#{
|
243
|
+
def initialize(gem_name, stackoverflow_token)
|
244
|
+
@STACKOVERFLOW_API = "https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=creation&q=#{gem_name}&site=stackoverflow&key=#{stackoverflow_token}"
|
244
245
|
end
|
245
246
|
|
246
247
|
#get questions from stackexchange
|
data/lib/repocrawler/version.rb
CHANGED