git_commands 3.1.6 → 3.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +79 -20
- data/lib/git_commands/cli.rb +1 -1
- data/lib/git_commands/command.rb +2 -1
- data/lib/git_commands/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b56d1810b535ad9bacd7d58b1dd1c68ef6f431f0
|
4
|
+
data.tar.gz: a1f27d3bf68f8f8c1293acc5f2ef24fc9faa83b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ad1209c4c0e95e1814134fc64a25433fc7f62c8e584c49bbea69913df58b75826d548683db648bebc16712e006955bed6f8eda8b7987653bf85dcc7f6b2ee1
|
7
|
+
data.tar.gz: c0f56e29eb44e2f35113379f6f3a9cc7b58e2831d89183bcb3278020069a937a0e8ada519aaae40bce114ac1b33f31cadd7b4a46a2e670008bf4b97e2ba29432
|
data/README.md
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
* [Workflow](#workflow)
|
3
3
|
* [Scope](#scope)
|
4
4
|
* [Installation](#installation)
|
5
|
+
* [git](#git)
|
5
6
|
* [Usage](#usage)
|
6
|
-
* [
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
* [Arguments](#help)
|
8
|
+
* [Help](#help)
|
9
|
+
* [Repository](#repository)
|
10
|
+
* [Branches](#branches)
|
11
|
+
* [Commands](#commands)
|
12
|
+
* [rebase](#rebase)
|
13
|
+
* [purge](#purge)
|
14
|
+
* [aggregate](#aggregate)
|
10
15
|
|
11
16
|
## Workflow
|
12
17
|
This script will facilitate adopting a subset of the branch-featuring workflow characterised by:
|
@@ -21,37 +26,61 @@ The scope of this gem is helping out in the following cases:
|
|
21
26
|
* you need to quickly aggregate branches for a release
|
22
27
|
|
23
28
|
## Installation
|
24
|
-
I assume you have GIT installed ;)
|
25
29
|
Just install the gem to use the binaries commands.
|
26
30
|
```
|
27
31
|
gem install git_commands
|
28
32
|
```
|
29
33
|
|
34
|
+
### git
|
35
|
+
The library uses the Ruby command line execution to invoke the **git** command. I assume you have the GIT program on your path.
|
36
|
+
|
30
37
|
## Usage
|
31
38
|
Here are the main commands:
|
32
39
|
|
33
|
-
###
|
34
|
-
|
40
|
+
### Arguments
|
41
|
+
All of the available commands come with the same set of arguments:
|
42
|
+
|
43
|
+
#### Help
|
44
|
+
Display the help of a specific command by:
|
35
45
|
|
36
46
|
```
|
37
47
|
rebase --help
|
38
48
|
Usage: rebase --repo=./Sites/oro --branches=feature/add_bin,fetaure/remove_rake_task
|
39
49
|
-r, --repo=REPO The path to the existing GIT repository
|
40
|
-
-b, --branches=BRANCHES The comma-separated list of branches or the path to a
|
50
|
+
-b, --branches=BRANCHES The comma-separated list of branches or the path to a file listing branches names on each line
|
41
51
|
-h, --help Prints this help
|
42
52
|
```
|
43
53
|
|
44
|
-
|
45
|
-
|
46
|
-
|
54
|
+
#### Repository
|
55
|
+
You have to specify the path (absolute or relative) to the GIT repository you want to work with. The path must be a folder initialized as a valid GIT repository (a check via *rev-parse* is performed), otherwise an error is raised:
|
56
|
+
|
57
|
+
```
|
58
|
+
rebase --repo=invalid
|
59
|
+
'invalid' is not a valid GIT repository!
|
60
|
+
```
|
61
|
+
|
62
|
+
#### Branches
|
63
|
+
Along with the repository you always have to specify the list of branches you want the command to interact with.
|
64
|
+
You have two main options here:
|
65
|
+
|
66
|
+
##### List of branches
|
67
|
+
Specify a comma separated list of branch names:
|
47
68
|
|
48
69
|
```
|
49
|
-
rebase --
|
70
|
+
rebase --branches=feature/love_me_tender,feature/teddybear,feature/return_to_sender
|
71
|
+
|
72
|
+
Loading branches file...
|
73
|
+
Successfully loaded 3 branches:
|
74
|
+
01. feature/love_me_tender
|
75
|
+
02. feature/teddybear
|
76
|
+
03. feature/return_to_sender
|
50
77
|
```
|
51
78
|
|
52
|
-
|
79
|
+
##### Path to a names file
|
80
|
+
Specify a path (absolute or relative) to a file containing the branches names on each line:
|
53
81
|
|
54
|
-
|
82
|
+
File *./Sites/greatest_hits*:
|
83
|
+
```
|
55
84
|
feature/love_me_tender
|
56
85
|
feature/teddybear
|
57
86
|
feature/return_to_sender
|
@@ -59,22 +88,52 @@ feature/in_the_ghetto
|
|
59
88
|
```
|
60
89
|
|
61
90
|
```
|
62
|
-
rebase --
|
91
|
+
rebase --branches=./Sites/greatest_hits
|
92
|
+
|
93
|
+
Loading branches file...
|
94
|
+
Successfully loaded 4 branches:
|
95
|
+
01. feature/love_me_tender
|
96
|
+
02. feature/teddybear
|
97
|
+
03. feature/return_to_sender
|
98
|
+
04. feature/in_the_ghetto
|
99
|
+
```
|
100
|
+
|
101
|
+
##### Checking
|
102
|
+
Each loaded branch is validated for existence (via *rev-parse*), in case it does not an error is raised:
|
103
|
+
|
104
|
+
```
|
105
|
+
rebase --repo=./Sites/greatest_hits --branches=noent
|
106
|
+
|
107
|
+
Loading branches file...
|
108
|
+
Branch 'noent' does not exist!
|
109
|
+
```
|
110
|
+
|
111
|
+
### Commands
|
112
|
+
Here are the available GIT commands:
|
113
|
+
|
114
|
+
#### rebase
|
115
|
+
This is probably the most useful command in case you have several branches to rebase with _origin/master_ frequently.
|
116
|
+
A confirmation is asked to before rebasing.
|
117
|
+
|
118
|
+
```
|
119
|
+
rebase --repo=./Sites/greatest_hits --branches=feature/love_me_tender,feature/teddybear,feature/return_to_sender
|
120
|
+
...
|
63
121
|
```
|
64
122
|
|
65
|
-
|
123
|
+
#### purge
|
66
124
|
This command remove the specified branches locally and remotely.
|
67
125
|
A confirmation is asked before removal.
|
68
126
|
|
69
127
|
```
|
70
|
-
purge --repo
|
128
|
+
purge --repo=/temp/top_20 --branches=release/in_the_ghetto
|
129
|
+
...
|
71
130
|
```
|
72
131
|
|
73
|
-
|
74
|
-
|
132
|
+
#### aggregate
|
133
|
+
This command aggregates all of the specified branches into a single one in case you want to create a release branch.
|
75
134
|
It uses the following naming convention: *release/yyyy_mm_dd*
|
76
135
|
A confirmation is asked before aggregating.
|
77
136
|
|
78
137
|
```
|
79
|
-
aggregate --repo
|
138
|
+
aggregate --repo=./Sites/greatest_hits --branches=./Sites/greatest_hits
|
80
139
|
```
|
data/lib/git_commands/cli.rb
CHANGED
data/lib/git_commands/command.rb
CHANGED
@@ -8,7 +8,7 @@ module GitCommands
|
|
8
8
|
include Prompt
|
9
9
|
|
10
10
|
class GitError < StandardError; end
|
11
|
-
class NoBranchesError <
|
11
|
+
class NoBranchesError < ArgumentError; end
|
12
12
|
class NoentRepositoryError < ArgumentError; end
|
13
13
|
|
14
14
|
GITHUB_HOST = "github.com"
|
@@ -92,6 +92,7 @@ module GitCommands
|
|
92
92
|
end
|
93
93
|
|
94
94
|
private def fetch_repo(repo)
|
95
|
+
fail NoentRepositoryError, "Please specify a valid GIT repository!" unless repo
|
95
96
|
fail NoentRepositoryError, "'#{repo}' is not a valid GIT repository!" unless valid_repo?(repo)
|
96
97
|
Pathname::new(repo)
|
97
98
|
end
|
data/lib/git_commands/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- costajob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|