glpl 0.0.2 → 0.1.0
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/glpl +11 -0
- data/lib/glpl.rb +8 -0
- data/lib/glpl/job.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dda217f7317d692951af87d0e7162f33fbb9f1b
|
4
|
+
data.tar.gz: 80cbdfaa9b276f685af8ea1971a31a0a7c60fbdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 852efff2121a9cc488359f06a7674a6abcc039a5ab441b1e7ca38f279d5c3615c59b9f5bdcd14ba4db7392d1a1c4e74e795745fd598c125846195e2c8dbb1aa7
|
7
|
+
data.tar.gz: 54b05ba589e6d824b6dbb0c2d87c546fb42c0f1edf5d6271abcd47f4094167356c2a13da2bf1db89f52c479681732786c365bc80ceaba0b9755c58f8c27472c6
|
data/bin/glpl
CHANGED
@@ -28,10 +28,21 @@ OptionParser.new do |opts|
|
|
28
28
|
opts.on("-p", "--pipeline ID", Integer, "Pipeline ID") do |pipeline_id|
|
29
29
|
options[:pipeline_id] = pipeline_id
|
30
30
|
end
|
31
|
+
|
32
|
+
opts.on("-r", "--retry ID", "Retry a given pipeline") do |pipeline_id|
|
33
|
+
options[:pipeline_id] = pipeline_id
|
34
|
+
options[:retry] = true
|
35
|
+
end
|
31
36
|
end.parse!
|
32
37
|
|
33
38
|
glpl = GLPL.new(private_token)
|
34
39
|
|
40
|
+
if options.key?(:retry) then
|
41
|
+
glpl.retry(project_id, options[:pipeline_id])
|
42
|
+
printf("Sucessfully retried Pipeline#%s.\n", options[:pipeline_id])
|
43
|
+
exit
|
44
|
+
end
|
45
|
+
|
35
46
|
if options.key?(:pipeline_id) then
|
36
47
|
for job in glpl.jobs(project_id, options[:pipeline_id]) do
|
37
48
|
printf("%s %s %s\n",
|
data/lib/glpl.rb
CHANGED
@@ -30,6 +30,14 @@ class GLPL
|
|
30
30
|
request("/#{project_id}/pipelines/#{pipeline_id}/jobs", :get).map { |data| GLPL::Job.new(data) }
|
31
31
|
end
|
32
32
|
|
33
|
+
# Retries a pipeline.
|
34
|
+
# Params:
|
35
|
+
# +project_id+:: +Integer+ Gitlab's project ID.
|
36
|
+
# +pipeline_id+:: +Integer+ The pipeline's ID.
|
37
|
+
def retry(project_id, pipeline_id)
|
38
|
+
GLPL::Pipeline.new(request("/#{project_id}/pipelines/#{pipeline_id}/retry", :post))
|
39
|
+
end
|
40
|
+
|
33
41
|
# Makes an HTTP Requests to Gitlab's API and returns the response as JSON.
|
34
42
|
# Params:
|
35
43
|
# +endpoint+:: +String+ which represents the API's endpoint to be contacted.
|
data/lib/glpl/job.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
1
3
|
class GLPL::Job
|
2
4
|
|
3
5
|
attr_reader :id, :status, :stage, :name, :ref, :created_at, :username
|
@@ -8,7 +10,7 @@ class GLPL::Job
|
|
8
10
|
@stage = job_data["stage"]
|
9
11
|
@name = job_data["name"]
|
10
12
|
@ref = job_data["ref"]
|
11
|
-
@created_at = job_data["created_at"]
|
13
|
+
@created_at = DateTime.parse(job_data["created_at"])
|
12
14
|
@username = job_data["username"]
|
13
15
|
end
|
14
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Gitlab Pipelines on your command line.
|
14
14
|
email: dinojoaocosta@gmail.com
|