gity 0.1.4 → 0.1.6
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/lib/gity/common.rb +9 -0
- data/lib/gity/landing.rb +14 -0
- data/lib/gity/operation/add.rb +22 -7
- data/lib/gity/operation/commit.rb +12 -2
- data/lib/gity/operation/delete.rb +10 -2
- data/lib/gity/operation/diff.rb +14 -8
- data/lib/gity/operation/ignore.rb +8 -4
- data/lib/gity/operation.rb +6 -2
- data/lib/gity/overview.rb +18 -8
- data/lib/gity/push_workspace.rb +51 -0
- data/lib/gity/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15e5211c909c15e0ca13dc9ce10a06f5ffcdd42583dc4164232f32b823bbe140
|
|
4
|
+
data.tar.gz: 637dab17aa26d859ff9b53e3048790a217fc1d668008747ced4e20c6d2284d92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 514447320f368f96478e494a769dc12e0c77709d2d84a4613a3a489b900a503ec50e55f063e9404b9db7d926cbe704644aff878aac48b447aa333e12918b960c
|
|
7
|
+
data.tar.gz: 6adaa2ed6281fd130f96ace2a6065874dcf67a11205d00e5f7d3bf3684ca2ab5fa60cfd62a144bc10b27c059a137a3cab0b752abaaf54501bfd10428773fa09a
|
data/lib/gity/common.rb
CHANGED
|
@@ -25,6 +25,15 @@ module Gity
|
|
|
25
25
|
opts.each do |f|
|
|
26
26
|
res = _pastel.send(f, res)
|
|
27
27
|
end
|
|
28
|
+
elsif msg.is_a?(GitCli::Delta::VCSItem)
|
|
29
|
+
case msg
|
|
30
|
+
when GitCli::Delta::ModifiedFile, GitCli::Delta::ModifiedDir
|
|
31
|
+
res = _pastel.bright_yellow(res)
|
|
32
|
+
when GitCli::Delta::DeletedFile, GitCli::Delta::DeletedDir
|
|
33
|
+
res = _pastel.strikethrough(res)
|
|
34
|
+
when GitCli::Delta::StagedFile, GitCli::Delta::StagedDir
|
|
35
|
+
res = _pastel.on_yellow(res)
|
|
36
|
+
end
|
|
28
37
|
end
|
|
29
38
|
|
|
30
39
|
" #{res}"
|
data/lib/gity/landing.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'git_cli'
|
|
|
4
4
|
require_relative 'common'
|
|
5
5
|
require_relative 'overview'
|
|
6
6
|
require_relative 'operation'
|
|
7
|
+
require_relative 'push_workspace'
|
|
7
8
|
|
|
8
9
|
module Gity
|
|
9
10
|
class Landing
|
|
@@ -12,6 +13,7 @@ module Gity
|
|
|
12
13
|
include Overview
|
|
13
14
|
include Operation
|
|
14
15
|
include Common
|
|
16
|
+
include PushWorkspace
|
|
15
17
|
|
|
16
18
|
def run(root, opts = {}, &block)
|
|
17
19
|
|
|
@@ -40,6 +42,18 @@ module Gity
|
|
|
40
42
|
rescue OperationCompleted
|
|
41
43
|
end
|
|
42
44
|
|
|
45
|
+
_prmt.puts
|
|
46
|
+
push = _prmt.yes?(_fmt("Do you want to push the changes to remote repository? ", :cyan))
|
|
47
|
+
if push
|
|
48
|
+
begin
|
|
49
|
+
|
|
50
|
+
_cls
|
|
51
|
+
push_workspace(@ws, opts)
|
|
52
|
+
|
|
53
|
+
rescue OperationCompleted
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
43
57
|
end
|
|
44
58
|
|
|
45
59
|
def process_flash
|
data/lib/gity/operation/add.rb
CHANGED
|
@@ -11,20 +11,35 @@ module Gity
|
|
|
11
11
|
_prmt.puts
|
|
12
12
|
print_workspace_items(ws, files, skip_other_files: true)
|
|
13
13
|
_prmt.puts
|
|
14
|
-
efiles = files.modified[:files] + files.
|
|
14
|
+
efiles = files.modified[:files] + files.deleted[:files]
|
|
15
|
+
efiles2 = files.new[:files] + files.new[:dirs]
|
|
15
16
|
|
|
16
17
|
begin
|
|
17
18
|
sels = _prmt.multi_select(_fmt("Please select all files to add to staging : "), filter: true, per_page: 10) do |m|
|
|
18
|
-
m.choice "All", "."
|
|
19
|
+
m.choice _fmt("All"), "."
|
|
19
20
|
efiles.sort.each do |f|
|
|
20
|
-
m.choice f,f.path
|
|
21
|
+
m.choice _fmt(f),f.path
|
|
21
22
|
end
|
|
23
|
+
|
|
24
|
+
efiles2.sort.each do |f|
|
|
25
|
+
if f.is_a?(GitCli::Delta::NewDir)
|
|
26
|
+
m.choice _fmt(f),f.path if f.has_files?
|
|
27
|
+
else
|
|
28
|
+
m.choice _fmt(f),f.path
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
m.choice "Done", :done
|
|
22
33
|
end
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
if sels.length == 0 or (sels.length == 1 and sels.first == :done)
|
|
36
|
+
# user not selected any files
|
|
37
|
+
else
|
|
38
|
+
block.call(:before_add_to_staging, sels) if block
|
|
39
|
+
st, res = ws.add_to_staging(*sels)
|
|
40
|
+
block.call(:after_add_to_staging, st, res) if block
|
|
41
|
+
raise OperationError, "Add to staging failed with error : #{res}" if not st
|
|
42
|
+
end
|
|
28
43
|
|
|
29
44
|
rescue TTY::Reader::InputInterrupt
|
|
30
45
|
end
|
|
@@ -18,12 +18,22 @@ module Gity
|
|
|
18
18
|
_prmt.puts
|
|
19
19
|
print_workspace_items(ws, files, skip_other_files: true)
|
|
20
20
|
_prmt.puts
|
|
21
|
-
efiles = files.modified[:files] + files.modified[:dirs] + files.
|
|
21
|
+
efiles = files.modified[:files] + files.modified[:dirs] + files.deleted[:files] + files.deleted[:dirs]
|
|
22
|
+
efiles2 = files.new[:files] + files.new[:dirs]
|
|
22
23
|
|
|
23
24
|
begin
|
|
24
25
|
sels = _prmt.multi_select(_fmt("Please select all files to be committed in this session : "), filter: true, per_page: 10) do |m|
|
|
25
26
|
efiles.sort.each do |f|
|
|
26
|
-
m.choice f,f.path
|
|
27
|
+
m.choice _fmt(f),f.path
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
efiles2.sort.each do |f|
|
|
31
|
+
case f
|
|
32
|
+
when GitCli::Delta::NewDir
|
|
33
|
+
m.choice _fmt(f),f.path if f.has_files?
|
|
34
|
+
else
|
|
35
|
+
m.choice _fmt(f),f.path
|
|
36
|
+
end
|
|
27
37
|
end
|
|
28
38
|
|
|
29
39
|
# allow to exit without selecting any files
|
|
@@ -11,15 +11,23 @@ module Gity
|
|
|
11
11
|
_prmt.puts
|
|
12
12
|
print_workspace_items(ws, files, skip_other_files: true)
|
|
13
13
|
_prmt.puts
|
|
14
|
-
efiles = files.modified[:files] + files.
|
|
14
|
+
efiles = files.modified[:files] + files.staged[:files]
|
|
15
15
|
|
|
16
16
|
begin
|
|
17
17
|
sels = _prmt.multi_select(_fmt("Please select all applicable files to be deleted : "), filter: true, per_page: 10) do |m|
|
|
18
18
|
efiles.sort.each do |f|
|
|
19
|
-
m.choice f,f
|
|
19
|
+
m.choice _fmt(f),f
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
files.new[:files].each do |f|
|
|
23
|
+
m.choice _fmt(f),f
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
m.choice "Done", :done
|
|
21
27
|
end
|
|
22
28
|
|
|
29
|
+
sels.delete_if { |e| e == :done }
|
|
30
|
+
|
|
23
31
|
sels.each do |s|
|
|
24
32
|
|
|
25
33
|
if s.is_a?(GitCli::Delta::NewFile)
|
data/lib/gity/operation/diff.rb
CHANGED
|
@@ -11,23 +11,29 @@ module Gity
|
|
|
11
11
|
_prmt.puts
|
|
12
12
|
print_workspace_items(ws, files, skip_other_files: true)
|
|
13
13
|
_prmt.puts
|
|
14
|
-
efiles = files.modified[:files] + files.staged[:files]
|
|
14
|
+
efiles = files.modified[:files] + files.staged[:files] #+ files.deleted[:files]
|
|
15
15
|
|
|
16
16
|
begin
|
|
17
17
|
sel = _prmt.select(_fmt("Please select file to diff : "), filter: true, per_page: 10) do |m|
|
|
18
18
|
efiles.sort.each do |f|
|
|
19
19
|
m.choice f,f.path
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
m.choice "Done", :done
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
raise OperationError, "Diff file '#{sel}' failed with error : #{res}" if not st
|
|
25
|
+
if is_empty?(sel) or sel != :done
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
st, res = ws.diff_file(sel)
|
|
28
|
+
raise OperationError, "Diff file '#{sel}' failed with error : #{res}" if not st
|
|
29
|
+
|
|
30
|
+
_prmt.puts _fmt "Diff file result for '#{sel}'"
|
|
31
|
+
_prmt.puts _fmt res, :bright_blue
|
|
32
|
+
_prmt.puts
|
|
33
|
+
_prmt.puts _fmt "[Enter to close]", :inverse
|
|
34
|
+
STDIN.gets
|
|
35
|
+
|
|
36
|
+
end
|
|
31
37
|
|
|
32
38
|
rescue TTY::Reader::InputInterrupt
|
|
33
39
|
end
|
|
@@ -18,12 +18,16 @@ module Gity
|
|
|
18
18
|
efiles.sort.each do |f|
|
|
19
19
|
m.choice f,f.path
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
m.choice "Done", :done
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if sels.length > 0 or (sels.length == 1 and sels.first != :done)
|
|
26
|
+
block.call(:before_ignore_file, sels) if block
|
|
27
|
+
st, res = ws.ignore(*sels)
|
|
28
|
+
block.call(:after_ignore_file, sels) if block
|
|
29
|
+
raise OperationError, "Ignore operation failed with error : #{res}" if not st
|
|
30
|
+
end
|
|
27
31
|
rescue TTY::Reader::InputInterrupt
|
|
28
32
|
end
|
|
29
33
|
|
data/lib/gity/operation.rb
CHANGED
|
@@ -29,9 +29,9 @@ module Gity
|
|
|
29
29
|
defOps.each do |o|
|
|
30
30
|
case o
|
|
31
31
|
when :commit_all
|
|
32
|
-
selOpts["Commit all"] = o if files.has_staged? or files.has_modified? or files.has_deleted?
|
|
32
|
+
selOpts["Commit all modified and deleted files"] = o if files.has_staged? or files.has_modified? or files.has_deleted?
|
|
33
33
|
when :commit
|
|
34
|
-
selOpts["
|
|
34
|
+
selOpts["Add and commit"] = o if files.has_staged? or files.has_new? or files.has_modified?
|
|
35
35
|
when :add
|
|
36
36
|
selOpts["Add"] = o if files.has_new?
|
|
37
37
|
when :ignore
|
|
@@ -45,6 +45,7 @@ module Gity
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
selOpts["Done"] = :done
|
|
48
49
|
selOpts["Quit"] = :quit
|
|
49
50
|
|
|
50
51
|
begin
|
|
@@ -90,6 +91,9 @@ module Gity
|
|
|
90
91
|
_prmt.puts
|
|
91
92
|
delete(ws, files, &block)
|
|
92
93
|
|
|
94
|
+
when :done
|
|
95
|
+
_operation_done(true)
|
|
96
|
+
|
|
93
97
|
when :quit
|
|
94
98
|
block.call(:before_quit) if block
|
|
95
99
|
_operation_done(opts[:no_exit])
|
data/lib/gity/overview.rb
CHANGED
|
@@ -38,7 +38,7 @@ module Gity
|
|
|
38
38
|
files = mfiles.staged[:dirs] + mfiles.staged[:files]
|
|
39
39
|
if files.length > 0
|
|
40
40
|
files.sort.each do |v|
|
|
41
|
-
_prmt.puts _fmt("* #{v}"
|
|
41
|
+
_prmt.puts _fmt("* #{v}")
|
|
42
42
|
end
|
|
43
43
|
else
|
|
44
44
|
_prmt.puts _fmt "** No staged file found", :yellow
|
|
@@ -50,17 +50,27 @@ module Gity
|
|
|
50
50
|
|
|
51
51
|
_prmt.puts ""
|
|
52
52
|
_prmt.puts _fmt "Other Files : ", :bold, :underline
|
|
53
|
-
res = mfiles.modified[:dirs].sort + mfiles.modified[:files].sort + mfiles.deleted[:dirs].sort + mfiles.deleted[:files].sort + mfiles.new[:dirs].sort + mfiles.new[:files].sort
|
|
53
|
+
#res = mfiles.modified[:dirs].sort + mfiles.modified[:files].sort + mfiles.deleted[:dirs].sort + mfiles.deleted[:files].sort + mfiles.new[:dirs].sort + mfiles.new[:files].sort
|
|
54
|
+
res = mfiles.modified[:dirs] + mfiles.modified[:files] + mfiles.deleted[:dirs] + mfiles.deleted[:files]
|
|
55
|
+
res2 = mfiles.new[:dirs] + mfiles.new[:files]
|
|
54
56
|
|
|
55
|
-
if res.length > 0
|
|
56
|
-
res.each do |vv|
|
|
57
|
+
if res.length > 0 or res2.length > 0
|
|
58
|
+
res.sort.each do |vv|
|
|
59
|
+
case vv
|
|
60
|
+
when GitCli::Delta::ModifiedFile, GitCli::Delta::ModifiedDir
|
|
61
|
+
_prmt.puts _fmt(vv)
|
|
62
|
+
when GitCli::Delta::DeletedFile, GitCli::Delta::DeletedDir
|
|
63
|
+
_prmt.puts _fmt(vv)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
_prmt.puts "\n ******** Untracked Files & Directories ******** "
|
|
68
|
+
res2.sort.each do |vv|
|
|
57
69
|
case vv
|
|
58
70
|
when GitCli::Delta::NewFile
|
|
59
71
|
_prmt.puts _fmt(vv)
|
|
60
|
-
when GitCli::Delta::
|
|
61
|
-
_prmt.puts _fmt(vv
|
|
62
|
-
when GitCli::Delta::DeletedFile
|
|
63
|
-
_prmt.puts _fmt(vv, :strikethrough)
|
|
72
|
+
when GitCli::Delta::NewDir
|
|
73
|
+
_prmt.puts _fmt(vv) if vv.has_files?
|
|
64
74
|
end
|
|
65
75
|
end
|
|
66
76
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module Gity
|
|
5
|
+
module PushWorkspace
|
|
6
|
+
include TR::CondUtils
|
|
7
|
+
|
|
8
|
+
def push_workspace(ws, opts = {})
|
|
9
|
+
|
|
10
|
+
_prmt.puts
|
|
11
|
+
if not ws.has_remote_repos?
|
|
12
|
+
_prmt.puts(_fmt("There is no remote repository defined."))
|
|
13
|
+
add = _prmt.yes?(_fmt("Add new repository? "))
|
|
14
|
+
|
|
15
|
+
while(add)
|
|
16
|
+
|
|
17
|
+
return if not add
|
|
18
|
+
|
|
19
|
+
name = _prmt.ask("Name of the repository : ", required: true, value: "origin")
|
|
20
|
+
path = _prmt.ask("Path to the repository : ", required: true)
|
|
21
|
+
|
|
22
|
+
ws.add_remote(name, path)
|
|
23
|
+
|
|
24
|
+
add = _prmt.yes?("Done adding remote? ")
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
selRepos = _prmt.select(_fmt("Please select a repository to push : "), filter: true) do |m|
|
|
32
|
+
|
|
33
|
+
ws.repos.each do |re|
|
|
34
|
+
m.choice "#{re.name} - #{re.url}", re
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
m.choice "Abort", :abort
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if selRepos != :abort
|
|
42
|
+
ws.push_changes_with_tags(selRepos.name)
|
|
43
|
+
_prmt.puts _fmt("\nChanges push to remote repository '#{selRepos.name}'.\n Have a good day.\n", :bright_green)
|
|
44
|
+
else
|
|
45
|
+
_prmt.puts _fmt("\nPush aborted\n", :bright_yellow)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
data/lib/gity/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gity
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-10-
|
|
11
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: toolrack
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
89
|
+
version: 0.13.9
|
|
90
90
|
type: :runtime
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
96
|
+
version: 0.13.9
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: release-gem
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,6 +134,7 @@ files:
|
|
|
134
134
|
- lib/gity/operation/ignore.rb
|
|
135
135
|
- lib/gity/operation/remove_staged.rb
|
|
136
136
|
- lib/gity/overview.rb
|
|
137
|
+
- lib/gity/push_workspace.rb
|
|
137
138
|
- lib/gity/status.rb
|
|
138
139
|
- lib/gity/status_list.rb
|
|
139
140
|
- lib/gity/version.rb
|
|
@@ -141,7 +142,7 @@ files:
|
|
|
141
142
|
homepage: ''
|
|
142
143
|
licenses: []
|
|
143
144
|
metadata: {}
|
|
144
|
-
post_install_message:
|
|
145
|
+
post_install_message:
|
|
145
146
|
rdoc_options: []
|
|
146
147
|
require_paths:
|
|
147
148
|
- lib
|
|
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
157
158
|
version: '0'
|
|
158
159
|
requirements: []
|
|
159
160
|
rubygems_version: 3.4.6
|
|
160
|
-
signing_key:
|
|
161
|
+
signing_key:
|
|
161
162
|
specification_version: 4
|
|
162
163
|
summary: ''
|
|
163
164
|
test_files: []
|