lib/nodes.rb in nodes-0.1.7 vs lib/nodes.rb in nodes-0.2.1
- old
+ new
@@ -1,75 +1,35 @@
-require 'find'
+require "nodes/version"
-
module Nodes
- VERSION = "0.1.7"
-
- def self.init(dir)
- puts "Init new point '#{File.basename(dir)}' in #{dir}"
- src = "#{File.dirname(__FILE__)}/../.point"
- system("cp -r #{src} #{dir}")
+ def self.init
+ puts "init new nodes in the file system"
end
- def self.clone(name)
- puts "Clone from server point '#{name}'"
- dir = "#{Dir.pwd}/#{name}"
- return unless system("mkdir #{dir}")
- init dir
- get dir
+ def self.put
+ puts "put the nodes to server"
end
- def self.put(dir)
- system("cd #{dir} && #{dir}/.point/put")
+ def self.get
+ puts "get the nodes to server"
end
- def self.get(dir)
- system("cd #{dir} && #{dir}/.point/get")
+ def self.del
+ puts "delete the nodes from file system"
end
- def self.del(dir)
- return unless system("cd #{dir} && #{dir}/.point/del")
- system("cd #{dir} && rm -rf #{dir}/.point")
+ def self.list
+ puts "list of nodes in the nodes"
end
- def self.size(dir, hidden = false)
- total_size = 0
- total_files = 0
- total_directories = 0
- Find.find(dir) do |path|
- if FileTest.directory?(path)
- total_directories += 1
- if File.basename(path)[0] == ?.
- Find.prune # Don't look any further into this directory.
- else
- next
- end
- else
- if hidden || File.basename(path)[0] != ?.
- total_files += 1
- total_size += FileTest.size(path)
-# print path+" -> "
-# puts FileTest.size(path)
- end
- end
- end
- puts "size: #{total_size}"
- puts "directories: #{total_directories}"
- puts "files: #{total_files}"
+ def self.size(hidden = false)
+ puts "size of the nodes"
end
- def self.country ip
- require 'geoip'
- print ip
- geoip = GeoIP.new("data/GeoIP.dat")
- location = geoip.country(p)
- country = location[2] if location != nil
- print " - #{country}"
- end
-
- def self.call cmd
- successfully = system(cmd)
- exit "blach" unless successfully
- end
+ #
+ #def self.call cmd
+ # successfully = system(cmd)
+ # exit "blach" unless successfully
+ #end
end
\ No newline at end of file