public
Description: Resources for rspec developers/contributors
Homepage: http://rspec.info/
Clone URL: git://github.com/dchelimsky/rspec-dev.git
disallow push or update if any of the repos hasn't been committed
pat-maddox (author)
Wed Apr 16 01:24:14 -0700 2008
commit  450a0a5a5ab9040a0add481a2e17b38c3b220f70
tree    eb1cf597c4e38f3ef05bfbb8949c5d82cfcf2d36
parent  181230bd45479978badb44b4bd08f7a40c54510b
...
1
2
3
 
 
4
5
6
...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
 
51
 
52
53
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
56
57
...
1
2
3
4
5
6
7
8
...
39
40
41
 
 
 
 
 
 
 
 
 
 
 
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
0
@@ -1,6 +1,8 @@
0
 module RSpec
0
   class Git
0
     def update
0
+      check_for_clean_repos "Unable to update"
0
+      
0
       submodules.each do |s|
0
         puts "** Updating #{s[:name]}"
0
         unless system("cd #{s[:path]} && git pull --rebase")
0
@@ -37,21 +39,31 @@ module RSpec
0
     end
0
 
0
     def push_all
0
-      if repos.all? do |r|
0
-          output = `cd #{r[:path]} && git status`
0
-          ['On branch master', 'nothing to commit'].all? {|message| output.include?(message) }
0
-        end
0
-        repos.each do |r|
0
-          puts "** push #{r[:name]}"
0
-          system "cd #{r[:path]} && git push"
0
-        end
0
-        puts "Successfully pushed changes to github"
0
-      else
0
-        puts "Unable to push.  Run 'rake git:status' to view any uncommitted changes"
0
+      check_for_clean_repos "Unable to push"
0
+
0
+      repos.each do |r|
0
+        puts "** push #{r[:name]}"
0
+        system "cd #{r[:path]} && git push"
0
       end
0
+      puts "Successfully pushed changes to github"
0
     end
0
 
0
     private
0
+    def check_for_clean_repos(message)
0
+      unless all_repos_clean?
0
+        puts "*** #{message} ***"
0
+        status
0
+        exit 1
0
+      end
0
+    end
0
+    
0
+    def all_repos_clean?
0
+      repos.all? do |r|
0
+        output = `cd #{r[:path]} && git status`
0
+        ['On branch master', 'nothing to commit'].all? {|message| output.include?(message) }
0
+      end
0
+    end
0
+    
0
     def repos
0
       [submodules, superproject].flatten
0
     end

Comments