Sha256: 412f82ac58e0c6d2d99b08c2f92f3d11818b0f995090f0f448a7631b2b39c309
Contents?: true
Size: 1014 Bytes
Versions: 2
Compression:
Stored size: 1014 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true ADB = ENV['ADB'] || 'adb' TARGETS = { '.epub' => '/sdcard/', '.mobi' => '/sdcard/Android/data/com.amazon.kindle/files/' }.freeze unless File.executable? ADB warn %(adb-push-ebook: `adb` not found.\nPlease set the ADB environment variable or add `adb` to your PATH.) exit 1 end require 'open3' require 'shellwords' payload_file = ARGV[0] || '_output/sample-book' transfers = if (payload_file_ext = File.extname payload_file).empty? TARGETS.map do |(ext, target_dir)| { src: %(#{payload_file}#{ext}), dest: target_dir } end else [{ src: payload_file, dest: TARGETS[payload_file_ext] }] end transfers.each do |transfer| next unless File.file? transfer[:src] Open3.popen2e Shellwords.join([ADB, 'push', transfer[:src], transfer[:dest]]) do |_input, output, _wait_thr| output.each { |line| puts line } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
asciidoctor-epub3-2.0.1 | bin/adb-push-ebook |
asciidoctor-epub3-2.0.0 | bin/adb-push-ebook |