actions-updater 0.1.4 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/actions-updater +12 -3
- data/lib/action.rb +11 -4
- metadata +61 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1750a3e84d196c21fdb35f226773f07b96684cda646e37c49a3a66849880a778
|
4
|
+
data.tar.gz: 3285583f5919ddcd653c516e7eb087f41c925fe98ca5cbceab07584105770645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25f4d9ef1f360d19cb4062b7766834a0ddf47986b1d59c9f4c00b4dfd393d16e1642047a2385b7177b6eefeab1703e04387459c313c10a3687efaf71844bb525
|
7
|
+
data.tar.gz: 90afc589800c9c5f195be466fc821cadd600b8d26be93125ba27a6ef6022e5d99456753997a8516aea18b17a395367a0dbd7318c1c50bd58224cfaf757311a00
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.12
|
data/bin/actions-updater
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'optparse'
|
5
|
+
require 'colorize'
|
5
6
|
require 'action'
|
6
7
|
|
7
8
|
OptionParser.new do |parser|
|
@@ -16,16 +17,24 @@ OptionParser.new do |parser|
|
|
16
17
|
end.parse!
|
17
18
|
|
18
19
|
ARGV.each do |path|
|
19
|
-
puts
|
20
|
+
puts path.magenta
|
20
21
|
yaml = File.read(path)
|
21
22
|
actions = Action.array_from_yaml(yaml)
|
22
23
|
actions.each do |current_action|
|
23
24
|
new_action = current_action.clone
|
24
25
|
new_action.ref = current_action.latest_tag
|
26
|
+
new_ref_str = new_action.ref.bold
|
27
|
+
current_ref_str = current_action.ref.bold
|
28
|
+
current_action_str = current_action.print_without_ref.cyan.bold
|
25
29
|
|
26
|
-
|
30
|
+
if current_action == new_action
|
31
|
+
next if @newer
|
32
|
+
else
|
33
|
+
new_ref_str = new_ref_str.green
|
34
|
+
current_ref_str = current_ref_str.red
|
35
|
+
end
|
27
36
|
|
28
|
-
puts "#{
|
37
|
+
puts "#{current_action_str} : #{current_ref_str} ==> #{new_ref_str}"
|
29
38
|
|
30
39
|
next unless @write
|
31
40
|
|
data/lib/action.rb
CHANGED
@@ -4,7 +4,6 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
class Action
|
6
6
|
attr_accessor :user, :repo, :dir, :ref
|
7
|
-
attr_reader :url
|
8
7
|
|
9
8
|
USES_REGEX = %r{^(?<user>[^/]+)[/](?<repo>[^/]+)[/]?(?<dir>.+)?[@](?<ref>.+)$}.freeze
|
10
9
|
TAGS_REGEX = %r{refs/tags/(.*)$}.freeze
|
@@ -34,24 +33,32 @@ class Action
|
|
34
33
|
@repo = captures['repo']
|
35
34
|
@dir = captures['dir']
|
36
35
|
@ref = captures['ref']
|
37
|
-
@url = "#{DOMAIN}/#{@user}/#{@repo}"
|
38
36
|
end
|
39
37
|
|
40
38
|
def to_s
|
39
|
+
print
|
40
|
+
end
|
41
|
+
|
42
|
+
def print
|
41
43
|
"#{@user}/#{@repo}#{@dir ? '/' : ''}#{@dir}#{@ref ? '@' : ''}#{@ref}"
|
42
44
|
end
|
43
45
|
|
46
|
+
def print_without_ref
|
47
|
+
"#{@user}/#{@repo}#{@dir ? '/' : ''}#{@dir}"
|
48
|
+
end
|
49
|
+
|
44
50
|
def ==(other)
|
45
51
|
to_s == other.to_s
|
46
52
|
end
|
47
53
|
|
48
54
|
def latest_tag
|
49
|
-
|
55
|
+
url = "#{DOMAIN}/#{@user}/#{@repo}"
|
56
|
+
tags = `git ls-remote -t #{url}`.scan(TAGS_REGEX).flatten
|
50
57
|
tags.reject! do |tag|
|
51
58
|
TAG_REJECT_REASONS.any? do |reason|
|
52
59
|
tag.include?(reason)
|
53
60
|
end
|
54
61
|
end
|
55
|
-
tags.last
|
62
|
+
tags.last || @ref
|
56
63
|
end
|
57
64
|
end
|
metadata
CHANGED
@@ -1,15 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actions-updater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dawid Dziurla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2020-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
13
69
|
description:
|
14
70
|
email:
|
15
71
|
executables:
|
@@ -39,7 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
95
|
- !ruby/object:Gem::Version
|
40
96
|
version: '0'
|
41
97
|
requirements: []
|
42
|
-
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.7.6.2
|
43
100
|
signing_key:
|
44
101
|
specification_version: 4
|
45
102
|
summary: Updater of used Github Actions in workflow files
|