dumb_down_viewer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 168cf3ff44970f98481dbfa56a9bad5ad019c67b
4
- data.tar.gz: 75373160ed335cf58bea04caab40f91d3f36d79b
3
+ metadata.gz: bd7eace0d8800abaab20ba3e1164b0b8d4daed9f
4
+ data.tar.gz: da3eb4bc5fbc02efe68c72e7e6f19df3828ad85b
5
5
  SHA512:
6
- metadata.gz: 5fa0f8ba7af6c70b32e10f99d8ec48cf287058b1efde59d2cf4c9742c3513d7cbcaa376275518023e613e01d290715e22b325ffe7f16a53fa4a4a35eacd16d42
7
- data.tar.gz: 86a23ddc37f8de3b5dea366aa495b18b3257987d24571aceb60fc2377396b4aa766b6462363f4e9cd819efc54773fb2d78eb30877f6f67f983190a015aa9997a
6
+ metadata.gz: 86c63e2182329a549dd09b57bcd5f8e777b93bdbb8b8501c99b6c7731a39ac9751d8546004193ae062ed8146a540b8458b10093885dc140e8c189ac0273b6735
7
+ data.tar.gz: 13c5a5f35464ca254670644e14824f0041f6684aef2f7bf54d1d151a4e10bdee2225fe70617c70761d48b10fd8c310022fbfde13b516df16a9a7427fa929e087
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.1
4
5
  - 2.2.4
5
6
  before_install: gem install bundler -v 1.13.2
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
4
4
 
5
- In some case, you can use ddv like "[tree](http://mama.indstate.edu/users/ice/tree/)" command, even though these commands are not compatible:
5
+ In some cases, you can use ddv like "[tree](http://mama.indstate.edu/users/ice/tree/)" command, even though these commands are not compatible:
6
6
 
7
- Several options of "tree" are missing in ddv, but there are also some options that are available only in ddv (such as --copy-to).
7
+ Several options of "tree" are missing in ddv. On the other hand, there are some options that are available only in ddv (such as --copy-to).
8
8
 
9
9
  ## Installation
10
10
 
@@ -47,7 +47,7 @@ Suppose you have a directory `spec/data`
47
47
  spec/data/aves/cannot_fly/ostrich.jpg
48
48
 
49
49
 
50
- Then type at the command line (or replace `spec/data` with a directory name which is on your system):
50
+ Then type the following at the command line (you may replace `spec/data` with a directory name which is on your system):
51
51
 
52
52
  $ ddv spec/data
53
53
 
@@ -79,7 +79,7 @@ The following is the list of available options:
79
79
  |Short |Long |Description |
80
80
  |------|-----|------------|
81
81
  |-s [style_name] |--style [=style_name] |Choose the style of output other than default from ascii_art, list, zenkaku or tree |
82
- |-f [format_name] |--format [=format_name] |Choose the output format other than default from csv, tsv or tree_csv |
82
+ |-f [format_name] |--format [=format_name] |Choose the output format other than default from csv, tsv, tree_csv, json or xml |
83
83
  |-d |--directories-only |List directories only |
84
84
  |-L [level] |- |Descend only level directories deep |
85
85
  |-P [pattern] |- |List only those files that match the given pattern |
@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.}
13
13
  spec.description = <<-DESCRIPTION
14
14
  DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
15
- In some case, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
15
+ In some cases, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
16
16
  even though these commands are not compatible: Several options of "tree" are missing in ddv,
17
- but there are also some options that are available only in ddv (such as --copy-to).
17
+ but there are some options that are available only in ddv (such as --copy-to) too.
18
18
  DESCRIPTION
19
19
  spec.homepage = "https://github.com/nico-hn/DumbDownViewer"
20
20
  spec.license = "MIT"
@@ -4,6 +4,12 @@ require 'find'
4
4
  require 'nokogiri'
5
5
 
6
6
  module DumbDownViewer
7
+ class << self
8
+ attr_reader :filesystem_encoding
9
+ end
10
+
11
+ @filesystem_encoding = Encoding.find('locale')
12
+
7
13
  def self.collect_directories_and_files(path)
8
14
  entries = Dir.entries(path) - ['.', '..']
9
15
  entries.partition do |entry|
@@ -23,7 +29,7 @@ module DumbDownViewer
23
29
 
24
30
  def initialize(pwd, name, depth)
25
31
  @directory = pwd
26
- @name = name
32
+ @name = name.encode(Encoding::UTF_8)
27
33
  @depth = depth
28
34
  @name_with_path = pwd.empty? ? @name : File.join(pwd, name)
29
35
  setup
@@ -66,6 +72,7 @@ module DumbDownViewer
66
72
 
67
73
  def entry_nodes(nodes, node_class, depth)
68
74
  nodes.map {|node| node_class.new(@name_with_path, node, depth) }
75
+ .sort_by {|node| node.name }
69
76
  end
70
77
  end
71
78
 
@@ -20,7 +20,7 @@ style:
20
20
  format:
21
21
  short: "-f [format_name]"
22
22
  long: "--format [=format_name]"
23
- description: Choose the output format other than default from csv, tsv, tree_csv
23
+ description: Choose the output format other than default from csv, tsv, tree_csv, json or xml
24
24
  directories:
25
25
  short: "-d"
26
26
  long: "--directories-only"
@@ -93,7 +93,7 @@ YAML
93
93
 
94
94
  def self.execute
95
95
  options = parse_command_line_options
96
- tree = DumbDownViewer.build_node_tree(ARGV[0])
96
+ tree = DumbDownViewer.build_node_tree(ARGV[0] || '.')
97
97
  prune_dot_files(tree) unless options[:show_all]
98
98
  prune_dirs_with_more_than(tree, options[:file_limit]) if options[:file_limit]
99
99
  prune_level(tree, options[:level]) if options[:level]
@@ -166,9 +166,9 @@ YAML
166
166
  def self.format_tree(tree, options)
167
167
  if options[:file_limit] and tree.sub_nodes.empty?
168
168
  ''
169
- elsif options[:json]
169
+ elsif options[:json] or options[:format] == :json
170
170
  format_json(tree, options)
171
- elsif options[:xml]
171
+ elsif options[:xml] or options[:format] == :xml
172
172
  format_xml(tree, options)
173
173
  else
174
174
  format_tree_with_builder(tree, options)
@@ -1,3 +1,3 @@
1
1
  module DumbDownViewer
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumb_down_viewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - HASHIMOTO, Naoki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-17 00:00:00.000000000 Z
11
+ date: 2017-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -82,9 +82,9 @@ dependencies:
82
82
  version: '3.0'
83
83
  description: |
84
84
  DumbDownViewer (ddv) is a recursive directory listing command with limited functionality.
85
- In some case, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
85
+ In some cases, you can use ddv like "tree" command (http://mama.indstate.edu/users/ice/tree/),
86
86
  even though these commands are not compatible: Several options of "tree" are missing in ddv,
87
- but there are also some options that are available only in ddv (such as --copy-to).
87
+ but there are some options that are available only in ddv (such as --copy-to) too.
88
88
  email:
89
89
  - hashimoto.naoki@gmail.com
90
90
  executables: