nit 0.0.5 → 0.0.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 +5 -5
- data/CHANGES.md +6 -1
- data/Gemfile +1 -0
- data/bin/nit-client +3 -0
- data/bin/nit-server +38 -0
- data/lib/nit/command/commit.rb +2 -1
- data/lib/nit/command/status.rb +4 -1
- data/lib/nit/lines.rb +3 -2
- data/lib/nit/version.rb +1 -1
- data/nit.gemspec +8 -5
- data/test/commands_test.rb +15 -2
- data/test/dummies/git/hooks/applypatch-msg.sample +0 -0
- data/test/dummies/git/hooks/commit-msg.sample +0 -0
- data/test/dummies/git/hooks/post-update.sample +0 -0
- data/test/dummies/git/hooks/pre-applypatch.sample +0 -0
- data/test/dummies/git/hooks/pre-commit.sample +0 -0
- data/test/dummies/git/hooks/pre-rebase.sample +0 -0
- data/test/dummies/git/hooks/prepare-commit-msg.sample +0 -0
- data/test/dummies/git/hooks/update.sample +0 -0
- data/test/lines_test.rb +3 -3
- data/test/nit_test.rb +6 -4
- data/test/test_helper.rb +5 -1
- metadata +41 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ed0ddde57650f01656e5feb9d67a49d9b2e4e4d50889d40a2b16ed3291031800
|
4
|
+
data.tar.gz: 7cc40e90614681a5d7abe8b94d1b95b8d4ad0c77d49f7ca2fdc79cbf1a5cb0c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe6c0c65bc72cf07e08086becc781f7f659c78cda187eb7006a7766b69ad799f982fac9db2f57420f18460d010f71c25f9b40c2f42706ea1115a6243b25391e
|
7
|
+
data.tar.gz: 3bf54fe3597da8495056f7296947cbc33a1a63e7dd3e1f935e2e3ed8364e224a13256020072e7bd4822b22a0437d02fe8aaddc68f7486cda73221ff56e05af29
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.0.6
|
2
|
+
|
3
|
+
* Allow Ruby 3.4.
|
4
|
+
|
5
|
+
|
1
6
|
## 0.0.5
|
2
7
|
|
3
8
|
* Make nit compatible with a git upgrade where the status command doesn't prepend lines with a hash (#) anymore (as seen in git 1.8.5.2).
|
@@ -10,4 +15,4 @@
|
|
10
15
|
## 0.0.3
|
11
16
|
|
12
17
|
* Some bug fixes.
|
13
|
-
* Allow passing arbitrary git arguments to all nit commands, like `nit commit -m "awesome work" abc"
|
18
|
+
* Allow passing arbitrary git arguments to all nit commands, like `nit commit -m "awesome work" abc"
|
data/Gemfile
CHANGED
data/bin/nit-client
ADDED
data/bin/nit-server
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# client:
|
4
|
+
# echo "bla and more" | netcat -U demo.socket
|
5
|
+
|
6
|
+
require "nit/app"
|
7
|
+
def run!(input)
|
8
|
+
foo = StringIO.new
|
9
|
+
$stdout = foo
|
10
|
+
|
11
|
+
Nit::App.start
|
12
|
+
|
13
|
+
$stdout.string
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
require 'socket'
|
19
|
+
|
20
|
+
socket_file_name = './demo.socket'
|
21
|
+
|
22
|
+
File.unlink socket_file_name
|
23
|
+
server = UNIXServer.new socket_file_name
|
24
|
+
|
25
|
+
loop do
|
26
|
+
client = server.accept
|
27
|
+
input = client.gets
|
28
|
+
|
29
|
+
argv = input.split(" ") # FIXME: this does not include +1 spaces.
|
30
|
+
ARGV = argv # FIXME: this sucks, it's the only interface for Thor. make input injectable for Nit::App
|
31
|
+
# FIXME: make App::run/start return outpub.
|
32
|
+
|
33
|
+
output = run!(input)
|
34
|
+
|
35
|
+
client.puts output
|
36
|
+
client.close
|
37
|
+
end
|
38
|
+
|
data/lib/nit/command/commit.rb
CHANGED
@@ -2,6 +2,7 @@ class Nit::Command
|
|
2
2
|
class Commit < Status
|
3
3
|
def process(state, indexes, args)
|
4
4
|
handle_m!(args)
|
5
|
+
pp state.files
|
5
6
|
system "git add #{state.files.list(indexes)} && git commit #{args.join(" ")}"
|
6
7
|
end
|
7
8
|
|
@@ -12,4 +13,4 @@ class Nit::Command
|
|
12
13
|
args[i+1] = "\"#{args[i+1]}\""
|
13
14
|
end
|
14
15
|
end
|
15
|
-
end
|
16
|
+
end
|
data/lib/nit/command/status.rb
CHANGED
@@ -40,6 +40,9 @@ module Nit
|
|
40
40
|
process_modified(i, file, ln)
|
41
41
|
elsif ln.match(screen.file_patterns[:new])
|
42
42
|
process_new(i, file, ln)
|
43
|
+
# elsif ln.match(screen.file_patterns[:deleted])
|
44
|
+
# raise
|
45
|
+
# process_deleted(i, file, ln)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
@@ -87,4 +90,4 @@ module Nit
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
end
|
90
|
-
end
|
93
|
+
end
|
data/lib/nit/lines.rb
CHANGED
@@ -32,7 +32,8 @@ module Nit
|
|
32
32
|
def file_patterns
|
33
33
|
{
|
34
34
|
modified: /#?\tmodified:(.+)/,
|
35
|
-
new: /#?\t((?!modified:).+)
|
35
|
+
new: /#?\t((?!modified:).+)/,
|
36
|
+
deleted: /#?\tdeleted:(.+)/,
|
36
37
|
}
|
37
38
|
end
|
38
39
|
end
|
@@ -60,4 +61,4 @@ module Nit
|
|
60
61
|
path.to_s
|
61
62
|
end
|
62
63
|
end
|
63
|
-
end
|
64
|
+
end
|
data/lib/nit/version.rb
CHANGED
data/nit.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'nit/version'
|
@@ -10,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
10
9
|
spec.email = ["apotonick@gmail.com"]
|
11
10
|
spec.description = %q{Improving your Git workflow since 2013.}
|
12
11
|
spec.summary = %q{Nit improves your git workflows.}
|
13
|
-
spec.homepage = "
|
12
|
+
spec.homepage = "https://github.com/apotonick/nit"
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
16
15
|
spec.files = `git ls-files`.split($/)
|
@@ -18,9 +17,13 @@ Gem::Specification.new do |spec|
|
|
18
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
18
|
spec.require_paths = ["lib"]
|
20
19
|
|
21
|
-
spec.add_dependency "thor", '
|
20
|
+
spec.add_dependency "thor", '>= 0.18.1'
|
22
21
|
|
23
|
-
|
22
|
+
# FIXME: this is for nit-server:
|
23
|
+
spec.add_dependency "mkfifo"
|
24
|
+
spec.add_dependency "ruby-fifo"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler"
|
24
27
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "minitest", "5.
|
28
|
+
spec.add_development_dependency "minitest", ">= 5.4.0"
|
26
29
|
end
|
data/test/commands_test.rb
CHANGED
@@ -28,7 +28,6 @@ class CommandsTest < MiniTest::Spec
|
|
28
28
|
|
29
29
|
describe "commit" do
|
30
30
|
let (:klass) { "Commit" }
|
31
|
-
let (:screen) { output }
|
32
31
|
|
33
32
|
it "also ignores files when commiting" do
|
34
33
|
config.ignored_files = ["new.rb", "brandnew.rb", "staged.rb"] # TODO: make this more generic.
|
@@ -41,6 +40,20 @@ class CommandsTest < MiniTest::Spec
|
|
41
40
|
it { cmd.call(["-m", "awesome work", "b"], output).must_equal "git add ../lib/new.rb && git commit -m \"awesome work\"" }
|
42
41
|
|
43
42
|
# TODO: test nit commit -a
|
43
|
+
|
44
|
+
it "allow co with a deleted file, so it gets {git rm}" do
|
45
|
+
output = <<-EOF
|
46
|
+
On branch master
|
47
|
+
Changes not staged for commit:
|
48
|
+
(use "git add/rm <file>..." to update what will be committed)
|
49
|
+
(use "git restore <file>..." to discard changes in working directory)
|
50
|
+
\tmodified: CHANGES.md
|
51
|
+
\tdeleted: bin/nit-client
|
52
|
+
\tmodified: bin/nit-server
|
53
|
+
EOF
|
54
|
+
|
55
|
+
assert_equal cmd.call(["ac"], output),%(git add CHANGES.md && git rm bin/nit-client && git commit )
|
56
|
+
end
|
44
57
|
end
|
45
58
|
end
|
46
59
|
|
@@ -52,4 +65,4 @@ class ArgsProcessorTest < MiniTest::Spec
|
|
52
65
|
it { subject.call(["-a"]).must_equal [[], ["-a"]] }
|
53
66
|
it { subject.call(["-a", "-m", '"message"', "abc"]).must_equal [["abc"], ["-a", "-m", '"message"']] }
|
54
67
|
it { subject.call(["-m", '"message"', "a", "b"]).must_equal [["a", "b"], ["-m", '"message"']] }
|
55
|
-
end
|
68
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/lines_test.rb
CHANGED
@@ -12,8 +12,8 @@ class LinesTest < StatusTest
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#to_s" do
|
15
|
-
let (:
|
16
|
-
it { Nit::Lines.new(
|
15
|
+
let (:out) { "1\n2" }
|
16
|
+
it { Nit::Lines.new(out).to_s.must_equal(out) }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "Line" do
|
@@ -24,4 +24,4 @@ class LinesTest < StatusTest
|
|
24
24
|
it { subject.delete
|
25
25
|
lines.to_s.must_equal "rocks"}
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/test/nit_test.rb
CHANGED
@@ -44,14 +44,16 @@ end
|
|
44
44
|
class DynamicCommandTest < NitTest
|
45
45
|
it "evaluates indexes and invokes git command with it" do
|
46
46
|
# how to capture STDERR: https://www.ruby-forum.com/topic/1103519#982117
|
47
|
-
nit(" checkout e 2>&1")
|
47
|
+
assert_equal nit(" checkout e 2>&1"), "error: pathspec 'new.rb' did not match any file(s) known to git
|
48
|
+
|
49
|
+
"
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
53
|
class ArbitraryGitCommandsTest < NitTest
|
52
54
|
it { nit(" diff b").must_match "a\/staged.rb" }
|
53
55
|
|
54
|
-
it { nit(" diff --raw b").must_equal ":100644 100644 e69de29
|
56
|
+
it { nit(" diff --raw b").must_equal ":100644 100644 e69de29 0000000 M\tstaged.rb\n" }
|
55
57
|
|
56
58
|
# commit:
|
57
59
|
it "allows strings after -m" do # TODO: implement that for all commands?
|
@@ -67,7 +69,7 @@ class ArbitraryGitCommandsTest < NitTest
|
|
67
69
|
`cd stage && git add stage/new_file`
|
68
70
|
end
|
69
71
|
puts output
|
70
|
-
output
|
72
|
+
assert_equal output, "] fixing it\n"
|
71
73
|
end
|
72
74
|
|
73
75
|
|
@@ -87,4 +89,4 @@ class NitWithCharIndexerTest < NitTest
|
|
87
89
|
out.must_match "a\/staged.rb"
|
88
90
|
out.must_match "a\/on_stage.rb"
|
89
91
|
end
|
90
|
-
end
|
92
|
+
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.18.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
20
24
|
- - ">="
|
21
25
|
- !ruby/object:Gem::Version
|
22
26
|
version: 0.18.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mkfifo
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
23
34
|
type: :runtime
|
24
35
|
prerelease: false
|
25
36
|
version_requirements: !ruby/object:Gem::Requirement
|
26
37
|
requirements:
|
27
|
-
- - "
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-fifo
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
28
46
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
30
52
|
- - ">="
|
31
53
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0
|
54
|
+
version: '0'
|
33
55
|
- !ruby/object:Gem::Dependency
|
34
56
|
name: bundler
|
35
57
|
requirement: !ruby/object:Gem::Requirement
|
36
58
|
requirements:
|
37
|
-
- - "
|
59
|
+
- - ">="
|
38
60
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
61
|
+
version: '0'
|
40
62
|
type: :development
|
41
63
|
prerelease: false
|
42
64
|
version_requirements: !ruby/object:Gem::Requirement
|
43
65
|
requirements:
|
44
|
-
- - "
|
66
|
+
- - ">="
|
45
67
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
68
|
+
version: '0'
|
47
69
|
- !ruby/object:Gem::Dependency
|
48
70
|
name: rake
|
49
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,16 +84,16 @@ dependencies:
|
|
62
84
|
name: minitest
|
63
85
|
requirement: !ruby/object:Gem::Requirement
|
64
86
|
requirements:
|
65
|
-
- -
|
87
|
+
- - ">="
|
66
88
|
- !ruby/object:Gem::Version
|
67
|
-
version: 5.
|
89
|
+
version: 5.4.0
|
68
90
|
type: :development
|
69
91
|
prerelease: false
|
70
92
|
version_requirements: !ruby/object:Gem::Requirement
|
71
93
|
requirements:
|
72
|
-
- -
|
94
|
+
- - ">="
|
73
95
|
- !ruby/object:Gem::Version
|
74
|
-
version: 5.
|
96
|
+
version: 5.4.0
|
75
97
|
description: Improving your Git workflow since 2013.
|
76
98
|
email:
|
77
99
|
- apotonick@gmail.com
|
@@ -88,6 +110,8 @@ files:
|
|
88
110
|
- Rakefile
|
89
111
|
- Thorfile
|
90
112
|
- bin/nit
|
113
|
+
- bin/nit-client
|
114
|
+
- bin/nit-server
|
91
115
|
- lib/nit.rb
|
92
116
|
- lib/nit/CHANGES.mk
|
93
117
|
- lib/nit/app.rb
|
@@ -138,7 +162,7 @@ files:
|
|
138
162
|
- test/nit_test.rb
|
139
163
|
- test/status_test.rb
|
140
164
|
- test/test_helper.rb
|
141
|
-
homepage:
|
165
|
+
homepage: https://github.com/apotonick/nit
|
142
166
|
licenses:
|
143
167
|
- MIT
|
144
168
|
metadata: {}
|
@@ -157,8 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
181
|
- !ruby/object:Gem::Version
|
158
182
|
version: '0'
|
159
183
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.2.1
|
184
|
+
rubygems_version: 3.2.3
|
162
185
|
signing_key:
|
163
186
|
specification_version: 4
|
164
187
|
summary: Nit improves your git workflows.
|