any_good 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fe801250f6e51612d255456a8ad2d7e7cea083b
4
- data.tar.gz: b8db3eb675a42e1ca7bc9f9ece8e70ddd275da63
3
+ metadata.gz: 5d970099a0791af084958bce26bb59ca96420b26
4
+ data.tar.gz: b9815f2897c70e7ca759dc7f17bb0f8c15b5eb9b
5
5
  SHA512:
6
- metadata.gz: 985c456c6133c922c904176719795fc1fc737deba31b90fe33c5c514fb5e504f8015019b39452638c2f21283e78375055c2b129d087f5284eb00ef9b1b213f51
7
- data.tar.gz: d457b7e29bf41e278beac08b949c9c473d9e917f879548ffe063ab04b31430d493563c91492475c24426a9c09d07bdf355ccf4ec0f2556d87632fca1874d9854
6
+ metadata.gz: ffda17d3b08aab4562eda6fa9c2e5aa2283c867f84006ee0355be1241f42fa0951274227cb2e3d5dc62de383a57e2abfefc826039485aa71a5dbd3eb6cba9c8b
7
+ data.tar.gz: c78b4e6a64d1df24f390988e63b8b48e9324b4e4020d7efb00fd2393e603ef9f1d2bd3aa040e25e9641b3a15795f95df8da885492d42dc283b234f1e8a6ec6a2
data/lib/any_good.rb CHANGED
@@ -18,6 +18,8 @@ class AnyGood
18
18
  end
19
19
  end
20
20
 
21
+ GITHUB_URI_PATTERN = %r{^https?://(www\.)?github\.com/}
22
+
21
23
  def fetch
22
24
  data = {
23
25
  gem: Gems.info(name),
@@ -26,7 +28,7 @@ class AnyGood
26
28
  }
27
29
 
28
30
  repo_id = [data[:gem]['source_code_uri'], data[:gem]['homepage_uri']]
29
- .grep(%r{^https?://github\.com/}).first&.sub(%r{^https?://github\.com/}, '')
31
+ .grep(GITHUB_URI_PATTERN).first&.sub(GITHUB_URI_PATTERN, '')
30
32
 
31
33
  if repo_id
32
34
  data.merge!(
@@ -65,14 +67,14 @@ class AnyGood
65
67
  now = Time.now
66
68
 
67
69
  metric('Downloads', thresholds: [5_000, 10_000]) { data.gem['downloads'] }
68
- metric('Latest version', thresholds: [T.month.decrease(now, 2), T.year.decrease(now)]) {
70
+ metric('Latest version', thresholds: [T.year.decrease(now), T.month.decrease(now, 2)]) {
69
71
  Time.parse(data.gem_versions.first['created_at'])
70
72
  }
71
73
  metric('Used by', thresholds: [10, 100]) { data.gem_rev_deps.count }
72
74
 
73
75
  metric('Stars', thresholds: [100, 500]) { data.repo[:stargazers_count] }
74
76
  metric('Forks', thresholds: [5, 20]) { data.repo[:forks_count] }
75
- metric('Last commit', thresholds: [T.month.decrease(now), T.month.decrease(now, 4)]) {
77
+ metric('Last commit', thresholds: [T.month.decrease(now, 4), T.month.decrease(now)]) {
76
78
  data.last_commit.dig(:commit, :committer, :date)
77
79
  }
78
80
 
@@ -80,10 +82,10 @@ class AnyGood
80
82
  res = data.open_issues.count
81
83
  res == 50 ? '50+' : res
82
84
  }
83
- metric('...without reaction', thresholds: [-5, -20]) {
85
+ metric('...without reaction', thresholds: [-20, -4]) {
84
86
  data.open_issues.reject { |i| i[:labels].any? || i[:comments] > 0 }.count
85
87
  }
86
- metric('...last reaction', thresholds: [T.week.decrease(now), T.month.decrease(now)]) {
88
+ metric('...last reaction', thresholds: [T.month.decrease(now), T.week.decrease(now)]) {
87
89
  data.open_issues.detect { |i| i[:labels].any? || i[:comments] > 0 }&.fetch(:updated_at)
88
90
  }
89
91
  metric('Closed issues') {
@@ -54,7 +54,7 @@ class AnyGood
54
54
  end
55
55
  end
56
56
 
57
- def deduce_color(yellow = nil, red = nil)
57
+ def deduce_color(red = nil, yellow = nil)
58
58
  return :dark if value.nil?
59
59
  return :white if !yellow # no thresholds given
60
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: any_good
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Shepelev