git-gc-cron 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +9 -6
- data/features/cli.feature +7 -0
- data/lib/git_gc_cron/cli.rb +2 -0
- data/lib/git_gc_cron/version.rb +1 -1
- metadata +3 -3
data/README
CHANGED
@@ -17,18 +17,21 @@ As user or as root:
|
|
17
17
|
|
18
18
|
Put this into the system crontab (for example fcron on Linux):
|
19
19
|
|
20
|
-
%weekly,nice(10),runas(git) * * git-gc-cron /var/spool/gitosis/repositories
|
21
|
-
%weekly,nice(10),runas(me) * * git-gc-cron /home/me/myprojects /home/me/myotherprojects
|
20
|
+
%weekly,nice(10),runas(git) * * git-gc-cron -v /var/spool/gitosis/repositories
|
21
|
+
%weekly,nice(10),runas(me) * * git-gc-cron -v /home/me/myprojects /home/me/myotherprojects
|
22
22
|
|
23
23
|
or into your personal crontab, if you like:
|
24
24
|
|
25
|
-
%weekly,nice(10) * * git-gc-cron /home/me
|
25
|
+
%weekly,nice(10) * * git-gc-cron -v /home/me
|
26
26
|
|
27
27
|
|
28
28
|
git-gc-cron takes any number of paths to traverse as argument.
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
The option -v prints the path of every repo to stdout. Remove the option -v
|
31
|
+
from the above examples if you want the cron job to be silent.
|
32
|
+
|
33
|
+
To watch the progress live you can take a look at the output of ps or top. For
|
34
|
+
each repo it compresses git-gc-cron changes the process name of the subprocess
|
35
|
+
"git gc" to something more useful:
|
33
36
|
|
34
37
|
(#1/10 /var/spool/gitosis/repositories/myproject.git) git
|
data/features/cli.feature
CHANGED
@@ -13,3 +13,10 @@ Feature: CLI
|
|
13
13
|
And the repo "repos1/def/xyz" should be packed
|
14
14
|
And the repo "repos2/ghi.git" should be packed
|
15
15
|
And the repo "repos3/jkl.git" should not be packed
|
16
|
+
|
17
|
+
Scenario: Verbose output
|
18
|
+
Given a checked out repo "repos1/abc"
|
19
|
+
And a checked out repo "repos1/def/xyz"
|
20
|
+
When I run "git-gc-cron -v repos1"
|
21
|
+
Then the output should contain "repos1/abc"
|
22
|
+
And the output should contain "repos1/def/xyz"
|
data/lib/git_gc_cron/cli.rb
CHANGED
@@ -2,10 +2,12 @@ module GitGcCron
|
|
2
2
|
class CLI
|
3
3
|
|
4
4
|
def self.start
|
5
|
+
verbose = ARGV.first == '-v' and ARGV.shift
|
5
6
|
ARGV.each do |base|
|
6
7
|
repos = Dir["#{base}/**/{.git,*.git}"]
|
7
8
|
repos.each_with_index do |repo_path, i|
|
8
9
|
Dir.chdir(repo_path) do
|
10
|
+
puts repo_path if verbose
|
9
11
|
system ["git", "(##{i + 1}/#{repos.size + 1} #{repo_path}) git"], "gc", "-q"
|
10
12
|
end
|
11
13
|
end
|
data/lib/git_gc_cron/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: git-gc-cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Ritz
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-26 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements: []
|
95
95
|
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.5.
|
97
|
+
rubygems_version: 1.5.2
|
98
98
|
signing_key:
|
99
99
|
specification_version: 3
|
100
100
|
summary: Let cron run "git gc" on all your git repos
|