github_exporter 0.1.0 → 0.1.1
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/CHANGELOG.md +5 -0
- data/github_exporter.gemspec +3 -4
- data/lib/github_exporter/exporter.rb +23 -37
- data/lib/github_exporter/github_exporter.rb +2 -5
- data/lib/github_exporter/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e584930fb1946cb9a0682f911a9d21c9bc85f0
|
4
|
+
data.tar.gz: ad760387610116c613c82c4ef844222695445139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d55a11d36965350712b82bb0e435c1fcc645b36f26c52d6f947fd018c0ff7c48ef049a04cada4b4254279d86529f738996336e2c3a5ce1bcb80a3dc7b6ecd74
|
7
|
+
data.tar.gz: 32f9bfe213494a87eb9a6c756d36c4b58d52b6e5c792b43772054ef2b9b8a5be816e7fb132fb6d0682dce7d4e84ec093ce8fe6cfd5c5ee27cec3402c8f561310
|
data/CHANGELOG.md
CHANGED
data/github_exporter.gemspec
CHANGED
@@ -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
|
11
|
-
spec.description = %q{Export any project from
|
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
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
116
|
-
|
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
|
114
|
+
def copy_output
|
122
115
|
generated_file = "#{output_dir}/pdfs2pdf_#{repo_name}.pdf"
|
123
|
-
|
124
|
-
|
125
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
|
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.
|
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-
|
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
|
280
|
-
useful features of the following ruby gems\n
|
281
|
-
html2pdf, pdfs2pdf and others)\n to
|
282
|
-
|
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
|
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:
|