Class: Bibi::Publish
- Inherits:
-
Object
- Object
- Bibi::Publish
- Extended by:
- Dry::Configurable
- Defined in:
- lib/bibi/publish.rb
Constant Summary collapse
- DEFAULT_MEDIA_TYPE =
"application/octet-stream"
Instance Method Summary collapse
-
#initialize(profile: :default, dry_run: false, **options) ⇒ Publish
constructor
A new instance of Publish.
- #run(epub, name) ⇒ Object
Constructor Details
#initialize(profile: :default, dry_run: false, **options) ⇒ Publish
Returns a new instance of Publish.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bibi/publish.rb', line 24 def initialize(profile: :default, dry_run: false, **) @profile = profile load_config update_config @dry_run = dry_run $stderr.puts <<EOS bibi: #{self.bibi} bookshelf: #{self.bookshelf} page: #{page?} head_end: #{self.head_end} body_end: #{self.body_end} endpoint: #{endpoint} EOS end |
Instance Method Details
#run(epub, name) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bibi/publish.rb', line 40 def run(epub, name) @epub = EPUB::Parser.parse(epub) @name = name raise "bibi or bookshelf URI is required." if bibi.nil? && bookshelf.nil? raise "bibi URI is required when generating HTML" if page? && bibi.nil? if config[:endpoint] # `force_path_style` required to upload to MinIO server Aws.config.update endpoint: config[:endpoint], force_path_style: true end upload_contents upload_html if page? end |