git-crecord 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/git_crecord/diff/line.rb +35 -1
- data/lib/git_crecord/diff.rb +14 -4
- data/lib/git_crecord/quit_action.rb +1 -1
- data/lib/git_crecord/ui/help_window.rb +2 -2
- data/lib/git_crecord/version.rb +1 -1
- data/lib/git_crecord.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f50b11b78c296e17be381bfcd4bcd6f0c353debf
|
4
|
+
data.tar.gz: 63b91fcd44796f4ca85dae4cdabf05ddd8c2d4d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53df5470936c02756917e03606bc3c36c661b5387761392422943252e68216005ca50ecf00323fb9f9f2c83376d40c6d19172e8d098f80764149ea867c9cc804
|
7
|
+
data.tar.gz: 3a31aa6f040cd3f3c9c955305fb3b5e6d38f24275812fd3cd30730496a93cf560bba27c084a1514f74a067bb9bbdd63ade1ff1e5b1020d9c4449567f1ca61ad4
|
data/README.md
CHANGED
@@ -3,6 +3,40 @@ require_relative '../ui/color'
|
|
3
3
|
|
4
4
|
module GitCrecord
|
5
5
|
module Diff
|
6
|
+
class PseudoLine < Difference
|
7
|
+
attr_accessor :selected
|
8
|
+
|
9
|
+
def initialize(line)
|
10
|
+
@line = line || 'file is empty'
|
11
|
+
@selected = false
|
12
|
+
super()
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
@line
|
17
|
+
end
|
18
|
+
|
19
|
+
def x_offset
|
20
|
+
6
|
21
|
+
end
|
22
|
+
|
23
|
+
def selectable?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def expanded
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_diff
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def style(is_highlighted)
|
36
|
+
Curses::A_BOLD | (is_highlighted ? UI::Color.hl : UI::Color.normal)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
6
40
|
class Line < Difference
|
7
41
|
attr_reader :selected
|
8
42
|
|
@@ -13,7 +47,7 @@ module GitCrecord
|
|
13
47
|
end
|
14
48
|
|
15
49
|
def to_s
|
16
|
-
@to_s ||= @line.
|
50
|
+
@to_s ||= @line.gsub(/\t/, Git.tab)
|
17
51
|
end
|
18
52
|
|
19
53
|
def x_offset
|
data/lib/git_crecord/diff.rb
CHANGED
@@ -42,11 +42,11 @@ module GitCrecord
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.untracked_file(filename)
|
45
|
-
file_lines = ::File.readlines(filename)
|
46
|
-
return nil if file_lines.empty?
|
47
45
|
File.new(filename, filename, type: :untracked).tap do |file|
|
48
|
-
|
49
|
-
|
46
|
+
lines, err = file_lines(filename)
|
47
|
+
file << "@@ -0,0 +1,#{lines.size} @@"
|
48
|
+
file.subs[0].subs << PseudoLine.new(err) if lines.empty?
|
49
|
+
lines.each{ |line| file.add_hunk_line("+#{line.chomp}") }
|
50
50
|
file.selected = false
|
51
51
|
end
|
52
52
|
end
|
@@ -56,5 +56,15 @@ module GitCrecord
|
|
56
56
|
untracked_file(filename) unless ::File.directory?(filename)
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
def self.file_encoding(filename)
|
61
|
+
`file --mime-encoding #{filename}`.split(': ', 2)[1].chomp
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.file_lines(filename)
|
65
|
+
encoding = file_encoding(filename)
|
66
|
+
return [[], 'binary'] if encoding == 'binary'
|
67
|
+
[::File.open(filename, "r:#{encoding}", &:readlines), nil]
|
68
|
+
end
|
59
69
|
end
|
60
70
|
end
|
data/lib/git_crecord/version.rb
CHANGED
data/lib/git_crecord.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require_relative 'git_crecord/git'
|
2
1
|
require_relative 'git_crecord/diff'
|
2
|
+
require_relative 'git_crecord/git'
|
3
3
|
require_relative 'git_crecord/ui'
|
4
|
-
require_relative 'git_crecord/version'
|
5
4
|
require_relative 'git_crecord/ui/help_window'
|
5
|
+
require_relative 'git_crecord/version'
|
6
6
|
|
7
7
|
module GitCrecord
|
8
8
|
def self.main(argv)
|
@@ -32,13 +32,13 @@ module GitCrecord
|
|
32
32
|
|
33
33
|
def self.help
|
34
34
|
puts <<EOS
|
35
|
-
usage: git crecord [<options>]
|
35
|
+
usage: git crecord [<options>]
|
36
36
|
|
37
37
|
--no-untracked-files -- ignore untracked files
|
38
|
-
--version -- show version information
|
39
|
-
-h -- this help message
|
38
|
+
--version -- show version information
|
39
|
+
-h -- this help message
|
40
40
|
|
41
|
-
in-program commands:
|
41
|
+
in-program commands:
|
42
42
|
#{UI::HelpWindow::CONTENT.gsub(/^/, ' ')}
|
43
43
|
EOS
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-crecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maik Brendler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|