dev 1.0.202 → 1.0.203

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dev/Commands.rb CHANGED
@@ -138,7 +138,7 @@ class Commands < Hash
138
138
  def has_diff
139
139
  call=nil
140
140
 
141
- if File.exists?(".git")
141
+ if DEV[:scm_type] == "git" #File.exists?(".git")
142
142
  call=Dev::SystemCall.new('git status')
143
143
  return true if call.output.include?("new file:")
144
144
  return true if call.output.include?("deleted:")
data/lib/dev/Scm.rb CHANGED
@@ -33,6 +33,17 @@ class Scm
33
33
  call=Dev::SystemCall.new("svn add \"#{afile}\" --parents")
34
34
  call.puts_summary
35
35
  end
36
+ end
37
+
38
+ if @scm_type=="git"
39
+ afile=file
40
+
41
+ `git status "#{afile}"`
42
+ status=$?.exitstatus
43
+ if(status != 0)
44
+ call=Dev::SystemCall.new("git add \"#{afile}\"")
45
+ call.puts_summary
46
+ end
36
47
  end
37
48
  end
38
49
 
@@ -4,8 +4,24 @@ class Commit < Array
4
4
  def refresh
5
5
  strip_auto_entries
6
6
  File.open('commit.message','w'){|f|f.puts "commit all"} if !File.exists?('commit.message')
7
- self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}" if File.exists?(".git")
8
- self << "{:cmd=>'svn commit -F commit.message',:auto=>true}" if File.exists?(".svn")
7
+ scm_type = get_default_scm_type
8
+ if scm_type == "svn"
9
+ self << "{:cmd=>'svn commit -F commit.message',:auto=>true}"
10
+ else
11
+ if scm_type == "git"
12
+ self << "{:cmd=>'git commit -a -F commit.message',:auto=>true}"
13
+ end
14
+ end
15
+ end
16
+
17
+ def get_default_scm_type
18
+ call=Dev::SystemCall.new("svn info")
19
+ return "svn" if call.output.include?("Last Changed Date:")
20
+ return "svn" if File.exists?(".svn")
21
+ call=Dev::SystemCall.new("git status")
22
+ return "git" if call.output.include?("#")
23
+ return "git" if File.exists?(".git")
24
+ return nil
9
25
  end
10
26
  end # class Compile
11
27
  end # module Cmd
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.202
4
+ version: 1.0.203
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: