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 +4 -4
- data/README.md +9 -1
- data/Rakefile +3 -3
- data/lib/vim_printer/cli.rb +27 -22
- data/lib/vim_printer/logger.rb +4 -4
- data/lib/vim_printer/version.rb +1 -1
- data/lib/vim_printer.rb +1 -0
- data/test/lib/vim_printer/test_cli.rb +1 -1
- data/vim_printer.gemspec +20 -22
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4da665f351436c68b1e1e2c7500b49f15131740
|
4
|
+
data.tar.gz: 62ff7b2472057f1dc9689507045a0526de774975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
2
|
-
require
|
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 :
|
10
|
+
task default: :test
|
11
11
|
|
12
12
|
task :pry do
|
13
13
|
require 'pry'
|
data/lib/vim_printer/cli.rb
CHANGED
@@ -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
|
-
|
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
|
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:
|
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
|
40
|
-
-n, [--inc-words=one two three] # List of words to be included in the result
|
41
|
-
-
|
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
|
-
|
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
|
-
|
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
|
-
|
110
|
-
|
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
|
-
|
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
|
data/lib/vim_printer/logger.rb
CHANGED
@@ -2,9 +2,9 @@ require 'logger'
|
|
2
2
|
module VimPrinter
|
3
3
|
class << self
|
4
4
|
attr_writer :logger
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# @return [Logger] the Logger for the project
|
6
|
+
def logger
|
7
|
+
@logger ||= Logger.new STDOUT
|
8
|
+
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/vim_printer/version.rb
CHANGED
data/lib/vim_printer.rb
CHANGED
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 =
|
7
|
+
spec.name = 'vim_printer'
|
8
8
|
spec.version = VimPrinter::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
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 =
|
14
|
-
spec.license =
|
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 = [
|
19
|
-
|
20
|
-
spec.add_runtime_dependency
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
spec.add_runtime_dependency
|
23
|
-
spec.
|
24
|
-
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
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.
|
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-
|
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.
|
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.
|
68
|
+
version: 0.0.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|