Sha256: 68f3aa9784bcb9f0d342347573bea43d21eee7203d3bcbe5baae8b2999a6f39b

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

# For now this is just a wrapper for Plainview. More goodness coming soon

require 'rbconfig'

module Shining

class Player
  include FileMethods and extend FileMethods
  
  def initialize(preso)
    raise ArgumentError, "argument needs to be an instance of Shining::Preso" unless preso.is_a? Shining::Preso
    @preso = preso
  end
  
  def go!
    raise RuntimeError, %w(
        Sorry! We currently only support Plainview on MacOSX as
        a player. Manually open your presentation's index.html
        via Safari or Chrome for the time being.
      ).join(' ') unless osx?
    download and decompress and install unless installed?
    `#{@preso.path}/vendor/Plainview.app/Contents/MacOS/Plainview #{@preso.path}/index.html`
  end
  
  def download
    Shining.say "Downloading Plainview from http://s3.amazonaws.com/plainviewapp/plainview_1.0.173.zip..."
    `curl -# http://s3.amazonaws.com/plainviewapp/plainview_1.0.173.zip -o /tmp/plainview.zip`
  end
  
  def decompress
    Shining.say "Decompressing /tmp/plainview.zip"
    `unzip -o -d /tmp /tmp/plainview.zip`
  end
  
  def install
    new_dir @preso.path/'vendor'
    move '/tmp/Plainview.app', @preso.path/'vendor/'
  end
  
  def installed?
    dir? @preso.path/'vendor'/'Plainview.app'
  end
    
  protected
  def osx?
    Config::CONFIG['host_os'].include? 'darwin'
  end
end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shining-1.1.7 lib/shining/player.rb
shining-1.1.5 lib/shining/player.rb
shining-1.1.4 lib/shining/player.rb
shining-1.1.3 lib/shining/player.rb
shining-1.1.2 lib/shining/player.rb
shining-1.1.1 lib/shining/player.rb
shining-1.1.0 lib/shining/player.rb