git_cli 0.3.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Rakefile +2 -0
- data/git_cli.gemspec +6 -2
- data/lib/git_cli.rb +2 -1
- data/lib/git_cli/add_commit.rb +10 -3
- data/lib/git_cli/delta.rb +36 -0
- data/lib/git_cli/git_core.rb +6 -18
- data/lib/git_cli/global.rb +8 -1
- data/lib/git_cli/version.rb +1 -1
- metadata +55 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2137f01ad23cca0e4c523417ac601e30bb46f3eeeafd04d6e359b2d812452c9d
|
4
|
+
data.tar.gz: 7127ecfaf5f42a8fdd311864003c92529ce86dffc30211d212872ac23d92d92b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa62792074ef5f323dea781ca32dd2ae81e76775b8943c6eb5c6cf3310ad0a4506a72ecbf23f05f53803648ed29d4afc811e92e93d2b233353eb6cc3ee0dea08
|
7
|
+
data.tar.gz: 0b178d8eb671e405e16d5e6ba521d7aceb6765eaaa5c77e625e94465c1872def522a6aaf90304864c2910f5d8190236bb4eff5bbc75e0406ecbb83341b27662b
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/git_cli.gemspec
CHANGED
@@ -27,6 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_dependency "tlogger", "
|
31
|
-
spec.add_dependency "toolrack", "
|
30
|
+
spec.add_dependency "tlogger", ">= 0.21"
|
31
|
+
spec.add_dependency "toolrack", ">= 0.4.0"
|
32
|
+
spec.add_dependency "gvcs", ">= 0.1.0"
|
33
|
+
spec.add_dependency "ptools", "~> 1.4.0"
|
34
|
+
|
35
|
+
spec.add_development_dependency 'devops_helper', ">= 0.2.0"
|
32
36
|
end
|
data/lib/git_cli.rb
CHANGED
data/lib/git_cli/add_commit.rb
CHANGED
@@ -93,9 +93,11 @@ module GitCli
|
|
93
93
|
|
94
94
|
end # remove_from_vcs
|
95
95
|
|
96
|
-
def commit(message)
|
96
|
+
def commit(message, opts = { })
|
97
97
|
check_vcs
|
98
98
|
|
99
|
+
files = opts[:files] || []
|
100
|
+
[files] if not files.is_a?(Array)
|
99
101
|
# have to escape the message for command line purposes
|
100
102
|
msg = message.gsub("\"","\\\"").gsub("\\","\\\\")
|
101
103
|
|
@@ -105,6 +107,9 @@ module GitCli
|
|
105
107
|
cmd << "&&"
|
106
108
|
cmd << @vcs.exe_path
|
107
109
|
cmd << "commit"
|
110
|
+
if not_empty?(files)
|
111
|
+
cmd << files.join(" ")
|
112
|
+
end
|
108
113
|
cmd << "-m"
|
109
114
|
cmd << "\"#{msg}\""
|
110
115
|
|
@@ -116,7 +121,7 @@ module GitCli
|
|
116
121
|
[st.success?, res.strip]
|
117
122
|
end
|
118
123
|
|
119
|
-
end
|
124
|
+
end # commit
|
120
125
|
|
121
126
|
def commit_all(msg)
|
122
127
|
check_vcs
|
@@ -141,7 +146,9 @@ module GitCli
|
|
141
146
|
[st.success?, res.strip]
|
142
147
|
end
|
143
148
|
|
144
|
-
end
|
149
|
+
end # commit_all
|
150
|
+
|
151
|
+
|
145
152
|
|
146
153
|
end
|
147
154
|
end
|
data/lib/git_cli/delta.rb
CHANGED
@@ -52,6 +52,7 @@ module GitCli
|
|
52
52
|
cmd << @wsPath
|
53
53
|
cmd << "&&"
|
54
54
|
cmd << @vcs.exe_path
|
55
|
+
# list only non staged modifications
|
55
56
|
cmd << "diff --name-only --diff-filter=M"
|
56
57
|
|
57
58
|
cmdln = cmd.join(" ")
|
@@ -183,6 +184,41 @@ module GitCli
|
|
183
184
|
|
184
185
|
end # deleted_files
|
185
186
|
|
187
|
+
def staged_files
|
188
|
+
|
189
|
+
check_vcs
|
190
|
+
|
191
|
+
cmd = []
|
192
|
+
cmd << "cd"
|
193
|
+
cmd << @wsPath
|
194
|
+
cmd << "&&"
|
195
|
+
cmd << @vcs.exe_path
|
196
|
+
cmd << "diff --name-only --cached"
|
197
|
+
|
198
|
+
cmdln = cmd.join(" ")
|
199
|
+
log_debug "New Files : #{cmdln}"
|
200
|
+
dirs = []
|
201
|
+
files = []
|
202
|
+
res = os_exec(cmdln) do |st, res|
|
203
|
+
|
204
|
+
if st.success?
|
205
|
+
res.each_line do |l|
|
206
|
+
l.chomp!
|
207
|
+
if File.directory?(File.join(@wsPath,l))
|
208
|
+
dirs << l
|
209
|
+
else
|
210
|
+
files << l
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
[true, dirs.sort, files.sort]
|
215
|
+
else
|
216
|
+
[false, [], []]
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end # staged_files
|
221
|
+
|
186
222
|
def reset_file_changes(path)
|
187
223
|
|
188
224
|
raise_if_empty(path, "Path cannot be empty for reset file changes operation", GitCliException)
|
data/lib/git_cli/git_core.rb
CHANGED
@@ -17,6 +17,8 @@
|
|
17
17
|
|
18
18
|
require_relative 'global'
|
19
19
|
|
20
|
+
require 'ptools'
|
21
|
+
|
20
22
|
module GitCli
|
21
23
|
module GitCore
|
22
24
|
|
@@ -58,25 +60,11 @@ module GitCli
|
|
58
60
|
private
|
59
61
|
def is_installed?
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
st, path = GitCli::OS::Linux::Utils.is_installed?("git")
|
65
|
-
GitCli::Global.instance.logger.debug "'git' install check return [#{st},#{path}]"
|
66
|
-
|
67
|
-
[st, path]
|
68
|
-
|
69
|
-
elsif Antrapol::ToolRack::RuntimeUtils.on_mac?
|
70
|
-
GitCli::Global.instance.logger.debug "Running on MacOS is detected"
|
71
|
-
require_relative 'os/macos/utils'
|
72
|
-
|
73
|
-
elsif Antrapol::ToolRack::RuntimeUtils.on_window?
|
74
|
-
GitCli::Global.instance.logger.debug "Running on MS Window is detected"
|
75
|
-
require_relative 'os/win/utils'
|
76
|
-
|
63
|
+
gpath = File.which('git')
|
64
|
+
if is_empty?(gpath)
|
65
|
+
[false, ""]
|
77
66
|
else
|
78
|
-
|
79
|
-
raise RuntimeError, "Unknown platform"
|
67
|
+
[true, gpath]
|
80
68
|
end
|
81
69
|
|
82
70
|
end # is_installed?
|
data/lib/git_cli/global.rb
CHANGED
@@ -24,8 +24,15 @@ module GitCli
|
|
24
24
|
|
25
25
|
attr_reader :logger
|
26
26
|
def initialize
|
27
|
-
|
27
|
+
debug = ENV['GitCli_Debug']
|
28
|
+
debugOut = ENV['GitCli_DebugOut'] || STDOUT
|
29
|
+
if debug.nil?
|
30
|
+
@logger = Tlogger.new('git_cli.log', 5, 1024*1024*10)
|
31
|
+
else
|
32
|
+
@logger = Tlogger.new(debugOut)
|
33
|
+
end
|
28
34
|
end
|
35
|
+
|
29
36
|
end
|
30
37
|
|
31
38
|
class GitCliException < StandardError; end
|
data/lib/git_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Liaw
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: tlogger
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- - "
|
17
|
+
- - ">="
|
17
18
|
- !ruby/object:Gem::Version
|
18
19
|
version: '0.21'
|
19
|
-
name: tlogger
|
20
|
-
prerelease: false
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.21'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: toolrack
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - "
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 0.4.0
|
33
|
-
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.4.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gvcs
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.1.0
|
48
|
+
type: :runtime
|
34
49
|
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ptools
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.4.0
|
35
62
|
type: :runtime
|
63
|
+
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
68
|
+
version: 1.4.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: devops_helper
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.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.2.0
|
41
83
|
description: Interface to GIT via command line interface instead of some sor of library
|
42
84
|
email:
|
43
85
|
- chrisliaw@antrapol.com
|
@@ -79,7 +121,7 @@ homepage: https://github.com/chrisliaw/git_cli
|
|
79
121
|
licenses:
|
80
122
|
- GPL-3.0
|
81
123
|
metadata: {}
|
82
|
-
post_install_message:
|
124
|
+
post_install_message:
|
83
125
|
rdoc_options: []
|
84
126
|
require_paths:
|
85
127
|
- lib
|
@@ -94,9 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
136
|
- !ruby/object:Gem::Version
|
95
137
|
version: '0'
|
96
138
|
requirements: []
|
97
|
-
|
98
|
-
|
99
|
-
signing_key:
|
139
|
+
rubygems_version: 3.1.2
|
140
|
+
signing_key:
|
100
141
|
specification_version: 4
|
101
142
|
summary: GIT command line interface
|
102
143
|
test_files: []
|