Skip to content

Commit

Permalink
Merge branch 'joss' into jose
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanxu committed Nov 17, 2023
2 parents d80ae37 + 79cc719 commit ee07c12
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ gem 'faraday-retry'
gem 'serrano'
gem 'rexml'
gem 'github-linguist'
gem 'licensee'
# Remove git ref once a version > 9.16 is released allowing use of latest octokit
gem 'licensee', git: 'https://github.com/licensee/licensee.git', ref: '8d95400835b'
gem 'issue'
gem 'chronic'

Expand Down
36 changes: 21 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
GIT
remote: https://github.com/licensee/licensee.git
revision: 8d95400835bb49a005785e2cdd6ea07270c07217
ref: 8d95400835b
specs:
licensee (9.16.0)
dotenv (~> 2.0)
octokit (>= 4.20, < 9.0)
reverse_markdown (>= 1, < 3)
rugged (>= 0.24, < 2.0)
thor (>= 0.19, < 2.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.1.1)
base64 (0.2.0)
bibtex-ruby (6.0.0)
latex-decode (~> 0.0)
cgi (0.3.6)
cgi (0.4.0)
charlock_holmes (0.7.7)
chronic (0.10.2)
concurrent-ruby (1.2.2)
Expand Down Expand Up @@ -34,22 +46,16 @@ GEM
openssl
rack
latex-decode (0.4.0)
licensee (9.16.0)
dotenv (~> 2.0)
octokit (>= 4.20, < 7.0)
reverse_markdown (>= 1, < 3)
rugged (>= 0.24, < 2.0)
thor (>= 0.19, < 2.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
mini_portile2 (2.8.5)
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
nio4r (2.5.9)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
octokit (6.1.1)
octokit (8.0.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
ojra (1.1.0)
Expand All @@ -58,13 +64,13 @@ GEM
public_suffix (5.0.3)
puma (6.4.0)
nio4r (~> 2.0)
racc (1.7.1)
racc (1.7.3)
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
redis-client (0.17.0)
redis-client (0.18.0)
connection_pool
reverse_markdown (2.1.1)
nokogiri
Expand Down Expand Up @@ -93,7 +99,7 @@ GEM
multi_json (~> 1.15)
rexml (~> 3.2, >= 3.2.5)
thor (~> 1.2, >= 1.2.1)
sidekiq (7.1.4)
sidekiq (7.2.0)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
rack (>= 2.2.4)
Expand All @@ -109,7 +115,7 @@ GEM
rack-protection (= 3.1.0)
sinatra (= 3.1.0)
tilt (~> 2.0)
thor (1.2.2)
thor (1.3.0)
tilt (2.3.0)
webmock (3.19.1)
addressable (>= 2.8.0)
Expand All @@ -126,7 +132,7 @@ DEPENDENCIES
faraday-retry
github-linguist
issue
licensee
licensee!
octokit
ojra
openssl
Expand Down
4 changes: 2 additions & 2 deletions app/workers/repo_checks_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def repo_summary
def detect_languages
repo = Rugged::Repository.new(path)
project = Linguist::Repository.new(repo, repo.head.target_id)

top_3 = project.languages.keys.take(3)
ordered_languages = project.languages.sort_by { |_, size| size }.reverse.first(3)
top_3 = ordered_languages.first(3).map {|l,s| l}
label_issue(top_3) unless top_3.empty?
end

Expand Down
2 changes: 1 addition & 1 deletion spec/workers/repo_checks_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
describe "#detect_languages" do
before do
repo = OpenStruct.new(head: OpenStruct.new(target_id: 33))
expected_languages = OpenStruct.new(languages: {"Ruby"=>176110, "HTML"=>664, "TeX"=>475, "Go"=>21})
expected_languages = OpenStruct.new(languages: {"Go"=>21, "HTML"=>664, "Ruby"=>176110, "TeX"=>475, "XML" => 100})
allow(Rugged::Repository).to receive(:new).and_return(repo)
allow(Linguist::Repository).to receive(:new).with(repo, 33).and_return(expected_languages)
end
Expand Down

0 comments on commit ee07c12

Please sign in to comment.