circler 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/circler/cli.rb +8 -0
- data/lib/circler/command/base_command.rb +3 -3
- data/lib/circler/command/cancel_command.rb +17 -0
- data/lib/circler/response/build.rb +4 -0
- data/lib/circler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23207f95906b69e2d7fd4178e9356e3c4a7695fd
|
4
|
+
data.tar.gz: 98fe86d9e135b661f885e8b8b62a2effced07278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa0323146dc3bce82a6fb2886a749cff7bf0756f4ff3fdcd1411d78caeebf7a6b632dbb37b899c2c2f1d2fa40ea24b749b15f4f0def4cba490b0281188719f4
|
7
|
+
data.tar.gz: 1cc5561eb1efefea98c998e92a494ee848ec7e5afa376279ebf829d3ac62ce55f0e41a2185e1b3b0c094078a4e883e5d09bd34f2cd243a31656ca47b01892a32
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[![Circle CI](https://circleci.com/gh/unhappychoice/Circler.svg?style=shield)](https://circleci.com/gh/unhappychoice/Circler)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/unhappychoice/Circler/badges/gpa.svg)](https://codeclimate.com/github/unhappychoice/Circler)
|
6
6
|
[![Dependency Status](https://gemnasium.com/badges/github.com/unhappychoice/Circler.svg)](https://gemnasium.com/github.com/unhappychoice/Circler)
|
7
|
+
![](http://ruby-gem-downloads-badge.herokuapp.com/circler?type=total)
|
7
8
|
|
8
9
|
Circler is a CLI tool for [Circle CI](https://circleci.com).
|
9
10
|
|
data/lib/circler/cli.rb
CHANGED
@@ -15,6 +15,7 @@ require 'circler/command/build_command'
|
|
15
15
|
require 'circler/command/browse_command'
|
16
16
|
require 'circler/command/watch_command'
|
17
17
|
require 'circler/command/retry_command'
|
18
|
+
require 'circler/command/cancel_command'
|
18
19
|
require 'circler/response/account'
|
19
20
|
require 'circler/response/project'
|
20
21
|
require 'circler/response/build'
|
@@ -60,6 +61,13 @@ module Circler
|
|
60
61
|
RetryCommand.run(options)
|
61
62
|
end
|
62
63
|
|
64
|
+
desc 'cancel', 'cancel a build'
|
65
|
+
method_option :project, aliases: 'p', type: :string, banner: 'user/project'
|
66
|
+
method_option :build, aliases: 'n', type: :numeric, banner: 'build-number'
|
67
|
+
def cancel
|
68
|
+
CancelCommand.run(options)
|
69
|
+
end
|
70
|
+
|
63
71
|
desc 'watch', 'watch a build in real time'
|
64
72
|
method_option :project, aliases: 'p', type: :string, banner: 'user/project'
|
65
73
|
method_option :build, aliases: 'n', type: :numeric, banner: 'build-number'
|
@@ -10,8 +10,8 @@ module Circler
|
|
10
10
|
def project_name(options)
|
11
11
|
if options.project
|
12
12
|
options.project
|
13
|
-
elsif
|
14
|
-
|
13
|
+
elsif reponame
|
14
|
+
reponame
|
15
15
|
else
|
16
16
|
say ProjectPrinter.new(Project.all)
|
17
17
|
ask('Input user-name/project-name :')
|
@@ -21,7 +21,7 @@ module Circler
|
|
21
21
|
def reponame
|
22
22
|
repository = Rugged::Repository.new('.')
|
23
23
|
origin = repository.remotes.find { |r| r.name == 'origin' }
|
24
|
-
return $1 if origin.url =~ %r{git@github
|
24
|
+
return $1 if origin.url =~ %r{git@github\.com/([\w_-]+/[\w_-]+)\Z}
|
25
25
|
nil
|
26
26
|
end
|
27
27
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Circler
|
2
|
+
class CancelCommand < BaseCommand
|
3
|
+
class << self
|
4
|
+
def run(options)
|
5
|
+
setup_token
|
6
|
+
username, reponame = project_name(options).split('/')
|
7
|
+
number = build_number(options)
|
8
|
+
build = Build.cancel(username, reponame, number)
|
9
|
+
if build.username
|
10
|
+
say "build #{build.username}/#{build.reponame} #{build.build_number} is canceled."
|
11
|
+
else
|
12
|
+
say "failed to cancel #{username}/#{reponame} #{number}."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -20,6 +20,10 @@ module Circler
|
|
20
20
|
def retry(username, reponame, number)
|
21
21
|
Build.new(CircleCi::Build.retry(username, reponame, number).body)
|
22
22
|
end
|
23
|
+
|
24
|
+
def cancel(username, reponame, number)
|
25
|
+
Build.new(CircleCi::Build.cancel(username, reponame, number).body)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
|
25
29
|
def initialize(hash)
|
data/lib/circler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unhappychoice
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pusher-client
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- lib/circler/command/browse_command.rb
|
218
218
|
- lib/circler/command/build_command.rb
|
219
219
|
- lib/circler/command/builds_command.rb
|
220
|
+
- lib/circler/command/cancel_command.rb
|
220
221
|
- lib/circler/command/projects_command.rb
|
221
222
|
- lib/circler/command/retry_command.rb
|
222
223
|
- lib/circler/command/watch_command.rb
|