Sha256: e94a25ce72abdca7788d6e41838ecfb0177fcef143779945790b7ab252ac88f0
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
class FlexPMD # Return a hash of configuration objects from config.yml def config require 'yaml' config = YAML.load_file(File.expand_path(File.join((File.dirname(__FILE__)), "..", "..", "config.yml"))) config_hash = config["flex-pmd"] end # Return the destination (think: vendor) directory to put the PMD into def dest_dir dest_dir = File.expand_path(File.join((File.dirname(__FILE__)), "..", "..", config["vendor_path"])) end # Return the version PMD def pmd_ver pmd_ver = config["pmd_ver"] end # Return the human readable name of the PMD def pmd_name pmd_name = "flex_pmd_" + pmd_ver end # Return just the file name of the target zip file def pmd_zipfile pmd_zipfile = pmd_name + ".zip" end # Return the full path of target zip file def dest_file dest_file = File.join(dest_dir, pmd_zipfile) end # Return the full path to the PMD dir, so other things/people can use it def pmd_dir pmd_dir = File.join(dest_dir, pmd_name) end # Return the full web URL of the PMD to download def cdn_file cdn_file = config["cdn_path"] end # Download the PMD zip file into the gem's directory def download puts "\n" unless File.file?(dest_file) puts "Downloading PMD\n\tFrom:\t#{cdn_file}\n\tTo:\t#{dest_file}\n\n" `curl #{cdn_file} --create-dirs -o #{dest_file} ` if $?.to_i != 0 raise "Failed to download Flex PMD\n\n" end else puts "Won't download PMD, file #{dest_file} already exists" end end # Unzip the downloaded zip file into the target dir def unzip puts "\n" unless File.directory?(pmd_dir) puts "Unzipping PMD\n\tFrom:\t#{dest_file}\n\tTo:\t#{pmd_dir}/\n\n" `unzip #{dest_file} -d #{pmd_dir}` if $?.to_i != 0 raise "Failed to unzip Flex PMD\n\n" end else puts "Won't unzip PMD, directory #{pmd_dir}/ already exists\n\n" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flex-sdk-0.7.1 | lib/flex_pmd/flex_pmd.rb |
flex-sdk-0.7.0 | lib/flex_pmd/flex_pmd.rb |