vim_printer 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +8 -6
- data/lib/vim_printer/cli.rb +16 -45
- data/lib/vim_printer/version.rb +1 -1
- data/vim_printer.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e112f2fc25ae31c97cc8df1dc09168fa5934bd5
|
4
|
+
data.tar.gz: fb5772428a7b8868cf0ce7adce87c4c1107a3496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e8cdd0bfa89eba6960496219de7831f0c3bab4b418e3e6cbee24f631b40e255a35ae98766cba5f949cfba38c0655fbcdd700e299638ffac3874d84d915f05a0
|
7
|
+
data.tar.gz: bbb3ad595c2b44e1ed902c008450a9d707293fe9a7d06b0fe6271eaf96dd061ebc9ac924eb55649dd71a76b1f34d3f18263cb948a00c394d9538145858abc0e7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -134,9 +134,9 @@ Usage:
|
|
134
134
|
vim_printer
|
135
135
|
|
136
136
|
Options:
|
137
|
-
-b, [--base-dir=BASE_DIR] # Base directory
|
137
|
+
-b, [--base-dir=BASE_DIR] # Base directory
|
138
138
|
# Default: . (current directory)
|
139
|
-
-e, [--exts=one two three] # List of extension to search for
|
139
|
+
-e, [--exts=one two three] # List of extension to search for
|
140
140
|
# e.g. -e rb md
|
141
141
|
-f, [--non-exts=one two three] # List of file without extension to be included in the result (optional)
|
142
142
|
# e.g. -f Gemfile LICENSE
|
@@ -151,16 +151,18 @@ Options:
|
|
151
151
|
-r, [--recursive], [--no-recursive] # Search for files recursively (optional)
|
152
152
|
# Default: --recursive
|
153
153
|
-v, [--version] # Display version information
|
154
|
+
#
|
154
155
|
-t, [--theme=THEME] # Vim colorscheme to use (optional)
|
155
156
|
# Default: 'default'
|
156
157
|
-c, [--index], [--no-index] # Generate the index.html file for the result (optional)
|
157
158
|
# Default: --index
|
158
|
-
-s, [--
|
159
|
-
# Note: the command must
|
159
|
+
-s, [--command] # Use the input file list from the result of the given shell command
|
160
|
+
# Note: the command must return the list of file to be valid
|
160
161
|
# This option ignore any of the following options -e, -f, -n, -x, -i if specified
|
161
|
-
# e.g. --
|
162
|
-
# e.g. --
|
162
|
+
# e.g. --command 'git diff --name-only HEAD~2 | grep -v test'
|
163
|
+
# e.g. --command 'find . -type f -iname "*.rb" | grep -v test | grep -v _spec'
|
163
164
|
Print files to (x)html using Vim
|
165
|
+
|
164
166
|
```
|
165
167
|
|
166
168
|
### Customization for output options
|
data/lib/vim_printer/cli.rb
CHANGED
@@ -26,10 +26,9 @@ module VimPrinter
|
|
26
26
|
desc: "Generate the index.html file for the result",
|
27
27
|
type: :boolean,
|
28
28
|
default: true
|
29
|
-
method_option :
|
29
|
+
method_option :command,
|
30
30
|
aliases: "-s",
|
31
|
-
desc: "Use input file list from the result of the given shell command"
|
32
|
-
type: :string
|
31
|
+
desc: "Use input file list from the result of the given shell command"
|
33
32
|
def print
|
34
33
|
opts = options.symbolize_keys
|
35
34
|
if opts[:version]
|
@@ -46,9 +45,9 @@ Usage:
|
|
46
45
|
vim_printer
|
47
46
|
|
48
47
|
Options:
|
49
|
-
-b, [--base-dir=BASE_DIR] # Base directory
|
48
|
+
-b, [--base-dir=BASE_DIR] # Base directory
|
50
49
|
# Default: . (current directory)
|
51
|
-
-e, [--exts=one two three] # List of extension to search for
|
50
|
+
-e, [--exts=one two three] # List of extension to search for
|
52
51
|
# e.g. -e rb md
|
53
52
|
-f, [--non-exts=one two three] # List of file without extension to be included in the result (optional)
|
54
53
|
# e.g. -f Gemfile LICENSE
|
@@ -63,15 +62,16 @@ Options:
|
|
63
62
|
-r, [--recursive], [--no-recursive] # Search for files recursively (optional)
|
64
63
|
# Default: --recursive
|
65
64
|
-v, [--version] # Display version information
|
65
|
+
#
|
66
66
|
-t, [--theme=THEME] # Vim colorscheme to use (optional)
|
67
67
|
# Default: 'default'
|
68
68
|
-c, [--index], [--no-index] # Generate the index.html file for the result (optional)
|
69
69
|
# Default: --index
|
70
|
-
-s, [--
|
71
|
-
# Note: the command must
|
70
|
+
-s, [--command] # Use the input file list from the result of the given shell command
|
71
|
+
# Note: the command must return the list of file to be valid
|
72
72
|
# This option ignore any of the following options -e, -f, -n, -x, -i if specified
|
73
|
-
# e.g. --
|
74
|
-
# e.g. --
|
73
|
+
# e.g. --command 'git diff --name-only HEAD~2 | grep -v test'
|
74
|
+
# e.g. --command 'find . -type f -iname "*.rb" | grep -v test | grep -v _spec'
|
75
75
|
Print files to (x)html using Vim
|
76
76
|
EOS
|
77
77
|
end
|
@@ -81,49 +81,20 @@ Print files to (x)html using Vim
|
|
81
81
|
|
82
82
|
private
|
83
83
|
|
84
|
-
# Get the
|
84
|
+
# Get the list of input file
|
85
85
|
#
|
86
86
|
# @param [Hash<Symbol, Object>] args the input options
|
87
|
-
# @option args [String] :
|
87
|
+
# @option args [String] :command the shell command to be used to get list of files
|
88
88
|
# @return [Array<String>] list of files in the format
|
89
|
-
#
|
90
|
-
# ["./Gemfile", "./lib/vim_printer/cli.rb", ..]
|
89
|
+
# ["./Gemfile", "./lib/vim_printer/cli.rb", ..]
|
91
90
|
def get_input_files(args = {})
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
command = args.fetch(:command, nil)
|
92
|
+
base_dir = args[:base_dir]
|
93
|
+
if command.nil?
|
95
94
|
CodeLister.files(args)
|
96
95
|
else
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
# Execute the command in the shell and return the output list for use
|
102
|
-
# e.g. `git diff --name-only HEAD~1` is getting the list of files that have been
|
103
|
-
# updated in the last commit
|
104
|
-
#
|
105
|
-
# @param [String] shell_input the input command to be executed in the shell
|
106
|
-
# @param [String] base_dir the starting directory
|
107
|
-
# @return [Array<String>] file list or empty list if the shell command is not valid
|
108
|
-
def files_from_shell_command(command, base_dir)
|
109
|
-
files = AgileUtils::Helper.shell(command.split(" ")).split(/\n/)
|
110
|
-
# Adapt the result and make sure that it start with "./"
|
111
|
-
# like the result from 'CodeLister.files()' method
|
112
|
-
files.map! do |file|
|
113
|
-
if file =~ /^\.\//
|
114
|
-
# skip if the file start with './' string
|
115
|
-
file
|
116
|
-
else
|
117
|
-
# add './' to the one that does not already have one
|
118
|
-
"./#{file}"
|
119
|
-
end
|
96
|
+
CodeLister.files_from_command(command, base_dir)
|
120
97
|
end
|
121
|
-
# Note: this make sure that it work with deleted file when use
|
122
|
-
# this with 'git diff --name-only HEAD~2'
|
123
|
-
files.delete_if { |file| !File.exist?(file.gsub(/^\./, base_dir)) }
|
124
|
-
rescue RuntimeError => e
|
125
|
-
# just return the empty list, if the user specified invalid command for 'shell_input' option
|
126
|
-
return []
|
127
98
|
end
|
128
99
|
|
129
100
|
# Main entry point to export the code
|
data/lib/vim_printer/version.rb
CHANGED
data/vim_printer.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.test_files = Dir.glob("{test}/**/*")
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
spec.add_runtime_dependency "thor", "~> 0.19"
|
27
|
-
spec.add_runtime_dependency "code_lister", "~> 0.1"
|
27
|
+
spec.add_runtime_dependency "code_lister", "~> 0.1.3"
|
28
28
|
spec.add_runtime_dependency "index_html", "~> 0.1"
|
29
29
|
spec.add_runtime_dependency "agile_utils", "~> 0.1"
|
30
30
|
spec.add_development_dependency "bundler", "~> 1.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vim_printer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.1.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.1.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: index_html
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|