lgit 0.2.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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +5 -4
- data/README.md +6 -6
- data/exe/lgit +7 -5
- data/lgit.gemspec +1 -1
- data/lib/lgit/version.rb +1 -1
- data/lib/lgit.rb +24 -11
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e86a10b2122a1b29aaa417a714eee4cc76ef8a84b0dbcdf6f11a2bc85cba19d
|
4
|
+
data.tar.gz: eab5647700602140ba3ab044748269dcf360d4adb03496b74d0a7a7b9ff41524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0563ae5834377d87e1d06fac991ae53b6f66caff727d278a583cdd6c07ca788ff9c207b51427b1ffbabf39eb5746c53259f26ce58cbc72e89af1996d40e9d492
|
7
|
+
data.tar.gz: 2d8b4664adc0358a34ef6d753ab2553e97a85784c116c63d7a13f138ef90a109de14ed405738126e2914eb11130fab94e125c41d56a66ab15140776a2861e6ed
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lgit (0.
|
4
|
+
lgit (0.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
minitest (5.11.3)
|
10
|
-
rake (
|
10
|
+
rake (13.0.1)
|
11
11
|
|
12
12
|
PLATFORMS
|
13
|
+
ruby
|
13
14
|
x64-mingw32
|
14
15
|
|
15
16
|
DEPENDENCIES
|
16
17
|
bundler (~> 1.16)
|
17
18
|
lgit!
|
18
19
|
minitest (~> 5.0)
|
19
|
-
rake (~>
|
20
|
+
rake (~> 13.0)
|
20
21
|
|
21
22
|
BUNDLED WITH
|
22
|
-
1.
|
23
|
+
1.17.3
|
data/README.md
CHANGED
@@ -22,16 +22,16 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
Rebase current branch from master
|
25
|
+
Rebase current branch from specified base or master by default
|
26
26
|
|
27
27
|
```shell
|
28
|
-
lgit rebase
|
28
|
+
lgit rebase [<base>]
|
29
29
|
```
|
30
30
|
|
31
|
-
Create new branch from freshly pulled master
|
31
|
+
Create new branch from freshly pulled base or master by default
|
32
32
|
|
33
33
|
```shell
|
34
|
-
lgit branch <name>
|
34
|
+
lgit branch <name> [<base>]
|
35
35
|
```
|
36
36
|
|
37
37
|
Delete all branches for which remotes are gone. *Use with caution!*
|
@@ -48,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
48
48
|
|
49
49
|
## Contributing
|
50
50
|
|
51
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/luladjiev/lgit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
52
52
|
|
53
53
|
## License
|
54
54
|
|
@@ -56,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
56
56
|
|
57
57
|
## Code of Conduct
|
58
58
|
|
59
|
-
Everyone interacting in the Lgit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
59
|
+
Everyone interacting in the Lgit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Luladjiev/lgit/blob/master/CODE_OF_CONDUCT.md).
|
data/exe/lgit
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
+
require 'lgit'
|
4
5
|
|
5
6
|
if ARGV.size.zero?
|
6
7
|
puts 'Specify command'
|
@@ -11,13 +12,14 @@ git = Lgit::Git.new
|
|
11
12
|
|
12
13
|
case ARGV[0]
|
13
14
|
when 'branch'
|
14
|
-
git.create_branch
|
15
|
+
git.create_branch(ARGV[1], ARGV[2])
|
15
16
|
when 'rebase'
|
16
|
-
|
17
|
-
|
17
|
+
default_branch = git.get_default_branch
|
18
|
+
if git.get_branch == default_branch
|
19
|
+
puts "Error: Cannot rebase #{default_branch}!"
|
18
20
|
exit 2
|
19
21
|
end
|
20
|
-
git.rebase
|
22
|
+
git.rebase ARGV[1]
|
21
23
|
when 'delete-branches'
|
22
24
|
git.delete_branches
|
23
25
|
else
|
data/lgit.gemspec
CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
-
spec.add_development_dependency "rake", "~>
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
35
35
|
spec.add_development_dependency "minitest", "~> 5.0"
|
36
36
|
end
|
data/lib/lgit/version.rb
CHANGED
data/lib/lgit.rb
CHANGED
@@ -1,27 +1,40 @@
|
|
1
|
-
require
|
1
|
+
require 'lgit/version'
|
2
2
|
|
3
3
|
module Lgit
|
4
|
+
###
|
5
|
+
# Git related class
|
4
6
|
class Git
|
5
|
-
def
|
6
|
-
|
7
|
+
def refresh_base(base)
|
8
|
+
base ||= get_default_branch
|
9
|
+
|
10
|
+
`git checkout #{base}`
|
7
11
|
`git pull`
|
8
12
|
end
|
9
13
|
|
10
14
|
def get_branch
|
15
|
+
`git branch --show-current`.strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_default_branch
|
19
|
+
#`git remote show origin`.split("\n")[3].match(/:\s(.*)$/)[1].strip
|
11
20
|
`git name-rev --name-only HEAD`.strip
|
12
21
|
end
|
13
22
|
|
14
|
-
def create_branch(name)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
23
|
+
def create_branch(name, base)
|
24
|
+
return unless name
|
25
|
+
|
26
|
+
base ||= get_default_branch
|
27
|
+
|
28
|
+
refresh_base base
|
29
|
+
`git checkout -b #{name}`
|
19
30
|
end
|
20
31
|
|
21
|
-
def rebase
|
22
|
-
|
32
|
+
def rebase(base)
|
33
|
+
base ||= get_default_branch
|
34
|
+
|
35
|
+
refresh_base base
|
23
36
|
`git checkout - `
|
24
|
-
`git rebase
|
37
|
+
`git rebase #{base}`
|
25
38
|
end
|
26
39
|
|
27
40
|
def delete_branches
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lgit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Luladjiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,8 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
|
-
|
98
|
-
rubygems_version: 2.7.3
|
97
|
+
rubygems_version: 3.1.2
|
99
98
|
signing_key:
|
100
99
|
specification_version: 4
|
101
100
|
summary: Git on steroids
|