repocrawler 0.1.8 → 0.1.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cb782e625bfe6927f3a16f58ed9a62b365b71cf
4
- data.tar.gz: fa90602aad52c6e7281f324d51ab4b41d9b330df
3
+ metadata.gz: 61cddf36b5cfde9736ab07938e3ccab3c60fe534
4
+ data.tar.gz: bb6453f2e6f0c773221d2d0a010a47ebab36d775
5
5
  SHA512:
6
- metadata.gz: 5f70eb2419766d7df9a23126eb7284346eb318f21902bc89c6142adc999e84470badbf291c153f8b1896d25cd6fced2464b894e8a10384285c59f49ddac88769
7
- data.tar.gz: 035cf8503b50c7ef13b8caf340e2a604f8504672e65c6cc36491e3ebe2c75f70371b6b75bea7d5406c4a99fbe03115b1d9976da0ba55a85a861803e3e5843b2c
6
+ metadata.gz: 9388ed7ad3a1c9844cb465d2a5c03606cdb69bcca78f2053de00d96b4f2f2e5b885aba588ef92b397f0c070d19bb5da7d718832e755d94ad5b414d82405d7db2
7
+ data.tar.gz: 964d35d8da298e377a573a70fa5c68ae568f951cf150a5cce5bf65ca5398d13b61ce25e1cbe577da32e94c7953574f40e7746f0dbbfb8c59eb0b424745571237
@@ -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 = ENV['github_token']
16
- @github_password = github_password === '' ? ENV['github_password'] : github_password
17
- @user_agent = ENV['user_agent']
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: "#{ENV['github_account']}:#{@github_password}"
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 = ENV['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=#{ENV['stackoverflow_token']}"
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
@@ -1,4 +1,4 @@
1
1
  # Versioning
2
2
  module Repos
3
- VERSION = '0.1.8'
3
+ VERSION = '0.1.9'
4
4
  end
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Chen