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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ce40cb00fbd0507889d52bf61b057450c613caa
4
- data.tar.gz: 560e59c303756db72f2ceab112c9b59c35dd608e
2
+ SHA256:
3
+ metadata.gz: ed0ddde57650f01656e5feb9d67a49d9b2e4e4d50889d40a2b16ed3291031800
4
+ data.tar.gz: 7cc40e90614681a5d7abe8b94d1b95b8d4ad0c77d49f7ca2fdc79cbf1a5cb0c2
5
5
  SHA512:
6
- metadata.gz: 7b9f0619293a6c4ae41ac59b8448a17000dab8aff956ed69e424831a234b79d124a463946e9b0531046860cf74f113514ab93ad02a2727067d781854046df6db
7
- data.tar.gz: 5875f64c730b320ae5b3bb6c716c80f479cd899a034b72ef6ab41410310a19acb506b89b758ecba685a39acda2066f3711c31234f954a7446fc113058d27062c
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
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in nit.gemspec
4
4
  gemspec
5
+ gem "minitest-line"
data/bin/nit-client ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ echo $* | netcat -U demo.socket
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
+
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Nit
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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 = "http://github.com/apotonick/nit"
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", '~> 0.18', '>= 0.18.1'
20
+ spec.add_dependency "thor", '>= 0.18.1'
22
21
 
23
- spec.add_development_dependency "bundler", "~> 1.3"
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.2.0"
28
+ spec.add_development_dependency "minitest", ">= 5.4.0"
26
29
  end
@@ -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 (:output) { "1\n2" }
16
- it { Nit::Lines.new(output).to_s.must_equal(output) }
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").must_match "error: pathspec 'new.rb' did not match any file(s) known to git."
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... 0000000... M\tstaged.rb\n" }
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.must_match "] fixing it\n"
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
@@ -41,4 +41,8 @@ MiniTest::Spec.class_eval do
41
41
  no changes added to commit (use "git add" and/or "git commit -a")
42
42
  EOF
43
43
  end
44
- end
44
+
45
+ def assert_equal(expected, asserted)
46
+ super(asserted, expected)
47
+ end
48
+ end
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.5
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: 2014-03-13 00:00:00.000000000 Z
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: '0.18'
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.18'
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.18.1
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: '1.3'
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: '1.3'
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.2.0
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.2.0
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: http://github.com/apotonick/nit
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
- rubyforge_project:
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.