Module: ShellCast

Defined in:
lib/shellcast.rb,
lib/shellcast/player.rb,
lib/shellcast/recorder.rb,
lib/shellcast/publisher.rb

Defined Under Namespace

Classes: Player, Publisher, Recorder

Constant Summary collapse

APP_NAME =
'shellcast'
DATA_DIR =
File.join(XDG['DATA_HOME'].to_s,   APP_NAME)
CONFIG_DIR =
File.join(XDG['CONFIG_HOME'].to_s, APP_NAME)
API_KEY =
File.join(CONFIG_DIR, 'api_key')
API_URL =
ENV['SC_LOCAL'] ? 'http://localhost:3000' : 'http://shell.heroku.com'

Class Method Summary collapse

Class Method Details

.api_keyObject



17
18
19
20
# File 'lib/shellcast.rb', line 17

def api_key
  return false unless File.exist?(API_KEY)
  @api_key ||= File.read(API_KEY).strip
end

.api_key=(key) ⇒ Object



22
23
24
25
26
27
# File 'lib/shellcast.rb', line 22

def api_key=(key)
  FileUtils.mkdir_p(CONFIG_DIR) unless File.exist?(CONFIG_DIR)
  File.open(API_KEY, 'w+') do |f|
    f.puts(key.strip)
  end
end

.shellcast_dir(shellcast_id) ⇒ Object



29
30
31
# File 'lib/shellcast.rb', line 29

def shellcast_dir(shellcast_id)
  File.join(ShellCast::DATA_DIR, shellcast_id.to_s)
end