vim_printer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +5 -0
  5. data/.yardopts +2 -0
  6. data/01-seoul256-input.png +0 -0
  7. data/01-seoul256-output.png +0 -0
  8. data/02-Tomorrow-Night-input.png +0 -0
  9. data/02-Tomorrow-Night-output.png +0 -0
  10. data/Gemfile +7 -0
  11. data/Guardfile +15 -0
  12. data/LICENSE +22 -0
  13. data/README.md +192 -0
  14. data/Rakefile +19 -0
  15. data/bin/vim_printer +4 -0
  16. data/lib/vim_printer/cli.rb +119 -0
  17. data/lib/vim_printer/core_ext/hash.rb +56 -0
  18. data/lib/vim_printer/logger.rb +10 -0
  19. data/lib/vim_printer/utility.rb +87 -0
  20. data/lib/vim_printer/version.rb +3 -0
  21. data/lib/vim_printer.rb +7 -0
  22. data/test/fixtures/inputs/demo1.xxx.rb +1 -0
  23. data/test/fixtures/inputs/demo1.yyy.rb +1 -0
  24. data/test/fixtures/inputs/demo2.xxx.rb +1 -0
  25. data/test/fixtures/inputs/demo2.yyy.rb +1 -0
  26. data/test/fixtures/inputs/java/demo3.xxx.java +1 -0
  27. data/test/fixtures/inputs/java/demo3.yyy.java +1 -0
  28. data/test/fixtures/inputs/java/demo4.xxx.java +1 -0
  29. data/test/fixtures/inputs/java/demo4.yyy.java +1 -0
  30. data/test/fixtures/inputs/noexts1_zzz +1 -0
  31. data/test/fixtures/inputs/noexts2_zzz +1 -0
  32. data/test/fixtures/outputs/demo1.xxx.rb.xhtml +91 -0
  33. data/test/fixtures/outputs/demo1.yyy.rb.xhtml +91 -0
  34. data/test/fixtures/outputs/demo2.xxx.rb.xhtml +91 -0
  35. data/test/fixtures/outputs/demo2.yyy.rb.xhtml +91 -0
  36. data/test/fixtures/outputs/java/demo3.xxx.java.xhtml +91 -0
  37. data/test/fixtures/outputs/java/demo3.yyy.java.xhtml +91 -0
  38. data/test/fixtures/outputs/java/demo4.xxx.java.xhtml +91 -0
  39. data/test/fixtures/outputs/java/demo4.yyy.java.xhtml +91 -0
  40. data/test/lib/vim_printer/test_utility.rb +48 -0
  41. data/test/test_helper.rb +12 -0
  42. data/vim_printer.gemspec +34 -0
  43. metadata +289 -0
@@ -0,0 +1,91 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title>~/Dropbox/spikes/vim_printer/test/fixtures/java/demo4.yyy.java.xhtml</title>
6
+ <meta name="Generator" content="Vim/7.4" />
7
+ <meta name="plugin-version" content="vim7.4_v1" />
8
+ <meta name="syntax" content="java" />
9
+ <meta name="settings" content="no_progress,number_lines,dynamic_folds,no_pre,use_xhtml,use_css,expand_tabs,line_ids,prevent_copy=" />
10
+ <meta name="colorscheme" content="Tomorrow-Night" />
11
+ <style type="text/css">
12
+
13
+ body { color: #bcbcbc; background-color: #262626; font-family: monospace; }
14
+ * { font-size: 1em; }
15
+ .LineNr { color: #4e4e4e; }
16
+ .Comment { color: #8a8a8a; }
17
+ .FoldColumn { color: #00ffff; background-color: #262626; padding-bottom: 1px; }
18
+ .FoldColumn { text-decoration: none; white-space: pre; }
19
+ .open-fold .Folded { display: none; }
20
+ .open-fold .fulltext { display: inline; }
21
+ .open-fold .toggle-open { display: none; }
22
+ .closed-fold .toggle-closed { display: inline; }
23
+
24
+ .closed-fold .fulltext { display: none; }
25
+ .closed-fold .Folded { display: inline; }
26
+ .closed-fold .toggle-open { display: inline; }
27
+ .closed-fold .toggle-closed { display: none; }
28
+
29
+ </style>
30
+
31
+ <script type='text/javascript'>
32
+ //<![CDATA[
33
+
34
+ function toggleFold(objID)
35
+ {
36
+ var fold;
37
+ fold = document.getElementById(objID);
38
+ if(fold.className == 'closed-fold')
39
+ {
40
+ fold.className = 'open-fold';
41
+ }
42
+ else if (fold.className == 'open-fold')
43
+ {
44
+ fold.className = 'closed-fold';
45
+ }
46
+ }
47
+
48
+ /* function to open any folds containing a jumped-to line before jumping to it */
49
+ function JumpToLine()
50
+ {
51
+ var lineNum;
52
+ lineNum = window.location.hash;
53
+ lineNum = lineNum.substr(1); /* strip off '#' */
54
+
55
+ if (lineNum.indexOf('L') == -1) {
56
+ lineNum = 'L'+lineNum;
57
+ }
58
+ lineElem = document.getElementById(lineNum);
59
+
60
+ /* navigate upwards in the DOM tree to open all folds containing the line */
61
+ var node = lineElem;
62
+ while (node && node.id != 'vimCodeElement')
63
+ {
64
+ if (node.className == 'closed-fold')
65
+ {
66
+ node.className = 'open-fold';
67
+ }
68
+ node = node.parentNode;
69
+ }
70
+ /* Always jump to new location even if the line was hidden inside a fold, or
71
+ * we corrected the raw number to a line ID.
72
+ */
73
+ if (lineElem) {
74
+ lineElem.scrollIntoView(true);
75
+ }
76
+ return true;
77
+ }
78
+ if ('onhashchange' in window) {
79
+ window.onhashchange = JumpToLine;
80
+ }
81
+
82
+ //]]>
83
+ </script>
84
+ </head>
85
+ <body onload='JumpToLine();'>
86
+ <div id='vimCodeElement'>
87
+ <span id="L1" class="LineNr">1&#160;</span><span class="Comment">// file: test/fixtures/java/demo4.yyy.java</span><br />
88
+ </div>
89
+ </body>
90
+ </html>
91
+ <!-- vim: set foldmethod=manual : -->
@@ -0,0 +1,48 @@
1
+ require_relative '../../test_helper'
2
+ require 'zlib'
3
+ require 'fileutils'
4
+
5
+ describe VimPrinter::Utility do
6
+
7
+ def setup
8
+ @files = VimPrinter::Utility.find("test/fixtures/outputs")
9
+ end
10
+
11
+ def teardown
12
+ @files = []
13
+ end
14
+
15
+ context '#find' do
16
+ it 'contains proper list of files' do
17
+ @files.wont_be_empty
18
+ end
19
+ end
20
+
21
+ context '#tar_gzip_files' do
22
+ before do
23
+ FileUtils.rm_rf("test/output.tar.gz")
24
+ end
25
+
26
+ after do
27
+ FileUtils.rm_rf("test/output.tar.gz")
28
+ end
29
+
30
+ it 'compresses list of files' do
31
+ files = VimPrinter::Utility.find("test/fixtures/outputs")
32
+ refute File.exists?("test/output.tar.gz"), "Output file must not exist"
33
+ VimPrinter::Utility.tar_gzip_files(files, "test/output.tar.gz")
34
+ assert File.exists?("test/output.tar.gz"), "Output file must be generated"
35
+ end
36
+ end
37
+
38
+ # TODO: come and revisit this test
39
+ # context '#delete' do
40
+ # it 'removes the files' do
41
+ # puts 'remove generated files'
42
+ # @files.wont_be_empty
43
+ # VimPrinter::Utility.delete(@files)
44
+ # #TODO: assert that the files were actually deleted!
45
+ # end
46
+ # end
47
+
48
+ end
@@ -0,0 +1,12 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require 'minitest-spec-context'
4
+
5
+ require 'awesome_print'
6
+ require 'pry'
7
+ require 'archive/tar/minitar'
8
+
9
+ require_relative '../lib/vim_printer'
10
+ include Archive::Tar
11
+ include Archive::Tar::Minitar
12
+
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vim_printer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vim_printer"
8
+ spec.version = VimPrinter::VERSION
9
+ spec.authors = ["Burin Choomnuan"]
10
+ spec.email = ["agilecreativity@gmail.com"]
11
+ spec.description = %q{Print any files using the power of Vim}
12
+ spec.summary = %q{Print any files at once using the power of Vim}
13
+ spec.homepage = "https://github.com/agilecreativity/vim_printer"
14
+ spec.license = "MIT"
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
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 "minitar", "~> 0.5.4"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "awesome_print", "~> 1.2"
27
+ spec.add_development_dependency "minitest-spec-context", "~> 0.0.3"
28
+ spec.add_development_dependency "guard-minitest", "~> 2.2"
29
+ spec.add_development_dependency "minitest", "~> 4.2"
30
+ spec.add_development_dependency "guard", "~> 2.6"
31
+ spec.add_development_dependency "pry", "~> 0.9"
32
+ spec.add_development_dependency "gem-ctags", "~> 1.0"
33
+ spec.add_development_dependency "yard", "~> 0.8"
34
+ end
metadata ADDED
@@ -0,0 +1,289 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vim_printer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Burin Choomnuan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.18'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.18'
27
+ - !ruby/object:Gem::Dependency
28
+ name: code_lister
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.6
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.6
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitar
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: awesome_print
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-spec-context
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.0.3
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.0.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-minitest
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: minitest
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '2.6'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.6'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.9'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.9'
167
+ - !ruby/object:Gem::Dependency
168
+ name: gem-ctags
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '1.0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '1.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.8'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.8'
195
+ description: Print any files using the power of Vim
196
+ email:
197
+ - agilecreativity@gmail.com
198
+ executables:
199
+ - vim_printer
200
+ extensions: []
201
+ extra_rdoc_files: []
202
+ files:
203
+ - ".gitignore"
204
+ - ".ruby-version"
205
+ - ".travis.yml"
206
+ - ".yardopts"
207
+ - 01-seoul256-input.png
208
+ - 01-seoul256-output.png
209
+ - 02-Tomorrow-Night-input.png
210
+ - 02-Tomorrow-Night-output.png
211
+ - Gemfile
212
+ - Guardfile
213
+ - LICENSE
214
+ - README.md
215
+ - Rakefile
216
+ - bin/vim_printer
217
+ - lib/vim_printer.rb
218
+ - lib/vim_printer/cli.rb
219
+ - lib/vim_printer/core_ext/hash.rb
220
+ - lib/vim_printer/logger.rb
221
+ - lib/vim_printer/utility.rb
222
+ - lib/vim_printer/version.rb
223
+ - test/fixtures/inputs/demo1.xxx.rb
224
+ - test/fixtures/inputs/demo1.yyy.rb
225
+ - test/fixtures/inputs/demo2.xxx.rb
226
+ - test/fixtures/inputs/demo2.yyy.rb
227
+ - test/fixtures/inputs/java/demo3.xxx.java
228
+ - test/fixtures/inputs/java/demo3.yyy.java
229
+ - test/fixtures/inputs/java/demo4.xxx.java
230
+ - test/fixtures/inputs/java/demo4.yyy.java
231
+ - test/fixtures/inputs/noexts1_zzz
232
+ - test/fixtures/inputs/noexts2_zzz
233
+ - test/fixtures/outputs/demo1.xxx.rb.xhtml
234
+ - test/fixtures/outputs/demo1.yyy.rb.xhtml
235
+ - test/fixtures/outputs/demo2.xxx.rb.xhtml
236
+ - test/fixtures/outputs/demo2.yyy.rb.xhtml
237
+ - test/fixtures/outputs/java/demo3.xxx.java.xhtml
238
+ - test/fixtures/outputs/java/demo3.yyy.java.xhtml
239
+ - test/fixtures/outputs/java/demo4.xxx.java.xhtml
240
+ - test/fixtures/outputs/java/demo4.yyy.java.xhtml
241
+ - test/lib/vim_printer/test_utility.rb
242
+ - test/test_helper.rb
243
+ - vim_printer.gemspec
244
+ homepage: https://github.com/agilecreativity/vim_printer
245
+ licenses:
246
+ - MIT
247
+ metadata: {}
248
+ post_install_message:
249
+ rdoc_options: []
250
+ require_paths:
251
+ - lib
252
+ required_ruby_version: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
257
+ required_rubygems_version: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - ">="
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ requirements: []
263
+ rubyforge_project:
264
+ rubygems_version: 2.2.2
265
+ signing_key:
266
+ specification_version: 4
267
+ summary: Print any files at once using the power of Vim
268
+ test_files:
269
+ - test/fixtures/inputs/demo1.xxx.rb
270
+ - test/fixtures/inputs/demo1.yyy.rb
271
+ - test/fixtures/inputs/demo2.xxx.rb
272
+ - test/fixtures/inputs/demo2.yyy.rb
273
+ - test/fixtures/inputs/java/demo3.xxx.java
274
+ - test/fixtures/inputs/java/demo3.yyy.java
275
+ - test/fixtures/inputs/java/demo4.xxx.java
276
+ - test/fixtures/inputs/java/demo4.yyy.java
277
+ - test/fixtures/inputs/noexts1_zzz
278
+ - test/fixtures/inputs/noexts2_zzz
279
+ - test/fixtures/outputs/demo1.xxx.rb.xhtml
280
+ - test/fixtures/outputs/demo1.yyy.rb.xhtml
281
+ - test/fixtures/outputs/demo2.xxx.rb.xhtml
282
+ - test/fixtures/outputs/demo2.yyy.rb.xhtml
283
+ - test/fixtures/outputs/java/demo3.xxx.java.xhtml
284
+ - test/fixtures/outputs/java/demo3.yyy.java.xhtml
285
+ - test/fixtures/outputs/java/demo4.xxx.java.xhtml
286
+ - test/fixtures/outputs/java/demo4.yyy.java.xhtml
287
+ - test/lib/vim_printer/test_utility.rb
288
+ - test/test_helper.rb
289
+ has_rdoc: