Sha256: 962c1300d8b98cce97ff06bc669958f2c11397919297bb4a5e732fb9add0fad8
Contents?: true
Size: 1012 Bytes
Versions: 24
Compression:
Stored size: 1012 Bytes
Contents
#!/usr/bin/env ruby require 'fileutils' arg=ARGV[0] arg="path" if !arg or arg.empty? case arg when "help" puts <<-DOC Usage: ## create ~/dyndoc folder and initialize some sharing dyn-init path ## add room folder dyn-init sync <room_id>:<room_folder_full_path>@<room_remote_wordir> DOC when "path" share_path=File.expand_path("../../share", __FILE__) dyndoc_path=File.join(ENV["HOME"],"dyndoc") unless File.exist? dyndoc_path FileUtils.mkdir_p dyndoc_path FileUtils.cp_r File.join(share_path,"."),dyndoc_path else puts "Warning: #{dyndoc_path} folder already exists!" end when "sync" require 'fileutils' FileUtils.mkdir_p (etc=File.join(ENV["HOME"],"dyndoc","etc")) room_sync=File.join(etc,".room_sync") room_dirs=(File.exists? room_sync) ? eval(File.read(room_sync)) : {} if ARGV[1] =~ /([^\:@]*)\:([^\:@]*)@([^\:@]*)/ room_id,room_local,room_remote=$1,$2,$3 room_dirs[room_id]={local: room_local, remote: room_remote} File.open(room_sync,"w") {|f| f << room_dirs.inspect } end end
Version data entries
24 entries across 24 versions & 1 rubygems