Sha256: e20cfd7e29fcf2f9d8051ad70b6ad71e6dadbdb90e9a5ff6045d928d766c9d51

Contents?: true

Size: 1.69 KB

Versions: 32

Compression:

Stored size: 1.69 KB

Contents

#!/usr/bin/env ruby

require 'fileutils'
require 'dyndoc/init/home'
dyndoc_home = Dyndoc.home
#p Dyndoc.home

lib_dir = ENV["DYNDOC_LIBRARY"] || File.join(dyndoc_home,"library")
repo_dir = File.join(lib_dir,".repository")

old_pwd = Dir.pwd

cmd = ARGV[0].to_sym
case cmd

# dyndoc-package install rcqls/dyndoc-share
when :install  #default is github from now!
owner,package=File.split(ARGV[1])
package = package[0...-4] if package =~ /\.git$/
package_dir = File.join(repo_dir,owner)
FileUtils.mkdir_p package_dir
FileUtils.cd package_dir
`git clone https://github.com/#{owner}/#{package}.git`

# dyndoc-package update rcqls/dyndoc-share
when :update
FileUtils.cd File.join(repo_dir,ARGV[1])
`git pull`

# dyndoc-package link rcqls/dyndoc-share/library/RCqls (default to RCqls)
# dyndoc-package link rcqls/dyndoc-share/library/RCqls RCqls
# dyndoc-package link <real local path to expand>
when :link
path = File.expand_path(ARGV[1])
unless (local = (File.directory? path) )
	path = ARGV[1] # not expanded
end
path,package = File.split(path)
target = ARGV[2] || package
target = File.join(lib_dir,target)
FileUtils.rm target if File.symlink? target #unlink first
source = local ? path : File.join(repo_dir,path,package)
if RUBY_PLATFORM =~ /(?:msys|mingw)/
	FileUtils.cp_r source,target
else
	FileUtils.ln_sf source,target
end
# dyndoc-package unlink RCqls
when :unlink
package = ARGV[1]
if RUBY_PLATFORM =~ /(?:msys|mingw)/
	FileUtils.rm_rf File.join(lib_dir,package)
else
	FileUtils.rm File.join(lib_dir,package)
end
when :ls
FileUtils.cd lib_dir
Dir["*"].each_with_index{|e,i| puts "#{i+1}) #{e}"}

when :repo
FileUtils.cd repo_dir
Dir[File.join("*","*")].each_with_index{|e,i| puts "#{i+1}) #{e}"}

end

FileUtils.cd old_pwd

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
dyndoc-ruby-0.8.5 bin/dpm
dyndoc-ruby-0.8.4 bin/dpm
dyndoc-ruby-0.8.3 bin/dpm
dyndoc-ruby-0.8.2 bin/dpm
dyndoc-ruby-0.8.1 bin/dpm
dyndoc-ruby-0.8.0 bin/dpm
dyndoc-ruby-0.7.7 bin/dpm
dyndoc-ruby-0.7.6 bin/dpm
dyndoc-ruby-0.7.5 bin/dpm
dyndoc-ruby-0.7.4 bin/dpm
dyndoc-ruby-0.7.3 bin/dpm
dyndoc-ruby-0.7.2 bin/dpm
dyndoc-ruby-0.7.1 bin/dpm
dyndoc-ruby-0.7.0 bin/dpm
dyndoc-ruby-0.6.9 bin/dpm
dyndoc-ruby-0.6.8 bin/dpm
dyndoc-ruby-0.6.7 bin/dpm
dyndoc-ruby-0.6.6 bin/dpm
dyndoc-ruby-0.6.2 bin/dpm
dyndoc-ruby-0.6.0 bin/dpm