Sha256: 026de336ea283a9342618ea37730fa9f7bba0e1bda4c7d3761d261feebed73bb
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'find' module Nodes VERSION = "0.1.6" def self.init(dir) puts "Init new point '#{File.basename(dir)}' in #{dir}" src = "#{File.dirname(__FILE__)}/../.point" system("cp -r #{src} #{dir}") end def self.clone(name) puts "Clone from server point '#{name}'" dir = "#{Dir.pwd}/#{name}" return unless system("mkdir #{dir}") init dir get dir end def self.put(dir) system("cd #{dir} && #{dir}/.point/put") end def self.get(dir) system("cd #{dir} && #{dir}/.point/get") end def self.del(dir) return unless system("cd #{dir} && #{dir}/.point/del") system("cd #{dir} && rm -rf #{dir}/.point") 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}" 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nodes-0.1.6 | lib/nodes.rb |