Sha256: 19175d98430b60bf153afd9be5f86c611fbe103fc77d95949c03553b6a7eede7

Contents?: true

Size: 1.49 KB

Versions: 105

Compression:

Stored size: 1.49 KB

Contents

module Dev
class Scm
  attr_accessor :scm_type
  
  def initialize
    @scm_type="none"
    @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)
    call=Dev::SystemCall.new("git add #{file}") if @scm_type=="git"
    
    if @scm_type=="svn"
      call=Dev::SystemCall.new("svn info \"#{file}\"")
      if(call.status != 0)
        call=Dev::SystemCall.new("svn add \"#{file}\" --parents")
        call.puts_summary
      end
    end
  end
  
  def add_file_glob(glob)
    Dir.glob(glob).each { |f|
	  if(!f.include?("/obj/") && 
	     !f.include?("/bin/") &&
		 f.index("obj/") != 0 &&
		 f.index("bin/") != 0 )
        add_file(f)
	  end
    }
  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}\"")
      call.puts_summary
      if(local_tmp != local)
        sleep 15
        File.rename(local_tmp,local) if File.exist?(local_tmp)
        sleep 15
      end
    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

105 entries across 105 versions & 1 rubygems

Version Path
dev-1.0.166 lib/dev/Scm.rb
dev-1.0.165 lib/dev/Scm.rb
dev-1.0.164 lib/dev/Scm.rb
dev-1.0.163 lib/dev/Scm.rb
dev-1.0.162 lib/dev/Scm.rb
dev-1.0.161 lib/dev/Scm.rb
dev-1.0.160 lib/dev/Scm.rb
dev-1.0.159 lib/dev/Scm.rb
dev-1.0.158 lib/dev/Scm.rb
dev-1.0.157 lib/dev/Scm.rb
dev-1.0.156 lib/dev/Scm.rb
dev-1.0.155 lib/dev/Scm.rb
dev-1.0.154 lib/dev/Scm.rb
dev-1.0.153 lib/dev/Scm.rb
dev-1.0.152 lib/dev/Scm.rb
dev-1.0.151 lib/dev/Scm.rb
dev-1.0.150 lib/dev/Scm.rb
dev-1.0.149 lib/dev/Scm.rb
dev-1.0.148 lib/dev/Scm.rb
dev-1.0.147 lib/dev/Scm.rb