epuber 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/epuber/book/target.rb +0 -1
- data/lib/epuber/book/toc_item.rb +0 -1
- data/lib/epuber/command/build.rb +1 -1
- data/lib/epuber/command/server.rb +1 -1
- data/lib/epuber/command.rb +9 -0
- data/lib/epuber/compiler/opf_generator.rb +13 -3
- data/lib/epuber/config.rb +12 -0
- data/lib/epuber/dsl/attribute.rb +5 -1
- data/lib/epuber/dsl/attribute_support.rb +2 -6
- data/lib/epuber/dsl/object.rb +0 -5
- data/lib/epuber/server/pages/book.bade +1 -1
- data/lib/epuber/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcab657cbef790188e95b1b238d68438e7f523e78be9c712209803c3808c3ca1
|
4
|
+
data.tar.gz: d36fe7e3f63eb459e9036a587adee857a5f9552524c35e8ef63ef0a867302eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 640ffc22f2584d5ce642a7c7e923b13734e66e9db7fed5c2094b874b69ff56e0feabd75951be7886ac05ff94aa661b0a44e047b7cea4358d6f9efce7747b8ae2
|
7
|
+
data.tar.gz: eff25321a3950ccfd005fcdc3fa12b2becb8d8f2a6e2f429afdb36569f940a0461ea0165a2436a963da5b7ee88aafb895a0a7d07e7c4d4c5aec56a78be1ef81d
|
data/lib/epuber/book/target.rb
CHANGED
data/lib/epuber/book/toc_item.rb
CHANGED
data/lib/epuber/command/build.rb
CHANGED
data/lib/epuber/command.rb
CHANGED
@@ -74,5 +74,14 @@ module Epuber
|
|
74
74
|
Epuber::Config.instance.save_lockfile
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
def pre_build_checks
|
79
|
+
Config.instance.warn_for_outdated_versions!
|
80
|
+
|
81
|
+
if !Config.instance.same_version_as_last_run? && File.exist?(Config.instance.working_path)
|
82
|
+
UI.warning('Using different version of Epuber or Bade, removing all build caches')
|
83
|
+
Config.instance.remove_build_caches
|
84
|
+
end
|
85
|
+
end
|
77
86
|
end
|
78
87
|
end
|
@@ -264,13 +264,23 @@ module Epuber
|
|
264
264
|
|
265
265
|
# Creates proper mime-type for file
|
266
266
|
#
|
267
|
-
# @param file [Epuber::
|
267
|
+
# @param file [Epuber::Compiler::FileTypes::AbstractFile | String]
|
268
268
|
#
|
269
269
|
# @return [String]
|
270
270
|
#
|
271
271
|
def mime_type_for(file)
|
272
|
-
filename = file.
|
273
|
-
|
272
|
+
filename = if file.is_a?(String)
|
273
|
+
file
|
274
|
+
else
|
275
|
+
file.destination_path
|
276
|
+
end
|
277
|
+
|
278
|
+
case File.extname(filename)
|
279
|
+
when '.ttf', '.otf'
|
280
|
+
'application/vnd.ms-opentype'
|
281
|
+
else
|
282
|
+
MIME::Types.of(filename).first.content_type
|
283
|
+
end
|
274
284
|
end
|
275
285
|
|
276
286
|
# Creates hash of namespaces for root package element
|
data/lib/epuber/config.rb
CHANGED
@@ -131,6 +131,18 @@ module Epuber
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
def same_version_as_last_run?
|
135
|
+
!(bookspec_lockfile.epuber_version != Epuber::VERSION ||
|
136
|
+
bookspec_lockfile.bade_version.nil? ||
|
137
|
+
bookspec_lockfile.bade_version != Bade::VERSION)
|
138
|
+
end
|
139
|
+
|
140
|
+
def remove_build_caches
|
141
|
+
FileUtils.rm_rf(File.join(working_path, 'build_cache'))
|
142
|
+
FileUtils.rm_rf(File.join(working_path, 'build'))
|
143
|
+
FileUtils.rm_rf(File.join(working_path, 'metadata'))
|
144
|
+
end
|
145
|
+
|
134
146
|
# ---------------------------------------------------------------------------------------------------------------- #
|
135
147
|
|
136
148
|
class << self
|
data/lib/epuber/dsl/attribute.rb
CHANGED
@@ -47,8 +47,10 @@ module Epuber
|
|
47
47
|
@auto_convert = auto_convert
|
48
48
|
@types = if !types.nil?
|
49
49
|
types
|
50
|
-
elsif @default_value
|
50
|
+
elsif @default_value && @auto_convert.empty?
|
51
51
|
[@default_value.class]
|
52
|
+
elsif !@auto_convert.empty?
|
53
|
+
[@auto_convert.values.first]
|
52
54
|
else
|
53
55
|
[String]
|
54
56
|
end
|
@@ -234,6 +236,8 @@ module Epuber
|
|
234
236
|
return dest_class.call(value)
|
235
237
|
elsif dest_class.respond_to?(:parse)
|
236
238
|
return dest_class.parse(value)
|
239
|
+
elsif dest_class <= String
|
240
|
+
return value.to_s
|
237
241
|
elsif dest_class.respond_to?(:new)
|
238
242
|
return dest_class.new(value)
|
239
243
|
else
|
@@ -66,12 +66,8 @@ module Epuber
|
|
66
66
|
parent.send(key)
|
67
67
|
|
68
68
|
elsif !attr.default_value.nil?
|
69
|
-
#
|
70
|
-
|
71
|
-
root_obj.send(attr.writer_name, attr.default_value)
|
72
|
-
|
73
|
-
# and return the default value
|
74
|
-
attr.default_value
|
69
|
+
# just return the default value
|
70
|
+
attr.converted_value(attr.default_value)
|
75
71
|
end
|
76
72
|
end
|
77
73
|
|
data/lib/epuber/dsl/object.rb
CHANGED
@@ -71,7 +71,7 @@ mixin iterate_spine(toc_item)
|
|
71
71
|
|
72
72
|
|
73
73
|
+section('Targets')
|
74
|
-
- book.
|
74
|
+
- book.buildable_targets.each do |b_target|
|
75
75
|
p(class: 'target_selected' if target == b_target): a(href: "/change_target/#{b_target.name}")= b_target.name
|
76
76
|
- end
|
77
77
|
|
data/lib/epuber/version.rb
CHANGED