Class: Dev::Scm
- Inherits:
-
Object
- Object
- Dev::Scm
- Defined in:
- lib/dev/Scm.rb
Instance Attribute Summary collapse
-
#scm_type ⇒ Object
Returns the value of attribute scm_type.
Class Method Summary collapse
Instance Method Summary collapse
- #add_file(file) ⇒ Object
- #add_file_glob(glob) ⇒ Object
- #file_tracked?(file) ⇒ Boolean
-
#initialize ⇒ Scm
constructor
A new instance of Scm.
Constructor Details
#initialize ⇒ Scm
Returns a new instance of Scm.
5 6 7 8 9 10 11 |
# File 'lib/dev/Scm.rb', line 5 def initialize @scm_type="none" call=Dev::SystemCall.new("svn info") @scm_type="svn" if call.output.include?("Last Changed Date:") @scm_type="svn" if File.exists?(".svn") @scm_type="git" if File.exists?(".git") end |
Instance Attribute Details
#scm_type ⇒ Object
Returns the value of attribute scm_type.
3 4 5 |
# File 'lib/dev/Scm.rb', line 3 def scm_type @scm_type end |
Class Method Details
.export(remote, local, scm) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dev/Scm.rb', line 49 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 |
.update(local) ⇒ Object
66 67 |
# File 'lib/dev/Scm.rb', line 66 def self.update(local) end |
Instance Method Details
#add_file(file) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dev/Scm.rb', line 21 def add_file(file) call=Dev::SystemCall.new("git add #{file}") if @scm_type=="git" if @scm_type=="svn" afile=file afile="#{file}@" if afile.include?('@') `svn info "#{afile}"` status=$?.exitstatus if(status != 0) call=Dev::SystemCall.new("svn add \"#{afile}\" --parents") call.puts_summary end end end |
#add_file_glob(glob) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/dev/Scm.rb', line 37 def add_file_glob(glob) Dir.glob(glob).each { |f| if(!f.include?("/obj/") && !f.include?("/bin/") && !f.include?("/TestOutput/") && f.index("obj/") != 0 && f.index("bin/") != 0 ) add_file(f) end } end |
#file_tracked?(file) ⇒ Boolean
13 14 15 16 17 18 19 |
# File 'lib/dev/Scm.rb', line 13 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 |