diff --git a/README.md b/README.md index 742081d..985491d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ curling-g32 -=========== +========================================================================== Projet Acsi Curling 2013-2014 Albert Jeremy, Aviles Adrien, Geoffrey Sentost, Quentin Rouland + +========================================================================== +Requiert : +* Gtk2 : gem install gtk2 +* net/ping : gem install net-ping + diff --git a/c/ff b/c/ff index 43cd637..6b2019c 100644 --- a/c/ff +++ b/c/ff @@ -1,3 +1 @@ -www.google.fr -www.japanimes.tk -www.fakeadresse.com +fdfsdjkfdjskljfldks http://www.google.fr fodfkljskljsd diff --git a/c/main.rb b/c/main.rb index 5249a03..08acb03 100755 --- a/c/main.rb +++ b/c/main.rb @@ -2,13 +2,14 @@ #lib require 'gtk2' # lib graphique -#require 'net-ping' #lib netwotk - +require 'net/http' #lib netwotk +require 'uri' #include require '../m/ReadFile' require '../v/Vue1' require '../v/VueError' + Gtk.init v1 = Vue1.new @@ -18,15 +19,12 @@ v1.listenerDestroy v1.getWindow.show_all Gtk.main str = v1.getEntry -#print str if(File.exist?(str)) f = ReadFile.new(str) - tabL = f.getLines - - for i in tabL - puts i - end + url = f.getUrls + puts url + else vd = VueError.new("Fichier inexistant") vd.getDialog.run @@ -37,4 +35,29 @@ end +# def ping(host) +# begin +# url=URI.parse(host) +# start_time = Time.now +# response=Net::HTTP.get(url) +# end_time = Time.now - start_time +# if response=="" +# return false +# else +# puts "response time : #{end_time}" +# return true +# end +# rescue Errno::ECONNREFUSED +# return false +# end +# end +# +# if(ping "") +# puts('vrai') +# else +# puts('faux') +# end + + + print "Termine\n" \ No newline at end of file diff --git a/m/ReadFile.rb b/m/ReadFile.rb index 16aab73..0c8ad8f 100644 --- a/m/ReadFile.rb +++ b/m/ReadFile.rb @@ -3,14 +3,15 @@ class ReadFile @fic = File.open(pFic, "r") end - def getLines - i=0 - tabLines = [] - @fic.each_line { |ligne| - tabLines[i] = ligne - i = i + 1 - } - return tabLines + def getALL + all = @fic.read + return all + end + + def getUrls + txt = self.getALL + url = txt.match /http[^\s]*/ + return url end end