github_exporter 0.1.0 → 0.1.1

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: 47dcd5396b00731afac0413cf3828b3b68a7c08f
4
- data.tar.gz: e2e30f973770a966a06ce78bb97a711695204218
3
+ metadata.gz: b9e584930fb1946cb9a0682f911a9d21c9bc85f0
4
+ data.tar.gz: ad760387610116c613c82c4ef844222695445139
5
5
  SHA512:
6
- metadata.gz: 22976c785ba411819679e2882c765d46c236cc347d2b08c040382013dc0bd0afc6a684f5ffccf84148af48885e6bc5dac76e0e3ee6e455d9cd9c8843d798f1f6
7
- data.tar.gz: c2840d83bed7a41e8925e1f5d945023086389f6aed3002498ebe1abe3e368817ff97675c8f861ed696ca854ea4ce4c8a527ff13d8d00fbb4106e5b6284669509
6
+ metadata.gz: 6d55a11d36965350712b82bb0e435c1fcc645b36f26c52d6f947fd018c0ff7c48ef049a04cada4b4254279d86529f738996336e2c3a5ce1bcb80a3dc7b6ecd74
7
+ data.tar.gz: 32f9bfe213494a87eb9a6c756d36c4b58d52b6e5c792b43772054ef2b9b8a5be816e7fb132fb6d0682dce7d4e84ec093ce8fe6cfd5c5ee27cec3402c8f561310
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ #### 0.1.1
2
+
3
+ - Fix style with the help of rubocop
4
+ - Misc code cleanup
5
+
1
6
  #### 0.1.0
2
7
 
3
8
  - Initial release following the [semantic versioning][]
@@ -7,12 +7,11 @@ Gem::Specification.new do |spec|
7
7
  spec.version = GithubExporter::VERSION
8
8
  spec.authors = ["Burin Choomnuan"]
9
9
  spec.email = ["agilecreativity@gmail.com"]
10
- spec.summary = %q(Export any project from github to a single pdf file)
11
- spec.description = %q{Export any project from github to a single pdf file.
10
+ spec.summary = %q(Export any project from Github or a local project directory to a single pdf file)
11
+ spec.description = %q{Export any project from Github (or a local directory) to a single pdf file.
12
12
  Combine useful features of the following ruby gems
13
13
  (vim_printer, html2pdf, pdfs2pdf and others)
14
- to produce a single pdf file that can be view any where
15
- where pdf is supported.
14
+ to produce a single pdf file for quick review.
16
15
  }
17
16
  spec.homepage = "https://github.com/agilecreativity/github_exporter"
18
17
  spec.license = "MIT"
@@ -3,9 +3,8 @@ require "uri"
3
3
  require "agile_utils"
4
4
  require_relative "../github_exporter"
5
5
  module GithubExporter
6
- # The temporary directory
7
6
  TMP_DIR = "github_exporter_tmp"
8
-
7
+ # rubocop:disable ClassLength, MethodLength
9
8
  class Exporter
10
9
  attr_reader :url,
11
10
  :exts,
@@ -41,6 +40,7 @@ module GithubExporter
41
40
  files2htmls
42
41
  htmls2pdfs
43
42
  pdfs2pdf
43
+ copy_output
44
44
  cleanup
45
45
  end
46
46
 
@@ -89,51 +89,39 @@ module GithubExporter
89
89
 
90
90
  # Convert files to htmls
91
91
  def files2htmls
92
- if input_available?
93
- GithubExporter.files_to_htmls base_dir: output_path,
94
- exts: exts,
95
- non_exts: non_exts,
96
- theme: theme
97
- end
92
+ GithubExporter.files_to_htmls base_dir: output_path,
93
+ exts: exts,
94
+ non_exts: non_exts,
95
+ theme: theme if input_available?
98
96
  end
99
97
 
100
98
  # Convert list of html to list of pdf files
101
99
  def htmls2pdfs
102
100
  input_file = File.expand_path("#{output_path}/vim_printer_#{repo_name}.tar.gz")
103
- if File.exist?(input_file)
104
- FileUtils.mkdir_p output_dir
105
- # input_file = File.expand_path("#{output_path}/vim_printer_#{repo_name}.tar.gz")
106
- AgileUtils::FileUtil.gunzip input_file, output_dir
107
- GithubExporter.htmls_to_pdfs(base_dir: output_dir)
108
- end
101
+ FileUtils.mkdir_p output_dir
102
+ AgileUtils::FileUtil.gunzip input_file, output_dir if File.exist?(input_file)
103
+ GithubExporter.htmls_to_pdfs base_dir: output_dir
109
104
  end
110
105
 
111
106
  # Merge/join multiple pdf files into single pdf
112
107
  def pdfs2pdf
113
108
  input_file = File.expand_path("#{output_dir}/html2pdf_#{repo_name}.tar.gz")
114
- if File.exist?(input_file)
115
- AgileUtils::FileUtil.gunzip input_file, output_dir
116
- GithubExporter.pdfs_to_pdf base_dir: output_dir,
117
- recursive: true
118
- end
109
+ AgileUtils::FileUtil.gunzip input_file, output_dir if File.exist?(input_file)
110
+ GithubExporter.pdfs_to_pdf base_dir: output_dir,
111
+ recursive: true
119
112
  end
120
113
 
121
- def cleanup
114
+ def copy_output
122
115
  generated_file = "#{output_dir}/pdfs2pdf_#{repo_name}.pdf"
123
- if File.exist?(generated_file)
124
- destination_file = File.expand_path(File.dirname(output_dir) + "../../#{repo_name}.pdf")
125
- FileUtils.mv generated_file, destination_file
126
- puts "Your final output is #{File.expand_path(destination_file)}"
127
-
128
- # Now cleanup the generated files
129
- FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{GithubExporter::TMP_DIR}")
130
-
131
- # Also remove the 'vim_printer_#{repo_name}.tar.gz' if we have one
132
- FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{repo_name}/vim_printer_#{repo_name}.tar.gz")
133
- end
116
+ destination_file = File.expand_path(File.dirname(output_dir) + "../../#{repo_name}.pdf")
117
+ FileUtils.mv generated_file, destination_file if File.exist?(generated_file)
118
+ puts "Your final output is #{File.expand_path(destination_file)}"
134
119
  end
135
120
 
136
- private
121
+ def cleanup
122
+ FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{GithubExporter::TMP_DIR}")
123
+ FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{repo_name}/vim_printer_#{repo_name}.tar.gz")
124
+ end
137
125
 
138
126
  def output_dir
139
127
  File.expand_path("#{base_dir}/#{GithubExporter::TMP_DIR}/#{repo_name}")
@@ -152,11 +140,9 @@ module GithubExporter
152
140
  # project_name('https://github.com/erikhuda/thor.git') #=> 'thor'
153
141
  # project_name('https://github.com/erikhuda/thor') #=> 'thor'
154
142
  def project_name(uri)
155
- if uri
156
- name = URI(uri).path.split(File::SEPARATOR).last
157
- # strip the '.' if any
158
- File.basename(name, ".*") if name
159
- end
143
+ name = URI(uri).path.split(File::SEPARATOR).last if uri
144
+ File.basename(name, ".*") if name
160
145
  end
161
146
  end
147
+ # robocop:enable All
162
148
  end
@@ -40,12 +40,9 @@ module GithubExporter
40
40
  opts.fetch(:theme, "default"),
41
41
  "--recursive"
42
42
  ]
43
+ args.concat(["--non-exts"]).concat(non_exts) unless non_exts.empty?
43
44
 
44
- # Add file without the extension if any
45
- unless non_exts.empty?
46
- args.concat(["--non-exts"]).concat(non_exts)
47
- end
48
- puts "Your input options for VimPrinter : #{args}"
45
+ puts "FYI: input options for VimPrinter : #{args}"
49
46
  VimPrinter::CLI.start(args)
50
47
  end
51
48
 
@@ -1,3 +1,3 @@
1
1
  module GithubExporter
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-06-10 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -276,11 +276,10 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0.8'
279
- description: "Export any project from github to a single pdf file.\n Combine
280
- useful features of the following ruby gems\n (vim_printer,
281
- html2pdf, pdfs2pdf and others)\n to produce a single pdf
282
- file that can be view any where\n where pdf is supported.\n
283
- \ "
279
+ description: "Export any project from Github (or a local directory) to a single pdf
280
+ file.\n Combine useful features of the following ruby gems\n
281
+ \ (vim_printer, html2pdf, pdfs2pdf and others)\n to
282
+ produce a single pdf file for quick review.\n "
284
283
  email:
285
284
  - agilecreativity@gmail.com
286
285
  executables:
@@ -326,6 +325,7 @@ rubyforge_project:
326
325
  rubygems_version: 2.2.2
327
326
  signing_key:
328
327
  specification_version: 4
329
- summary: Export any project from github to a single pdf file
328
+ summary: Export any project from Github or a local project directory to a single pdf
329
+ file
330
330
  test_files: []
331
331
  has_rdoc: