git-gc-cron 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ tmp/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in git-gc-cron.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Thomas Ritz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,28 @@
1
+ Description
2
+ --------------
3
+
4
+ git-gc-cron recursively searches for .git and *.git repos in the directories
5
+ specified on the command line and runs "git gc" on them.
6
+
7
+ Make sure you only have it search repos you own.
8
+
9
+
10
+ Installation
11
+ ----------------
12
+
13
+ As user or as root:
14
+
15
+ $ gem install git-gc-cron
16
+
17
+
18
+ Put this into the system crontab (for example fcron on Linux):
19
+
20
+ %weekly,nice(10),runas(gitosis) * * git-gc-cron /var/spool/gitosis/repositories
21
+ %weekly,nice(10),runas(me) * * git-gc-cron /home/me/myprojects /home/me/myotherprojects
22
+
23
+ or into your personal crontab, if you like:
24
+
25
+ %weekly,nice(10) * * git-gc-cron /home/me
26
+
27
+
28
+ git-gc-cron takes any number of paths to traverse as argument.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'cucumber/rake/task'
5
+
6
+ Cucumber::Rake::Task.new do |t|
7
+ t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
8
+ end
9
+
10
+ task :default => :cucumber
data/bin/git-gc-cron ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'git_gc_cron/cli'
4
+ GitGcCron::CLI.start
@@ -0,0 +1,15 @@
1
+ Feature: CLI
2
+ In order to compress all my git repos
3
+ As a cron job writer
4
+ I want the CLI to iterate over my repos
5
+
6
+ Scenario: recursively search repos
7
+ Given a checked out repo "repos1/abc"
8
+ And a checked out repo "repos1/def/xyz"
9
+ And a bare repo "repos2/ghi.git"
10
+ And a bare repo "repos3/jkl.git"
11
+ When I run "git-gc-cron scan repos1 repos2"
12
+ Then the repo "repos1/abc" should be packed
13
+ And the repo "repos1/def/xyz" should be packed
14
+ And the repo "repos2/ghi.git" should be packed
15
+ And the repo "repos3/jkl.git" should not be packed
@@ -0,0 +1,21 @@
1
+ Given /^a checked out repo "([^"]*)"$/ do |path|
2
+ dirs << path
3
+ run "git init -q"
4
+ dirs.pop
5
+ end
6
+
7
+ Given /^a bare repo "([^"]*)"$/ do |path|
8
+ dirs << path
9
+ run "git init --bare -q"
10
+ dirs.pop
11
+ end
12
+
13
+ Then /^the repo "([^"]*)" should be packed$/ do |path|
14
+ path << "/.git" unless path =~ /\.git$/
15
+ Then %|a file named "#{path}/objects/info/packs" should exist|
16
+ end
17
+
18
+ Then /^the repo "([^"]*)" should not be packed$/ do |path|
19
+ path << "/.git" unless path =~ /\.git$/
20
+ Then %|a file named "#{path}/objects/info/packs" should not exist|
21
+ end
@@ -0,0 +1 @@
1
+ require 'aruba/cucumber'
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "git_gc_cron/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "git-gc-cron"
7
+ s.version = GitGcCron::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Thomas Ritz"]
10
+ s.email = ["thomas@galaxy-ritz.de"]
11
+ s.homepage = ""
12
+ s.summary = %q{Let cron run "git gc" on all your git repos}
13
+ s.description = %q{git-gc-cron recursively searches for git repos in the directories specified on the command line and runs "git gc" on them.}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.extra_rdoc_files = ["LICENSE", "README"]
19
+ s.rdoc_options = ["--charset=UTF-8"]
20
+
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "cucumber"
25
+ s.add_development_dependency "aruba"
26
+ end
@@ -0,0 +1,3 @@
1
+ module GitGcCron
2
+ # Your code goes here...
3
+ end
@@ -0,0 +1,15 @@
1
+ module GitGcCron
2
+ class CLI
3
+
4
+ def self.start
5
+ ARGV.each do |base|
6
+ Dir["#{base}/**/{.git,*.git}"].each do |repo_path|
7
+ Dir.chdir(repo_path) do
8
+ system "git gc -q"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module GitGcCron
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-gc-cron
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Thomas Ritz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-02-06 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :development
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: aruba
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ description: git-gc-cron recursively searches for git repos in the directories specified on the command line and runs "git gc" on them.
50
+ email:
51
+ - thomas@galaxy-ritz.de
52
+ executables:
53
+ - git-gc-cron
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - LICENSE
58
+ - README
59
+ files:
60
+ - .gitignore
61
+ - Gemfile
62
+ - LICENSE
63
+ - README
64
+ - Rakefile
65
+ - bin/git-gc-cron
66
+ - features/cli.feature
67
+ - features/step_definitions/repos.rb
68
+ - features/support/setup.rb
69
+ - git-gc-cron.gemspec
70
+ - lib/git_gc_cron.rb
71
+ - lib/git_gc_cron/cli.rb
72
+ - lib/git_gc_cron/version.rb
73
+ has_rdoc: true
74
+ homepage: ""
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options:
79
+ - --charset=UTF-8
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project:
97
+ rubygems_version: 1.5.0
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Let cron run "git gc" on all your git repos
101
+ test_files:
102
+ - features/cli.feature
103
+ - features/step_definitions/repos.rb
104
+ - features/support/setup.rb