git-restart 0.0.10.dev → 0.0.11.pre.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/git-restart +10 -3
- data/lib/git-restart/runner.rb +18 -7
- data/lib/git-restart/task.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0602539b39f373497f2c7f0c83cd68babd3864
|
4
|
+
data.tar.gz: 760387660b687fb183e2de28c72a8631fcd190d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0cb6c02b073a56c0a4ca364756f0043701497a6f028d247cc5ffcc6b8dd5d576d302b5d775ad273811a7078e0a11e05687c64f88f4fe09c40da2e631f7a7cb
|
7
|
+
data.tar.gz: f58686e48ac26a080bf7d3a7a42a445f17f2d2b98491ab256684a23e6689566f2099aa492a87aec0e776d73d158c6165230338f24224055cc972afae6b53b4e9
|
data/bin/git-restart
CHANGED
@@ -5,10 +5,17 @@ require 'git-restart/runner.rb'
|
|
5
5
|
|
6
6
|
puts "Starting runner ..."
|
7
7
|
|
8
|
-
|
9
|
-
target
|
8
|
+
$taskfiles = Array.new();
|
9
|
+
target = ".gitrun"
|
10
|
+
ARGV.each do |t|
|
11
|
+
if(File.extname(t) == ".gitrun")
|
12
|
+
target = t;
|
13
|
+
elsif(File.extname(t) == ".gittask")
|
14
|
+
$taskfiles << t;
|
15
|
+
end
|
16
|
+
end
|
10
17
|
|
11
|
-
raise ArgumentError, "No valid
|
18
|
+
raise ArgumentError, "No valid runner file specified!" unless File.exist? target
|
12
19
|
|
13
20
|
load target
|
14
21
|
|
data/lib/git-restart/runner.rb
CHANGED
@@ -11,6 +11,7 @@ module GitRestart
|
|
11
11
|
attr_accessor :name
|
12
12
|
|
13
13
|
attr_accessor :repo, :branches, :exclude_branches, :start_on
|
14
|
+
attr_accessor :allowed_tasks
|
14
15
|
|
15
16
|
attr_reader :next_tasks
|
16
17
|
attr_reader :current_task_file
|
@@ -19,7 +20,7 @@ module GitRestart
|
|
19
20
|
attr_accessor :octokit
|
20
21
|
|
21
22
|
def current_commit()
|
22
|
-
@git.object("HEAD").sha;
|
23
|
+
@git.object("HEAD^").sha;
|
23
24
|
end
|
24
25
|
def current_branch()
|
25
26
|
@git.current_branch();
|
@@ -28,9 +29,15 @@ module GitRestart
|
|
28
29
|
@current_modified;
|
29
30
|
end
|
30
31
|
|
31
|
-
def initialize()
|
32
|
+
def initialize(fileList = nil)
|
33
|
+
raise ArgumentError, "File list needs to be nil or an Array!" unless (fileList.is_a? Array or fileList.nil?)
|
34
|
+
|
32
35
|
GitRestart::Task.runner = self;
|
33
36
|
|
37
|
+
@allowed_tasks = Array.new();
|
38
|
+
@allowed_tasks << fileList if(fileList);
|
39
|
+
@allowed_tasks << $taskfiles unless($taskfiles.empty?)
|
40
|
+
|
34
41
|
@current_tasks = Hash.new();
|
35
42
|
@next_tasks = Hash.new();
|
36
43
|
|
@@ -43,6 +50,8 @@ module GitRestart
|
|
43
50
|
|
44
51
|
yield(self);
|
45
52
|
|
53
|
+
@allowed_tasks.flatten!
|
54
|
+
|
46
55
|
@listenedSub = @mqtt.subscribe_to "GitHub/#{@repo}" do |data|
|
47
56
|
begin
|
48
57
|
data = JSON.parse(data, symbolize_names: true);
|
@@ -65,12 +74,10 @@ module GitRestart
|
|
65
74
|
end
|
66
75
|
|
67
76
|
def update_status(name, newStatus, message = nil)
|
68
|
-
puts "Task #{@name} assumed a new status: #{newStatus}#{message ? " MSG:#{message}" : ""}"
|
69
|
-
|
70
77
|
return unless @octokit;
|
71
78
|
|
72
79
|
begin
|
73
|
-
@octokit.create_status(@repo, current_commit
|
80
|
+
@octokit.create_status(@repo, current_commit, newStatus, {
|
74
81
|
context: "#{@name}/#{name}".gsub(" ", "_"),
|
75
82
|
description: message,
|
76
83
|
})
|
@@ -115,6 +122,10 @@ module GitRestart
|
|
115
122
|
t.gsub!(/^\.\//,"");
|
116
123
|
@current_task_file = t;
|
117
124
|
|
125
|
+
unless(@allowed_tasks.empty?)
|
126
|
+
next unless @allowed_tasks.include? @current_task_file
|
127
|
+
end
|
128
|
+
|
118
129
|
begin
|
119
130
|
load(t);
|
120
131
|
rescue ScriptError, StandardError
|
@@ -132,7 +143,7 @@ module GitRestart
|
|
132
143
|
def _start_next_tasks()
|
133
144
|
_generate_next_tasks();
|
134
145
|
|
135
|
-
puts "\nStarting next tasks!"
|
146
|
+
puts "\n\nStarting next tasks!"
|
136
147
|
@next_tasks.each do |name, t|
|
137
148
|
next unless t.active;
|
138
149
|
next unless t.triggered?
|
@@ -143,7 +154,7 @@ module GitRestart
|
|
143
154
|
end
|
144
155
|
|
145
156
|
def _switch_to(branch, commit = nil)
|
146
|
-
puts "\
|
157
|
+
puts "\nSwitching to branch: #{branch}#{commit ? ",commit: #{commit}" : ""}"
|
147
158
|
|
148
159
|
begin
|
149
160
|
@git.fetch();
|
data/lib/git-restart/task.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-restart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11.pre.dev
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xasin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mqtt-sub_handler
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: 1.3.1
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.6.14.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: "(Re)start scripts and monitor them on a GitHub push"
|