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



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

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



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

def check_flash_player
  check_cmd 'Flash Player', fp_path
end

#check_flex_sdkObject



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

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

#compcObject



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

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

#compc_pathObject



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

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

#compc_ready?Boolean

Returns:

  • (Boolean)


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

def compc_ready?
  executable? compc
end

#env(opt = {}) ⇒ Object

Public: Check the flash developing environment



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

def env(opt={})
  check_flex_sdk
  check_flash_player
end

#executable?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


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

def executable? cmd
  !!executable_path( cmd )
end

#executable_path(cmd) ⇒ Object



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

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

#flash_playerObject



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

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

#flash_player_pathObject Also known as: fp_path



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

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

#flash_player_ready?Boolean Also known as: fp_ready?

Returns:

  • (Boolean)


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

def flash_player_ready?
  executable? flash_player
end

#flex_sdk_ready?Boolean

Returns:

  • (Boolean)


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

def flex_sdk_ready?
  mxmlc_ready? && compc_ready?
end

#mm_cfgObject



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

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

#mxmlcObject



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

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

#mxmlc_pathObject



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

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

#mxmlc_ready?Boolean

Returns:

  • (Boolean)


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

def mxmlc_ready?
  executable? mxmlc
end

#trace_log_fileObject



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

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