colorls 1.3.4.pre.660 → 1.3.4.pre.670

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
2
  SHA256:
3
- metadata.gz: 5a6690688c4362a266953238b6bf231438a23f55192f5cfd1cc53c0305342893
4
- data.tar.gz: 4c2f0bbf5e38a210b353e0b12b69f59750898dbba907799bfe9f24c3ce8722d1
3
+ metadata.gz: f249b8fa5de108d3c989ab6790dd0eeb0f0606a6d48f8837c4a27aad786e2502
4
+ data.tar.gz: d60bc4c540b32113f6f30d48e19d2fc2c5517061ec8767390d5929c68c99bc96
5
5
  SHA512:
6
- metadata.gz: 415f22cb137bab6044e70743ad5637505dda28d80d00226f554258d37b5138975fbade4d46ebe2b416d8e280339b42d28a477096bc0f165e72731feb293fa2df
7
- data.tar.gz: 6bbdd3fa18e6fc396c95b03335dae515ea023e220854c32603fbfc77a05fa8e8e1d7e743ff8881494f4500e10ae8c55fcb3f8d96a959b0c94c20d69b4f76d4bc
6
+ metadata.gz: 44a0a3ba40c74096526b25283a9eb745d074daefaf7f5d3f00a476596f7e62c0cc98f8f41c0e16c04bd72e03609543e76bfdca1d855876e3b83d6be6e4aee1e3
7
+ data.tar.gz: cef18047297eecf989f9dee0f3583d1216759fe2c8bd0bd4ae7b1670c62407537b5361a28655a91e1f324f458eb0a5e3bd9da513477eef41e047319d18d0182b
data/.travis.yml CHANGED
@@ -56,6 +56,8 @@ script:
56
56
  - colorls --color=always
57
57
  - colorls --tree
58
58
  - colorls --tree=1
59
+ - LC_ALL=C colorls spec/fixtures/
60
+ - LC_ALL=C colorls --git spec/fixtures/
59
61
 
60
62
  deploy:
61
63
  provider: rubygems
data/colorls.gemspec CHANGED
@@ -47,7 +47,9 @@ Gem::Specification.new do |spec|
47
47
 
48
48
  spec.required_ruby_version = '>= 2.4.0'
49
49
 
50
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
50
+ spec.files = IO.popen(
51
+ %w[git ls-files -z], external_encoding: Encoding::ASCII_8BIT
52
+ ).read.split("\x0").reject do |f|
51
53
  f.match(%r{^(test|spec|features)/})
52
54
  end
53
55
 
data/lib/colorls/core.rb CHANGED
@@ -72,14 +72,14 @@ module ColorLS
72
72
  CHARS_PER_ITEM = 12
73
73
 
74
74
  def item_widths
75
- @contents.map { |item| item.name.size + CHARS_PER_ITEM }
75
+ @contents.map { |item| item.show.size + CHARS_PER_ITEM }
76
76
  end
77
77
 
78
78
  def init_contents(path)
79
79
  info = FileInfo.new(path, link_info = @long)
80
80
 
81
81
  if info.directory?
82
- @contents = Dir.entries(path)
82
+ @contents = Dir.entries(path, encoding: Encoding::ASCII_8BIT)
83
83
 
84
84
  filter_hidden_contents
85
85
 
@@ -239,7 +239,11 @@ module ColorLS
239
239
  end
240
240
 
241
241
  def git_file_info(path)
242
- return ' ✓ '.colorize(@colors[:unchanged]) unless @git_status[path]
242
+ unless @git_status[path]
243
+ return ' ✓ '
244
+ .encode(Encoding.default_external, undef: :replace, replace: '=')
245
+ .colorize(@colors[:unchanged])
246
+ end
243
247
 
244
248
  Git.colored_status_symbols(@git_status[path], @colors)
245
249
  end
@@ -283,10 +287,10 @@ module ColorLS
283
287
  @count[increment] += 1
284
288
  value = increment == :folders ? @folders[key] : @files[key]
285
289
  logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }
286
- name = content.name
290
+ name = content.show
287
291
  name = make_link(path, name) if @hyperlink
288
292
  name += content.directory? ? '/' : ' '
289
- entry = logo + ' ' + name
293
+ entry = logo.encode(Encoding.default_external, undef: :replace, replace: '') + ' ' + name
290
294
 
291
295
  "#{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
292
296
  end
@@ -295,9 +299,10 @@ module ColorLS
295
299
  padding = 0
296
300
  line = +''
297
301
  chunk.each_with_index do |content, i|
302
+ entry = fetch_string(@input, content, *options(content))
298
303
  line << ' ' * padding
299
- line << ' ' << fetch_string(@input, content, *options(content))
300
- padding = widths[i] - content.name.length - CHARS_PER_ITEM
304
+ line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
305
+ padding = widths[i] - content.show.length - CHARS_PER_ITEM
301
306
  end
302
307
  print line << "\n"
303
308
  end
@@ -16,6 +16,8 @@ module ColorLS
16
16
  @name = File.basename(path)
17
17
  @stats = File.lstat(path)
18
18
 
19
+ @show_name = nil
20
+
19
21
  handle_symlink(path) if link_info && @stats.symlink?
20
22
  end
21
23
 
@@ -23,6 +25,13 @@ module ColorLS
23
25
  FileInfo.new(path)
24
26
  end
25
27
 
28
+ def show
29
+ return @show_name unless @show_name.nil?
30
+
31
+ @show_name = @name.encode(Encoding.find('filesystem'), Encoding.default_external,
32
+ invalid: :replace, undef: :replace)
33
+ end
34
+
26
35
  def dead?
27
36
  @dead
28
37
  end
data/lib/colorls/git.rb CHANGED
@@ -31,7 +31,11 @@ module ColorLS
31
31
  end
32
32
 
33
33
  def self.colored_status_symbols(modes, colors)
34
- return ' ✓ '.colorize(colors[:unchanged]) if modes.empty?
34
+ if modes.empty?
35
+ return ' ✓ '
36
+ .encode(Encoding.default_external, undef: :replace, replace: '=')
37
+ .colorize(colors[:unchanged])
38
+ end
35
39
 
36
40
  modes = modes.to_a.join.uniq.rjust(3).ljust(4)
37
41
 
@@ -51,7 +55,10 @@ module ColorLS
51
55
  end
52
56
 
53
57
  def git_subdir_status(repo_path)
54
- yield IO.popen(['git', '-C', repo_path, 'status', '--porcelain', '-z', '-unormal', '--ignored', '.'])
58
+ yield IO.popen(
59
+ ['git', '-C', repo_path, 'status', '--porcelain', '-z', '-unormal', '--ignored', '.'],
60
+ external_encoding: Encoding::ASCII_8BIT
61
+ )
55
62
  end
56
63
  end
57
64
  end
data/lib/colorls/yaml.rb CHANGED
@@ -20,7 +20,7 @@ module ColorLS
20
20
  end
21
21
 
22
22
  def read_file(filepath)
23
- ::YAML.safe_load(File.read(filepath)).symbolize_keys
23
+ ::YAML.safe_load(File.read(filepath, encoding: Encoding::UTF_8)).symbolize_keys
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4.pre.660
4
+ version: 1.3.4.pre.670
5
5
  platform: ruby
6
6
  authors:
7
7
  - Athitya Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clocale