Module: LFD::Env

Included in:
App
Defined in:
lib/lfd/env.rb

Instance Method Summary collapse

Instance Method Details

#check_cmd(title, cmd_path) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/lfd/env.rb', line 16

def check_cmd title, cmd_path
  print "#{title}: ".capitalize.rjust(20)
  if cmd_path
    puts cmd_path.chomp.green
  else
    puts "✗".red
  end
end

#check_flash_playerObject



25
26
27
# File 'lib/lfd/env.rb', line 25

def check_flash_player
  check_cmd 'Flash Player', fp_path
end

#check_flex_sdkObject



11
12
13
14
# File 'lib/lfd/env.rb', line 11

def check_flex_sdk
  check_cmd( "flex sdk - mxmlc", mxmlc_path )
  check_cmd( "flex sdk - compc", compc_path )
end

#compcObject



58
59
60
# File 'lib/lfd/env.rb', line 58

def compc
  ENV['COMPC'] || 'compc'
end

#compc_pathObject



62
63
64
# File 'lib/lfd/env.rb', line 62

def compc_path
  @compc_path ||= executable_path( compc )
end

#compc_ready?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/lfd/env.rb', line 46

def compc_ready?
  executable? compc
end

#env(opt = {}) ⇒ Object

Public: Check the flash developing environment



6
7
8
9
# File 'lib/lfd/env.rb', line 6

def env(opt={})
  check_flex_sdk
  check_flash_player
end

#executable?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/lfd/env.rb', line 37

def executable? cmd
  !!executable_path( cmd )
end

#executable_path(cmd) ⇒ Object



41
42
43
44
# File 'lib/lfd/env.rb', line 41

def executable_path cmd
  path = `which #{Shellwords.escape(cmd)}`
  path.empty? ? nil : path.chomp
end

#flash_playerObject



72
73
74
# File 'lib/lfd/env.rb', line 72

def flash_player
  ENV['FLASH_PLAYER'] || 'flashplayer'
end

#flash_player_pathObject Also known as: fp_path



76
77
78
# File 'lib/lfd/env.rb', line 76

def flash_player_path
  @fp_path ||= executable_path( flash_player )
end

#flash_player_ready?Boolean Also known as: fp_ready?

Returns:

  • (Boolean)


66
67
68
# File 'lib/lfd/env.rb', line 66

def flash_player_ready?
  executable? flash_player
end

#flex_sdk_ready?Boolean

Returns:

  • (Boolean)


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

def flex_sdk_ready?
  mxmlc_ready? && compc_ready?
end

#mm_cfgObject



86
87
88
# File 'lib/lfd/env.rb', line 86

def mm_cfg
  File.join ENV['HOME'], 'mm.cfg'
end

#mxmlcObject



50
51
52
# File 'lib/lfd/env.rb', line 50

def mxmlc
  ENV['MXMLC'] || 'mxmlc'
end

#mxmlc_pathObject



54
55
56
# File 'lib/lfd/env.rb', line 54

def mxmlc_path
  @mxmlc_path ||= executable_path( mxmlc )
end

#mxmlc_ready?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/lfd/env.rb', line 33

def mxmlc_ready?
  executable? mxmlc
end

#trace_log_fileObject



82
83
84
# File 'lib/lfd/env.rb', line 82

def trace_log_file
  File.join ENV['HOME'], '.macromedia/Flash_Player/Logs/flashlog.txt'
end