circler 0.4.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5961bad07a4cc984a8a3e1ee1add550212da1f90
4
- data.tar.gz: c09434edbac2080beb6dcde0392bc00c2047ee7e
3
+ metadata.gz: 23207f95906b69e2d7fd4178e9356e3c4a7695fd
4
+ data.tar.gz: 98fe86d9e135b661f885e8b8b62a2effced07278
5
5
  SHA512:
6
- metadata.gz: 0d85d4550bbf333cb53889c3f8c9cfb58f4f0a4ef2bc3e7191be99ec708f83bbfca66050a082b671776bf92a6dc78f263c87bb42d729361c7cc181914ea1a885
7
- data.tar.gz: 21ceea61473f81b51694d0ecea126ceb74e4ade95f333bde2bcb88b7fb9754fc973ca4386d0ce787579756c2b84b0b63cca241e927b8adbe61dcf87bbe1fca7e
6
+ metadata.gz: 4fa0323146dc3bce82a6fb2886a749cff7bf0756f4ff3fdcd1411d78caeebf7a6b632dbb37b899c2c2f1d2fa40ea24b749b15f4f0def4cba490b0281188719f4
7
+ data.tar.gz: 1cc5561eb1efefea98c998e92a494ee848ec7e5afa376279ebf829d3ac62ce55f0e41a2185e1b3b0c094078a4e883e5d09bd34f2cd243a31656ca47b01892a32
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circler (0.4.1)
4
+ circler (0.5.0)
5
5
  circleci (~> 1.0.3)
6
6
  colorize (~> 0.8.1)
7
7
  faraday (~> 0.11.0)
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
 
@@ -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 self.reponame
14
- self.reponame
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.com:([\w_-]+/[\w_-]+)\.git}
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)
@@ -1,3 +1,3 @@
1
1
  module Circler
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
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.1
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-02-11 00:00:00.000000000 Z
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