Class: Dev::Cmd::Commit

Inherits:
Array
  • Object
show all
Defined in:
lib/dev/cmd/Commit.rb

Instance Method Summary collapse

Methods inherited from Array

#strip_auto_entries

Instance Method Details

#get_default_scm_typeObject



18
19
20
21
22
23
24
25
26
# File 'lib/dev/cmd/Commit.rb', line 18

def get_default_scm_type
  call=Dev::SystemCall.new("svn info")
	return "svn" if call.output.include?("Last Changed Date:")
  return "svn" if File.exists?(".svn")
	call=Dev::SystemCall.new("git status")
	return "git" if call.output.include?("#")
  return "git" if File.exists?(".git")
	return nil
end

#refreshObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dev/cmd/Commit.rb', line 4

def refresh
	strip_auto_entries
	File.open('commit.message','w'){|f|f.puts "commit all"} if !File.exists?('commit.message')
	scm_type = get_default_scm_type
	if scm_type == "svn" 
 self << "{:cmd=>'svn commit -F commit.message',:auto=>true}" 
	else
 if scm_type == "git"
   self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}"
#self << "{:cmd=>'git svn dcommit',:auto=>true}"
 end
  end
end