puppet-community-rangefinder-webhook 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: ef7ddc103f99dd6467e3eb219847e1a8d5976133ee118b77eea9dc0a30e8c0d1
4
- data.tar.gz: 6c0dc61f6c7389722da76f642ed7fde664580486654d67109471d380f4d6a3e7
3
+ metadata.gz: 97d4e3e0e3376c9071f87ac1e3ea73922f0f69c671aec734b2760eb72af6e47d
4
+ data.tar.gz: 0f06f440ae68cd20937a1a4ea8df938d396ca1377458141c18dd107e5fac7470
5
5
  SHA512:
6
- metadata.gz: f718c1bb85d95de3f2b564fc4fdbd7f486115b2aa7790499574d81739923adcc9f1947446f0322831f4f34e60a1a17c948381eab52f8acd6f06ae6398408efb8
7
- data.tar.gz: 16efde15c4e7280cbcd2375f75c209e8b5f3b1e83c527d0f35c9d82899382136b51b594c35ab3f14139eca24891f6c81c87d7aa4bcffb963654e01e39b0fb94e
6
+ metadata.gz: c63f5214bde0ea420a1f6709714e163127db86a81c52cfb48ffb08d493ed4cb73503e1d5a44447a775818a10d7003f5c8d467c7cc4bc3d48f71af9c2d3e6c035
7
+ data.tar.gz: b160617aa6f2d0549879af64d03e6488458170410dbdc7317ccd2036c681c51b57124270c4f9ba8e9d8bc0a5e3a6680aec0a5c8dbe3a2184448e2503a3e9f5c0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.0.3
2
+
3
+ * Make all URIs in a report into forms that are clickable in a web browser.
4
+
5
+
1
6
  # v0.0.2
2
7
 
3
8
  * Check against the base repo instead of head
@@ -1,5 +1,5 @@
1
1
  require 'rangefinder/version'
2
2
  class Rangefinder::Webhook
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
 
@@ -31,6 +31,7 @@ class Rangefinder::Webhook < Sinatra::Base
31
31
  rescue => e
32
32
  $logger.error "There's a problem with your configuration file!"
33
33
  $logger.error e.message
34
+ $logger.debug e.backtrace.join "\n"
34
35
  exit 1
35
36
  end
36
37
  end
@@ -96,6 +97,9 @@ class Rangefinder::Webhook < Sinatra::Base
96
97
  uri = files.shift[:blob_url] # this order is intentional, it keeps the two lists in sync
97
98
  next if item.nil?
98
99
  item[:fileuri] = uri
100
+
101
+ munge_repo_urls(item[:exact])
102
+ munge_repo_urls(item[:near])
99
103
  end
100
104
  @impact.compact!
101
105
 
@@ -104,6 +108,27 @@ class Rangefinder::Webhook < Sinatra::Base
104
108
  end
105
109
  end
106
110
 
111
+ def munge_repo_urls(mod)
112
+ mod.each do |item|
113
+ item[:repo] = canonicalize(item[:repo], item[:module])
114
+ end
115
+ end
116
+
117
+ def canonicalize(url, mod)
118
+ # do it like this instead of a regex because this should cover more git servers. (github, gitlab, bitbucket, etc)
119
+ if url.nil? or url.class != String
120
+ "https://forge.puppet.com/#{mod.sub('-', '/')}"
121
+ elsif url.start_with? 'git://'
122
+ url.sub(/^git/, 'https')
123
+ elsif url.start_with? 'git@'
124
+ url.sub(/^git@([^:]+):/, 'https://\1/')
125
+ elsif url !~ URI::regexp
126
+ "https://forge.puppet.com/#{mod.sub('-', '/')}"
127
+ else
128
+ url
129
+ end
130
+ end
131
+
107
132
  # Saves the raw payload and converts the payload to JSON format
108
133
  def get_payload_request(request)
109
134
  # request.body is an IO or StringIO object
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-community-rangefinder-webhook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra