Sha256: 95bade678adbdf047026168ca8e6fe733ecbbb15e27e01cc05b6dc09af832baf

Contents?: true

Size: 1.32 KB

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
shining-2.0.1 lib/shining/player.rb
shining-2.0.0 lib/shining/player.rb
shining-1.3.7 lib/shining/player.rb
shining-1.3.6 lib/shining/player.rb
shining-1.3.5 lib/shining/player.rb
shining-1.3.4 lib/shining/player.rb
shining-1.3.3 lib/shining/player.rb
shining-1.3.2 lib/shining/player.rb
shining-1.3.1 lib/shining/player.rb
shining-1.3.0 lib/shining/player.rb
shining-1.2.0 lib/shining/player.rb
shining-1.1.8 lib/shining/player.rb