public
Rubygem
Description: Don't mind this, go to http://github.com/integrity/integrity
Homepage: http://integrityapp.com
Clone URL: git://github.com/foca/integrity.git
log scm operations
sr (author)
Fri Nov 21 16:05:45 -0800 2008
commit  bc3e0a60f2538c117188f6b76ce39a3c4933482a
tree    f35d0560144973053bc672d9670dbafb18aeedfa
parent  dfd589f421c3850e47034e4dbc43ce3db37e2ad4
...
43
44
45
 
46
47
48
...
52
53
54
55
 
 
56
57
58
59
 
60
61
62
...
71
72
73
 
 
 
 
74
75
76
...
43
44
45
46
47
48
49
...
53
54
55
 
56
57
58
59
60
61
62
63
64
65
...
74
75
76
77
78
79
80
81
82
83
0
@@ -43,6 +43,7 @@ module Integrity
0
         end
0
     
0
         def clone
0
+          log "Cloning #{uri} to #{working_directory}"
0
           `git clone #{uri} #{working_directory}`
0
         end
0
 
0
@@ -52,11 +53,13 @@ module Integrity
0
             when local_branches.include?(branch) then branch
0
             else                                      "-b #{branch} origin/#{branch}"
0
           end
0
-          
0
+
0
+          log "Checking-out #{strategy}"
0
           `cd #{working_directory} && git checkout #{strategy}`
0
         end
0
 
0
         def pull
0
+          log "Pull-ing in #{working_directory}"
0
           `cd #{working_directory} && git pull`
0
         end
0
 
0
@@ -71,6 +74,10 @@ module Integrity
0
         def on_branch?
0
           File.basename(`cd #{working_directory} && git symbolic-ref HEAD`).chomp == branch
0
         end
0
+
0
+        def log(message)
0
+          Integrity.logger.info("Git") { message }
0
+        end
0
     end
0
   end
0
 end
...
22
23
24
 
 
 
 
 
 
25
26
27
...
39
40
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
43
44
...
22
23
24
25
26
27
28
29
30
31
32
33
...
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
70
71
72
73
0
@@ -22,6 +22,12 @@ describe Integrity::SCM::Git do
0
     @git.name.should == "Git"
0
   end
0
 
0
+  specify "#log should delegate to Integrity#log with 'Git' as progname" do
0
+    message = lambda { "message" }
0
+    Integrity.logger.should_receive(:info).with("Git") { message }
0
+    @git.send(:log, "message")
0
+  end
0
+
0
   describe "Determining the state of the code for this project" do
0
     it "should know if a project has been cloned or not by looking at the directories" do
0
       File.stub!(:directory?).with("/var/integrity/exports/foca-integrity/.git").and_return(true)
0
@@ -39,6 +45,29 @@ describe Integrity::SCM::Git do
0
     end
0
   end
0
 
0
+  describe "Logging of operations" do
0
+    before do
0
+      @git.stub!(:`)
0
+      Integrity.stub!(:logger).and_return(mock("logger", :info => ""))
0
+    end
0
+
0
+    it "should log clone" do
0
+      @git.should_receive(:log).
0
+        with("Cloning git://github.com/foca/integrity.git to /var/integrity/exports/foca-integrity")
0
+      @git.clone
0
+    end
0
+
0
+    it "should log checkout" do
0
+      @git.should_receive(:log).with("Checking-out HEAD")
0
+      @git.checkout('HEAD')
0
+    end
0
+
0
+    it "should log pull" do
0
+      @git.should_receive(:log).with("Pull-ing in /var/integrity/exports/foca-integrity")
0
+      @git.pull
0
+    end
0
+  end
0
+
0
   describe "Fetching the code from the repo" do
0
     before do
0
       @git.stub!(:on_branch?).and_return(true)

Comments