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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/glpl +11 -0
  3. data/lib/glpl.rb +8 -0
  4. data/lib/glpl/job.rb +3 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a8aaf48584aeb649d2059f431309140ba1617f5
4
- data.tar.gz: 3706f52730c4fba61ff26f21f84922c4f86753af
3
+ metadata.gz: 9dda217f7317d692951af87d0e7162f33fbb9f1b
4
+ data.tar.gz: 80cbdfaa9b276f685af8ea1971a31a0a7c60fbdd
5
5
  SHA512:
6
- metadata.gz: f45ae4f75b50bbbed32c26a69306233d35d6c04f92b17901f547f5109fb75a0e3d8d06a801c2c30c86d072e6a9638f68491542f6d74a28022efee18784537235
7
- data.tar.gz: 73b8f64e96f4484583e507300e00f63ad632e50f0059981d3f7e44f28b839fddaa2f3652d5f9e2b01c6f52891f8ba214a30525da5d0edb486f17c9a8ab72410d
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",
@@ -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.
@@ -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.2
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-09-22 00:00:00.000000000 Z
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