vim_printer 0.0.2 → 0.0.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: 627dd0639342f4d39918630c32d8071d23428011
4
- data.tar.gz: d4aeddd9698d21abcd92411c47fa46a3da0ce6f4
3
+ metadata.gz: b7ef6d1e0db8517896394fe80a2036465e245935
4
+ data.tar.gz: 3c71aa32e2383276078b518b2bd2dc4456eb4d56
5
5
  SHA512:
6
- metadata.gz: 52f8a0c49c1cbc6db7d9fb3de4b024bc261b41b443be37a09736170083e0647f59a65d468377501bbbc029e911ca61c3780e0fbb38fe7eb49813b2fc8d4a5fba
7
- data.tar.gz: 084e97a8ad34092e53547d4a3728a0c6f7a22f1d4e036447971ec1bd7fd8270d745833e48e938faf7cb98265f43683d046af22acc6a4a33e0b8cbb43dfe6dd2b
6
+ metadata.gz: 4d1d8341564158a4e8aa96d9ad7ef7ea7455f43bdbb8ead615179ca92692352f9903d8ef8da56036f6813dafbca4211860e00d6926c278dafd9f48b0ff6a0809
7
+ data.tar.gz: 7ea497584135d9dbd07387c06a2703a201162131a8e61213ed215341ffd8617c736028662ddf776107687dcb8b51df9c6aeade47c0b8ca35df82893276cdf0c4
data/Gemfile CHANGED
@@ -2,6 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ebook_renamer.gemspec
4
4
  gemspec
5
-
6
- gem 'code_lister', '~> 0.0.6'
7
- gem 'minitar'
data/README.md CHANGED
@@ -169,6 +169,14 @@ rake
169
169
 
170
170
  ### Changelog
171
171
 
172
+ #### 0.0.3
173
+
174
+ - Use generic functions from [agile_utils][] gem
175
+
176
+ - Update [index_html][] gem from 0.0.5 to 0.0.7
177
+
178
+ - Fix the bug in generated 'index.html' due to bug from index_html gem
179
+
172
180
  #### 0.0.2
173
181
 
174
182
  - Add the 'index_html' gem to generate the 'index.html' to the output
@@ -196,3 +204,5 @@ rake
196
204
  [vim colorschemes]: https://github.com/flazz/vim-colorschemes/tree/master/colors
197
205
  [seoul256.vim]: https://github.com/junegunn/seoul256.vim
198
206
  [Tomorrow-theme]: https://github.com/ChrisKempson/Tomorrow-Theme
207
+ [agile_utils]: https://rubygems.org/gems/agile_utils
208
+ [index_html]: https://rubygems.org/gems/index_html
@@ -1,8 +1,10 @@
1
+ require 'agile_utils'
1
2
  require 'code_lister'
2
3
  require 'index_html'
3
4
  require_relative '../vim_printer'
4
5
 
5
6
  module VimPrinter
7
+ include AgileUtils
6
8
 
7
9
  class CLI < CodeLister::BaseCLI
8
10
 
@@ -67,7 +69,7 @@ Print the list of files
67
69
  to_htmls(input_files, options)
68
70
 
69
71
  # Search for files that we created
70
- generated_files = VimPrinter::Utility.find(options[:base_dir])
72
+ generated_files = AgileUtils::FileUtil.find(options[:base_dir])
71
73
 
72
74
  # Generate the 'index.html' file
73
75
  index_file = "#{options[:base_dir]}/index.html"
@@ -75,19 +77,16 @@ Print the list of files
75
77
  base_dir: options[:base_dir],
76
78
  output: index_file
77
79
 
78
- # We add the missing index file
80
+ # Add the missing index file
79
81
  generated_files << index_file
82
+ AgileUtils::FileUtil.tar_gzip_files(generated_files, 'output.tar.gz')
83
+ AgileUtils::FileUtil.delete(generated_files)
80
84
 
81
- VimPrinter::Utility.tar_gzip_files(generated_files, 'output.tar.gz')
82
-
83
- # Cleanup after ourself
84
- VimPrinter::Utility.delete(generated_files)
85
-
86
- # Remove the extra index.html file as well
85
+ # Remove the extra index.html file
87
86
  FileUtils.rm_rf(index_file)
88
87
 
89
88
  # report the result
90
- puts "Your result should be available at `output.tar.gz`"
89
+ puts "Your result should be available at #{File.absolute_path('output.tar.gz')}"
91
90
  end
92
91
 
93
92
  # convert multiple files to 'html'
@@ -1,3 +1,3 @@
1
1
  module VimPrinter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/vim_printer.rb CHANGED
@@ -3,5 +3,4 @@ require 'code_lister'
3
3
  require_relative 'vim_printer/core_ext/hash'
4
4
  require_relative 'vim_printer/version'
5
5
  require_relative 'vim_printer/logger'
6
- require_relative 'vim_printer/utility'
7
6
  require_relative 'vim_printer/cli'
@@ -0,0 +1,8 @@
1
+ require_relative '../../test_helper'
2
+ describe VimPrinter do
3
+ context '#dummy_test' do
4
+ it 'must work' do
5
+ "text".wont_be_empty
6
+ end
7
+ end
8
+ end
data/test/test_helper.rb CHANGED
@@ -1,12 +1,8 @@
1
+ # standard include
1
2
  require 'minitest/autorun'
2
3
  require 'minitest/pride'
3
4
  require 'minitest-spec-context'
4
5
 
5
6
  require 'awesome_print'
6
7
  require 'pry'
7
- require 'archive/tar/minitar'
8
-
9
8
  require_relative '../lib/vim_printer'
10
- include Archive::Tar
11
- include Archive::Tar::Minitar
12
-
data/vim_printer.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = VimPrinter::VERSION
9
9
  spec.authors = ["Burin Choomnuan"]
10
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}
11
+ spec.description = %q{Print/export files to html using the power of Vim editor}
12
+ spec.summary = %q{Print/export files to html using the power of Vim}
13
13
  spec.homepage = "https://github.com/agilecreativity/vim_printer"
14
14
  spec.license = "MIT"
15
15
  spec.files = `git ls-files`.split($/)
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_runtime_dependency "thor", "~> 0.18"
21
21
  spec.add_runtime_dependency "code_lister", "~> 0.0.6"
22
- spec.add_runtime_dependency "index_html", "~> 0.0.5"
23
- spec.add_runtime_dependency "minitar", "~> 0.5.4"
22
+ spec.add_runtime_dependency "index_html", "~> 0.0.7"
23
+ spec.add_runtime_dependency "agile_utils", "~> 0.0.2"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
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.2
4
+ version: 0.0.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-04-17 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.5
47
+ version: 0.0.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.5
54
+ version: 0.0.7
55
55
  - !ruby/object:Gem::Dependency
56
- name: minitar
56
+ name: agile_utils
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.4
61
+ version: 0.0.2
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.5.4
68
+ version: 0.0.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -206,7 +206,7 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0.8'
209
- description: Print any files using the power of Vim
209
+ description: Print/export files to html using the power of Vim editor
210
210
  email:
211
211
  - agilecreativity@gmail.com
212
212
  executables:
@@ -232,7 +232,6 @@ files:
232
232
  - lib/vim_printer/cli.rb
233
233
  - lib/vim_printer/core_ext/hash.rb
234
234
  - lib/vim_printer/logger.rb
235
- - lib/vim_printer/utility.rb
236
235
  - lib/vim_printer/version.rb
237
236
  - test/fixtures/inputs/demo1.xxx.rb
238
237
  - test/fixtures/inputs/demo1.yyy.rb
@@ -252,7 +251,7 @@ files:
252
251
  - test/fixtures/outputs/java/demo3.yyy.java.xhtml
253
252
  - test/fixtures/outputs/java/demo4.xxx.java.xhtml
254
253
  - test/fixtures/outputs/java/demo4.yyy.java.xhtml
255
- - test/lib/vim_printer/test_utility.rb
254
+ - test/lib/vim_printer/test_cli.rb
256
255
  - test/test_helper.rb
257
256
  - vim_printer.gemspec
258
257
  homepage: https://github.com/agilecreativity/vim_printer
@@ -278,7 +277,7 @@ rubyforge_project:
278
277
  rubygems_version: 2.2.2
279
278
  signing_key:
280
279
  specification_version: 4
281
- summary: Print any files at once using the power of Vim
280
+ summary: Print/export files to html using the power of Vim
282
281
  test_files:
283
282
  - test/fixtures/inputs/demo1.xxx.rb
284
283
  - test/fixtures/inputs/demo1.yyy.rb
@@ -298,6 +297,6 @@ test_files:
298
297
  - test/fixtures/outputs/java/demo3.yyy.java.xhtml
299
298
  - test/fixtures/outputs/java/demo4.xxx.java.xhtml
300
299
  - test/fixtures/outputs/java/demo4.yyy.java.xhtml
301
- - test/lib/vim_printer/test_utility.rb
300
+ - test/lib/vim_printer/test_cli.rb
302
301
  - test/test_helper.rb
303
302
  has_rdoc:
@@ -1,88 +0,0 @@
1
- require 'zlib'
2
- require 'stringio'
3
- require 'find'
4
- require 'fileutils'
5
- require 'archive/tar/minitar'
6
-
7
- module VimPrinter
8
-
9
- include Archive::Tar
10
- include Archive::Tar::Minitar
11
-
12
- module Utility
13
-
14
- # @todo use me when you have to!
15
- CustomError = Class.new(StandardError)
16
-
17
- class << self
18
-
19
- # Find list of files based on certain extension
20
- #
21
- # @param [String] base_dir the starting directory
22
- # @param [String] extension the file extension to search for
23
- #
24
- # @return [Array<String>] list of matching files or empty list
25
- def find(base_dir, extension = 'xhtml')
26
- file_paths = []
27
- Find.find(base_dir) do |path|
28
- file_paths << path if path =~ /.*\.#{extension}$/
29
- end
30
- file_paths || []
31
- end
32
-
33
- # Tar and gzip list of files
34
- #
35
- # @param [Array<String>] files list of input files
36
- # @param [String] output the output file in .tar.gz format
37
- def tar_gzip_files(files, output = 'output.tar.gz')
38
- begin
39
- sgz = Zlib::GzipWriter.new(File.open(output, 'wb'))
40
- tar = Minitar::Output.new(sgz)
41
- files.each do |file|
42
- Minitar.pack_file(file, tar)
43
- end
44
- ensure
45
- # Closes both tar and sgz.
46
- tar.close unless tar.nil?
47
- tar = nil
48
- end
49
- end
50
-
51
- # Delete the files from the given list
52
- def delete(files)
53
- # Note: should we remove the files and be done with it?
54
- files.each do |file|
55
- #puts "FYI: about to delete file #{file}"
56
- FileUtils.rm_rf(file)
57
- end
58
- end
59
-
60
- # Add suffix to each extensions
61
- #
62
- # @param [Array<String>] extensions list of extension
63
- # @param [String] suffix the suffix string
64
- #
65
- # @return [Array<String>] new list with the suffix added to each element
66
- def add_suffix(extensions = %w(rb pdf), suffix)
67
- extensions.map {|e| "#{e}.#{suffix}" }
68
- end
69
-
70
- # Time the operation before and after the operation for tuning purpose
71
- def time
72
- beg_time = Time.now
73
- yield
74
- end_time = Time.now
75
- end_time - beg_time
76
- end
77
-
78
- end
79
- end
80
- end
81
-
82
- if __FILE__ == $0
83
- include VimPrinter::Utility
84
- include Archive::Tar
85
- include Archive::Tar::Minitar
86
- files = VimPrinter::Utility.find('test/fixtures/inputs')
87
- VimPrinter::Utility.tar_gzip_files(files, 'test/fixtures/output.tar.gz')
88
- end
@@ -1,48 +0,0 @@
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