Merge branch 'master' of https://github.com/sidya82/curling-g32
This commit is contained in:
commit
0ad36db9a5
3
c/ff
3
c/ff
@ -1 +1,4 @@
|
||||
fdfsdjkfdjskljfldks http://www.google.fr fodfkljskljsd
|
||||
dqdjqdjodzzd http://www.ndqjkdjqdkjz.com hdqhdkjqdqzdq
|
||||
dqdqdkdpqzdd dqzdqzdkqlzndlkqdhqlkhdlkqhlkdkql djqlojdqkzjdmq
|
||||
dqljdqjdmoljqdj http://www.a.com
|
||||
|
0
c/hello.rb
Executable file → Normal file
0
c/hello.rb
Executable file → Normal file
47
c/main.rb
47
c/main.rb
@ -2,14 +2,15 @@
|
||||
|
||||
#lib
|
||||
require 'gtk2' # lib graphique
|
||||
require 'net/http' #lib netwotk
|
||||
require 'uri'
|
||||
require 'net/ping' #lib netwotk
|
||||
|
||||
#include
|
||||
require '../m/ReadFile'
|
||||
require '../v/Vue1'
|
||||
require '../v/VueError'
|
||||
|
||||
|
||||
|
||||
Gtk.init
|
||||
v1 = Vue1.new
|
||||
|
||||
@ -23,41 +24,25 @@ str = v1.getEntry
|
||||
if(File.exist?(str))
|
||||
f = ReadFile.new(str)
|
||||
url = f.getUrls
|
||||
puts url
|
||||
|
||||
else
|
||||
vd = VueError.new("Fichier inexistant")
|
||||
vd.getDialog.run
|
||||
vd.getDialog.destroy
|
||||
vd = VueError.new("Fichier inexistant")
|
||||
vd.getDialog.run
|
||||
vd.getDialog.destroy
|
||||
end
|
||||
|
||||
url.each { |n|
|
||||
p = Net::Ping::HTTP.new n , 80
|
||||
if p.ping?
|
||||
puts n + "is alive and kicking"
|
||||
else
|
||||
puts n + "est mort"
|
||||
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"
|
@ -10,7 +10,7 @@ class ReadFile
|
||||
|
||||
def getUrls
|
||||
txt = self.getALL
|
||||
url = txt.match /http[^\s]*/
|
||||
url = txt.scan(/http[^\s]*/)
|
||||
return url
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user