circler 0.5.1 → 0.6.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: 6b496c88b672daa2d95f78e14b78f3f3dd5dc799
4
- data.tar.gz: d5e547bcc6e3fc1a8c1e862b3d43a8b1c981d037
3
+ metadata.gz: 936602f560e2e91450584b8ab2c186a37f2d5739
4
+ data.tar.gz: 91e836604c0338e304a4084f70a4fb2d7f1f867f
5
5
  SHA512:
6
- metadata.gz: 01fc2707b6fe0664ad6f13fe1bea85f74b2696dba677f191436929643ac97a14c460116550a6382caee14df924dfe1dff74a8e5f88b0cbe3d708e30bd9092fb5
7
- data.tar.gz: b6874dc50e07e93c4b22d62548f7aaf5d68af07b8f2d0d2f81e2bdc1b2ccc4800d2e119cf0a0204d1c082c87b2bcc32ea57270db2c1d290c390a0e4edbaec5e3
6
+ metadata.gz: e186b0c3a8e57895ba5be1f158afeebeb58a838f5c0f25bae3b40c746b1f07f15bbb57e064e222f7490832a8ab345ba96a74c14a7d44eeae2437300806023f76
7
+ data.tar.gz: 62d8a1f21cb6cb2e0db79479d767abf4959b088dfcbbec160af95918ad2606507b9fdce0d02075d3aac78193e87434c55b7dc8e9d7d2bedd638a2d9a9ab1a17a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- circler (0.5.1)
4
+ circler (0.6.0)
5
5
  circleci (~> 1.0.3)
6
6
  colorize (~> 0.8.1)
7
7
  faraday (~> 0.11.0)
@@ -30,6 +30,7 @@ require 'circler/networking/pusher_client'
30
30
  module Circler
31
31
  class CLI < Thor
32
32
  desc 'projects', 'list projects'
33
+ method_option :format, aliases: 'f', type: :string, banner: 'pretty/simple', default: 'pretty'
33
34
  def projects
34
35
  ProjectsCommand.run(options)
35
36
  end
@@ -37,6 +38,7 @@ module Circler
37
38
  desc 'builds', 'list builds'
38
39
  method_option :project, aliases: 'p', type: :string, banner: 'user/project'
39
40
  method_option :branch, aliases: 'b', type: :string, banner: 'some-branch'
41
+ method_option :format, aliases: 'f', type: :string, banner: 'pretty/simple', default: 'pretty'
40
42
  def builds
41
43
  BuildsCommand.run(options)
42
44
  end
@@ -55,7 +57,7 @@ module Circler
55
57
  BrowseCommand.run(options)
56
58
  end
57
59
 
58
- desc 'retry', 'show build description'
60
+ desc 'retry', 'retry a build'
59
61
  method_option :project, aliases: 'p', type: :string, banner: 'user/project'
60
62
  method_option :build, aliases: 'n', type: :numeric, banner: 'build-number'
61
63
  def retry
@@ -11,7 +11,7 @@ module Circler
11
11
  builds = Build.all(username, reponame)
12
12
  end
13
13
 
14
- say BuildPrinter.new(builds)
14
+ say BuildPrinter.new(builds, compact: options['format'] == 'simple')
15
15
  end
16
16
  end
17
17
  end
@@ -3,7 +3,7 @@ module Circler
3
3
  class << self
4
4
  def run(options)
5
5
  setup_token
6
- say ProjectPrinter.new(Project.all)
6
+ say ProjectPrinter.new(Project.all, compact: options['format'] == 'simple')
7
7
  end
8
8
  end
9
9
  end
@@ -7,7 +7,10 @@ module Circler
7
7
 
8
8
  def to_s
9
9
  if @compact
10
+ max_row_widths = max_row_widths(@builds)
10
11
  @builds.map(&:information)
12
+ .map { |array| array.map.with_index { |column, index| column.to_s + ' ' * (max_row_widths[index] - column.to_s.size) }.join(' ').to_s }
13
+ .join("\n")
11
14
  else
12
15
  Terminal::Table.new(title: title, headings: headings, rows: rows).to_s
13
16
  end
@@ -26,5 +29,12 @@ module Circler
26
29
  def rows
27
30
  @builds.map(&:information)
28
31
  end
32
+
33
+ def max_row_widths(builds)
34
+ builds.map(&:information)
35
+ .map { |array| array.map(&:to_s).map(&:size) }
36
+ .transpose
37
+ .map(&:max)
38
+ end
29
39
  end
30
40
  end
@@ -7,8 +7,8 @@ module Circler
7
7
  end
8
8
 
9
9
  def to_s
10
- if compact
11
- @projects.map(&:name_array)
10
+ if @compact
11
+ @projects.map(&:information).map { |array| array.join('/').to_s }.sort.join("\n")
12
12
  else
13
13
  Terminal::Table.new(
14
14
  title: 'Projects'.green,
@@ -1,3 +1,3 @@
1
1
  module Circler
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.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.5.1
4
+ version: 0.6.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-03-22 00:00:00.000000000 Z
11
+ date: 2017-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pusher-client