Class: Shining::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/shining/player.rb

Instance Method Summary collapse

Constructor Details

#initialize(preso) ⇒ Player

Returns a new instance of Player.

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/shining/player.rb', line 10

def initialize preso
  raise ArgumentError, "argument needs to be an instance of Shining::Preso" unless preso.is_a? Shining::Preso
  @preso = preso
end

Instance Method Details

#decompressObject



30
31
32
33
# File 'lib/shining/player.rb', line 30

def decompress
  Shining.say "Decompressing /tmp/plainview.zip"
  `unzip -o -d /tmp /tmp/plainview.zip`
end

#downloadObject



25
26
27
28
# File 'lib/shining/player.rb', line 25

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

#go!Object

Raises:

  • (RuntimeError)


15
16
17
18
19
20
21
22
23
# File 'lib/shining/player.rb', line 15

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

#installObject



35
36
37
38
# File 'lib/shining/player.rb', line 35

def install
  new_dir @preso.path/'vendor'
  move '/tmp/Plainview.app', @preso.path/'vendor/'
end

#installed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/shining/player.rb', line 40

def installed?
  dir? @preso.path/'vendor'/'Plainview.app'
end