pruner 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/standardrb.yml +31 -0
- data/.github/workflows/tests.yml +31 -0
- data/.gitignore +8 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/LICENSE.md +21 -0
- data/README.md +106 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/standardize +3 -0
- data/bin/standardrb +29 -0
- data/exe/pruner +19 -0
- data/lib/pruner.rb +15 -0
- data/lib/pruner/branches.rb +96 -0
- data/lib/pruner/message_formatter.rb +30 -0
- data/lib/pruner/version.rb +3 -0
- data/pruner.gemspec +37 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fd2253cf034d30266a7d54b6f9087374519e914b2586566efa40b9adda818e91
|
4
|
+
data.tar.gz: 2c7c2085fdc492ac4fb9a2a0c91113d6452d690029cfd0651dde5e150f635536
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0040e18435e00ffaa8ea16cd88b14a39c0cc140716146d3ac7f4de1862ee9297ceca4fc42d0db9f5a9ca4f8d86170df6a0f81436bef57e15f7aa14417b3355de
|
7
|
+
data.tar.gz: 54f8f9f30dc1544f39a1e92dfd8f664486cf354df7b3c7aba9d20a44ff45e61b25f172898871cd9a875df68f9a8f9424b60bd4aecb7fdaf4285cd81c73745bcb
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: StandardRB
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: StandardRB Check Action
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: eregon/use-ruby-action@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.7
|
20
|
+
- uses: actions/cache@v1
|
21
|
+
with:
|
22
|
+
path: vendor/bundle
|
23
|
+
key: bundle-use-ruby-${{ hashFiles('**/Gemfile.lock') }}
|
24
|
+
restore-keys: |
|
25
|
+
bundle-use-ruby-
|
26
|
+
- name: Bundle install
|
27
|
+
run: |
|
28
|
+
bundle config path vendor/bundle
|
29
|
+
bundle install --jobs 4 --retry 3
|
30
|
+
- name: Run StandardRB
|
31
|
+
run: bundle exec standardrb --format progress
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Ruby Test Action
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: eregon/use-ruby-action@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.7
|
20
|
+
- uses: actions/cache@v1
|
21
|
+
with:
|
22
|
+
path: vendor/bundle
|
23
|
+
key: bundle-use-ruby-${{ hashFiles('**/Gemfile.lock') }}
|
24
|
+
restore-keys: |
|
25
|
+
bundle-use-ruby-
|
26
|
+
- name: Bundle install
|
27
|
+
run: |
|
28
|
+
bundle config path vendor/bundle
|
29
|
+
bundle install --jobs 4 --retry 3
|
30
|
+
- name: Run Tests
|
31
|
+
run: bundle exec rake test
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.0
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at andrewmcodes@protonmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pruner (0.1.0)
|
5
|
+
git (~> 1.5)
|
6
|
+
tty-prompt (~> 0.19)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.0)
|
12
|
+
coderay (1.1.2)
|
13
|
+
equatable (0.6.1)
|
14
|
+
git (1.5.0)
|
15
|
+
jaro_winkler (1.5.4)
|
16
|
+
method_source (0.9.2)
|
17
|
+
minitest (5.14.0)
|
18
|
+
necromancer (0.5.1)
|
19
|
+
parallel (1.19.1)
|
20
|
+
parser (2.7.0.2)
|
21
|
+
ast (~> 2.4.0)
|
22
|
+
pastel (0.7.3)
|
23
|
+
equatable (~> 0.6)
|
24
|
+
tty-color (~> 0.5)
|
25
|
+
pry (0.12.2)
|
26
|
+
coderay (~> 1.1.0)
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
rainbow (3.0.0)
|
29
|
+
rake (12.3.3)
|
30
|
+
rubocop (0.77.0)
|
31
|
+
jaro_winkler (~> 1.5.1)
|
32
|
+
parallel (~> 1.10)
|
33
|
+
parser (>= 2.6)
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
ruby-progressbar (~> 1.7)
|
36
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
37
|
+
rubocop-performance (1.5.2)
|
38
|
+
rubocop (>= 0.71.0)
|
39
|
+
ruby-progressbar (1.10.1)
|
40
|
+
standard (0.1.7)
|
41
|
+
rubocop (~> 0.77.0)
|
42
|
+
rubocop-performance (~> 1.5.1)
|
43
|
+
tty-color (0.5.1)
|
44
|
+
tty-cursor (0.7.0)
|
45
|
+
tty-prompt (0.20.0)
|
46
|
+
necromancer (~> 0.5.0)
|
47
|
+
pastel (~> 0.7.0)
|
48
|
+
tty-reader (~> 0.7.0)
|
49
|
+
tty-reader (0.7.0)
|
50
|
+
tty-cursor (~> 0.7)
|
51
|
+
tty-screen (~> 0.7)
|
52
|
+
wisper (~> 2.0.0)
|
53
|
+
tty-screen (0.7.0)
|
54
|
+
unicode-display_width (1.6.1)
|
55
|
+
wisper (2.0.1)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
bundler
|
62
|
+
minitest (~> 5.0)
|
63
|
+
pruner!
|
64
|
+
pry
|
65
|
+
rake (~> 12.0)
|
66
|
+
standard
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
2.1.4
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Andrew Mason
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
![StandardRB](https://github.com/andrewmcodes/pruner/workflows/StandardRB/badge.svg)
|
2
|
+
![Tests](https://github.com/andrewmcodes/pruner/workflows/Tests/badge.svg)
|
3
|
+
|
4
|
+
# Pruner
|
5
|
+
|
6
|
+
A small Ruby Gem to help you delete Git branches. This implementation is a bit naive so **be careful**. If you select the current branch you have checked out, the gem will **not** delete it.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```sh
|
11
|
+
gem install pruner
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
Inside of a repository working directory:
|
17
|
+
|
18
|
+
```sh
|
19
|
+
pruner
|
20
|
+
```
|
21
|
+
|
22
|
+
A multiselect prompt will appear. Use the arrow keys to move between branch names, and hit the spacebar on branches you want to delete. When you have finished making your selections, hit <kbd>Enter</kbd>.
|
23
|
+
|
24
|
+
The gem will then delete your branches! It's as easy as that.
|
25
|
+
|
26
|
+
### Example
|
27
|
+
|
28
|
+
#### Step 1
|
29
|
+
|
30
|
+
Run the `pruner` command.
|
31
|
+
|
32
|
+
```sh
|
33
|
+
➜ pruner
|
34
|
+
```
|
35
|
+
|
36
|
+
#### Step 2
|
37
|
+
|
38
|
+
Use the spacebar to select the branches you want to delete and hit <kbd>Enter</kbd>.
|
39
|
+
|
40
|
+
```sh
|
41
|
+
➜ pruner
|
42
|
+
|
43
|
+
==== Select branches to delete ====
|
44
|
+
test_1, test_2, test_3
|
45
|
+
⬡ master
|
46
|
+
⬢ test_1
|
47
|
+
⬢ test_2
|
48
|
+
‣ ⬢ test_3
|
49
|
+
```
|
50
|
+
|
51
|
+
#### Step 3
|
52
|
+
|
53
|
+
Type <kbd>Y</kbd> and then hit <kbd>Enter</kbd>.
|
54
|
+
|
55
|
+
```sh
|
56
|
+
➜ pruner
|
57
|
+
|
58
|
+
==== Select branches to delete ====
|
59
|
+
test_1, test_2, test_3
|
60
|
+
|
61
|
+
==== Are you sure you want to delete these branches? ====
|
62
|
+
→ (Y/n) Y
|
63
|
+
```
|
64
|
+
|
65
|
+
#### Step 4
|
66
|
+
|
67
|
+
The branches will be deleted and the output will look like the output below.
|
68
|
+
|
69
|
+
```sh
|
70
|
+
➜ pruner
|
71
|
+
|
72
|
+
==== Select branches to delete ====
|
73
|
+
test_1, test_2, test_3
|
74
|
+
|
75
|
+
==== Are you sure you want to delete these branches? ====
|
76
|
+
→ Yes
|
77
|
+
|
78
|
+
==== Deleting Branches ====
|
79
|
+
- test_1
|
80
|
+
- test_2
|
81
|
+
- test_3
|
82
|
+
|
83
|
+
==== Branches Deleted ====
|
84
|
+
```
|
85
|
+
|
86
|
+
## Development
|
87
|
+
|
88
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
89
|
+
|
90
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
91
|
+
|
92
|
+
## Contributing
|
93
|
+
|
94
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andrewmcodes/pruner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/andrewmcodes/pruner/blob/master/CODE_OF_CONDUCT.md).
|
95
|
+
|
96
|
+
## Code of Conduct
|
97
|
+
|
98
|
+
Everyone interacting in the Pruner project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/andrewmcodes/pruner/blob/master/CODE_OF_CONDUCT.md).
|
99
|
+
|
100
|
+
### Coding Standards
|
101
|
+
|
102
|
+
This project uses [Standard](https://github.com/testdouble/standard) to minimize bike shedding related to code formatting.
|
103
|
+
|
104
|
+
## License
|
105
|
+
|
106
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pruner"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/bin/standardize
ADDED
data/bin/standardrb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'standardrb' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("standard", "standardrb")
|
data/exe/pruner
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
4
|
+
|
5
|
+
require "pruner"
|
6
|
+
|
7
|
+
begin
|
8
|
+
Pruner.start
|
9
|
+
rescue SignalException => e
|
10
|
+
if Signal.signame(e.signo) == "TERM"
|
11
|
+
exit(0)
|
12
|
+
else
|
13
|
+
raise
|
14
|
+
end
|
15
|
+
rescue
|
16
|
+
exit(1)
|
17
|
+
else
|
18
|
+
exit(0)
|
19
|
+
end
|
data/lib/pruner.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "tty-prompt"
|
2
|
+
require "git"
|
3
|
+
|
4
|
+
require "pruner/message_formatter"
|
5
|
+
require "pruner/branches"
|
6
|
+
require "pruner/version"
|
7
|
+
|
8
|
+
module Pruner
|
9
|
+
class << self
|
10
|
+
def start
|
11
|
+
cs = Pruner::Branches.confirmed_selections
|
12
|
+
Pruner::Branches.delete(cs)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Pruner
|
2
|
+
module Branches
|
3
|
+
class << self
|
4
|
+
include MessageFormatter
|
5
|
+
|
6
|
+
#
|
7
|
+
# Initialize new TTY Prompt
|
8
|
+
#
|
9
|
+
# @return [object] TTY::Prompt
|
10
|
+
#
|
11
|
+
def prompt
|
12
|
+
@prompt ||= TTY::Prompt.new
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Initialize new Git object
|
17
|
+
#
|
18
|
+
# @return [object] Git
|
19
|
+
#
|
20
|
+
def git
|
21
|
+
@git ||= Git.open(`pwd`.strip)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# All branches
|
26
|
+
#
|
27
|
+
# @return [array] all branches
|
28
|
+
#
|
29
|
+
def branches
|
30
|
+
git.branches.to_a
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Loop to delete the selected branches
|
35
|
+
#
|
36
|
+
# @return [string] confirmation_message
|
37
|
+
#
|
38
|
+
def delete(selections)
|
39
|
+
title_message("Deleting Branches")
|
40
|
+
selections.each do |s|
|
41
|
+
s.delete
|
42
|
+
puts "- #{s}"
|
43
|
+
end
|
44
|
+
confirmation_message
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Selected branches for deletion
|
49
|
+
#
|
50
|
+
# @return [array] array of branch names
|
51
|
+
#
|
52
|
+
def confirmed_selections
|
53
|
+
selections = prompt.multi_select(title_message("Select branches to delete"), branches)
|
54
|
+
no_selections if selections.empty?
|
55
|
+
confirmation_prompt ? selections : canceled_message
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Prompt to confirm deletion of branches
|
60
|
+
#
|
61
|
+
# @return [boolean] T:F depending on selection
|
62
|
+
#
|
63
|
+
def confirmation_prompt
|
64
|
+
title_message("Are you sure you want to delete these branches?")
|
65
|
+
prompt.yes?("→")
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Confirmation message that the branches were removed
|
70
|
+
#
|
71
|
+
# @return [string] Branches deleted message
|
72
|
+
#
|
73
|
+
def confirmation_message
|
74
|
+
title_message("Branches Deleted")
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# No selection message
|
79
|
+
#
|
80
|
+
# @return [string] message indicating no selections were made
|
81
|
+
#
|
82
|
+
def no_selections
|
83
|
+
abort_message("No selections were made.")
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# Canceled message
|
88
|
+
#
|
89
|
+
# @return [string] message indicating the operation was canceled
|
90
|
+
#
|
91
|
+
def canceled_message
|
92
|
+
abort_message("Operation canceled by user.")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Pruner
|
2
|
+
module MessageFormatter
|
3
|
+
#
|
4
|
+
# Title message formatter
|
5
|
+
#
|
6
|
+
# @return [string] formatted title string
|
7
|
+
#
|
8
|
+
def title_message(message)
|
9
|
+
puts "\n==== #{message} ====\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Abort message formatter
|
14
|
+
#
|
15
|
+
# @return [string] formatted abort string
|
16
|
+
#
|
17
|
+
def abort_message(message)
|
18
|
+
abort "\n==== #{message} ====\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Body message formatter
|
23
|
+
#
|
24
|
+
# @return [string] formatted body string
|
25
|
+
#
|
26
|
+
def body_message(message)
|
27
|
+
puts "\n#{message}\n"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/pruner.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "lib/pruner/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "pruner"
|
5
|
+
spec.version = Pruner::VERSION
|
6
|
+
spec.authors = ["Andrew Mason"]
|
7
|
+
spec.email = ["andrewmcodes@protonmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "Prune your GIT branches"
|
10
|
+
spec.description = "A CLI tool written in Ruby to help you remove unneeded GIT branches."
|
11
|
+
spec.homepage = "https://github.com/andrewmcodes/pruner"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = "https://github.com/andrewmcodes/pruner"
|
17
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
# Development Dependencies
|
29
|
+
spec.add_dependency "git", "~> 1.5"
|
30
|
+
spec.add_dependency "tty-prompt", "~> 0.19"
|
31
|
+
|
32
|
+
# Development Dependencies
|
33
|
+
spec.add_development_dependency "bundler"
|
34
|
+
spec.add_development_dependency "pry"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "standard"
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pruner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Mason
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tty-prompt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.19'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.19'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A CLI tool written in Ruby to help you remove unneeded GIT branches.
|
98
|
+
email:
|
99
|
+
- andrewmcodes@protonmail.com
|
100
|
+
executables:
|
101
|
+
- pruner
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".github/workflows/standardrb.yml"
|
106
|
+
- ".github/workflows/tests.yml"
|
107
|
+
- ".gitignore"
|
108
|
+
- ".ruby-version"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CODE_OF_CONDUCT.md
|
111
|
+
- Gemfile
|
112
|
+
- Gemfile.lock
|
113
|
+
- LICENSE.md
|
114
|
+
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- bin/console
|
117
|
+
- bin/setup
|
118
|
+
- bin/standardize
|
119
|
+
- bin/standardrb
|
120
|
+
- exe/pruner
|
121
|
+
- lib/pruner.rb
|
122
|
+
- lib/pruner/branches.rb
|
123
|
+
- lib/pruner/message_formatter.rb
|
124
|
+
- lib/pruner/version.rb
|
125
|
+
- pruner.gemspec
|
126
|
+
homepage: https://github.com/andrewmcodes/pruner
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata:
|
130
|
+
homepage_uri: https://github.com/andrewmcodes/pruner
|
131
|
+
source_code_uri: https://github.com/andrewmcodes/pruner
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 2.3.0
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
requirements: []
|
147
|
+
rubygems_version: 3.1.2
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Prune your GIT branches
|
151
|
+
test_files: []
|