Sha256: a259ead6dee0d569564c7deab886be0b52c944893156c75884ca0a2680cb2b5f

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

require 'flex_sdk'
require 'shell'

module FlexAnalyzer
  
  def analyze_pmd(src,outdir)
    run_command(pmd_jar,src,outdir)
  end

  def analyze_cpd(src,outfile)
    run_command(cpd_jar,src,outfile)
  end
  
  def analyze_metrics(src,outfile)
    run_command(metrics_jar,src,outfile)
  end
  
  def run_command(jar,src,out)
    command = "#{java_cmd} -jar #{Shell.escape File.join(pmd_dir,jar)} -s #{src} -o #{out}"
    puts command
    `#{command}`
  end
  
  def java_mem
    java_mem = "512m"
  end
  
  def java_cmd
    java_cmd = "java -Xmx#{java_mem}"
  end
  
  def flex_pmd
    FlexPMD.new
  end
  
  def pmd_dir
    flex_pmd.pmd_dir
  end
  
  def pmd_ver
    flex_pmd.pmd_ver
  end
  
  def pmd_jar
    pmd_jar = "flex-pmd-command-line-" + pmd_ver + ".jar"
  end
  
  def cpd_jar
    cpd_jar = "flex-pmd-cpd-command-line-" + pmd_ver + ".jar"
  end
  
  def metrics_jar
    metrics_jar = "flex-pmd-metrics-command-line-" + pmd_ver + ".jar"
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flex-sdk-0.7.1 lib/flex_analyzer.rb
flex-sdk-0.7.0 lib/flex_analyzer.rb