-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupstream_version_check
More file actions
executable file
·38 lines (32 loc) · 920 Bytes
/
upstream_version_check
File metadata and controls
executable file
·38 lines (32 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby
require 'open3'
packages = {
haml_lint: 'https://github.com/brigade/haml-lint/tags',
brakeman: 'https://github.com/presidentbeef/brakeman/tags',
rubocop: 'https://github.com/bbatsov/rubocop/tags',
rails_best_practices: 'https://github.com/railsbp/rails_best_practices/tags'
}
Dir.chdir __dir__
packages.each do |package, url|
line = File.readlines('Gemfile').grep(/#{package}/)[0]
version = line.match(/((\d+\.?)+)/).to_s
cmd = %W(
uscan
--upstream-version #{version}
--package #{package}
--no-download
--watchfile -
).join ' '
Open3.popen3(cmd) do |stdin, stdout, _stderr, _thread|
stdin.puts(
'version=3',
'opts=filenamemangle=' \
's/.+\\/v?(\\d\S*)\\.tar\\.gz/rubocop-$1\\.tar\\.gz/ \\',
"#{url} \\",
'.*/v?(\d\S*)\.tar\.gz'
)
stdin.close
ret = stdout.read.chomp
puts ret unless ret.empty?
end
end