vim_printer 0.1.2 → 0.1.3

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: 307a4175693abcee3e60440a46e3d8cb223e9748
4
- data.tar.gz: 00e7d3dd10f1e2d68cdef51546488daf2effff5a
3
+ metadata.gz: c66a1dad19aee97afbab376c433324fc873e3093
4
+ data.tar.gz: 56d10c7c5ef09d38e94fd78f29ffc6e2e658cb0c
5
5
  SHA512:
6
- metadata.gz: 2ec0fac91f63bcaf6f5253baddc192ee9eca2ce351e38357040df6b100da437f1abff8a6349a7141e4741eddbbe5fe5fed776fe6ded2f228b6b14424a1b725ee
7
- data.tar.gz: fcf2714715b12c563692619b3c2e3a55e22069600cac78f5c43e2810141ba98465be3524b466ab748b0089f8c42a57ad22d1880df0427c54cedde1ebd6982151
6
+ metadata.gz: 014b47117c42528e5f84e19400a85cb8fab77e02bc74d1411d6c1189194b287d7ad83f5480a36d7ce7255261d9efde8679db9dade3f3b295e74c8bad7714521c
7
+ data.tar.gz: 17662a26f001304382dc23d6883d73ccd3025bbf566e4d4e122722f729d81e88a4abd5831866cea7af47b1a728aa3449a9e9d8ea36ceb89db4ccd88ac1259b8b
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  # Custom ignore files
19
19
  vim_printer_output.tar.gz
20
+ .ruby-version
data/.rubocop.yml CHANGED
@@ -1 +1,96 @@
1
- inherit_from: rubocop-todo.yml
1
+ AllCops:
2
+ Include:
3
+ - Gemfile
4
+ - Rakefile
5
+ - bin/*
6
+ - vim_printer.gemspec
7
+ - lib/**/*.rb
8
+ - test/**/*.rb
9
+
10
+ # Avoid long parameter lists
11
+ ParameterLists:
12
+ Max: 5
13
+ CountKeywordArgs: true
14
+
15
+ MethodLength:
16
+ CountComments: false
17
+ Max: 15
18
+
19
+ # Avoid more than `Max` levels of nesting.
20
+ BlockNesting:
21
+ Max: 4
22
+
23
+ # Align with the style guide.
24
+ CollectionMethods:
25
+ PreferredMethods:
26
+ collect: 'map'
27
+ inject: 'reduce'
28
+ find: 'detect'
29
+ find_all: 'select'
30
+
31
+ # Do not force public/protected/private keyword to be indented at the same
32
+ # level as the def keyword. My personal preference is to outdent these keywords
33
+ # because I think when scanning code it makes it easier to identify the
34
+ # sections of code and visually separate them. When the keyword is at the same
35
+ # level I think it sort of blends in with the def keywords and makes it harder
36
+ # to scan the code and see where the sections are.
37
+ AccessModifierIndentation:
38
+ Enabled: false
39
+
40
+ # Limit line length
41
+ LineLength:
42
+ Enabled: false
43
+
44
+ # Disable documentation checking until a class needs to be documented once
45
+ Documentation:
46
+ Enabled: false
47
+
48
+ # Enforce Ruby 1.8-compatible hash syntax
49
+ HashSyntax:
50
+ Enabled: true
51
+
52
+ # No spaces inside hash literals
53
+ SpaceInsideHashLiteralBraces:
54
+ EnforcedStyle: no_space
55
+
56
+ # Allow dots at the end of lines
57
+ DotPosition:
58
+ Enabled: false
59
+
60
+ # Don't require magic comment at the top of every file
61
+ Encoding:
62
+ Enabled: false
63
+
64
+ # Enforce outdenting of access modifiers (i.e. public, private, protected)
65
+ AccessModifierIndentation:
66
+ EnforcedStyle: outdent
67
+
68
+ EmptyLinesAroundAccessModifier:
69
+ Enabled: true
70
+
71
+ # Align ends correctly
72
+ EndAlignment:
73
+ AlignWith: variable
74
+
75
+ # Indentation of when/else
76
+ CaseIndentation:
77
+ IndentWhenRelativeTo: end
78
+ IndentOneStep: false
79
+
80
+ DoubleNegation:
81
+ Enabled: false
82
+
83
+ PercentLiteralDelimiters:
84
+ PreferredDelimiters:
85
+ '%': ()
86
+ '%i': ()
87
+ '%q': ()
88
+ '%Q': ()
89
+ '%r': '{}'
90
+ '%s': ()
91
+ '%w': '[]'
92
+ '%W': '[]'
93
+ '%x': ()
94
+
95
+ StringLiterals:
96
+ EnforcedStyle: double_quotes
@@ -1,5 +1,10 @@
1
1
  ### Changelog
2
2
 
3
+ #### 0.1.3
4
+
5
+ - Simplify the CLI interface
6
+ - Cleanup style with rubocop
7
+
3
8
  #### 0.1.2
4
9
 
5
10
  - Minor code cleanup
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in ebook_renamer.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -40,19 +40,13 @@ The html output as renderd in the browser
40
40
  - Any decent `~/.vimrc` should do
41
41
 
42
42
  * There are so many great vim dotfiles in github repos.
43
-
44
43
  * [NeoBundle][] is a very good start if you are new to Vim.
45
-
46
44
  * If you like you can use [my dotvim][] which is based on the [NeoBundle][].
47
-
48
45
  * Use any [vim colorschemes][] if not the `default` colorscheme will be used.
49
-
50
46
  My personal favourite are [seoul256.vim][] and [Tomorrow-Theme][]
51
47
 
52
48
  - Any valid file types that are supported by Vim will be shown proper color in the output.
53
-
54
49
  * By default Vim comes with supported for major languages so you should see the proper syntax with color in the output.
55
-
56
50
  * On newer language like [Elixir][], you may have to first install [vim-elixir][] to see the proper syntax in the output.
57
51
  If this is not installed then you will get the output but will not have the beautiful color syntax.
58
52
 
@@ -61,7 +55,7 @@ The html output as renderd in the browser
61
55
  - Run with the sample fixture files
62
56
 
63
57
  ```sh
64
- vim_printer print -b test/fixtures/inputs -e rb java -r
58
+ vim_printer -b test/fixtures/inputs -e rb java -r
65
59
  ```
66
60
 
67
61
  Will produce the file `output.tar.gz` with the following result on the screen.
@@ -100,9 +94,9 @@ The following command will print out all java, and ruby files recursively
100
94
  using the `solarized` colorscheme.
101
95
 
102
96
  ```sh
103
- vim_printer print --base-dir ./test/fixtures \
104
- --exts rb \
105
- --theme solarized
97
+ vim_printer --base-dir ./test/fixtures \
98
+ --exts rb \
99
+ --theme solarized
106
100
  ```
107
101
 
108
102
  Your output will be saved to the default `output.tar.gz` in the directory where you run this command.
@@ -118,10 +112,10 @@ tar zxvf vim_printer_output.tar.gz
118
112
  - Print only files that contain the word `xxx` in the title
119
113
 
120
114
  ```sh
121
- vim_printer print --base-dir ./test/fixtures \
122
- --exts java \
123
- --theme solarized \
124
- --n xxx
115
+ vim_printer --base-dir ./test/fixtures \
116
+ --exts java \
117
+ --theme solarized \
118
+ --n xxx
125
119
  ```
126
120
 
127
121
  - For help in using the gem just type `vim_printer` without any parameter
@@ -129,7 +123,7 @@ You should see something like the following:
129
123
 
130
124
  ```
131
125
  Usage:
132
- vim_printer print [OPTIONS]
126
+ vim_printer
133
127
 
134
128
  Options:
135
129
  -b, [--base-dir=BASE_DIR] # Base directory
data/Rakefile CHANGED
@@ -1,15 +1,15 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
  Rake::TestTask.new do |t|
4
- t.libs << 'lib/vim_printer'
5
- t.test_files = FileList['test/lib/vim_printer/test_*.rb']
4
+ t.libs << "lib/vim_printer"
5
+ t.test_files = FileList["test/lib/vim_printer/test_*.rb"]
6
6
  t.verbose = true
7
7
  end
8
8
  task default: :test
9
9
  task :pry do
10
- require 'pry'
11
- require 'awesome_print'
12
- require 'vim_printer'
10
+ require "pry"
11
+ require "awesome_print"
12
+ require "vim_printer"
13
13
  include VimPrinter
14
14
  ARGV.clear
15
15
  Pry.start
data/bin/vim_printer CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/vim_printer'
2
+ require_relative "../lib/vim_printer"
3
3
  include VimPrinter
4
- VimPrinter::CLI.start(ARGV)
4
+ if ARGV.empty?
5
+ VimPrinter::CLI.start(%w[usage])
6
+ else
7
+ VimPrinter::CLI.start(%w[print].concat(ARGV))
8
+ end
data/lib/vim_printer.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'thor'
2
- require 'agile_utils'
3
- require 'code_lister'
4
- require_relative 'vim_printer/version'
5
- require_relative 'vim_printer/logger'
6
- require_relative 'vim_printer/cli'
1
+ require "thor"
2
+ require "agile_utils"
3
+ require "code_lister"
4
+ require_relative "vim_printer/version"
5
+ require_relative "vim_printer/logger"
6
+ require_relative "vim_printer/cli"
@@ -1,15 +1,13 @@
1
- require 'agile_utils'
2
- require 'code_lister'
3
- require 'index_html'
4
- require 'fileutils'
5
- require_relative '../vim_printer'
6
-
1
+ require "agile_utils"
2
+ require "code_lister"
3
+ require "index_html"
4
+ require "fileutils"
5
+ require_relative "../vim_printer"
7
6
  module VimPrinter
8
7
  include AgileUtils
9
8
 
10
9
  class CLI < Thor
11
- desc 'print', 'Print the list of files'
12
-
10
+ desc "print", "Print the list of files"
13
11
  method_option *AgileUtils::Options::BASE_DIR
14
12
  method_option *AgileUtils::Options::EXTS
15
13
  method_option *AgileUtils::Options::NON_EXTS
@@ -18,11 +16,10 @@ module VimPrinter
18
16
  method_option *AgileUtils::Options::IGNORE_CASE
19
17
  method_option *AgileUtils::Options::RECURSIVE
20
18
  method_option *AgileUtils::Options::VERSION
21
-
22
19
  method_option :theme,
23
- aliases: '-t',
24
- desc: 'Vim colorscheme to use',
25
- default: 'default'
20
+ aliases: "-t",
21
+ desc: "Vim colorscheme to use",
22
+ default: "default"
26
23
  def print
27
24
  opts = options.symbolize_keys
28
25
  if opts[:version]
@@ -32,11 +29,11 @@ module VimPrinter
32
29
  execute(opts)
33
30
  end
34
31
 
35
- desc 'usage', 'Display help screen'
32
+ desc "usage", "Display help screen"
36
33
  def usage
37
34
  puts <<-EOS
38
35
  Usage:
39
- vim_printer print [OPTIONS]
36
+ vim_printer
40
37
 
41
38
  Options:
42
39
  -b, [--base-dir=BASE_DIR] # Base directory
@@ -59,7 +56,7 @@ Print the list of files
59
56
 
60
57
  default_task :usage
61
58
 
62
- private
59
+ private
63
60
 
64
61
  # Main entry point to export the code
65
62
  #
@@ -79,7 +76,7 @@ Print the list of files
79
76
  "#{f}.xhtml"
80
77
  end
81
78
 
82
- index_file = './index.html'
79
+ index_file = "./index.html"
83
80
 
84
81
  IndexHtml.htmlify generated_files,
85
82
  base_dir: options[:base_dir],
@@ -88,14 +85,14 @@ Print the list of files
88
85
  # Add the missing index file
89
86
  generated_files << index_file
90
87
 
91
- AgileUtils::FileUtil.tar_gzip_files(generated_files, 'vim_printer_output.tar.gz')
88
+ AgileUtils::FileUtil.tar_gzip_files(generated_files, "vim_printer_output.tar.gz")
92
89
 
93
90
  AgileUtils::FileUtil.delete(generated_files)
94
91
 
95
92
  # Remove the extra index.html file
96
93
  FileUtils.rm_rf(index_file)
97
94
 
98
- puts "Your output file is #{File.absolute_path('vim_printer_output.tar.gz')}"
95
+ puts "Your output file is #{File.absolute_path("vim_printer_output.tar.gz")}"
99
96
  end
100
97
 
101
98
  # convert multiple files to 'html'
@@ -109,15 +106,15 @@ Print the list of files
109
106
 
110
107
  def to_html(filename, options = {})
111
108
  opts = {
112
- theme: 'seoul256-light'
109
+ theme: "seoul256-light"
113
110
  }.merge(options)
114
111
 
115
112
  fail "Invalid input file #{filename}" unless File.exist?(filename)
116
113
 
117
114
  # sensible argument, see :help :TOhtml (from Vim)
118
115
  command = [
119
- 'vim',
120
- '-E',
116
+ "vim",
117
+ "-E",
121
118
  "-c 'let g:html_expand_tabs = 1'",
122
119
  "-c 'let g:html_use_css = 1'",
123
120
  "-c 'let g:html_no_progress = 1'"
@@ -132,10 +129,9 @@ Print the list of files
132
129
  "-c 'w'",
133
130
  "-c 'qa!'",
134
131
  "#{filename}",
135
- '> /dev/null'
132
+ "> /dev/null"
136
133
  ]
137
-
138
- system(command.concat(args).join(' '))
134
+ system(command.concat(args).join(" "))
139
135
  end
140
136
  end
141
137
  end
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require "logger"
2
2
  module VimPrinter
3
3
  class << self
4
4
  attr_writer :logger
@@ -1,3 +1,3 @@
1
1
  module VimPrinter
2
- VERSION = '0.1.2'
2
+ VERSION = "0.1.3"
3
3
  end
@@ -1,8 +1,8 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
  describe VimPrinter do
3
- context '#dummy_test' do
4
- it 'must work' do
5
- 'text'.wont_be_empty
3
+ context "#dummy_test" do
4
+ it "must work" do
5
+ "text".wont_be_empty
6
6
  end
7
7
  end
8
8
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'minitest/autorun'
2
- require 'minitest/pride'
3
- require 'minitest-spec-context'
4
- require 'awesome_print'
5
- require 'pry'
6
- require_relative '../lib/vim_printer'
1
+ require "minitest/autorun"
2
+ require "minitest/pride"
3
+ require "minitest-spec-context"
4
+ require "awesome_print"
5
+ require "pry"
6
+ require_relative "../lib/vim_printer"
data/vim_printer.gemspec CHANGED
@@ -1,42 +1,41 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'vim_printer/version'
5
-
4
+ require "vim_printer/version"
6
5
  Gem::Specification.new do |spec|
7
- spec.name = 'vim_printer'
6
+ spec.name = "vim_printer"
8
7
  spec.version = VimPrinter::VERSION
9
- spec.authors = ['Burin Choomnuan']
10
- spec.email = ['agilecreativity@gmail.com']
8
+ spec.authors = ["Burin Choomnuan"]
9
+ spec.email = ["agilecreativity@gmail.com"]
11
10
  spec.description = %q(Batch convert multiple files to htmls using the power of Vim editor)
12
11
  spec.summary = %q(Batch convert multiple files to htmls using the power of Vim.
13
12
  Work will any languages that can be open with Vim e.g. any non-binary files.)
14
- spec.homepage = 'https://github.com/agilecreativity/vim_printer'
15
- spec.license = 'MIT'
16
- spec.files = Dir.glob('{bin,lib}/**/*') + %w(Gemfile
13
+ spec.homepage = "https://github.com/agilecreativity/vim_printer"
14
+ spec.license = "MIT"
15
+ spec.files = Dir.glob("{bin,lib}/**/*") + %w[Gemfile
17
16
  Rakefile
18
17
  vim_printer.gemspec
19
18
  README.md
20
- CHANGELOGS.md
19
+ CHANGELOG.md
21
20
  LICENSE
22
21
  .rubocop.yml
23
- .gitignore)
22
+ .gitignore]
24
23
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
- spec.test_files = Dir.glob('{test}/**/*')
26
- spec.require_paths = ['lib']
27
- spec.add_runtime_dependency 'thor', '~> 0.19'
28
- spec.add_runtime_dependency 'code_lister', '~> 0.1'
29
- spec.add_runtime_dependency 'index_html', '~> 0.1'
30
- spec.add_runtime_dependency 'agile_utils', '~> 0.1'
31
- spec.add_development_dependency 'bundler', '~> 1.3'
32
- spec.add_development_dependency 'rake'
33
- spec.add_development_dependency 'awesome_print', '~> 1.2'
34
- spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
35
- spec.add_development_dependency 'guard-minitest', '~> 2.2'
36
- spec.add_development_dependency 'minitest', '~> 5.3'
37
- spec.add_development_dependency 'guard', '~> 2.6'
38
- spec.add_development_dependency 'pry', '~> 0.9'
39
- spec.add_development_dependency 'rubocop', '~> 0.20'
40
- spec.add_development_dependency 'gem-ctags', '~> 1.0'
41
- spec.add_development_dependency 'yard', '~> 0.8'
24
+ spec.test_files = Dir.glob("{test}/**/*")
25
+ spec.require_paths = ["lib"]
26
+ spec.add_runtime_dependency "thor", "~> 0.19"
27
+ spec.add_runtime_dependency "code_lister", "~> 0.1"
28
+ spec.add_runtime_dependency "index_html", "~> 0.1"
29
+ spec.add_runtime_dependency "agile_utils", "~> 0.1"
30
+ spec.add_development_dependency "bundler", "~> 1.3"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "awesome_print", "~> 1.2"
33
+ spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
34
+ spec.add_development_dependency "guard-minitest", "~> 2.2"
35
+ spec.add_development_dependency "minitest", "~> 5.3"
36
+ spec.add_development_dependency "guard", "~> 2.6"
37
+ spec.add_development_dependency "pry", "~> 0.9"
38
+ spec.add_development_dependency "rubocop", "~> 0.20"
39
+ spec.add_development_dependency "gem-ctags", "~> 1.0"
40
+ spec.add_development_dependency "yard", "~> 0.8"
42
41
  end
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.2
4
+ version: 0.1.3
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-12 00:00:00.000000000 Z
11
+ date: 2014-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -230,7 +230,7 @@ extra_rdoc_files: []
230
230
  files:
231
231
  - ".gitignore"
232
232
  - ".rubocop.yml"
233
- - CHANGELOGS.md
233
+ - CHANGELOG.md
234
234
  - Gemfile
235
235
  - LICENSE
236
236
  - README.md
@@ -250,6 +250,7 @@ files:
250
250
  - test/fixtures/inputs/java/demo4.yyy.java
251
251
  - test/fixtures/inputs/noexts1_zzz
252
252
  - test/fixtures/inputs/noexts2_zzz
253
+ - test/fixtures/inputs/vim_printer_output.tar.gz
253
254
  - test/fixtures/outputs/demo1.xxx.rb.xhtml
254
255
  - test/fixtures/outputs/demo1.yyy.rb.xhtml
255
256
  - test/fixtures/outputs/demo2.xxx.rb.xhtml
@@ -287,24 +288,25 @@ specification_version: 4
287
288
  summary: Batch convert multiple files to htmls using the power of Vim. Work will any
288
289
  languages that can be open with Vim e.g. any non-binary files.
289
290
  test_files:
290
- - test/lib/vim_printer/test_cli.rb
291
- - test/test_helper.rb
292
- - test/fixtures/outputs/demo1.xxx.rb.xhtml
293
- - test/fixtures/outputs/java/demo3.xxx.java.xhtml
294
- - test/fixtures/outputs/java/demo4.yyy.java.xhtml
295
- - test/fixtures/outputs/java/demo3.yyy.java.xhtml
296
- - test/fixtures/outputs/java/demo4.xxx.java.xhtml
297
- - test/fixtures/outputs/demo2.xxx.rb.xhtml
298
- - test/fixtures/outputs/demo1.yyy.rb.xhtml
299
- - test/fixtures/outputs/demo2.yyy.rb.xhtml
300
- - test/fixtures/inputs/noexts2_zzz
291
+ - test/fixtures/inputs/demo1.xxx.rb
292
+ - test/fixtures/inputs/demo1.yyy.rb
293
+ - test/fixtures/inputs/demo2.xxx.rb
294
+ - test/fixtures/inputs/demo2.yyy.rb
301
295
  - test/fixtures/inputs/java/demo3.xxx.java
302
- - test/fixtures/inputs/java/demo4.xxx.java
303
296
  - test/fixtures/inputs/java/demo3.yyy.java
297
+ - test/fixtures/inputs/java/demo4.xxx.java
304
298
  - test/fixtures/inputs/java/demo4.yyy.java
305
- - test/fixtures/inputs/demo2.yyy.rb
306
- - test/fixtures/inputs/demo1.yyy.rb
307
- - test/fixtures/inputs/demo2.xxx.rb
308
299
  - test/fixtures/inputs/noexts1_zzz
309
- - test/fixtures/inputs/demo1.xxx.rb
300
+ - test/fixtures/inputs/noexts2_zzz
301
+ - test/fixtures/inputs/vim_printer_output.tar.gz
302
+ - test/fixtures/outputs/demo1.xxx.rb.xhtml
303
+ - test/fixtures/outputs/demo1.yyy.rb.xhtml
304
+ - test/fixtures/outputs/demo2.xxx.rb.xhtml
305
+ - test/fixtures/outputs/demo2.yyy.rb.xhtml
306
+ - test/fixtures/outputs/java/demo3.xxx.java.xhtml
307
+ - test/fixtures/outputs/java/demo3.yyy.java.xhtml
308
+ - test/fixtures/outputs/java/demo4.xxx.java.xhtml
309
+ - test/fixtures/outputs/java/demo4.yyy.java.xhtml
310
+ - test/lib/vim_printer/test_cli.rb
311
+ - test/test_helper.rb
310
312
  has_rdoc: