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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gem-gratitude.rb +12 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6e0df38ab77aaad1839d6bd7430460ab3aa6219
4
- data.tar.gz: 7ee7a242f2bbbfff8eeabea882f6688e018f4c1c
3
+ metadata.gz: 710b23fb9fd552becbb23b9d7eeba0cf33be1116
4
+ data.tar.gz: 967e71f8ab49ade409700c025d81b42ac8d121b4
5
5
  SHA512:
6
- metadata.gz: 3e22d369ab0d42f01de4d926e9880a1ef6d9679627f3eca600b5d60c7e633a8aba3b9a9f912f0f0cf0946ece665b9a9f5bc33c94131c77ad8b1a9e33c869d655
7
- data.tar.gz: 8572a745a497dec321bc00a6874ebbfa020a988a1b29d501e6efe5e0c9ac1a27e6abd8c5c723a2df512a9b802d29d762ee137adfaa008c8a4ed53afc92644d3c
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
- gem_spec = Gem::Specification.find_by_name(gem_name)
34
- @gem_list << {name: gem_name, homepage: gem_spec.homepage}
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-gratitude
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Bartlett