vim_printer 0.1.3 → 0.1.4

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: c66a1dad19aee97afbab376c433324fc873e3093
4
- data.tar.gz: 56d10c7c5ef09d38e94fd78f29ffc6e2e658cb0c
3
+ metadata.gz: 68504b44732aaf36bcda265109f09c747fe7d6d6
4
+ data.tar.gz: 6f804fd2c714914e8d603ae37b3a470287bcca97
5
5
  SHA512:
6
- metadata.gz: 014b47117c42528e5f84e19400a85cb8fab77e02bc74d1411d6c1189194b287d7ad83f5480a36d7ce7255261d9efde8679db9dade3f3b295e74c8bad7714521c
7
- data.tar.gz: 17662a26f001304382dc23d6883d73ccd3025bbf566e4d4e122722f729d81e88a4abd5831866cea7af47b1a728aa3449a9e9d8ea36ceb89db4ccd88ac1259b8b
6
+ metadata.gz: 27a961c2e2815543dc300b421c5f6d03e9230743737d23586f387fe3ddbaba1627367290d51d092a014b4e6bcaa0f0805029f48fe19effa88635bfd673b136dc
7
+ data.tar.gz: 10cc2d66de8eea91d90c2cabb613510b0385d28a3d04ed78433c38df3484702d02a5822fee40126d7de2ae7f74d99895e72f7a3675617617a6dfec4ac66edd41
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Changelog
2
2
 
3
+ #### 0.1.4
4
+
5
+ - Skip binary input files when applicable
6
+
3
7
  #### 0.1.3
4
8
 
5
9
  - Simplify the CLI interface
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 be shown proper color in the output.
49
- * By default Vim comes with supported for major languages so you should see the proper syntax with color in the output.
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.1 # or whatever the version of you ruby
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
- - Print any files that you like using the simple command
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 output.tar.gz ~/Desktop/vim_printer
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:
@@ -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
@@ -1,3 +1,3 @@
1
1
  module VimPrinter
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/vim_printer.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "thor"
2
2
  require "agile_utils"
3
3
  require "code_lister"
4
+ require_relative "vim_printer/core_ext/file"
4
5
  require_relative "vim_printer/version"
5
6
  require_relative "vim_printer/logger"
6
7
  require_relative "vim_printer/cli"
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.3
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-17 00:00:00.000000000 Z
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