backenup 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/backenup.rb +33 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76d389780e71f7211a2ac251a2c548e183b22a8a
|
4
|
+
data.tar.gz: 8ff90d63611c58d7ffc00f50b2f9e0e85e8c38e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33672c2ad0e8f08e68ee765f391e85e0ec607db6204151077a4df8a0e990c74265ac57480f9f25c0c54f71ea6c5ea65f850f37033a057872ba2ecc8aa951b87e
|
7
|
+
data.tar.gz: 7eff004f52ec47fe0c24f16f0c4ad921ca1e9dec03bd140b391802a1237d455dd1e49d5396ad829bba7fa0343068348e81ac6a721a64aede92140396fdd1cf16
|
data/lib/backenup.rb
CHANGED
@@ -45,13 +45,16 @@ module Backenup
|
|
45
45
|
end
|
46
46
|
|
47
47
|
|
48
|
-
def commit(message = nil
|
48
|
+
def commit(message = nil)
|
49
49
|
message = default_message if message.nil?
|
50
50
|
|
51
51
|
Dir.chdir self.base_path do
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
|
53
|
+
with_timeout 0 do
|
54
|
+
with_max_size 0 do
|
55
|
+
@repo.add "." # Add all new / modified files
|
56
|
+
@repo.commit_all message # This handles any file that was deleted
|
57
|
+
end
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
@@ -67,6 +70,8 @@ module Backenup
|
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
73
|
+
|
74
|
+
|
70
75
|
|
71
76
|
private
|
72
77
|
|
@@ -74,6 +79,30 @@ module Backenup
|
|
74
79
|
Dir.mkdir self.storage_path unless File.exists?(self.storage_path)
|
75
80
|
end
|
76
81
|
|
82
|
+
|
83
|
+
def with_timeout(seconds)
|
84
|
+
previous = Grit::Git.git_timeout
|
85
|
+
begin
|
86
|
+
Grit::Git.git_timeout = seconds
|
87
|
+
yield
|
88
|
+
ensure
|
89
|
+
Grit::Git.git_timeout = previous
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
def with_max_size(size)
|
95
|
+
previous = Grit::Git.git_max_size
|
96
|
+
begin
|
97
|
+
Grit::Git.git_max_size = size
|
98
|
+
yield
|
99
|
+
ensure
|
100
|
+
Grit::Git.git_max_size = previous
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
|
77
106
|
end
|
78
107
|
|
79
108
|
end
|