vim_printer 0.0.3 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7ef6d1e0db8517896394fe80a2036465e245935
4
- data.tar.gz: 3c71aa32e2383276078b518b2bd2dc4456eb4d56
3
+ metadata.gz: e4da665f351436c68b1e1e2c7500b49f15131740
4
+ data.tar.gz: 62ff7b2472057f1dc9689507045a0526de774975
5
5
  SHA512:
6
- metadata.gz: 4d1d8341564158a4e8aa96d9ad7ef7ea7455f43bdbb8ead615179ca92692352f9903d8ef8da56036f6813dafbca4211860e00d6926c278dafd9f48b0ff6a0809
7
- data.tar.gz: 7ea497584135d9dbd07387c06a2703a201162131a8e61213ed215341ffd8617c736028662ddf776107687dcb8b51df9c6aeade47c0b8ca35df82893276cdf0c4
6
+ metadata.gz: 6a139ffe7f1ca9729a8be68a51a1c375d7f6fc0826e0b060049057887d1f94af8d811fb4e82654666d26b0ae1ad912c0079c785a0c7543a4db8215581e757cd8
7
+ data.tar.gz: 81557cd9c34d5bb8f3aaf46bdf75a9e21cff155d2921f259d33c49de6d455387811ca45c9994ce3689c5024d320edd2cc52ae13e49069f78de13079d1d601315
data/README.md CHANGED
@@ -169,11 +169,19 @@ rake
169
169
 
170
170
  ### Changelog
171
171
 
172
+ #### 0.0.4
173
+
174
+ - Fix the output path of 'index.html' to root directory to make links valid.
175
+
176
+ - Update [agile_utils][] to '0.0.4'
177
+
178
+ - Code cleanup using rubocop
179
+
172
180
  #### 0.0.3
173
181
 
174
182
  - Use generic functions from [agile_utils][] gem
175
183
 
176
- - Update [index_html][] gem from 0.0.5 to 0.0.7
184
+ - Update [index_html][] gem to 0.0.7
177
185
 
178
186
  - Fix the bug in generated 'index.html' due to bug from index_html gem
179
187
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new do |t|
5
5
  t.libs << 'lib/vim_printer'
@@ -7,7 +7,7 @@ Rake::TestTask.new do |t|
7
7
  t.verbose = true
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
11
11
 
12
12
  task :pry do
13
13
  require 'pry'
@@ -7,45 +7,47 @@ module VimPrinter
7
7
  include AgileUtils
8
8
 
9
9
  class CLI < CodeLister::BaseCLI
10
-
11
10
  desc 'print', 'Print the list of files'
12
11
 
13
- shared_options
12
+ method_option *AgileUtils::Options::BASE_DIR
13
+ method_option *AgileUtils::Options::EXTS
14
+ method_option *AgileUtils::Options::NON_EXTS
15
+ method_option *AgileUtils::Options::INC_WORDS
16
+ method_option *AgileUtils::Options::EXC_WORDS
17
+ method_option *AgileUtils::Options::IGNORE_CASE
18
+ method_option *AgileUtils::Options::RECURSIVE
19
+ method_option *AgileUtils::Options::THEME
20
+ method_option *AgileUtils::Options::VERSION
14
21
 
15
- method_option :theme,
16
- aliases: "-t",
17
- desc: "Vim colorscheme to use",
18
- default: "default"
19
22
  def print
20
23
  opts = options.symbolize_keys
21
24
  if opts[:version]
22
25
  puts "You are using VimPrinter version #{VimPrinter::VERSION}"
23
26
  exit
24
27
  end
25
- puts "FYI: your options #{opts}"
26
28
  execute(opts)
27
29
  end
28
30
 
29
- desc "usage", "Display help screen"
31
+ desc 'usage', 'Display help screen'
30
32
  def usage
31
33
  puts <<-EOS
32
34
  Usage:
33
- vim_printer print
35
+ vim_printer print [OPTIONS]
34
36
 
35
37
  Options:
36
38
  -b, [--base-dir=BASE_DIR] # Base directory
37
- # Default: /home/bchoomnuan/Dropbox/spikes/vim_printer
39
+ # Default: . (current directory)
38
40
  -e, [--exts=one two three] # List of extensions to search for
39
- -f, [--non-exts=one two three] # List of files without extension to search for
40
- -n, [--inc-words=one two three] # List of words to be included in the result if any
41
- -x, [--exc-words=one two three] # List of words to be excluded from the result if any
41
+ -f, [--non-exts=one two three] # List of extensions to search for
42
+ -n, [--inc-words=one two three] # List of words to be included in the result
43
+ -n, [--exc-words=one two three] # List of words to be included in the result
42
44
  -i, [--ignore-case], [--no-ignore-case] # Match case insensitively
43
45
  # Default: true
44
46
  -r, [--recursive], [--no-recursive] # Search for files recursively
45
47
  # Default: true
46
- -v, [--version], [--no-version] # Display version information
47
48
  -t, [--theme=THEME] # Vim colorscheme to use
48
49
  # Default: default
50
+ -v, [--version], [--no-version] # Display version information
49
51
 
50
52
  Print the list of files
51
53
  EOS
@@ -55,10 +57,10 @@ Print the list of files
55
57
 
56
58
  private
57
59
 
60
+ # Main entry point to export the code
58
61
  #
59
62
  # @param [Hash<Symbol, Object>] options the options argument
60
63
  def execute(options = {})
61
-
62
64
  input_files = CodeLister.files(options)
63
65
 
64
66
  if input_files.empty?
@@ -69,24 +71,27 @@ Print the list of files
69
71
  to_htmls(input_files, options)
70
72
 
71
73
  # Search for files that we created
74
+ # TODO: may be use the CodeLister.files(..) instead?
72
75
  generated_files = AgileUtils::FileUtil.find(options[:base_dir])
73
76
 
74
77
  # Generate the 'index.html' file
75
78
  index_file = "#{options[:base_dir]}/index.html"
79
+
76
80
  IndexHtml.htmlify generated_files,
77
81
  base_dir: options[:base_dir],
78
82
  output: index_file
79
83
 
80
84
  # Add the missing index file
81
85
  generated_files << index_file
86
+
82
87
  AgileUtils::FileUtil.tar_gzip_files(generated_files, 'output.tar.gz')
88
+
83
89
  AgileUtils::FileUtil.delete(generated_files)
84
90
 
85
91
  # Remove the extra index.html file
86
92
  FileUtils.rm_rf(index_file)
87
93
 
88
- # report the result
89
- puts "Your result should be available at #{File.absolute_path('output.tar.gz')}"
94
+ puts "Your output file is #{File.absolute_path('output.tar.gz')}"
90
95
  end
91
96
 
92
97
  # convert multiple files to 'html'
@@ -102,12 +107,12 @@ Print the list of files
102
107
  theme: 'seoul256-light'
103
108
  }.merge(options)
104
109
 
105
- raise "Invalid input file #{filename}" unless File.exists?(filename)
110
+ fail "Invalid input file #{filename}" unless File.exist?(filename)
106
111
 
107
112
  # sensible argument, see :help :TOhtml (from Vim)
108
113
  command = [
109
- "vim",
110
- "-E",
114
+ 'vim',
115
+ '-E',
111
116
  "-c 'let g:html_expand_tabs = 1'",
112
117
  "-c 'let g:html_use_css = 1'",
113
118
  "-c 'let g:html_no_progress = 1'"
@@ -122,11 +127,11 @@ Print the list of files
122
127
  "-c 'w'",
123
128
  "-c 'qa!'",
124
129
  "#{filename}",
125
- "> /dev/null"
130
+ '> /dev/null'
126
131
  ]
127
132
 
128
133
  # Note: have to run as system only
129
- system(command.concat(args).join(" "))
134
+ system(command.concat(args).join(' '))
130
135
  end
131
136
  end
132
137
  end
@@ -2,9 +2,9 @@ require 'logger'
2
2
  module VimPrinter
3
3
  class << self
4
4
  attr_writer :logger
5
- # @return [Logger] the Logger for the project
6
- def logger
7
- @logger ||= Logger.new STDOUT
8
- end
5
+ # @return [Logger] the Logger for the project
6
+ def logger
7
+ @logger ||= Logger.new STDOUT
8
+ end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module VimPrinter
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/vim_printer.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'agile_utils'
2
3
  require 'code_lister'
3
4
  require_relative 'vim_printer/core_ext/hash'
4
5
  require_relative 'vim_printer/version'
@@ -2,7 +2,7 @@ require_relative '../../test_helper'
2
2
  describe VimPrinter do
3
3
  context '#dummy_test' do
4
4
  it 'must work' do
5
- "text".wont_be_empty
5
+ 'text'.wont_be_empty
6
6
  end
7
7
  end
8
8
  end
data/vim_printer.gemspec CHANGED
@@ -4,32 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'vim_printer/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "vim_printer"
7
+ spec.name = 'vim_printer'
8
8
  spec.version = VimPrinter::VERSION
9
- spec.authors = ["Burin Choomnuan"]
10
- spec.email = ["agilecreativity@gmail.com"]
9
+ spec.authors = ['Burin Choomnuan']
10
+ spec.email = ['agilecreativity@gmail.com']
11
11
  spec.description = %q{Print/export files to html using the power of Vim editor}
12
12
  spec.summary = %q{Print/export files to html using the power of Vim}
13
- spec.homepage = "https://github.com/agilecreativity/vim_printer"
14
- spec.license = "MIT"
13
+ spec.homepage = 'https://github.com/agilecreativity/vim_printer'
14
+ spec.license = 'MIT'
15
15
  spec.files = `git ls-files`.split($/)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_runtime_dependency "thor", "~> 0.18"
21
- spec.add_runtime_dependency "code_lister", "~> 0.0.6"
22
- spec.add_runtime_dependency "index_html", "~> 0.0.7"
23
- spec.add_runtime_dependency "agile_utils", "~> 0.0.2"
24
-
25
- spec.add_development_dependency "bundler", "~> 1.3"
26
- spec.add_development_dependency "rake"
27
- spec.add_development_dependency "awesome_print", "~> 1.2"
28
- spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
29
- spec.add_development_dependency "guard-minitest", "~> 2.2"
30
- spec.add_development_dependency "minitest", "~> 4.2"
31
- spec.add_development_dependency "guard", "~> 2.6"
32
- spec.add_development_dependency "pry", "~> 0.9"
33
- spec.add_development_dependency "gem-ctags", "~> 1.0"
34
- spec.add_development_dependency "yard", "~> 0.8"
18
+ spec.require_paths = ['lib']
19
+ spec.add_runtime_dependency 'thor', '~> 0.18'
20
+ spec.add_runtime_dependency 'code_lister', '~> 0.0.6'
21
+ spec.add_runtime_dependency 'index_html', '~> 0.0.7'
22
+ spec.add_runtime_dependency 'agile_utils', '~> 0.0.4'
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'awesome_print', '~> 1.2'
26
+ spec.add_development_dependency 'minitest-spec-context', '~> 0.0.3'
27
+ spec.add_development_dependency 'guard-minitest', '~> 2.2'
28
+ spec.add_development_dependency 'minitest', '~> 4.2'
29
+ spec.add_development_dependency 'guard', '~> 2.6'
30
+ spec.add_development_dependency 'pry', '~> 0.9'
31
+ spec.add_development_dependency 'gem-ctags', '~> 1.0'
32
+ spec.add_development_dependency 'yard', '~> 0.8'
35
33
  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.0.3
4
+ version: 0.0.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-04-18 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.2
61
+ version: 0.0.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.2
68
+ version: 0.0.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement