silo 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
1
  rvm:
2
- - 1.8.6
3
2
  - 1.8.7
4
- - 1.9.1
5
3
  - 1.9.2
6
- - jruby
4
+ - 1.9.3
5
+ - rbx
6
+ - rbx-2.0
7
7
  - ree
8
+ - ruby-head
data/.yardopts CHANGED
@@ -1 +1,4 @@
1
1
  --files Changelog.md,LICENSE
2
+ --markup markdown
3
+ --private
4
+ --protected
@@ -1,7 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.1.3
4
+
5
+ **September 21<sup>st</sup>, 2011**
6
+
7
+ * Fixed problems of the `remote` command
8
+ * Various improvements to code style and integration
9
+
10
+ See the [Git history](https://github.com/koraktor/silo/compare/0.1.2...0.1.3)
11
+ for version 0.1.3
12
+
3
13
  ## Version 0.1.2
4
14
 
15
+ **April 12<sup>th</sup>, 2011**
16
+
5
17
  * Improved compatibility with Rubies other than 1.8.7
6
18
  * Use Bundler
7
19
  * Added a monkey patch for Grit returning commits in wrong order
@@ -12,6 +24,8 @@
12
24
 
13
25
  ## Version 0.1.1
14
26
 
27
+ **February 2<sup>nd</sup>, 2011**
28
+
15
29
  * Fixed bugs related to file operations
16
30
  * Added a monkey patch for Grit not being able to delete directories
17
31
  * Lots of other fixes and improvements
data/Gemfile CHANGED
@@ -1,11 +1,3 @@
1
1
  source :rubygems
2
2
 
3
- gem 'grit', '~> 2.4.1'
4
-
5
- group :development do
6
- gem 'yard', '~> 0.6.7'
7
- end
8
-
9
- group :test do
10
- gem 'shoulda', '~> 2.11.3'
11
- end
3
+ gemspec
@@ -1,18 +1,30 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ silo (0.1.2)
5
+ grit (~> 2.4.1)
6
+ hashery (~> 1.4.0)
7
+ rubikon (~> 0.6.0)
8
+
1
9
  GEM
2
10
  remote: http://rubygems.org/
3
11
  specs:
4
- diff-lcs (1.1.2)
12
+ diff-lcs (1.1.3)
5
13
  grit (2.4.1)
6
14
  diff-lcs (~> 1.1)
7
15
  mime-types (~> 1.15)
16
+ hashery (1.4.0)
8
17
  mime-types (1.16)
18
+ rake (0.9.2)
19
+ rubikon (0.6.0)
9
20
  shoulda (2.11.3)
10
- yard (0.6.7)
21
+ yard (0.7.2)
11
22
 
12
23
  PLATFORMS
13
24
  ruby
14
25
 
15
26
  DEPENDENCIES
16
- grit (~> 2.4.1)
27
+ rake (~> 0.9.2)
17
28
  shoulda (~> 2.11.3)
18
- yard (~> 0.6.7)
29
+ silo!
30
+ yard (~> 0.7.2)
data/Rakefile CHANGED
@@ -1,22 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  # This code is free software; you can redistribute it and/or modify it under
2
4
  # the terms of the new BSD License.
3
5
  #
4
6
  # Copyright (c) 2010-2011, Sebastian Staudt
5
7
 
6
- require 'rake/gempackagetask'
7
8
  require 'rake/testtask'
9
+ require 'rubygems/package_task'
8
10
 
9
11
  task :default => :test
10
12
 
11
13
  # Rake tasks for building the gem
12
14
  spec = Gem::Specification.load('silo.gemspec')
13
- Rake::GemPackageTask.new(spec) do |pkg|
15
+ Gem::PackageTask.new(spec) do |pkg|
14
16
  end
15
17
 
16
18
  # Test task
17
19
  Rake::TestTask.new do |t|
18
20
  t.libs << 'lib' << 'test'
19
- t.pattern = 'test/**/test_*.rb'
21
+ t.test_files = FileList['test/**/test_*.rb']
20
22
  t.verbose = true
21
23
  end
22
24
 
@@ -26,8 +28,8 @@ begin
26
28
  # Create a rake task +:doc+ to build the documentation using YARD
27
29
  YARD::Rake::YardocTask.new do |yardoc|
28
30
  yardoc.name = 'doc'
29
- yardoc.files = ['lib/**/*.rb', 'LICENSE', 'README.md']
30
- yardoc.options = ['--private', '--title', 'Silo &mdash; API Documentation']
31
+ yardoc.files = ['lib/**/*.rb', 'Changelog.md', 'LICENSE', 'README.md']
32
+ yardoc.options = ['--markup', 'markdown', '--private', '--protected', '--title', 'Silo API Documentation']
31
33
  end
32
34
  rescue LoadError
33
35
  desc 'Generate YARD Documentation (not available)'
data/bin/silo CHANGED
@@ -3,7 +3,8 @@
3
3
  # This code is free software; you can redistribute it and/or modify it under
4
4
  # the terms of the new BSD License.
5
5
  #
6
- # Copyright (c) 2010, Sebastian Staudt
6
+ # Copyright (c) 2010-2011, Sebastian Staudt
7
7
 
8
- require File.join(File.dirname(__FILE__), '..', 'lib', 'silo.rb')
9
- require 'silo/cli.rb'
8
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'silo')
9
+ require File.join(File.dirname(__FILE__), '..', '..', 'rubikon', 'lib', 'rubikon')
10
+ require 'silo/cli'
@@ -3,9 +3,15 @@
3
3
  #
4
4
  # Copyright (c) 2010-2011, Sebastian Staudt
5
5
 
6
- require 'rubygems'
7
6
  require 'rubikon'
8
7
 
8
+ HASH_CLASS = if RUBY_VERSION < '1.9'
9
+ require 'hashery/ordered_hash'
10
+ OrderedHash
11
+ else
12
+ Hash
13
+ end
14
+
9
15
  module Silo
10
16
 
11
17
  # This class is a Rubikon application that implements the command-line
@@ -103,7 +109,8 @@ module Silo
103
109
  end
104
110
  end
105
111
 
106
- command :remote, 'Add or remove remote repositories', { :action => ['add', 'rm', :optional], :name => :optional, :url => :optional } do
112
+ args = HASH_CLASS[:action, ['add', 'rm', :optional], :remote_name, :optional, :url, :optional]
113
+ command :remote, 'Add or remove remote repositories', args do
107
114
  usage = lambda do
108
115
  puts 'usage: silo remote add <name> <url>'
109
116
  puts ' or: silo remote rm <name>'
@@ -116,14 +123,14 @@ module Silo
116
123
  puts info
117
124
  end
118
125
  when 'add'
119
- if url.nil?
120
- repo.add_remote name, url
126
+ unless url.nil?
127
+ repo.add_remote remote_name, url
121
128
  else
122
129
  usage.call
123
130
  end
124
131
  when 'rm'
125
- unless url.nil?
126
- repo.remove_remote name
132
+ if url.nil?
133
+ repo.remove_remote remote_name
127
134
  else
128
135
  usage.call
129
136
  end
@@ -5,11 +5,8 @@
5
5
 
6
6
  require 'tmpdir'
7
7
 
8
- require 'rubygems'
9
- require 'bundler'
10
- Bundler.require :default
8
+ require 'grit'
11
9
 
12
- require File.dirname(__FILE__) + '/../grit/git-ruby/repository'
13
10
  require File.dirname(__FILE__) + '/../grit/index'
14
11
 
15
12
  module Silo
@@ -6,6 +6,6 @@
6
6
  module Silo
7
7
 
8
8
  # The current version of the Silo gem
9
- VERSION = '0.1.2'
9
+ VERSION = '0.1.3' unless const_defined? :VERSION
10
10
 
11
11
  end
@@ -1,5 +1,3 @@
1
- require 'bundler'
2
-
3
1
  require File.expand_path(File.dirname(__FILE__) + '/lib/silo/version')
4
2
 
5
3
  Gem::Specification.new do |s|
@@ -13,7 +11,14 @@ Gem::Specification.new do |s|
13
11
  s.summary = 'A command-line utility and API for Git-based backups'
14
12
  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
13
 
16
- s.add_bundler_dependencies
14
+ s.add_dependency 'grit', '~> 2.4.1'
15
+ s.add_dependency 'hashery', '~> 1.4.0' if RUBY_VERSION < '1.9'
16
+ s.add_dependency 'rubikon', '~> 0.6.0'
17
+
18
+ s.add_development_dependency 'rake', '~> 0.9.2'
19
+ s.add_development_dependency 'shoulda', '~> 2.11.3'
20
+ s.add_development_dependency 'yard', '~> 0.7.2'
21
+
17
22
  s.requirements = [ 'git >= 1.6' ]
18
23
 
19
24
  s.files = `git ls-files`.split("\n")
@@ -1,11 +1,14 @@
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
+
6
+ require 'rubygems'
7
+ require 'test/unit'
8
+
9
+ require 'shoulda'
5
10
 
6
11
  $: << File.join(File.dirname(__FILE__), '..', 'lib')
7
12
  $: << File.dirname(__FILE__)
8
13
  require 'silo'
9
14
  include Silo
10
-
11
- Bundler.require :test
@@ -98,14 +98,21 @@ class TestRepository < Test::Unit::TestCase
98
98
  end
99
99
 
100
100
  should 'save single files correctly' do
101
+ commit_msgs = [
102
+ 'Enabled Silo for this repository',
103
+ "Added file #{@data_dir + 'file1'} into '/'",
104
+ "Added file #{@data_dir + 'file2'} into '/'"
105
+ ]
106
+
107
+ sleep 1
101
108
  @repo.add @data_dir/'file1'
109
+ sleep 1
102
110
  @repo.add @data_dir/'file2'
103
111
 
104
112
  assert_equal 3, @repo.git.commits.size
105
113
  assert_instance_of Grit::Blob, @repo.git.tree/'file1'
106
114
  assert_instance_of Grit::Blob, @repo.git.tree/'file2'
107
- assert_equal "Added file #{@data_dir + 'file1'} into '/'", @repo.git.commits[1].message
108
- assert_equal "Added file #{@data_dir + 'file2'} into '/'", @repo.git.commits[0].message
115
+ assert_same_elements commit_msgs, @repo.git.commits.map(&:message)
109
116
  assert_equal %w{.silo file1 file2}, @repo.contents
110
117
 
111
118
  assert_raise FileNotFoundError do
@@ -114,6 +121,7 @@ class TestRepository < Test::Unit::TestCase
114
121
  end
115
122
 
116
123
  should 'save directory trees correctly' do
124
+ sleep 1
117
125
  @repo.add @data_dir
118
126
 
119
127
  assert_equal 2, @repo.git.commits.size
@@ -134,14 +142,21 @@ class TestRepository < Test::Unit::TestCase
134
142
  end
135
143
 
136
144
  should 'save single files correctly into a prefix directory' do
145
+ commit_msgs = [
146
+ 'Enabled Silo for this repository',
147
+ "Added file #{@data_dir + 'file1'} into 'prefix'",
148
+ "Added file #{@data_dir + 'file2'} into 'prefix'"
149
+ ]
150
+
151
+ sleep 1
137
152
  @repo.add @data_dir/'file1', 'prefix'
153
+ sleep 1
138
154
  @repo.add @data_dir/'file2', 'prefix'
139
155
 
140
156
  assert_equal 3, @repo.git.commits.size
141
157
  assert_instance_of Grit::Blob, @repo.git.tree/'prefix/file1'
142
158
  assert_instance_of Grit::Blob, @repo.git.tree/'prefix/file2'
143
- assert_equal "Added file #{@data_dir + 'file1'} into 'prefix'", @repo.git.commits[1].message
144
- assert_equal "Added file #{@data_dir + 'file2'} into 'prefix'", @repo.git.commits[0].message
159
+ assert_same_elements commit_msgs, @repo.git.commits.map(&:message)
145
160
 
146
161
  assert_raise FileNotFoundError do
147
162
  @repo.restore 'file1'
@@ -149,6 +164,7 @@ class TestRepository < Test::Unit::TestCase
149
164
  end
150
165
 
151
166
  should 'save directory trees correctly into a prefix directory' do
167
+ sleep 1
152
168
  @repo.add @data_dir, 'prefix'
153
169
 
154
170
  assert_equal 2, @repo.git.commits.size
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sebastian Staudt
@@ -15,10 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-12 00:00:00 Z
18
+ date: 2011-09-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ name: grit
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
26
  - - ~>
@@ -29,26 +31,88 @@ dependencies:
29
31
  - 4
30
32
  - 1
31
33
  version: 2.4.1
32
- name: grit
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: hashery
33
38
  prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 1
47
+ - 4
48
+ - 0
49
+ version: 1.4.0
34
50
  type: :runtime
35
- requirement: *id001
51
+ version_requirements: *id002
36
52
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
53
+ name: rubikon
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
38
56
  none: false
39
57
  requirements:
40
58
  - - ~>
41
59
  - !ruby/object:Gem::Version
42
- hash: 9
60
+ hash: 7
43
61
  segments:
44
62
  - 0
45
63
  - 6
46
- - 7
47
- version: 0.6.7
64
+ - 0
65
+ version: 0.6.0
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: rake
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 63
77
+ segments:
78
+ - 0
79
+ - 9
80
+ - 2
81
+ version: 0.9.2
82
+ type: :development
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: shoulda
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 37
93
+ segments:
94
+ - 2
95
+ - 11
96
+ - 3
97
+ version: 2.11.3
98
+ type: :development
99
+ version_requirements: *id005
100
+ - !ruby/object:Gem::Dependency
48
101
  name: yard
49
102
  prerelease: false
103
+ requirement: &id006 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ hash: 7
109
+ segments:
110
+ - 0
111
+ - 7
112
+ - 2
113
+ version: 0.7.2
50
114
  type: :development
51
- requirement: *id002
115
+ version_requirements: *id006
52
116
  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.
53
117
  email:
54
118
  - koraktor@gmail.com
@@ -70,7 +134,6 @@ files:
70
134
  - Rakefile
71
135
  - bin/silo
72
136
  - lib/core_ext/pathname.rb
73
- - lib/grit/git-ruby/repository.rb
74
137
  - lib/grit/index.rb
75
138
  - lib/silo.rb
76
139
  - lib/silo/cli.rb
@@ -115,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
178
  requirements:
116
179
  - git >= 1.6
117
180
  rubyforge_project:
118
- rubygems_version: 1.7.2
181
+ rubygems_version: 1.8.10
119
182
  signing_key:
120
183
  specification_version: 3
121
184
  summary: A command-line utility and API for Git-based backups
@@ -1,34 +0,0 @@
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