def ofx version=@@latest_version
            self._version=version
            response = Faraday.get do |req| 
                req.url "http://www.openframeworks.cc/download/"
            end
            doc = Nokogiri::HTML(response.body)
            latest_version = doc.css("#download-latest-header h2")
            puts "Openframeworks current version is "+ latest_version.text+"\n"
            puts "your os is "+RUBY_PLATFORM.downcase
            config = get_config(version)
            href=config["file"]
            
            if href and href!=""
                p "downing "+href
                uri = URI(href)
                Net::HTTP.start(uri.host,uri.port) do |http|
                    request = Net::HTTP::Get.new uri.request_uri

                    http.request request do |response|
                        open config["filename"], 'w' do |io|
                            response.read_body do |chunk|
                                io.write chunk
                            end
                        end
                    end
                end

                if File.exists?(config["dirname"])
                   puts "openframewors dir #{config['dirname']} exists. pass.." 
                else

                    if RUBY_PLATFORM.downcase.include?("darwin")
                        puts "unzip dir.."
                        destination="."
                        Zip::ZipFile.open(config["filename"]) {|file|

                            file.each do |f| 
                                f_path = File.join(destination, f.name)
                                FileUtils.mkdir_p(File.dirname(f_path))
                                file.extract(f,f_path)
                            end
                        } 
                        #cleanup
                        p "cleanup..."
                        `rm -rf __MACOSX`
                        `rm -rf ofx.zip`
                    elsif RUBY_PLATFORM.downcase.include?("linux")
                        p "tar file... #{config['filename']}"
                        `tar vzxf #{config["filename"]}`
                    end
                end

            end

        end
def ofx version=@@latest_version
            self._version=version
            response = Faraday.get do |req| 
                req.url "http://www.openframeworks.cc/download/"
            end
            doc = Nokogiri::HTML(response.body)
            latest_version = doc.css("#download-latest-header h2")
            puts "Openframeworks current version is "+ latest_version.text+"\n"
            puts "your os is "+RUBY_PLATFORM.downcase
            config = get_config(version)
            href=config["file"]
            
            if href and href!=""
                p "downing "+href
                uri = URI(href)
                Net::HTTP.start(uri.host,uri.port) do |http|
                    request = Net::HTTP::Get.new uri.request_uri

                    http.request request do |response|
                        open config["filename"], 'w' do |io|
                            response.read_body do |chunk|
                                io.write chunk
                            end
                        end
                    end
                end

                if File.exists?(config["dirname"])
                   puts "openframewors dir #{config['dirname']} exists. pass.." 
                else

                    if RUBY_PLATFORM.downcase.include?("darwin")
                        puts "unzip dir.."
                        destination="."
                        Zip::ZipFile.open(config["filename"]) {|file|

                            file.each do |f| 
                                f_path = File.join(destination, f.name)
                                FileUtils.mkdir_p(File.dirname(f_path))
                                file.extract(f,f_path)
                            end
                        } 
                        #cleanup
                        p "cleanup..."
                        `rm -rf __MACOSX`
                        `rm -rf ofx.zip`
                    elsif RUBY_PLATFORM.downcase.include?("linux")
                        p "tar file... #{config['filename']}"
                        `tar vzxf #{config["filename"]}`
                    end
                end

            end

        end
install latest version