silo 0.1.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +7 -0
- data/Changelog.md +19 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +18 -0
- data/README.md +14 -2
- data/Rakefile +7 -8
- data/lib/grit/git-ruby/repository.rb +34 -0
- data/lib/grit/index.rb +1 -1
- data/lib/silo/repository.rb +55 -53
- data/lib/silo/version.rb +1 -1
- data/silo.gemspec +22 -0
- data/test/helper.rb +1 -3
- data/test/test_repository.rb +32 -31
- metadata +42 -88
- data/gemspec.yml +0 -30
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Changelog.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 0.1.2
|
4
|
+
|
5
|
+
* Improved compatibility with Rubies other than 1.8.7
|
6
|
+
* Use Bundler
|
7
|
+
* Added a monkey patch for Grit returning commits in wrong order
|
8
|
+
* Improved tests
|
9
|
+
|
10
|
+
See the [Git history](https://github.com/koraktor/silo/compare/0.1.1...0.1.2)
|
11
|
+
for version 0.1.2
|
12
|
+
|
13
|
+
## Version 0.1.1
|
14
|
+
|
15
|
+
* Fixed bugs related to file operations
|
16
|
+
* Added a monkey patch for Grit not being able to delete directories
|
17
|
+
* Lots of other fixes and improvements
|
18
|
+
|
19
|
+
See the [Git history](https://github.com/koraktor/silo/compare/0.1.0...0.1.1)
|
20
|
+
for version 0.1.1
|
21
|
+
|
3
22
|
## Version 0.1.0
|
4
23
|
|
5
24
|
**January 30<sup>th</sup>, 2011**
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
grit (2.4.1)
|
6
|
+
diff-lcs (~> 1.1)
|
7
|
+
mime-types (~> 1.15)
|
8
|
+
mime-types (1.16)
|
9
|
+
shoulda (2.11.3)
|
10
|
+
yard (0.6.7)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
grit (~> 2.4.1)
|
17
|
+
shoulda (~> 2.11.3)
|
18
|
+
yard (~> 0.6.7)
|
data/README.md
CHANGED
@@ -26,11 +26,22 @@ and recommended for most users.
|
|
26
26
|
|
27
27
|
$ gem install silo
|
28
28
|
|
29
|
-
If you want to use the development code you
|
29
|
+
If you want to use the development code you can add the following dependency
|
30
|
+
to your Gemfile:
|
31
|
+
|
32
|
+
gem 'silo', :git => git://github.com/koraktor/silo.git
|
33
|
+
|
34
|
+
If you want to work with the development code you should clone the Git
|
35
|
+
repository:
|
30
36
|
|
31
37
|
$ git clone git://github.com/koraktor/silo.git
|
32
38
|
$ cd silo
|
33
|
-
$
|
39
|
+
$ bundle install
|
40
|
+
|
41
|
+
Or even better, create your own fork.
|
42
|
+
|
43
|
+
The current status of the development code:
|
44
|
+
[![Build Status](http://travis-ci.org/koraktor/silo.png)][6]
|
34
45
|
|
35
46
|
## Basic usage
|
36
47
|
|
@@ -151,3 +162,4 @@ Follow Silo on Twitter [@silorb](http://twitter.com/silorb).
|
|
151
162
|
[3]: http://github.com/koraktor/silo
|
152
163
|
[4]: http://github.com/koraktor/silo/issues
|
153
164
|
[5]: http://rubydoc.info/github/koraktor/silo/master/frames
|
165
|
+
[6]: http://travis-ci.org/koraktor/silo
|
data/Rakefile
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# This code is free software; you can redistribute it and/or modify it under
|
2
2
|
# the terms of the new BSD License.
|
3
3
|
#
|
4
|
-
# Copyright (c) 2010, Sebastian Staudt
|
4
|
+
# Copyright (c) 2010-2011, Sebastian Staudt
|
5
5
|
|
6
|
+
require 'rake/gempackagetask'
|
6
7
|
require 'rake/testtask'
|
7
8
|
|
8
9
|
task :default => :test
|
9
10
|
|
11
|
+
# Rake tasks for building the gem
|
12
|
+
spec = Gem::Specification.load('silo.gemspec')
|
13
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
14
|
+
end
|
15
|
+
|
10
16
|
# Test task
|
11
17
|
Rake::TestTask.new do |t|
|
12
18
|
t.libs << 'lib' << 'test'
|
@@ -14,13 +20,6 @@ Rake::TestTask.new do |t|
|
|
14
20
|
t.verbose = true
|
15
21
|
end
|
16
22
|
|
17
|
-
begin
|
18
|
-
require 'ore/tasks'
|
19
|
-
Ore::Tasks.new
|
20
|
-
rescue LoadError
|
21
|
-
$stderr.puts 'You need ore-tasks to build the gem. Install it using `gem install ore-tasks`.'
|
22
|
-
end
|
23
|
-
|
24
23
|
begin
|
25
24
|
require 'yard'
|
26
25
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# This code is free software; you can redistribute it and/or modify it under
|
2
|
+
# the terms of the new BSD License.
|
3
|
+
#
|
4
|
+
# Copyright (c) 2011, Sebastian Staudt
|
5
|
+
|
6
|
+
# Monkey patches an issue in Grit::GitRuby::Repository which will cause commits
|
7
|
+
# to appear in the wrong order
|
8
|
+
class Grit::GitRuby::Repository
|
9
|
+
|
10
|
+
# Returns a list of revisions for the given reference ID and the given
|
11
|
+
# options
|
12
|
+
#
|
13
|
+
# @returns [String] A list of commits and additional information, just like
|
14
|
+
# git-rev-list.
|
15
|
+
def rev_list(sha, options)
|
16
|
+
(end_sha, sha) = sha if sha.is_a? Array
|
17
|
+
|
18
|
+
log = log(sha, options)
|
19
|
+
log = truncate_arr(log, end_sha) if end_sha
|
20
|
+
|
21
|
+
if options[:max_count]
|
22
|
+
if (opt_len = options[:max_count].to_i) < log.size
|
23
|
+
log = log[0, opt_len]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if options[:pretty] == 'raw'
|
28
|
+
log.map {|k, v| v }.join('')
|
29
|
+
else
|
30
|
+
log.map {|k, v| k }.join("\n")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/lib/grit/index.rb
CHANGED
@@ -12,7 +12,7 @@ class Grit::Index
|
|
12
12
|
# @param [String] path The path to the file
|
13
13
|
# @param [String] data The contents of the file
|
14
14
|
def add(path, data)
|
15
|
-
is_dir = path[-1] ==
|
15
|
+
is_dir = path[-1].chr == '/'
|
16
16
|
path = path.split('/')
|
17
17
|
filename = path.pop
|
18
18
|
filename += '/' if is_dir
|
data/lib/silo/repository.rb
CHANGED
@@ -6,8 +6,10 @@
|
|
6
6
|
require 'tmpdir'
|
7
7
|
|
8
8
|
require 'rubygems'
|
9
|
-
require '
|
9
|
+
require 'bundler'
|
10
|
+
Bundler.require :default
|
10
11
|
|
12
|
+
require File.dirname(__FILE__) + '/../grit/git-ruby/repository'
|
11
13
|
require File.dirname(__FILE__) + '/../grit/index'
|
12
14
|
|
13
15
|
module Silo
|
@@ -53,7 +55,7 @@ module Silo
|
|
53
55
|
|
54
56
|
@path = File.expand_path path
|
55
57
|
|
56
|
-
if File.exist?(@path) && Dir.
|
58
|
+
if File.exist?(@path) && Dir.entries(@path).size > 2
|
57
59
|
unless File.exist?(File.join(@path, 'HEAD')) &&
|
58
60
|
File.stat(File.join(@path, 'objects')).directory? &&
|
59
61
|
File.stat(File.join(@path, 'refs')).directory?
|
@@ -100,7 +102,7 @@ module Silo
|
|
100
102
|
pre = (p == '/') ? file : File.join(p, file)
|
101
103
|
dir = File.stat(f).directory?
|
102
104
|
if dir
|
103
|
-
Dir.entries(f)
|
105
|
+
(Dir.entries(f) - %w{. ..}).each do |child|
|
104
106
|
add.call File.join(f, child), pre
|
105
107
|
end
|
106
108
|
else
|
@@ -111,7 +113,7 @@ module Silo
|
|
111
113
|
dir = add.call path, prefix
|
112
114
|
type = dir ? 'directory' : 'file'
|
113
115
|
commit_msg = "Added #{type} #{path} into '#{prefix}'"
|
114
|
-
index.commit commit_msg, @git.head.commit.sha
|
116
|
+
index.commit commit_msg, [@git.head.commit.sha]
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
@@ -153,6 +155,42 @@ module Silo
|
|
153
155
|
@remotes.each_value { |remote| remote.push }
|
154
156
|
end
|
155
157
|
|
158
|
+
# Returns the object (tree or blob) at the given path inside the repository
|
159
|
+
#
|
160
|
+
# @param [String] path The path of the object in the repository
|
161
|
+
# @raise [FileNotFoundError] if no object with the given path exists
|
162
|
+
# @return [Grit::Blob, Grit::Tree] The object at the given path
|
163
|
+
def find_object(path = '/')
|
164
|
+
(path == '/') ? @git.tree : @git.tree/path
|
165
|
+
end
|
166
|
+
|
167
|
+
# Loads remotes from the backing Git repository's configuration
|
168
|
+
#
|
169
|
+
# @see Remote::Git
|
170
|
+
def git_remotes
|
171
|
+
remotes = {}
|
172
|
+
@git.git.remote.split.each do |remote|
|
173
|
+
url = @git.git.config({}, '--get', "remote.#{remote}.url").strip
|
174
|
+
remotes[remote] = Remote::Git.new(self, remote, url)
|
175
|
+
end
|
176
|
+
remotes
|
177
|
+
end
|
178
|
+
|
179
|
+
# Generate a history of Git commits for either the complete repository or
|
180
|
+
# a specified file or directory
|
181
|
+
#
|
182
|
+
# @param [String] path The path of the file or directory to generate the
|
183
|
+
# history for. If +nil+, the history of the entire repository will
|
184
|
+
# be returned.
|
185
|
+
# @return [Array<Grit::Commit>] The commit history for the repository or
|
186
|
+
# given path
|
187
|
+
def history(path = nil)
|
188
|
+
params = ['--format=raw']
|
189
|
+
params += ['--', path] unless path.nil?
|
190
|
+
output = @git.git.log({}, *params)
|
191
|
+
Grit::Commit.list_from_string @git, output
|
192
|
+
end
|
193
|
+
|
156
194
|
# Run a block of code with +$GIT_WORK_TREE+ set to a specified path
|
157
195
|
#
|
158
196
|
# This executes a block of code while the environment variable
|
@@ -164,9 +202,9 @@ module Silo
|
|
164
202
|
# @yield [path] The code inside this block will be executed with
|
165
203
|
# +$GIT_WORK_TREE+ set
|
166
204
|
# @yieldparam [String] path The absolute path used for +$GIT_WORK_TREE+
|
167
|
-
def in_work_tree(path
|
205
|
+
def in_work_tree(path)
|
168
206
|
tmp_dir = path == :tmp
|
169
|
-
path =
|
207
|
+
path = Dir.mktmpdir if tmp_dir
|
170
208
|
old_work_tree = ENV['GIT_WORK_TREE']
|
171
209
|
ENV['GIT_WORK_TREE'] = path
|
172
210
|
Dir.chdir(path) { yield path }
|
@@ -205,16 +243,16 @@ module Silo
|
|
205
243
|
info
|
206
244
|
end
|
207
245
|
|
208
|
-
#
|
246
|
+
# Returns the object (tree or blob) at the given path inside the repository
|
247
|
+
# or fail if it does not exist
|
209
248
|
#
|
210
|
-
# @see
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
remotes
|
249
|
+
# @param (see #find_object)
|
250
|
+
# @raise [FileNotFoundError] if no object with the given path exists
|
251
|
+
# @return (see #find_object)
|
252
|
+
def object!(path)
|
253
|
+
object = find_object path
|
254
|
+
raise FileNotFoundError.new(path) if object.nil?
|
255
|
+
object
|
218
256
|
end
|
219
257
|
|
220
258
|
# Prepares the Git repository backing this Silo repository for use with
|
@@ -230,42 +268,6 @@ module Silo
|
|
230
268
|
end
|
231
269
|
end
|
232
270
|
|
233
|
-
# Generate a history of Git commits for either the complete repository or
|
234
|
-
# a specified file or directory
|
235
|
-
#
|
236
|
-
# @param [String] path The path of the file or directory to generate the
|
237
|
-
# history for. If +nil+, the history of the entire repository will
|
238
|
-
# be returned.
|
239
|
-
# @return [Array<Grit::Commit>] The commit history for the repository or
|
240
|
-
# given path
|
241
|
-
def history(path = nil)
|
242
|
-
params = ['--format=raw']
|
243
|
-
params += ['--', path] unless path.nil?
|
244
|
-
output = @git.git.log({}, *params)
|
245
|
-
Grit::Commit.list_from_string @git, output
|
246
|
-
end
|
247
|
-
|
248
|
-
# Returns the object (tree or blob) at the given path inside the repository
|
249
|
-
#
|
250
|
-
# @param [String] path The path of the object in the repository
|
251
|
-
# @raise [FileNotFoundError] if no object with the given path exists
|
252
|
-
# @return [Grit::Blob, Grit::Tree] The object at the given path
|
253
|
-
def find_object(path = '/')
|
254
|
-
(path == '/') ? @git.tree : @git.tree/path
|
255
|
-
end
|
256
|
-
|
257
|
-
# Returns the object (tree or blob) at the given path inside the repository
|
258
|
-
# or fail if it does not exist
|
259
|
-
#
|
260
|
-
# @param (see #find_object)
|
261
|
-
# @raise [FileNotFoundError] if no object with the given path exists
|
262
|
-
# @return (see #find_object)
|
263
|
-
def object!(path)
|
264
|
-
object = find_object path
|
265
|
-
raise FileNotFoundError.new(path) if object.nil?
|
266
|
-
object
|
267
|
-
end
|
268
|
-
|
269
271
|
# Return whether the Git repository backing this Silo repository has
|
270
272
|
# already been prepared for use with Silo
|
271
273
|
#
|
@@ -308,13 +310,13 @@ module Silo
|
|
308
310
|
# repository
|
309
311
|
def remove(path)
|
310
312
|
object = object! path
|
311
|
-
path += '/' if object.is_a?(Grit::Tree) && path[-1] !=
|
313
|
+
path += '/' if object.is_a?(Grit::Tree) && path[-1].chr != '/'
|
312
314
|
index = @git.index
|
313
315
|
index.read_tree 'HEAD'
|
314
316
|
index.delete path
|
315
317
|
type = object.is_a?(Grit::Tree) ? 'directory' : 'file'
|
316
318
|
commit_msg = "Removed #{type} #{path}"
|
317
|
-
index.commit commit_msg, @git.head.commit.sha
|
319
|
+
index.commit commit_msg, [@git.head.commit.sha]
|
318
320
|
end
|
319
321
|
alias_method :rm, :remove
|
320
322
|
|
data/lib/silo/version.rb
CHANGED
data/silo.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/lib/silo/version')
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "silo"
|
7
|
+
s.version = Silo::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = [ 'Sebastian Staudt' ]
|
10
|
+
s.email = [ 'koraktor@gmail.com' ]
|
11
|
+
s.licenses = [ 'BSD' ]
|
12
|
+
s.homepage = 'http://koraktor.de/silo'
|
13
|
+
s.summary = 'A command-line utility and API for Git-based backups'
|
14
|
+
s.description = %Q{With Silo you can backup arbitrary files into one or more Git repositories and take advantage of Git's compression, speed and other features. No Git knowledge needed.}
|
15
|
+
|
16
|
+
s.add_bundler_dependencies
|
17
|
+
s.requirements = [ 'git >= 1.6' ]
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- test/test_*.rb`.split("\n")
|
21
|
+
s.require_paths = [ 'lib' ]
|
22
|
+
end
|
data/test/helper.rb
CHANGED
data/test/test_repository.rb
CHANGED
@@ -19,7 +19,7 @@ class TestRepository < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
should 'contain a bare Git repository prepared for Silo by default' do
|
21
21
|
repo = Repository.new @dir
|
22
|
-
|
22
|
+
assert_instance_of Grit::Repo, repo.git
|
23
23
|
assert repo.prepared?
|
24
24
|
assert_equal 1, repo.git.commits.size
|
25
25
|
assert_equal 'Enabled Silo for this repository', repo.git.commits.first.message
|
@@ -27,7 +27,7 @@ class TestRepository < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
should 'contain a plain Git repository when option :prepare is false' do
|
29
29
|
repo = Repository.new @dir, :prepare => false
|
30
|
-
|
30
|
+
assert_instance_of Grit::Repo, repo.git
|
31
31
|
assert !repo.prepared?
|
32
32
|
assert_equal 0, repo.git.commits.size
|
33
33
|
end
|
@@ -60,12 +60,13 @@ class TestRepository < Test::Unit::TestCase
|
|
60
60
|
FileUtils.touch '.silo'
|
61
61
|
`git add .silo`
|
62
62
|
`git commit -m "Enabled Silo for this repository"`
|
63
|
+
ENV['GIT_DIR'] = nil
|
63
64
|
ENV['GIT_WORK_TREE'] = nil
|
64
65
|
@repo = Repository.new @repo_dir
|
65
66
|
end
|
66
67
|
|
67
68
|
should 'contain a Git repository' do
|
68
|
-
|
69
|
+
assert_instance_of Grit::Repo, @repo.git
|
69
70
|
end
|
70
71
|
|
71
72
|
should 'be prepared' do
|
@@ -101,10 +102,10 @@ class TestRepository < Test::Unit::TestCase
|
|
101
102
|
@repo.add @data_dir/'file2'
|
102
103
|
|
103
104
|
assert_equal 3, @repo.git.commits.size
|
104
|
-
|
105
|
-
|
105
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'file1'
|
106
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'file2'
|
106
107
|
assert_equal "Added file #{@data_dir + 'file1'} into '/'", @repo.git.commits[1].message
|
107
|
-
assert_equal "Added file #{@data_dir + 'file2'} into '/'", @repo.git.commits[
|
108
|
+
assert_equal "Added file #{@data_dir + 'file2'} into '/'", @repo.git.commits[0].message
|
108
109
|
assert_equal %w{.silo file1 file2}, @repo.contents
|
109
110
|
|
110
111
|
assert_raise FileNotFoundError do
|
@@ -116,13 +117,13 @@ class TestRepository < Test::Unit::TestCase
|
|
116
117
|
@repo.add @data_dir
|
117
118
|
|
118
119
|
assert_equal 2, @repo.git.commits.size
|
119
|
-
assert_equal "Added directory #{@data_dir} into '/'", @repo.git.commits[
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
assert_equal "Added directory #{@data_dir} into '/'", @repo.git.commits[0].message
|
121
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'data/file1'
|
122
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'data/file2'
|
123
|
+
assert_instance_of Grit::Tree, @repo.git.tree/'data/subdir1'
|
124
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'data/subdir1/file1'
|
125
|
+
assert_instance_of Grit::Tree, @repo.git.tree/'data/subdir2'
|
126
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'data/subdir2/file2'
|
126
127
|
assert_equal %w{data data/file1 data/file2 data/subdir1 data/subdir1/file1 data/subdir2 data/subdir2/file2}, @repo.contents('data')
|
127
128
|
assert_equal %w{data/subdir1 data/subdir1/file1}, @repo.contents('data/subdir1')
|
128
129
|
assert_equal %w{data/subdir2 data/subdir2/file2}, @repo.contents('data/subdir2')
|
@@ -137,10 +138,10 @@ class TestRepository < Test::Unit::TestCase
|
|
137
138
|
@repo.add @data_dir/'file2', 'prefix'
|
138
139
|
|
139
140
|
assert_equal 3, @repo.git.commits.size
|
140
|
-
|
141
|
-
|
141
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/file1'
|
142
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/file2'
|
142
143
|
assert_equal "Added file #{@data_dir + 'file1'} into 'prefix'", @repo.git.commits[1].message
|
143
|
-
assert_equal "Added file #{@data_dir + 'file2'} into 'prefix'", @repo.git.commits[
|
144
|
+
assert_equal "Added file #{@data_dir + 'file2'} into 'prefix'", @repo.git.commits[0].message
|
144
145
|
|
145
146
|
assert_raise FileNotFoundError do
|
146
147
|
@repo.restore 'file1'
|
@@ -151,13 +152,13 @@ class TestRepository < Test::Unit::TestCase
|
|
151
152
|
@repo.add @data_dir, 'prefix'
|
152
153
|
|
153
154
|
assert_equal 2, @repo.git.commits.size
|
154
|
-
assert_equal "Added directory #{@data_dir} into 'prefix'", @repo.git.commits[
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
155
|
+
assert_equal "Added directory #{@data_dir} into 'prefix'", @repo.git.commits[0].message
|
156
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/data/file1'
|
157
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/data/file2'
|
158
|
+
assert_instance_of Grit::Tree, @repo.git.tree/'prefix/data/subdir1'
|
159
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/data/subdir1/file1'
|
160
|
+
assert_instance_of Grit::Tree, @repo.git.tree/'prefix/data/subdir2'
|
161
|
+
assert_instance_of Grit::Blob, @repo.git.tree/'prefix/data/subdir2/file2'
|
161
162
|
|
162
163
|
assert_raise FileNotFoundError do
|
163
164
|
@repo.restore 'prefix/file1'
|
@@ -194,15 +195,15 @@ class TestRepository < Test::Unit::TestCase
|
|
194
195
|
|
195
196
|
@repo.remove 'data/file1'
|
196
197
|
assert_equal 4, @repo.git.commits.size
|
197
|
-
|
198
|
+
assert_nil @repo.git.tree/'data/file1'
|
198
199
|
|
199
200
|
@repo.remove 'data'
|
200
201
|
assert_equal 5, @repo.git.commits.size
|
201
|
-
|
202
|
+
assert_nil @repo.git.tree/'data'
|
202
203
|
|
203
204
|
@repo.remove 'file1'
|
204
205
|
assert_equal 6, @repo.git.commits.size
|
205
|
-
|
206
|
+
assert_nil @repo.git.tree/'file1'
|
206
207
|
end
|
207
208
|
|
208
209
|
should 'purge files and directories correctly' do
|
@@ -211,15 +212,15 @@ class TestRepository < Test::Unit::TestCase
|
|
211
212
|
|
212
213
|
@repo.purge 'data/file1'
|
213
214
|
assert_equal 3, @repo.git.commits.size
|
214
|
-
|
215
|
+
assert_nil @repo.git.tree/'data/file1'
|
215
216
|
|
216
217
|
@repo.purge 'data'
|
217
218
|
assert_equal 2, @repo.git.commits.size
|
218
|
-
|
219
|
+
assert_nil @repo.git.tree/'data'
|
219
220
|
|
220
221
|
@repo.purge 'file1'
|
221
222
|
assert_equal 1, @repo.git.commits.size
|
222
|
-
|
223
|
+
assert_nil @repo.git.tree/'file1'
|
223
224
|
|
224
225
|
@repo.add @data_dir
|
225
226
|
@repo.add @data_dir/'file1'
|
@@ -227,8 +228,8 @@ class TestRepository < Test::Unit::TestCase
|
|
227
228
|
@repo.purge 'data', false
|
228
229
|
@repo.purge 'file1', false
|
229
230
|
assert_equal 3, @repo.git.commits.size
|
230
|
-
|
231
|
-
|
231
|
+
assert_nil @repo.git.tree/'data'
|
232
|
+
assert_nil @repo.git.tree/'file1'
|
232
233
|
end
|
233
234
|
|
234
235
|
teardown do
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.1.1.1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Sebastian Staudt
|
@@ -16,29 +15,10 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable: silo
|
18
|
+
date: 2011-04-12 00:00:00 Z
|
21
19
|
dependencies:
|
22
20
|
- !ruby/object:Gem::Dependency
|
23
|
-
|
24
|
-
prerelease: false
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 7
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 6
|
34
|
-
- 0
|
35
|
-
version: 0.6.0
|
36
|
-
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: grit
|
40
|
-
prerelease: false
|
41
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
42
22
|
none: false
|
43
23
|
requirements:
|
44
24
|
- - ~>
|
@@ -49,89 +29,63 @@ dependencies:
|
|
49
29
|
- 4
|
50
30
|
- 1
|
51
31
|
version: 2.4.1
|
52
|
-
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: shoulda
|
32
|
+
name: grit
|
56
33
|
prerelease: false
|
57
|
-
|
58
|
-
|
59
|
-
requirements:
|
60
|
-
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 37
|
63
|
-
segments:
|
64
|
-
- 2
|
65
|
-
- 11
|
66
|
-
- 3
|
67
|
-
version: 2.11.3
|
68
|
-
type: :development
|
69
|
-
version_requirements: *id003
|
34
|
+
type: :runtime
|
35
|
+
requirement: *id001
|
70
36
|
- !ruby/object:Gem::Dependency
|
71
|
-
|
72
|
-
prerelease: false
|
73
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
74
38
|
none: false
|
75
39
|
requirements:
|
76
40
|
- - ~>
|
77
41
|
- !ruby/object:Gem::Version
|
78
|
-
hash:
|
42
|
+
hash: 9
|
79
43
|
segments:
|
80
44
|
- 0
|
81
|
-
-
|
82
|
-
-
|
83
|
-
version: 0.
|
84
|
-
type: :development
|
85
|
-
version_requirements: *id004
|
86
|
-
- !ruby/object:Gem::Dependency
|
45
|
+
- 6
|
46
|
+
- 7
|
47
|
+
version: 0.6.7
|
87
48
|
name: yard
|
88
49
|
prerelease: false
|
89
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
|
-
requirements:
|
92
|
-
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
hash: 15
|
95
|
-
segments:
|
96
|
-
- 0
|
97
|
-
- 6
|
98
|
-
- 4
|
99
|
-
version: 0.6.4
|
100
50
|
type: :development
|
101
|
-
|
51
|
+
requirement: *id002
|
102
52
|
description: With Silo you can backup arbitrary files into one or more Git repositories and take advantage of Git's compression, speed and other features. No Git knowledge needed.
|
103
|
-
email:
|
104
|
-
|
105
|
-
|
53
|
+
email:
|
54
|
+
- koraktor@gmail.com
|
55
|
+
executables: []
|
56
|
+
|
106
57
|
extensions: []
|
107
58
|
|
108
|
-
extra_rdoc_files:
|
59
|
+
extra_rdoc_files: []
|
60
|
+
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .travis.yml
|
64
|
+
- .yardopts
|
109
65
|
- Changelog.md
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
110
68
|
- LICENSE
|
111
|
-
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/silo
|
72
|
+
- lib/core_ext/pathname.rb
|
73
|
+
- lib/grit/git-ruby/repository.rb
|
74
|
+
- lib/grit/index.rb
|
75
|
+
- lib/silo.rb
|
76
|
+
- lib/silo/cli.rb
|
77
|
+
- lib/silo/errors.rb
|
78
|
+
- lib/silo/remote/base.rb
|
112
79
|
- lib/silo/remote/git.rb
|
113
|
-
- gemspec.yml
|
114
80
|
- lib/silo/repository.rb
|
115
|
-
- lib/
|
116
|
-
- .
|
81
|
+
- lib/silo/version.rb
|
82
|
+
- silo.gemspec
|
117
83
|
- test/data/file1
|
118
84
|
- test/data/file2
|
119
|
-
- bin/silo
|
120
|
-
- LICENSE
|
121
|
-
- test/data/subdir2/file2
|
122
85
|
- test/data/subdir1/file1
|
123
|
-
-
|
124
|
-
- lib/grit/index.rb
|
125
|
-
- Rakefile
|
126
|
-
- README.md
|
127
|
-
- test/test_repository.rb
|
128
|
-
- Changelog.md
|
129
|
-
- lib/silo/remote/base.rb
|
130
|
-
- lib/silo/errors.rb
|
131
|
-
- lib/silo.rb
|
86
|
+
- test/data/subdir2/file2
|
132
87
|
- test/helper.rb
|
133
|
-
-
|
134
|
-
has_rdoc: true
|
88
|
+
- test/test_repository.rb
|
135
89
|
homepage: http://koraktor.de/silo
|
136
90
|
licenses:
|
137
91
|
- BSD
|
@@ -160,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
114
|
version: "0"
|
161
115
|
requirements:
|
162
116
|
- git >= 1.6
|
163
|
-
rubyforge_project:
|
164
|
-
rubygems_version: 1.
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 1.7.2
|
165
119
|
signing_key:
|
166
120
|
specification_version: 3
|
167
121
|
summary: A command-line utility and API for Git-based backups
|
data/gemspec.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
name: silo
|
2
|
-
summary: A command-line utility and API for Git-based backups
|
3
|
-
description: With Silo you can backup arbitrary files into one or more Git
|
4
|
-
repositories and take advantage of Git's compression, speed and
|
5
|
-
other features. No Git knowledge needed.
|
6
|
-
version: 0.1.1.1
|
7
|
-
|
8
|
-
license: BSD
|
9
|
-
authors: Sebastian Staudt
|
10
|
-
email: koraktor@gmail.com
|
11
|
-
homepage: http://koraktor.de/silo
|
12
|
-
has_yard: true
|
13
|
-
|
14
|
-
extra_doc_files:
|
15
|
-
- Changelog.md
|
16
|
-
- LICENSE
|
17
|
-
require_paths: lib
|
18
|
-
test_files: test/**/test_*.rb
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
grit: ~> 2.4.1
|
22
|
-
rubikon: ~> 0.6.0
|
23
|
-
|
24
|
-
development_dependencies:
|
25
|
-
ore-tasks: ~> 0.3.0
|
26
|
-
shoulda: ~> 2.11.3
|
27
|
-
yard: ~> 0.6.4
|
28
|
-
|
29
|
-
requirements:
|
30
|
-
- git >= 1.6
|