vim_printer 0.1.3 → 0.1.4
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -7
- data/lib/vim_printer/cli.rb +1 -9
- data/lib/vim_printer/core_ext/file.rb +13 -0
- data/lib/vim_printer/version.rb +1 -1
- data/lib/vim_printer.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68504b44732aaf36bcda265109f09c747fe7d6d6
|
4
|
+
data.tar.gz: 6f804fd2c714914e8d603ae37b3a470287bcca97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a961c2e2815543dc300b421c5f6d03e9230743737d23586f387fe3ddbaba1627367290d51d092a014b4e6bcaa0f0805029f48fe19effa88635bfd673b136dc
|
7
|
+
data.tar.gz: 10cc2d66de8eea91d90c2cabb613510b0385d28a3d04ed78433c38df3484702d02a5822fee40126d7de2ae7f74d99895e72f7a3675617617a6dfec4ac66edd41
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -39,14 +39,14 @@ The html output as renderd in the browser
|
|
39
39
|
|
40
40
|
- Any decent `~/.vimrc` should do
|
41
41
|
|
42
|
-
* There are so many great vim dotfiles in github repos
|
42
|
+
* There are so many great vim dotfiles in github repos, just search for `dotfiles` keyword:w
|
43
43
|
* [NeoBundle][] is a very good start if you are new to Vim.
|
44
44
|
* If you like you can use [my dotvim][] which is based on the [NeoBundle][].
|
45
45
|
* Use any [vim colorschemes][] if not the `default` colorscheme will be used.
|
46
46
|
My personal favourite are [seoul256.vim][] and [Tomorrow-Theme][]
|
47
47
|
|
48
|
-
- Any valid file types that are supported by Vim will
|
49
|
-
* By default Vim
|
48
|
+
- Any valid file types that are supported by Vim will produce proper color syntax in the output.
|
49
|
+
* By default Vim supports most of major languages so you should see the proper syntax with color in the output.
|
50
50
|
* On newer language like [Elixir][], you may have to first install [vim-elixir][] to see the proper syntax in the output.
|
51
51
|
If this is not installed then you will get the output but will not have the beautiful color syntax.
|
52
52
|
|
@@ -79,16 +79,18 @@ Your output file is ./test/fixtures/inputs/vim_printer_output.tar.gz
|
|
79
79
|
e.g. for rbenv your session will be something like
|
80
80
|
|
81
81
|
```sh
|
82
|
-
rbenv local 2.1.
|
82
|
+
rbenv local 2.1.2
|
83
83
|
rbenv rehash
|
84
84
|
gem install vim_printer
|
85
85
|
```
|
86
|
+
|
86
87
|
- Print any files using the gem
|
87
88
|
|
88
89
|
```sh
|
89
90
|
vim_printer
|
90
91
|
```
|
91
|
-
|
92
|
+
|
93
|
+
- Print any files that you like using the simplest command
|
92
94
|
|
93
95
|
The following command will print out all java, and ruby files recursively
|
94
96
|
using the `solarized` colorscheme.
|
@@ -104,7 +106,7 @@ To see the output in your browser just type:
|
|
104
106
|
|
105
107
|
```sh
|
106
108
|
mkdir -p ~/Desktop/vim_printer
|
107
|
-
mv
|
109
|
+
mv vim_printer_output.tar.gz ~/Desktop/vim_printer
|
108
110
|
cd ~/Desktop/vim_printer
|
109
111
|
tar zxvf vim_printer_output.tar.gz
|
110
112
|
```
|
@@ -118,8 +120,14 @@ vim_printer --base-dir ./test/fixtures \
|
|
118
120
|
--n xxx
|
119
121
|
```
|
120
122
|
|
123
|
+
- To include files that do not have any extension you can use `--non-exts`
|
124
|
+
|
125
|
+
```shell
|
126
|
+
# To print all ruby files as well as 'Gemfile' or 'Rakefile'
|
127
|
+
vim_printer -e ruby -f Gemfile Rakefile -r
|
128
|
+
```
|
129
|
+
|
121
130
|
- For help in using the gem just type `vim_printer` without any parameter
|
122
|
-
You should see something like the following:
|
123
131
|
|
124
132
|
```
|
125
133
|
Usage:
|
data/lib/vim_printer/cli.rb
CHANGED
@@ -5,7 +5,6 @@ require "fileutils"
|
|
5
5
|
require_relative "../vim_printer"
|
6
6
|
module VimPrinter
|
7
7
|
include AgileUtils
|
8
|
-
|
9
8
|
class CLI < Thor
|
10
9
|
desc "print", "Print the list of files"
|
11
10
|
method_option *AgileUtils::Options::BASE_DIR
|
@@ -63,7 +62,7 @@ Print the list of files
|
|
63
62
|
# @param [Hash<Symbol, Object>] options the options argument
|
64
63
|
def execute(options = {})
|
65
64
|
input_files = CodeLister.files(options)
|
66
|
-
|
65
|
+
input_files.delete_if { |file| File.binary?(file.gsub(/^\./,options[:base_dir])) }
|
67
66
|
if input_files.empty?
|
68
67
|
puts "No file found for your option: #{options}"
|
69
68
|
return
|
@@ -77,21 +76,14 @@ Print the list of files
|
|
77
76
|
end
|
78
77
|
|
79
78
|
index_file = "./index.html"
|
80
|
-
|
81
79
|
IndexHtml.htmlify generated_files,
|
82
80
|
base_dir: options[:base_dir],
|
83
81
|
output: index_file
|
84
82
|
|
85
|
-
# Add the missing index file
|
86
83
|
generated_files << index_file
|
87
|
-
|
88
84
|
AgileUtils::FileUtil.tar_gzip_files(generated_files, "vim_printer_output.tar.gz")
|
89
|
-
|
90
85
|
AgileUtils::FileUtil.delete(generated_files)
|
91
|
-
|
92
|
-
# Remove the extra index.html file
|
93
86
|
FileUtils.rm_rf(index_file)
|
94
|
-
|
95
87
|
puts "Your output file is #{File.absolute_path("vim_printer_output.tar.gz")}"
|
96
88
|
end
|
97
89
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# From: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/44936
|
2
|
+
class File
|
3
|
+
def self.binary?(name)
|
4
|
+
name = File.expand_path(name)
|
5
|
+
myStat = stat(name)
|
6
|
+
return false unless myStat.file?
|
7
|
+
open(name) do |file|
|
8
|
+
blk = file.read(myStat.blksize)
|
9
|
+
return blk.size == 0 ||
|
10
|
+
blk.count("^ -~", "^\r\n") / blk.size > 0.3 || blk.count("\x00") > 0
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/vim_printer/version.rb
CHANGED
data/lib/vim_printer.rb
CHANGED
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.4
|
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-05-
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -238,6 +238,7 @@ files:
|
|
238
238
|
- bin/vim_printer
|
239
239
|
- lib/vim_printer.rb
|
240
240
|
- lib/vim_printer/cli.rb
|
241
|
+
- lib/vim_printer/core_ext/file.rb
|
241
242
|
- lib/vim_printer/logger.rb
|
242
243
|
- lib/vim_printer/version.rb
|
243
244
|
- test/fixtures/inputs/demo1.xxx.rb
|