Sha256: a19dc4ede92eec6df36de7781110c214d3804317f84ce8d53ee06ed8b62bdfa2
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
require 'tempfile' require 'fileutils' require 'rscm' module RSCM class Darcs < AbstractSCM register self ann :description => "Directory" attr_accessor :dir def initialize(dir=".") @dir = File.expand_path(dir) end def name "Darcs" end def create with_working_dir(@dir) do IO.popen("darcs initialize") do |stdout| stdout.each_line do |line| yield line if block_given? end end end end def import(dir, message) ENV["EMAIL"] = "dcontrol@codehaus.org" FileUtils.cp_r(Dir.glob("#{dir}/*"), @dir) with_working_dir(@dir) do puts "IN::::: #{@dir}" cmd = "darcs add --recursive ." puts cmd IO.popen(cmd) do |stdout| stdout.each_line do |line| yield line if block_given? end end puts $? logfile = Tempfile.new("darcs_logfile") logfile.print(message) logfile.close cmd = "darcs record --all --patch-name \"something nice\" --logfile #{PathConverter.filepath_to_nativepath(logfile.path, false)}" puts cmd IO.popen(cmd) do |stdout| stdout.each_line do |line| yield line if block_given? end end puts $? end end def checkout(checkout_dir) # :yield: file with_working_dir(File.dirname(checkout_dir)) do cmd = "darcs get --verbose --repo-name #{File.basename(checkout_dir)} #{@dir}" puts cmd IO.popen(cmd) do |stdout| stdout.each_line do |line| puts line yield line if block_given? end end end puts $? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rscm-0.2.0 | lib/rscm/scm/darcs.rb |
rscm-0.2.1.1404 | lib/rscm/scm/darcs.rb |