vim_printer 0.1.7 → 0.1.8

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: 5566edff0f15c84bb060c3a67ebb43c9a1f82493
4
- data.tar.gz: 25d4de42648eeeb45ee1a3172053b661857d973c
3
+ metadata.gz: cf94e1504753731437a2895e6a335a7df773c1fb
4
+ data.tar.gz: 3573098d508d822a609f978e6f9596c1e1fc8bc6
5
5
  SHA512:
6
- metadata.gz: 528cfb4898ae23c698d738d004ba260ef7e77cbb3109387d7b737ac243ef681865310e2f2a725dfbdffbd71f1a7a5d289dd71979bb91f368896206046b02ecc8
7
- data.tar.gz: cc553f646c27ab209ec96f41c7993c3aa83308d7f697b05f188a552524e101f6737306b599cb8ebcac94d3dabae737107cf4daf36346d2838520ab0ba18c3d95
6
+ metadata.gz: 7c092273c740770e119028ad783c4a0eaed523fd167ccf3bd73c67c02b03cf22c63f398b5ef9dd1170a29f4fc61a5be3d11ae92481db7d3e3615634897d1925c
7
+ data.tar.gz: b1295ce482b28db558fab1ab11340b6b3c5c8d56d8e1500c2309b8cef8504718c57ffa5efdc234568ab2bff5874f3c01b9f5a440065261e7d01f3b52e69ec435
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ### Changelog
2
2
 
3
+ #### 0.1.8
4
+
5
+ - Add `configuration.rb` for easy customization of options to `:TOhtml` [New]
6
+ - Update default usage in `cli.rb` and `README.md` [Improvement]
7
+ - Suppress line number in the result by default [Improvement]
8
+
3
9
  #### 0.1.7
4
10
 
5
11
  - Handle the edge case for File.binary?
data/README.md CHANGED
@@ -134,25 +134,53 @@ 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 (mandatory)
138
138
  # Default: . (current directory)
139
- -e, [--exts=one two three] # List of extensions to search for
140
- -f, [--non-exts=one two three] # List of files without extension to search for
141
- -n, [--inc-words=one two three] # List of words in the filename to be included in the result if any
142
- -x, [--exc-words=one two three] # List of words in the filename to be excluded from the result if any
143
- -i, [--ignore-case], [--no-ignore-case] # Match case insensitively
144
- # Default: true
145
- -r, [--recursive], [--no-recursive] # Search for files recursively
146
- # Default: true
147
- -v, [--version], [--no-version] # Display version information
148
- -t, [--theme=THEME] # Vim colorscheme to use
139
+ -e, [--exts=one two three] # List of extension to search for (mandatory)
140
+ # e.g. -e rb md
141
+ -f, [--non-exts=one two three] # List of file without extension to be included in the result (optional)
142
+ # e.g. -f Gemfile LICENSE
143
+ -n, [--inc-words=one two three] # List of word that must be part of the name to be included in the result (optional)
144
+ # If this option is not specified then
145
+ # all files having the extension specified by -e or all file specified by -f will be included
146
+ -x, [--exc-words=one two three] # List of words to be excluded from the result if any (optional)
147
+ # Use this option to filter out files that contain some word in the name
148
+ # e.g. -x '_spec' to exclude files that end with '*_spec.rb' in the name
149
+ -i, [--ignore-case], [--no-ignore-case] # Match case insensitively apply to both -f, n, and -x options (optional)
150
+ # Default: --ignore-case
151
+ -r, [--recursive], [--no-recursive] # Search for files recursively (optional)
152
+ # Default: --recursive
153
+ -v, [--version] # Display version information
154
+ -t, [--theme=THEME] # Vim colorscheme to use (optional)
149
155
  # Default: 'default'
150
- -c, [--index], [--no-index] # Generate the index.html file for the result
151
- # Default: true
156
+ -c, [--index], [--no-index] # Generate the index.html file for the result (optional)
157
+ # Default: --index
152
158
 
153
159
  Print files to (x)html using Vim
154
160
  ```
155
161
 
162
+ ### Customization for output options
163
+
164
+ You can customize how the output is produced by using the following configuration.
165
+
166
+ Edit the file `config/initializers/vim_printer.rb` to adjust the options used by
167
+ `:TOhtml` in Vim. (see `:help :TOhtml` from inside Vim for more detail)
168
+
169
+ The default settings for the `:TOhtml` are as follow
170
+
171
+ ```ruby
172
+ [
173
+ "-c 'let g:html_expand_tabs = 1'",
174
+ "-c 'let g:html_use_css = 1'",
175
+ "-c 'let g:html_no_progress = 1'",
176
+ "-c 'let g:html_number_lines = 1'"
177
+ ]
178
+ ```
179
+
180
+ For example, if you like to suppress the line number in the output you will
181
+ need to use `"-c 'let g:html_number_lines = 0'"` which will suppress the
182
+ setting of `:set number` in Vim.
183
+
156
184
  ### Development/Testing
157
185
 
158
186
  ```sh
data/bin/vim_printer CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative "../lib/vim_printer"
3
- include VimPrinter
3
+ require_relative "../config/initializers/vim_printer"
4
+ VimPrinter.update_config
4
5
  if ARGV.empty?
5
6
  VimPrinter::CLI.start(%w[usage])
6
7
  else
@@ -0,0 +1,15 @@
1
+ require_relative "../../lib/vim_printer/configuration"
2
+ module VimPrinter
3
+ class << self
4
+ def update_config
5
+ VimPrinter.configure do |config|
6
+ config.options[:html] = [
7
+ "-c 'let g:html_expand_tabs = 1'",
8
+ "-c 'let g:html_use_css = 1'",
9
+ "-c 'let g:html_no_progress = 1'",
10
+ "-c 'let g:html_number_lines = 0'"
11
+ ]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -3,6 +3,7 @@ require "code_lister"
3
3
  require "index_html"
4
4
  require "fileutils"
5
5
  require_relative "../vim_printer"
6
+ require_relative "configuration"
6
7
  module VimPrinter
7
8
  include AgileUtils
8
9
  class CLI < Thor
@@ -41,21 +42,27 @@ Usage:
41
42
  vim_printer
42
43
 
43
44
  Options:
44
- -b, [--base-dir=BASE_DIR] # Base directory
45
+ -b, [--base-dir=BASE_DIR] # Base directory (mandatory)
45
46
  # Default: . (current directory)
46
- -e, [--exts=one two three] # List of extensions to search for
47
- -f, [--non-exts=one two three] # List of files without extension to search for
48
- -n, [--inc-words=one two three] # List of words to be included in the result if any
49
- -x, [--exc-words=one two three] # List of words to be excluded from the result if any
50
- -i, [--ignore-case], [--no-ignore-case] # Match case insensitively
51
- # Default: true
52
- -r, [--recursive], [--no-recursive] # Search for files recursively
53
- # Default: true
54
- -v, [--version], [--no-version] # Display version information
55
- -t, [--theme=THEME] # Vim colorscheme to use
56
- # Default: default
57
- -c, [--index], [--no-index] # Generate the index.html file for the result
58
- # Default: true
47
+ -e, [--exts=one two three] # List of extension to search for (mandatory)
48
+ # e.g. -e rb md
49
+ -f, [--non-exts=one two three] # List of file without extension to be included in the result (optional)
50
+ # e.g. -f Gemfile LICENSE
51
+ -n, [--inc-words=one two three] # List of word that must be part of the name to be included in the result (optional)
52
+ # If this option is not specified then
53
+ # all files having the extension specified by -e or all file specified by -f will be included
54
+ -x, [--exc-words=one two three] # List of words to be excluded from the result if any (optional)
55
+ # Use this option to filter out files that contain some word in the name
56
+ # e.g. -x '_spec' to exclude files that end with '*_spec.rb' in the name
57
+ -i, [--ignore-case], [--no-ignore-case] # Match case insensitively apply to both -f, n, and -x options (optional)
58
+ # Default: --ignore-case
59
+ -r, [--recursive], [--no-recursive] # Search for files recursively (optional)
60
+ # Default: --recursive
61
+ -v, [--version] # Display version information
62
+ -t, [--theme=THEME] # Vim colorscheme to use (optional)
63
+ # Default: 'default'
64
+ -c, [--index], [--no-index] # Generate the index.html file for the result (optional)
65
+ # Default: --index
59
66
 
60
67
  Print files to (x)html using Vim
61
68
  EOS
@@ -106,14 +113,13 @@ Print files to (x)html using Vim
106
113
  }.merge(options)
107
114
 
108
115
  fail "Invalid input file #{filename}" unless File.exist?(filename)
116
+ html_options = VimPrinter.configuration.options[:html]
109
117
 
110
118
  # sensible argument, see :help :TOhtml (from Vim)
111
119
  command = [
112
120
  "vim",
113
121
  "-E",
114
- "-c 'let g:html_expand_tabs = 1'",
115
- "-c 'let g:html_use_css = 1'",
116
- "-c 'let g:html_no_progress = 1'"
122
+ *VimPrinter.configuration.options[:html]
117
123
  ]
118
124
 
119
125
  # set the colorscheme for the output
@@ -0,0 +1,25 @@
1
+ module VimPrinter
2
+ class Configuration
3
+ attr_accessor :options
4
+ def initialize
5
+ @options = {
6
+ # see: :help :TOhtml from Vim for detail
7
+ html: [
8
+ "-c 'let g:html_expand_tabs = 1'",
9
+ "-c 'let g:html_use_css = 1'",
10
+ "-c 'let g:html_no_progress = 1'",
11
+ "-c 'let g:html_number_lines = 0'"
12
+ ]
13
+ }
14
+ end
15
+ end
16
+ class << self
17
+ attr_accessor :configuration
18
+ def configuration
19
+ @configuration ||= Configuration.new
20
+ end
21
+ def configure
22
+ yield configuration
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module VimPrinter
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/vim_printer.gemspec CHANGED
@@ -12,14 +12,14 @@ Gem::Specification.new do |spec|
12
12
  Work will any languages that can be open with Vim e.g. any non-binary files.)
13
13
  spec.homepage = "https://github.com/agilecreativity/vim_printer"
14
14
  spec.license = "MIT"
15
- spec.files = Dir.glob("{bin,lib}/**/*") + %w[Gemfile
16
- Rakefile
17
- vim_printer.gemspec
18
- README.md
19
- CHANGELOG.md
20
- LICENSE
21
- .rubocop.yml
22
- .gitignore]
15
+ spec.files = Dir.glob("{bin,lib,config}/**/*") + %w[Gemfile
16
+ Rakefile
17
+ vim_printer.gemspec
18
+ README.md
19
+ CHANGELOG.md
20
+ LICENSE
21
+ .rubocop.yml
22
+ .gitignore]
23
23
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
24
  spec.test_files = Dir.glob("{test}/**/*")
25
25
  spec.require_paths = ["lib"]
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.7
4
+ version: 0.1.8
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-06 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -236,8 +236,10 @@ files:
236
236
  - README.md
237
237
  - Rakefile
238
238
  - bin/vim_printer
239
+ - config/initializers/vim_printer.rb
239
240
  - lib/vim_printer.rb
240
241
  - lib/vim_printer/cli.rb
242
+ - lib/vim_printer/configuration.rb
241
243
  - lib/vim_printer/core_ext/file.rb
242
244
  - lib/vim_printer/logger.rb
243
245
  - lib/vim_printer/version.rb
@@ -251,6 +253,7 @@ files:
251
253
  - test/fixtures/inputs/java/demo4.yyy.java
252
254
  - test/fixtures/inputs/noexts1_zzz
253
255
  - test/fixtures/inputs/noexts2_zzz
256
+ - test/fixtures/inputs/vim_printer_output.tar.gz
254
257
  - test/fixtures/outputs/demo1.xxx.rb.xhtml
255
258
  - test/fixtures/outputs/demo1.yyy.rb.xhtml
256
259
  - test/fixtures/outputs/demo2.xxx.rb.xhtml
@@ -288,24 +291,25 @@ specification_version: 4
288
291
  summary: Batch convert multiple files to htmls using the power of Vim. Work will any
289
292
  languages that can be open with Vim e.g. any non-binary files.
290
293
  test_files:
291
- - test/lib/vim_printer/test_cli.rb
292
- - test/test_helper.rb
293
- - test/fixtures/outputs/demo1.xxx.rb.xhtml
294
- - test/fixtures/outputs/java/demo3.xxx.java.xhtml
295
- - test/fixtures/outputs/java/demo4.yyy.java.xhtml
296
- - test/fixtures/outputs/java/demo3.yyy.java.xhtml
297
- - test/fixtures/outputs/java/demo4.xxx.java.xhtml
298
- - test/fixtures/outputs/demo2.xxx.rb.xhtml
299
- - test/fixtures/outputs/demo1.yyy.rb.xhtml
300
- - test/fixtures/outputs/demo2.yyy.rb.xhtml
301
- - test/fixtures/inputs/noexts2_zzz
294
+ - test/fixtures/inputs/demo1.xxx.rb
295
+ - test/fixtures/inputs/demo1.yyy.rb
296
+ - test/fixtures/inputs/demo2.xxx.rb
297
+ - test/fixtures/inputs/demo2.yyy.rb
302
298
  - test/fixtures/inputs/java/demo3.xxx.java
303
- - test/fixtures/inputs/java/demo4.xxx.java
304
299
  - test/fixtures/inputs/java/demo3.yyy.java
300
+ - test/fixtures/inputs/java/demo4.xxx.java
305
301
  - test/fixtures/inputs/java/demo4.yyy.java
306
- - test/fixtures/inputs/demo2.yyy.rb
307
- - test/fixtures/inputs/demo1.yyy.rb
308
- - test/fixtures/inputs/demo2.xxx.rb
309
302
  - test/fixtures/inputs/noexts1_zzz
310
- - test/fixtures/inputs/demo1.xxx.rb
303
+ - test/fixtures/inputs/noexts2_zzz
304
+ - test/fixtures/inputs/vim_printer_output.tar.gz
305
+ - test/fixtures/outputs/demo1.xxx.rb.xhtml
306
+ - test/fixtures/outputs/demo1.yyy.rb.xhtml
307
+ - test/fixtures/outputs/demo2.xxx.rb.xhtml
308
+ - test/fixtures/outputs/demo2.yyy.rb.xhtml
309
+ - test/fixtures/outputs/java/demo3.xxx.java.xhtml
310
+ - test/fixtures/outputs/java/demo3.yyy.java.xhtml
311
+ - test/fixtures/outputs/java/demo4.xxx.java.xhtml
312
+ - test/fixtures/outputs/java/demo4.yyy.java.xhtml
313
+ - test/lib/vim_printer/test_cli.rb
314
+ - test/test_helper.rb
311
315
  has_rdoc: