source2epub 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49381aa871fbc375f7b62d6100d7566c1521d8a7
4
- data.tar.gz: 650952fef912b638c94bac9405cfd916a90047aa
3
+ metadata.gz: 19d5b12cf8b5ad412833dea86bfa538106755c2b
4
+ data.tar.gz: bacbd2e2844ed886a3c8f58125fcdac77f1fe70c
5
5
  SHA512:
6
- metadata.gz: 23eff92128f60398434a3c5569c63ff3337607d588fde7147ceb407b4f67490b8f764d006d051951b8e9e2ebf39ee6fbe69c7f3bc0d0715d4258f46d5966ec7d
7
- data.tar.gz: 255d4424d223017d65bd3d60eafae2bbcae294ddec40ea8c343f23c64d0b06a68c690a4b4e3d3a316e34f0d5307f3c8cdf3483e642a9ae85a6befb247cc04207
6
+ metadata.gz: 9deec68b5c3e2d2d012ca8d14228b642256b0258b1f163db61f9dc7a43e25b09e2978038cd33d9f44c446a9ae4a12cbdfb05a39bf9923c899919f0f598d8fe67
7
+ data.tar.gz: 93bcf378e58cf94442936c91f06f47e2631da95b12d62ba4203262e38ad2f99921bcce446e7dc37d66bcf53d34bb746b823401d2b1e1b2dd9982ad49b8334b26
data/.rubocop.yml CHANGED
@@ -3,9 +3,10 @@ AllCops:
3
3
  - Gemfile
4
4
  - Rakefile
5
5
  - bin/*
6
- - source2epub.gemspec
7
6
  - lib/**/*.rb
8
7
  - test/**/*.rb
8
+ Exclude:
9
+ - source2epub.gemspec
9
10
 
10
11
  # Avoid long parameter lists
11
12
  ParameterLists:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ #### 0.2.2
2
+
3
+ - Code refactoring
4
+
1
5
  #### 0.2.1
2
6
 
3
7
  - Make ruby 2.1.0+ as required in spec file
@@ -3,7 +3,7 @@ module Source2Epub
3
3
  attr_accessor :creator,
4
4
  :publisher,
5
5
  :published_date,
6
- :identifier,
6
+ :identifier
7
7
  def initialize
8
8
  @creator = "https://github.com/agilecreativity/source2epub"
9
9
  @publisher = "http://agilecreativity.com"
@@ -12,6 +12,7 @@ module Source2Epub
12
12
  :theme,
13
13
  :command,
14
14
  :epub_title
15
+
15
16
  attr_reader :base_dir,
16
17
  :repo_name,
17
18
  :output_path
@@ -49,7 +50,7 @@ module Source2Epub
49
50
  cleanup
50
51
  end
51
52
 
52
- private
53
+ private
53
54
 
54
55
  def clone
55
56
  if File.exist?(output_path)
@@ -96,33 +97,19 @@ module Source2Epub
96
97
  # Convert list of html to list of epub file
97
98
  def htmls2epub
98
99
  input_file = File.expand_path("#{output_path}/vim_printer_#{repo_name}.tar.gz")
99
-
100
100
  if File.exist?(input_file)
101
- FileUtils.mkdir_p output_dir
102
- AgileUtils::FileUtil.gunzip input_file, output_dir
101
+ FileUtils.mkdir_p(output_dir)
102
+ AgileUtils::FileUtil.gunzip(input_file, output_dir)
103
103
  xhtml_files = CodeLister.files base_dir: output_dir,
104
104
  recursive: true,
105
105
  exts: %w[xhtml],
106
106
  non_exts: []
107
107
  project_dir = File.expand_path(File.dirname(output_dir) + "../../#{Source2Epub::TMP_DIR}/#{repo_name}")
108
-
109
108
  xhtml_files.map! do |f|
110
109
  File.expand_path(f.gsub(/^\./, project_dir))
111
110
  end
112
-
113
111
  nav_list = nav_index(xhtml_files, project_dir)
114
- # Note: need to assign the local varaiable for this to work
115
- title = epub_title
116
- epub = EeePub.make do
117
- title title
118
- creator Source2Epub.configuration.creator
119
- publisher Source2Epub.configuration.publisher
120
- date Source2Epub.configuration.published_date
121
- identifier Source2Epub.configuration.identifier, scheme: "URL"
122
- files(xhtml_files)
123
- nav nav_list
124
- end
125
- epub.save(output_filename)
112
+ create_epub(xhtml_files, nav_list)
126
113
  end
127
114
  end
128
115
 
@@ -184,5 +171,20 @@ module Source2Epub
184
171
  # Also remove the 'vim_printer_#{repo_name}.tar.gz' if we have one
185
172
  FileUtils.rm_rf File.expand_path(File.dirname(output_dir) + "../../#{repo_name}/vim_printer_#{repo_name}.tar.gz")
186
173
  end
174
+
175
+ def create_epub(xhtml_files, nav_list)
176
+ # Note: need to assign the local varaiable for this to work
177
+ title = epub_title
178
+ epub = EeePub.make do
179
+ title title
180
+ creator Source2Epub.configuration.creator
181
+ publisher Source2Epub.configuration.publisher
182
+ date Source2Epub.configuration.published_date
183
+ identifier Source2Epub.configuration.identifier, scheme: "URL"
184
+ files(xhtml_files)
185
+ nav nav_list
186
+ end
187
+ epub.save(output_filename)
188
+ end
187
189
  end
188
190
  end
@@ -1,3 +1,3 @@
1
1
  module Source2Epub
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: source2epub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burin Choomnuan