Sha256: afa39f6dc6d9d5e3be3b45a6555bec34135cc8fe7d03dd01acead47c0c152679

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module Dev
class Scm
  attr_accessor :scm_type
  
  def initialize
    @scm_type="svn"
    @scm_type="svn" if File.exists?(".svn")
    @scm_type="git" if File.exists?(".git")
  end
  
  def file_tracked?(file)
    if @scm_type=="git"
      call=Dev::SystemCall.new("git ls-files #{file} -error_unmatch")
      return true if call.status==0
    end
    false
  end
  
  def add_file(file)
    if @scm_type=="git"
      call=Dev::SystemCall.new("git add #{file}")
    end
  end
  
  def add_file_glob(glob)
    Dir.glob(glob).each { |f|
      add_file(f)
    }
  end
  
  def self.export(remote,local,scm)
    puts_debug "Scm.export, scm=#{scm}"
    if remote.include?("svn:") || scm=="svn"
      local_tmp=local.gsub('@','-')
      call=Dev::SystemCall.new("svn export #{remote} #{local_tmp}")
      File.rename(local_tmp,local) if File.exist?(local_tmp)
    end
    if scm=="git"
      call=Dev::SystemCall.new("git clone #{remote} #{local}")
    end
  end
  
  def self.update(local)
  end
  
end # class Scm
end # module Dev

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dev-1.0.36 lib/dev/Scm.rb
dev-1.0.35 lib/dev/Scm.rb
dev-1.0.34 lib/dev/Scm.rb