nit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +9 -0
  3. data/lib/nit/command/commit.rb +8 -0
  4. data/lib/nit/lines.rb +1 -1
  5. data/lib/nit/version.rb +1 -1
  6. data/nit.gemspec +2 -2
  7. data/test/commands_test.rb +3 -1
  8. data/test/dummies/{stage → files}/brandnew.rb +0 -0
  9. data/test/dummies/{stage → files}/new.rb +0 -0
  10. data/test/dummies/{stage → files}/on_stage.rb +0 -0
  11. data/test/dummies/{stage → files}/staged.rb +0 -0
  12. data/test/dummies/{stage/git → git}/COMMIT_EDITMSG +0 -0
  13. data/test/dummies/{stage/git → git}/HEAD +0 -0
  14. data/test/dummies/{stage/git → git}/config +0 -0
  15. data/test/dummies/{stage/git → git}/description +0 -0
  16. data/test/dummies/{stage/git → git}/hooks/applypatch-msg.sample +0 -0
  17. data/test/dummies/{stage/git → git}/hooks/commit-msg.sample +0 -0
  18. data/test/dummies/{stage/git → git}/hooks/post-update.sample +0 -0
  19. data/test/dummies/{stage/git → git}/hooks/pre-applypatch.sample +0 -0
  20. data/test/dummies/{stage/git → git}/hooks/pre-commit.sample +0 -0
  21. data/test/dummies/{stage/git → git}/hooks/pre-rebase.sample +0 -0
  22. data/test/dummies/{stage/git → git}/hooks/prepare-commit-msg.sample +0 -0
  23. data/test/dummies/{stage/git → git}/hooks/update.sample +0 -0
  24. data/test/dummies/{stage/git → git}/index +0 -0
  25. data/test/dummies/{stage/git → git}/info/exclude +0 -0
  26. data/test/dummies/{stage/git → git}/logs/HEAD +0 -0
  27. data/test/dummies/{stage/git → git}/logs/refs/heads/master +0 -0
  28. data/test/dummies/{stage/git → git}/objects/0f/e4f83176db6842cd95f439f1edad3cb8483b4e +0 -0
  29. data/test/dummies/{stage/git → git}/objects/5c/0d92dd14afeb4c2bcd11bc3f072390be598a73 +0 -0
  30. data/test/dummies/{stage/git → git}/objects/60/bd895ee4a908b754f1980491c0e0852c29a8cd +0 -0
  31. data/test/dummies/{stage/git → git}/objects/b7/5ac79d08245a3a8a662520dd90f80be097cc44 +0 -0
  32. data/test/dummies/{stage/git → git}/objects/c1/172bf75d73a630c467f1e1448c44d9188fe23e +0 -0
  33. data/test/dummies/{stage/git → git}/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  34. data/test/dummies/{stage/git → git}/refs/heads/master +0 -0
  35. data/test/lines_test.rb +2 -1
  36. data/test/nit_test.rb +27 -2
  37. data/test/status_test.rb +1 -0
  38. data/test/test_helper.rb +1 -0
  39. metadata +72 -74
  40. data/test/dummies/stage/.gitignore +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad661b2510762a5a197158e53996a4b5c48443dc
4
- data.tar.gz: c7a40b75bb9e2e1a0f15929fd478f08637ee635f
3
+ metadata.gz: f516d5091e63c8591e12facb8e6971d19116c8bc
4
+ data.tar.gz: c76c5d753527a5568bce39965197aa5c1ddf34cc
5
5
  SHA512:
6
- metadata.gz: 2a53d6fcaee8a35a8c37614e211179e6b9c1c56d7501e21a6ae4a07e2bcf8b6175ea6520476eeeb964d788996e5a56177faf65a334d8a3505104ffcf6b59f304
7
- data.tar.gz: 2a9103e438303f1cdeb3e46fd1f01d1fa8c3bef9c38766e499db0c53325d3ac5c7b9c268c3267425dcad071e50f59283957ffbbd60faec657fbff153833c085a
6
+ metadata.gz: 1f3392cec82272850b8dd83bf405deb84c85e3c00746fc744e4d2b371675f91f782a32f7f75c094d1ceb51e918f5b132f45fdafff002768047de43a3e9e65c5a
7
+ data.tar.gz: afd638bc8f316a9982ae688137edaec506807d7a42935e69689eed73e0e0a58a272333ce054aa191a2b1b5014976b8f6d92a2480d60ef969a448317fd66bf994
data/CHANGES.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.0.5
2
+
3
+
4
+
5
+ ## 0.0.4
6
+
7
+ * Fixed a bug where new files starting with one of the chars in [modified] weren't recognized.
8
+ * Finally allow `nit commit -m "awesome work" abc", it didn't really work on the CLI before.
9
+
1
10
  ## 0.0.3
2
11
 
3
12
  * Some bug fixes.
@@ -1,7 +1,15 @@
1
1
  class Nit::Command
2
2
  class Commit < Status
3
3
  def process(state, indexes, args)
4
+ handle_m!(args)
4
5
  system "git add #{state.files.list(indexes)} && git commit #{args.join(" ")}"
5
6
  end
7
+
8
+ private
9
+ def handle_m!(args)
10
+ return unless i = args.index("-m")
11
+
12
+ args[i+1] = "\"#{args[i+1]}\""
13
+ end
6
14
  end
7
15
  end
@@ -32,7 +32,7 @@ module Nit
32
32
  def file_patterns
33
33
  {
34
34
  modified: /#\tmodified:(.+)/,
35
- new: /#\t([^modified:].+)/
35
+ new: /#\t((?!modified:).+)/
36
36
  }
37
37
  end
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module Nit
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "thor"
21
+ spec.add_dependency "thor", "~> 0.18.1"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "minitest", "~> 5.0"
25
+ spec.add_development_dependency "minitest", "5.2.0"
26
26
  end
@@ -36,7 +36,9 @@ class CommandsTest < MiniTest::Spec
36
36
  cmd.call(["b"], output).must_equal "git add ../lib/new.rb && git commit "
37
37
  end
38
38
 
39
- it { cmd.call(["-m", '"awesome work"', "b"], output).must_equal "git add ../lib/new.rb && git commit -m \"awesome work\"" }
39
+ # FIXME: this test is useless as -m didn't work in earlier versions of nit.
40
+ # "awesome work" is passed in as 'awesome work', without any additional quotes from thor.
41
+ it { cmd.call(["-m", "awesome work", "b"], output).must_equal "git add ../lib/new.rb && git commit -m \"awesome work\"" }
40
42
 
41
43
  # TODO: test nit commit -a
42
44
  end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -6,7 +6,8 @@ class LinesTest < StatusTest
6
6
  "staged.rb",
7
7
  "brandnew.rb",
8
8
  "new.rb",
9
- "../lib/new.rb"])
9
+ "../lib/new.rb",
10
+ "db/migrate/"])
10
11
  end
11
12
  end
12
13
 
@@ -19,11 +19,22 @@ class NitTest < MiniTest::Spec
19
19
 
20
20
  def nit(args)
21
21
  output = ""
22
+
23
+ Dir.chdir "test/dummies/" do
24
+ `rm -rf stage`
25
+ `mkdir stage`
26
+ `cp -R git stage/.git`
27
+ `cp files/* stage/`
28
+ end
29
+
22
30
  Dir.chdir "test/dummies/stage" do
23
- `cp -R git .git`
24
31
  output = `../../../bin/nit #{args}`
25
- `rm -rf .git`
26
32
  end
33
+
34
+ Dir.chdir "test/dummies/" do
35
+ `rm -rf stage`
36
+ end
37
+
27
38
  output
28
39
  end
29
40
  end
@@ -39,6 +50,20 @@ class ArbitraryGitCommandsTest < NitTest
39
50
  it { nit(" diff b").must_match "a\/staged.rb" }
40
51
 
41
52
  it { nit(" diff --raw b").must_equal ":100644 100644 e69de29... 0000000... M\tstaged.rb\n" }
53
+
54
+ # commit:
55
+ it "allows strings after -m" do # TODO: implement that for all commands?
56
+ output = nit(' co -m "fixing it" a')
57
+ output.must_match "] fixing it\n"
58
+ output.must_match "1 file changed" # TODO: check if correct file was commited.
59
+ end
60
+
61
+ # it "allows -m after file indices" do
62
+ # output = nit(' co ab -m add something 4 u')
63
+ # puts output
64
+ # output.must_match "] add #999\n"
65
+ # output.must_match "2 files changed" # TODO: check if correct file was commited.
66
+ # end
42
67
  end
43
68
 
44
69
  class NitWithCharIndexerTest < NitTest
@@ -18,6 +18,7 @@ class StatusTest < MiniTest::Spec
18
18
  console.must_match "modified: [1] staged.rb"
19
19
  console.must_match "[2] brandnew.rb"
20
20
  console.must_match "[3] new.rb"
21
+ console.must_match "[5] db/migrate/"
21
22
  end
22
23
  end
23
24
 
@@ -17,6 +17,7 @@ MiniTest::Spec.class_eval do
17
17
  #\tbrandnew.rb
18
18
  #\tnew.rb
19
19
  #\t../lib/new.rb
20
+ #\tdb/migrate/
20
21
  no changes added to commit (use "git add" and/or "git commit -a")
21
22
  EOF
22
23
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-15 00:00:00.000000000 Z
11
+ date: 2014-02-21 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'
19
+ version: 0.18.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.18.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
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
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '5.0'
61
+ version: 5.2.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '5.0'
68
+ version: 5.2.0
69
69
  description: Improving your Git workflow since 2013.
70
70
  email:
71
71
  - apotonick@gmail.com
@@ -74,7 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
77
+ - ".gitignore"
78
78
  - CHANGES.md
79
79
  - Gemfile
80
80
  - LICENSE.txt
@@ -99,34 +99,33 @@ files:
99
99
  - nit.gemspec
100
100
  - test/commands_test.rb
101
101
  - test/config_test.rb
102
- - test/dummies/stage/.gitignore
103
- - test/dummies/stage/brandnew.rb
104
- - test/dummies/stage/git/COMMIT_EDITMSG
105
- - test/dummies/stage/git/HEAD
106
- - test/dummies/stage/git/config
107
- - test/dummies/stage/git/description
108
- - test/dummies/stage/git/hooks/applypatch-msg.sample
109
- - test/dummies/stage/git/hooks/commit-msg.sample
110
- - test/dummies/stage/git/hooks/post-update.sample
111
- - test/dummies/stage/git/hooks/pre-applypatch.sample
112
- - test/dummies/stage/git/hooks/pre-commit.sample
113
- - test/dummies/stage/git/hooks/pre-rebase.sample
114
- - test/dummies/stage/git/hooks/prepare-commit-msg.sample
115
- - test/dummies/stage/git/hooks/update.sample
116
- - test/dummies/stage/git/index
117
- - test/dummies/stage/git/info/exclude
118
- - test/dummies/stage/git/logs/HEAD
119
- - test/dummies/stage/git/logs/refs/heads/master
120
- - test/dummies/stage/git/objects/0f/e4f83176db6842cd95f439f1edad3cb8483b4e
121
- - test/dummies/stage/git/objects/5c/0d92dd14afeb4c2bcd11bc3f072390be598a73
122
- - test/dummies/stage/git/objects/60/bd895ee4a908b754f1980491c0e0852c29a8cd
123
- - test/dummies/stage/git/objects/b7/5ac79d08245a3a8a662520dd90f80be097cc44
124
- - test/dummies/stage/git/objects/c1/172bf75d73a630c467f1e1448c44d9188fe23e
125
- - test/dummies/stage/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
126
- - test/dummies/stage/git/refs/heads/master
127
- - test/dummies/stage/new.rb
128
- - test/dummies/stage/on_stage.rb
129
- - test/dummies/stage/staged.rb
102
+ - test/dummies/files/brandnew.rb
103
+ - test/dummies/files/new.rb
104
+ - test/dummies/files/on_stage.rb
105
+ - test/dummies/files/staged.rb
106
+ - test/dummies/git/COMMIT_EDITMSG
107
+ - test/dummies/git/HEAD
108
+ - test/dummies/git/config
109
+ - test/dummies/git/description
110
+ - test/dummies/git/hooks/applypatch-msg.sample
111
+ - test/dummies/git/hooks/commit-msg.sample
112
+ - test/dummies/git/hooks/post-update.sample
113
+ - test/dummies/git/hooks/pre-applypatch.sample
114
+ - test/dummies/git/hooks/pre-commit.sample
115
+ - test/dummies/git/hooks/pre-rebase.sample
116
+ - test/dummies/git/hooks/prepare-commit-msg.sample
117
+ - test/dummies/git/hooks/update.sample
118
+ - test/dummies/git/index
119
+ - test/dummies/git/info/exclude
120
+ - test/dummies/git/logs/HEAD
121
+ - test/dummies/git/logs/refs/heads/master
122
+ - test/dummies/git/objects/0f/e4f83176db6842cd95f439f1edad3cb8483b4e
123
+ - test/dummies/git/objects/5c/0d92dd14afeb4c2bcd11bc3f072390be598a73
124
+ - test/dummies/git/objects/60/bd895ee4a908b754f1980491c0e0852c29a8cd
125
+ - test/dummies/git/objects/b7/5ac79d08245a3a8a662520dd90f80be097cc44
126
+ - test/dummies/git/objects/c1/172bf75d73a630c467f1e1448c44d9188fe23e
127
+ - test/dummies/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
128
+ - test/dummies/git/refs/heads/master
130
129
  - test/files_test.rb
131
130
  - test/ignore_test.rb
132
131
  - test/lines_test.rb
@@ -143,51 +142,50 @@ require_paths:
143
142
  - lib
144
143
  required_ruby_version: !ruby/object:Gem::Requirement
145
144
  requirements:
146
- - - '>='
145
+ - - ">="
147
146
  - !ruby/object:Gem::Version
148
147
  version: '0'
149
148
  required_rubygems_version: !ruby/object:Gem::Requirement
150
149
  requirements:
151
- - - '>='
150
+ - - ">="
152
151
  - !ruby/object:Gem::Version
153
152
  version: '0'
154
153
  requirements: []
155
154
  rubyforge_project:
156
- rubygems_version: 2.0.3
155
+ rubygems_version: 2.2.1
157
156
  signing_key:
158
157
  specification_version: 4
159
158
  summary: Nit improves your git workflows.
160
159
  test_files:
161
160
  - test/commands_test.rb
162
161
  - test/config_test.rb
163
- - test/dummies/stage/.gitignore
164
- - test/dummies/stage/brandnew.rb
165
- - test/dummies/stage/git/COMMIT_EDITMSG
166
- - test/dummies/stage/git/HEAD
167
- - test/dummies/stage/git/config
168
- - test/dummies/stage/git/description
169
- - test/dummies/stage/git/hooks/applypatch-msg.sample
170
- - test/dummies/stage/git/hooks/commit-msg.sample
171
- - test/dummies/stage/git/hooks/post-update.sample
172
- - test/dummies/stage/git/hooks/pre-applypatch.sample
173
- - test/dummies/stage/git/hooks/pre-commit.sample
174
- - test/dummies/stage/git/hooks/pre-rebase.sample
175
- - test/dummies/stage/git/hooks/prepare-commit-msg.sample
176
- - test/dummies/stage/git/hooks/update.sample
177
- - test/dummies/stage/git/index
178
- - test/dummies/stage/git/info/exclude
179
- - test/dummies/stage/git/logs/HEAD
180
- - test/dummies/stage/git/logs/refs/heads/master
181
- - test/dummies/stage/git/objects/0f/e4f83176db6842cd95f439f1edad3cb8483b4e
182
- - test/dummies/stage/git/objects/5c/0d92dd14afeb4c2bcd11bc3f072390be598a73
183
- - test/dummies/stage/git/objects/60/bd895ee4a908b754f1980491c0e0852c29a8cd
184
- - test/dummies/stage/git/objects/b7/5ac79d08245a3a8a662520dd90f80be097cc44
185
- - test/dummies/stage/git/objects/c1/172bf75d73a630c467f1e1448c44d9188fe23e
186
- - test/dummies/stage/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
187
- - test/dummies/stage/git/refs/heads/master
188
- - test/dummies/stage/new.rb
189
- - test/dummies/stage/on_stage.rb
190
- - test/dummies/stage/staged.rb
162
+ - test/dummies/files/brandnew.rb
163
+ - test/dummies/files/new.rb
164
+ - test/dummies/files/on_stage.rb
165
+ - test/dummies/files/staged.rb
166
+ - test/dummies/git/COMMIT_EDITMSG
167
+ - test/dummies/git/HEAD
168
+ - test/dummies/git/config
169
+ - test/dummies/git/description
170
+ - test/dummies/git/hooks/applypatch-msg.sample
171
+ - test/dummies/git/hooks/commit-msg.sample
172
+ - test/dummies/git/hooks/post-update.sample
173
+ - test/dummies/git/hooks/pre-applypatch.sample
174
+ - test/dummies/git/hooks/pre-commit.sample
175
+ - test/dummies/git/hooks/pre-rebase.sample
176
+ - test/dummies/git/hooks/prepare-commit-msg.sample
177
+ - test/dummies/git/hooks/update.sample
178
+ - test/dummies/git/index
179
+ - test/dummies/git/info/exclude
180
+ - test/dummies/git/logs/HEAD
181
+ - test/dummies/git/logs/refs/heads/master
182
+ - test/dummies/git/objects/0f/e4f83176db6842cd95f439f1edad3cb8483b4e
183
+ - test/dummies/git/objects/5c/0d92dd14afeb4c2bcd11bc3f072390be598a73
184
+ - test/dummies/git/objects/60/bd895ee4a908b754f1980491c0e0852c29a8cd
185
+ - test/dummies/git/objects/b7/5ac79d08245a3a8a662520dd90f80be097cc44
186
+ - test/dummies/git/objects/c1/172bf75d73a630c467f1e1448c44d9188fe23e
187
+ - test/dummies/git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
188
+ - test/dummies/git/refs/heads/master
191
189
  - test/files_test.rb
192
190
  - test/ignore_test.rb
193
191
  - test/lines_test.rb
@@ -1 +0,0 @@
1
- .nit