git_curate 0.4.0 → 0.4.2

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
  SHA256:
3
- metadata.gz: e1c8358c5021c6985ce3e6d701d607a2df341cc4ed2ba20dac43c13912a1fe44
4
- data.tar.gz: c30b0e19d28f7ae48e5fb59372da44158940b8b79008c9d2a07f3b3e8d7d6534
3
+ metadata.gz: '0399b237571cee939ec07f97f719f29225491cf5a2899e6bc539b1c5b4ad863b'
4
+ data.tar.gz: 22c062f9e94c984de985fda7cd44cba9e6978999b2920599e72574e69358a490
5
5
  SHA512:
6
- metadata.gz: 2a872d7d0555cab6a4d4df1d33c96cda3cce1952c09cda057816065e81a7af65c033196365ed0207a255c5cf9c0b190cd500376ca8620b9738084b683064e88c
7
- data.tar.gz: 8e842c8f27654e625bcc9b895064a49764c6d67fd0c0b340c8ba900bcd6ad0850b66c836158e08fab0f04d03a3cd98b6dba6c38e84472ab7aa6c97c1db80b72c
6
+ metadata.gz: 3092b79d185c7b090f4409ba22b1e234b8a46666d692d3e935bad2e1e3cb4edadcba0cee625a2e07d9010562c95271e4783b1a37dcd75d456e5d7d0b39248d4b
7
+ data.tar.gz: 6b19d4d6c85e6418a91f0ef8256fdb9d7d4fe7077d07452aadb93cccc9ab0b3fbb832edffc5ebafbd531c233aefa52b50e4ce52f793adb108b039a7d54e46e78
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.4.2
4
+
5
+ * Cap output to terminal width automatically.
6
+ * Documentation improvements.
7
+
3
8
  ### v0.4.0
4
9
 
5
10
  * Add "Status vs upstream" column.
data/Gemfile.lock CHANGED
@@ -1,18 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_curate (0.4.0)
5
- highline (= 2.0.0)
6
- tabulo (= 1.2.0)
4
+ git_curate (0.4.2)
5
+ highline (= 2.0.1)
6
+ tabulo (= 1.2.1)
7
+ tty-screen (= 0.6.5)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- highline (2.0.0)
12
+ highline (2.0.1)
12
13
  rake (11.3.0)
13
14
  rake-version (1.0.1)
14
15
  rake (> 11.1)
15
- tabulo (1.2.0)
16
+ tabulo (1.2.1)
17
+ tty-screen (0.6.5)
16
18
 
17
19
  PLATFORMS
18
20
  ruby
data/README.md CHANGED
@@ -22,6 +22,10 @@ a time, outputting the following information about each:
22
22
 
23
23
  You can then select whether to delete or keep each branch as you go.
24
24
 
25
+ **NOTE** `git curate` does _not_ run `git fetch` prior to generating its output. If you want to
26
+ be sure that the "Status vs upstream" column reflects the latest state of the upstream branches
27
+ as per their remote repository, you should run `git fetch` first.
28
+
25
29
  ## Installation
26
30
 
27
31
  You'll need Ruby v2.1.10 or higher. Run
@@ -50,14 +54,15 @@ a gem. When `git_curate` is installed, an executable is created called `git-cura
50
54
  In general, for any executable of the form _git-xyz_ in your `PATH`, `git` will automatically
51
55
  recognize _xyz_ as a subcommand, and will run that executable whenever that subcommand is invoked.)
52
56
 
53
- ## Development
54
-
55
- After checking out the repo, run `bin/setup` to install dependencies.
56
-
57
57
  ## Contributing
58
58
 
59
59
  Bug reports and pull requests are welcome on [GitHub](https://github.com/matt-harvey/git_curate).
60
60
 
61
+ To start working on `git_curate`, `git clone` and `cd` into your fork of the repo, then run `bin/setup` to
62
+ install dependencies.
63
+
64
+ For a list of Rake tasks that are available in the development environment, run `rake -T`.
65
+
61
66
  ## License
62
67
 
63
68
  The gem is available as open source under the terms of the [MIT
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.2
data/git_curate.gemspec CHANGED
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_runtime_dependency "highline", "2.0.0"
32
- spec.add_runtime_dependency "tabulo", "1.2.0"
31
+ spec.add_runtime_dependency "highline", "2.0.1"
32
+ spec.add_runtime_dependency "tabulo", "1.2.1"
33
+ spec.add_runtime_dependency "tty-screen", "0.6.5"
33
34
 
34
35
  spec.add_development_dependency "bundler", "~> 1.16"
35
36
  spec.add_development_dependency "rake", "~> 11.0"
@@ -1,3 +1,8 @@
1
+ require "highline/import"
2
+ require "set"
3
+ require "tabulo"
4
+ require "tty-screen"
5
+
1
6
  module GitCurate
2
7
 
3
8
  # Regexes for unpacking the output of `git branch -vv`
@@ -13,8 +18,8 @@ module GitCurate
13
18
  end
14
19
 
15
20
  branches = command_to_a("git branch").reject { |b| current_branch?(b) }
16
- merged_branches = command_to_a("git branch --merged").reject { |b| current_branch?(b) }.to_set
17
- upstreams = upstream_branches
21
+ merged_branches = command_to_a("git branch --merged").to_set
22
+ upstream_branches = get_upstream_branches
18
23
 
19
24
  table = Tabulo::Table.new(branches, vertical_rule_character: " ", intersection_character: " ",
20
25
  horizontal_rule_character: "-", column_padding: 0) do |t|
@@ -38,16 +43,19 @@ module GitCurate
38
43
  end
39
44
 
40
45
  t.add_column("Status vs\nupstream", align_header: :left) do |branch|
41
- upstreams.fetch(branch, "No upstream")
46
+ upstream_branches.fetch(branch, "No upstream")
42
47
  end
43
48
  end
44
49
 
45
- table.shrinkwrap!(max_table_width: 150)
50
+ prompt = " Delete? [y/n/done/abort/help] "
51
+ longest_response = "abort"
52
+ prompt_and_response_width = prompt.length + longest_response.length + 1
53
+ table.shrinkwrap!(max_table_width: TTY::Screen.width - prompt_and_response_width)
46
54
 
47
55
  branches_to_delete = []
48
56
 
49
57
  table.each_with_index do |row, index|
50
- case HighLine.ask("#{row} Delete? [y/n/done/abort/help] ")
58
+ case HighLine.ask("#{row}#{prompt}")
51
59
  when "y"
52
60
  branches_to_delete << row.to_h[:branch]
53
61
  when "n"
@@ -78,10 +86,10 @@ module GitCurate
78
86
  branch =~ /^\s*\*/
79
87
  end
80
88
 
81
- # Returns a Hash containing, as keys, all local branches that have upstream branches (excluding
82
- # the current branch) and, as values, a brief description of each branch's status relative
83
- # to its upstream branch (up to date, or ahead/behind)
84
- def upstream_branches
89
+ # Returns a Hash containing, as keys, all local branches that have upstream branches,
90
+ # and, as values, a brief description of each branch's status relative to its upstream
91
+ # branch (up to date, or ahead/behind)
92
+ def get_upstream_branches
85
93
  command_to_a("git branch -vv").map do |line|
86
94
  branch_name = line.split(BRANCH_NAME_REGEX)[0]
87
95
  remote_info = line[REMOTE_INFO_REGEX, 1]
@@ -1,3 +1,3 @@
1
1
  module GitCurate
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/git_curate.rb CHANGED
@@ -1,5 +1,2 @@
1
1
  require "git_curate/runner"
2
2
  require "git_curate/version"
3
- require "highline/import"
4
- require "set"
5
- require "tabulo"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_curate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Harvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0
19
+ version: 2.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tabulo
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.2.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: tty-screen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.6.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.6.5
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement