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

Version Path
dyndoc-ruby-0.9.2 bin/dyn-init
dyndoc-ruby-0.9.1 bin/dyn-init
dyndoc-ruby-0.9.0 bin/dyn-init
dyndoc-ruby-0.8.5 bin/dyn-init
dyndoc-ruby-0.8.4 bin/dyn-init
dyndoc-ruby-0.8.3 bin/dyn-init
dyndoc-ruby-0.8.2 bin/dyn-init
dyndoc-ruby-0.8.1 bin/dyn-init
dyndoc-ruby-0.8.0 bin/dyn-init
dyndoc-ruby-0.7.7 bin/dyn-init
dyndoc-ruby-0.7.6 bin/dyn-init
dyndoc-ruby-0.7.5 bin/dyn-init
dyndoc-ruby-0.7.4 bin/dyn-init
dyndoc-ruby-0.7.3 bin/dyn-init
dyndoc-ruby-0.7.2 bin/dyn-init
dyndoc-ruby-0.7.1 bin/dyn-init
dyndoc-ruby-0.7.0 bin/dyn-init
dyndoc-ruby-0.6.9 bin/dyn-init
dyndoc-ruby-0.6.8 bin/dyn-init
dyndoc-ruby-0.6.7 bin/dyn-init