repocrawler 0.1.7 → 0.1.8
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/Gemfile +0 -1
- data/Gemfile.lock +13 -16
- data/lib/repocrawler/crawler.rb +6 -11
- data/lib/repocrawler/version.rb +1 -1
- metadata +1 -2
- data/config/local.example.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cb782e625bfe6927f3a16f58ed9a62b365b71cf
|
4
|
+
data.tar.gz: fa90602aad52c6e7281f324d51ab4b41d9b330df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f70eb2419766d7df9a23126eb7284346eb318f21902bc89c6142adc999e84470badbf291c153f8b1896d25cd6fced2464b894e8a10384285c59f49ddac88769
|
7
|
+
data.tar.gz: 035cf8503b50c7ef13b8caf340e2a604f8504672e65c6cc36491e3ebe2c75f70371b6b75bea7d5406c4a99fbe03115b1d9976da0ba55a85a861803e3e5843b2c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
5
|
-
bson (
|
6
|
-
configuration (1.3.4)
|
4
|
+
addressable (2.4.0)
|
5
|
+
bson (4.0.1)
|
7
6
|
descendants_tracker (0.0.4)
|
8
7
|
thread_safe (~> 0.3, >= 0.3.1)
|
9
8
|
faraday (0.9.2)
|
10
9
|
multipart-post (>= 1.2, < 3)
|
11
10
|
gems (0.8.3)
|
12
|
-
github_api (0.
|
13
|
-
addressable (~> 2.
|
11
|
+
github_api (0.13.1)
|
12
|
+
addressable (~> 2.4.0)
|
14
13
|
descendants_tracker (~> 0.0.4)
|
15
14
|
faraday (~> 0.8, < 0.10)
|
16
15
|
hashie (>= 3.4)
|
17
16
|
multi_json (>= 1.7.5, < 2.0)
|
18
|
-
nokogiri (~> 1.6.6)
|
19
17
|
oauth2
|
20
18
|
hashie (3.4.3)
|
21
19
|
httparty (0.13.7)
|
22
20
|
json (~> 1.8)
|
23
21
|
multi_xml (>= 0.5.2)
|
24
22
|
json (1.8.3)
|
25
|
-
jwt (1.5.
|
26
|
-
|
27
|
-
mongo (2.
|
28
|
-
bson (~>
|
23
|
+
jwt (1.5.1)
|
24
|
+
mini_portile2 (2.0.0)
|
25
|
+
mongo (2.2.2)
|
26
|
+
bson (~> 4.0)
|
29
27
|
multi_json (1.11.2)
|
30
28
|
multi_xml (0.5.5)
|
31
29
|
multipart-post (2.0.0)
|
32
|
-
nokogiri (1.6.
|
33
|
-
|
34
|
-
oauth2 (1.
|
30
|
+
nokogiri (1.6.7.2)
|
31
|
+
mini_portile2 (~> 2.0.0.rc2)
|
32
|
+
oauth2 (1.1.0)
|
35
33
|
faraday (>= 0.8, < 0.10)
|
36
|
-
jwt (~> 1.0)
|
34
|
+
jwt (~> 1.0, < 1.5.2)
|
37
35
|
multi_json (~> 1.3)
|
38
36
|
multi_xml (~> 0.5)
|
39
|
-
rack (
|
37
|
+
rack (>= 1.2, < 3)
|
40
38
|
rack (1.6.4)
|
41
39
|
thread_safe (0.3.5)
|
42
40
|
|
@@ -44,7 +42,6 @@ PLATFORMS
|
|
44
42
|
ruby
|
45
43
|
|
46
44
|
DEPENDENCIES
|
47
|
-
configuration
|
48
45
|
gems
|
49
46
|
github_api
|
50
47
|
httparty
|
data/lib/repocrawler/crawler.rb
CHANGED
@@ -3,21 +3,18 @@ require 'gems'
|
|
3
3
|
require 'mongo'
|
4
4
|
require 'github_api'
|
5
5
|
require 'httparty'
|
6
|
-
require 'configuration'
|
7
6
|
require 'nokogiri'
|
8
7
|
require 'open-uri'
|
9
8
|
|
10
9
|
module Repos
|
11
|
-
Kernel.load 'config/local.rb'
|
12
10
|
|
13
11
|
class GithubData
|
14
12
|
def initialize(repo_user, repo_name, github_password='')
|
15
13
|
@GITHUB_README_URL = "https://raw.githubusercontent.com/#{repo_user}/#{repo_name}/master"
|
16
14
|
@GITHUB_API_BASE_URL = "https://api.github.com/repos/#{repo_user}/#{repo_name}"
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@user_agent = @rubygems.user_agent
|
15
|
+
@access_token = ENV['github_token']
|
16
|
+
@github_password = github_password === '' ? ENV['github_password'] : github_password
|
17
|
+
@user_agent = ENV['user_agent']
|
21
18
|
@repo_user = repo_user
|
22
19
|
@repo_name = repo_name
|
23
20
|
end
|
@@ -115,7 +112,7 @@ module Repos
|
|
115
112
|
|
116
113
|
# get the date of the last commit
|
117
114
|
def get_last_commits_days
|
118
|
-
github = Github.new basic_auth: "#{
|
115
|
+
github = Github.new basic_auth: "#{ENV['github_account']}:#{@github_password}"
|
119
116
|
|
120
117
|
commit = github.repos.commits.list(@repo_user, @repo_name).to_ary[0].to_hash['commit']['author']['date']
|
121
118
|
last_commit = (Date.today - Date.parse(commit)).to_i
|
@@ -220,8 +217,7 @@ module Repos
|
|
220
217
|
|
221
218
|
class RubyToolBoxData
|
222
219
|
def initialize(gem_name)
|
223
|
-
|
224
|
-
@user_agent = rubygems.user_agent
|
220
|
+
@user_agent = ENV['user_agent']
|
225
221
|
@RUBY_TOOLBOX_BASE_URL = "https://www.ruby-toolbox.com/projects/"
|
226
222
|
@RANKING_PATH = "//div[@class='teaser-bar']//li[last()-1]//a"
|
227
223
|
@gem_name = gem_name
|
@@ -244,8 +240,7 @@ module Repos
|
|
244
240
|
|
245
241
|
class StackOverflow
|
246
242
|
def initialize(gem_name)
|
247
|
-
|
248
|
-
@STACKOVERFLOW_API = "https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=creation&q=#{gem_name}&site=stackoverflow&key=#{stackoverflow.stackoverflow_token}"
|
243
|
+
@STACKOVERFLOW_API = "https://api.stackexchange.com/2.2/search/advanced?order=desc&sort=creation&q=#{gem_name}&site=stackoverflow&key=#{ENV['stackoverflow_token']}"
|
249
244
|
end
|
250
245
|
|
251
246
|
#get questions from stackexchange
|
data/lib/repocrawler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repocrawler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Chen
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- Gemfile.lock
|
96
96
|
- README.md
|
97
97
|
- bin/repocrawler
|
98
|
-
- config/local.example.rb
|
99
98
|
- lib/repocrawler.rb
|
100
99
|
- lib/repocrawler/crawler.rb
|
101
100
|
- lib/repocrawler/version.rb
|
data/config/local.example.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'configuration'
|
2
|
-
|
3
|
-
Configuration.for('rubygems') do
|
4
|
-
github_token TOKEN
|
5
|
-
github_account GITHUB_ACCOUNT
|
6
|
-
github_password GITHUB_PASSWORD
|
7
|
-
user_agent USER_AGENT
|
8
|
-
end
|
9
|
-
|
10
|
-
Configuration.for('stackoverflow') do
|
11
|
-
stackoverflow_token STACKOVERFLOW_TOKEN
|
12
|
-
end
|