gem-gratitude 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gem-gratitude.rb +12 -3
- 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: 710b23fb9fd552becbb23b9d7eeba0cf33be1116
|
4
|
+
data.tar.gz: 967e71f8ab49ade409700c025d81b42ac8d121b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d739213d01adbc80976f7593c33a2e963c9b73d3f6844e406b868141b9e6f3499002136bdd4a242dda434073fce7c2daff0a45acafe165fb2c2c802648859a
|
7
|
+
data.tar.gz: 05a30bb51db7d9b7c95af8273fc7c728692185067969a7f2f5c6c917b89be600f001e2d1dc02d1f521ad8a86de248678bd8673bd708c4bb103047c8b01953831
|
data/lib/gem-gratitude.rb
CHANGED
@@ -24,14 +24,21 @@ class Issue
|
|
24
24
|
replacements = [ '\'', '"', ',' ]
|
25
25
|
|
26
26
|
# Parse the gem names from the Gemfile
|
27
|
+
puts 'Reading Gemfile...'
|
27
28
|
File.open(gemfile_path).read.each_line do |line|
|
28
29
|
parts = line.split
|
29
30
|
if parts[0] == "gem" && parts[0].start_with?("gem")
|
30
31
|
gem_name = parts[1]
|
31
32
|
replacements.each {|r| gem_name.gsub!(r, '')}
|
32
33
|
next if parts[2] == 'github:'
|
33
|
-
|
34
|
-
|
34
|
+
begin
|
35
|
+
gem_spec = Gem::Specification.find_by_name(gem_name)
|
36
|
+
puts "#{gem_name}"
|
37
|
+
@gem_list << {name: gem_name, homepage: gem_spec.homepage} if gem_spec.homepage
|
38
|
+
rescue Gem::LoadError
|
39
|
+
puts "Could not find gem '#{gem_name}'"
|
40
|
+
next
|
41
|
+
end
|
35
42
|
end
|
36
43
|
end
|
37
44
|
|
@@ -46,6 +53,7 @@ class Issue
|
|
46
53
|
file = File.open(tmp_html, 'w')
|
47
54
|
|
48
55
|
# Find all open issues via the GitHub API
|
56
|
+
puts 'Querying GitHub API for open issues...'
|
49
57
|
@html_content = ''
|
50
58
|
@issue_count = 0
|
51
59
|
@gem_list.each do |g|
|
@@ -53,7 +61,7 @@ class Issue
|
|
53
61
|
response = HTTParty.get("https://api.github.com/repos/#{github_url[-2]}/#{github_url[-1]}/issues?state=open")
|
54
62
|
json = JSON.parse(response.body)
|
55
63
|
if response.code == 200
|
56
|
-
puts "#{g[:name]}: #{g[:homepage]} - #{json.count} open issues
|
64
|
+
puts "#{g[:name]}: #{g[:homepage]} - #{json.count} open issues"
|
57
65
|
json.each do |issue|
|
58
66
|
@issue_count += 1
|
59
67
|
@html_content <<
|
@@ -65,6 +73,7 @@ class Issue
|
|
65
73
|
end
|
66
74
|
|
67
75
|
# Write to ERB template
|
76
|
+
puts 'Generating HTML...'
|
68
77
|
erb = ERB.new(File.read('template.erb'))
|
69
78
|
file.write erb.result(binding)
|
70
79
|
|