Class: Mnogootex::CLI
Constant Summary collapse
- IS_MNOGOO =
(ENV['IS_MNOGOO'] == 'true').freeze
Class Method Summary collapse
Instance Method Summary collapse
- #cd(*args) ⇒ Object
- #clobber ⇒ Object
- #dir(*args) ⇒ Object
- #go(*args) ⇒ Object
- #mnogoo ⇒ Object
- #open(*args) ⇒ Object
- #pdf(*args) ⇒ Object
Class Method Details
Instance Method Details
#cd(*args) ⇒ Object
21 |
# File 'lib/mnogootex/cli.rb', line 21 def cd(*args); end |
#clobber ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/mnogootex/cli.rb', line 37 def clobber # NOTE: this is a tad slow - using shell would improve that tmp_dir = Pathname.new(Dir.tmpdir).join('mnogootex') tmp_dir_size = Mnogootex::Utils.humanize_bytes Mnogootex::Utils.dir_size(tmp_dir) print "Freeing up #{tmp_dir_size}... " FileUtils.rm_r tmp_dir, secure: true if tmp_dir.directory? puts 'Done.' end |
#dir(*args) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/mnogootex/cli.rb', line 56 def dir(*args) jobs, main, = Mnogootex::Cfg.recombobulate(*args) if jobs.empty? puts main.dirname else jobs.map! { |hid| Mnogootex::Job::Porter.new hid: hid, source_path: main } jobs.map!(&:target_dir) puts jobs end end |
#go(*args) ⇒ Object
48 49 50 51 52 |
# File 'lib/mnogootex/cli.rb', line 48 def go(*args) _, main, cfg = Mnogootex::Cfg.recombobulate(*args) cfg = Mnogootex::Cfg::DEFAULTS.merge cfg Mnogootex::Job::Warden.new(source: main, configuration: cfg).start end |
#mnogoo ⇒ Object
31 32 33 |
# File 'lib/mnogootex/cli.rb', line 31 def mnogoo puts Pathname.new('mnogoo.sh') end |
#open(*args) ⇒ Object
25 |
# File 'lib/mnogootex/cli.rb', line 25 def open(*args); end |
#pdf(*args) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/mnogootex/cli.rb', line 70 def pdf(*args) jobs, main, cfg = Mnogootex::Cfg.recombobulate(*args) jobs = cfg['jobs'] if jobs.empty? jobs.map! { |hid| Mnogootex::Job::Porter.new hid: hid, source_path: main } jobs.map! { |porter| porter.target_path.sub_ext('.pdf') } puts jobs end |