repertoire 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +15 -0
- data/Manifest.txt +23 -10
- data/README.txt +31 -6
- data/Rakefile +2 -1
- data/lib/repertoire/compat.rb +4 -3
- data/lib/repertoire/{media/exceptions → exceptions}/checkout_failed.rb +0 -0
- data/lib/repertoire/exceptions/program_not_found.rb +1 -1
- data/lib/repertoire/{media/exceptions → exceptions}/repository_exists.rb +0 -0
- data/lib/repertoire/{media/exceptions → exceptions}/update_failed.rb +0 -0
- data/lib/repertoire/exceptions.rb +3 -0
- data/lib/repertoire/media/exceptions/unknown_media.rb +3 -1
- data/lib/repertoire/media/exceptions.rb +0 -3
- data/lib/repertoire/{extensions → media/extensions}/meta/object.rb +5 -5
- data/lib/repertoire/media/extensions/meta.rb +1 -0
- data/lib/repertoire/media/extensions.rb +1 -0
- data/lib/repertoire/media/media.rb +2 -115
- data/lib/repertoire/media/type.rb +87 -69
- data/lib/repertoire/media/types/git.rb +7 -7
- data/lib/repertoire/media/types/hg.rb +30 -0
- data/lib/repertoire/media/types/rsync.rb +5 -7
- data/lib/repertoire/media/types/svn.rb +5 -7
- data/lib/repertoire/media/types.rb +1 -2
- data/lib/repertoire/repertoire.rb +102 -6
- data/lib/repertoire/repository.rb +78 -18
- data/lib/repertoire/version.rb +2 -1
- data/spec/compat_spec.rb +31 -0
- data/{test/test_repertoire.rb → spec/helpers/repository/.hg/.keep} +0 -0
- data/spec/helpers/repository/dir/file.txt +1 -0
- data/spec/helpers/repository/dir/file2.txt +1 -0
- data/spec/helpers/repository/file.txt +1 -0
- data/spec/helpers/repository.rb +1 -0
- data/spec/media/media_spec.rb +79 -0
- data/spec/media/type_spec.rb +36 -0
- data/spec/media/types/git_spec.rb +17 -0
- data/spec/media/types/hg_spec.rb +13 -0
- data/spec/media/types/rsync_spec.rb +17 -0
- data/spec/media/types/svn_spec.rb +17 -0
- data/spec/repertoire_spec.rb +9 -0
- data/spec/repository_spec.rb +78 -0
- data/spec/spec_helper.rb +7 -0
- data/tasks/spec.rb +9 -0
- metadata +31 -18
- data/lib/repertoire/extensions/meta.rb +0 -1
- data/lib/repertoire/extensions/uri.rb +0 -26
- data/lib/repertoire/extensions.rb +0 -1
- data/lib/repertoire/media/types/cvs.rb +0 -31
- data/lib/repertoire/media/types/darcs.rb +0 -30
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 0.2.0 / 2009-03-26
|
2
|
+
|
3
|
+
* Refactored Repertoire::Media::Type.
|
4
|
+
* Added the cd method.
|
5
|
+
* Added the switch_dir method.
|
6
|
+
* Refactored Repertoire::Repository.
|
7
|
+
* Added Repository#update.
|
8
|
+
* Added Repository#delete.
|
9
|
+
* Removed support for CVS.
|
10
|
+
* Removed support for Darcs.
|
11
|
+
* Fixed a bug in Git.update.
|
12
|
+
* Fixed various typos.
|
13
|
+
* Added support for Mercurial (Hg).
|
14
|
+
* Added specs.
|
15
|
+
|
1
16
|
== 0.1.2 / 2008-05-01
|
2
17
|
|
3
18
|
* Added Media support for Git.
|
data/Manifest.txt
CHANGED
@@ -4,28 +4,41 @@ README.txt
|
|
4
4
|
Rakefile
|
5
5
|
lib/repertoire.rb
|
6
6
|
lib/repertoire/compat.rb
|
7
|
-
lib/repertoire/extensions.rb
|
8
|
-
lib/repertoire/extensions/meta.rb
|
9
|
-
lib/repertoire/extensions/meta/object.rb
|
10
|
-
lib/repertoire/extensions/uri.rb
|
11
7
|
lib/repertoire/exceptions.rb
|
12
8
|
lib/repertoire/exceptions/program_not_found.rb
|
13
9
|
lib/repertoire/exceptions/command_failed.rb
|
10
|
+
lib/repertoire/exceptions/repository_exists.rb
|
11
|
+
lib/repertoire/exceptions/checkout_failed.rb
|
12
|
+
lib/repertoire/exceptions/update_failed.rb
|
14
13
|
lib/repertoire/media.rb
|
15
14
|
lib/repertoire/media/exceptions.rb
|
16
15
|
lib/repertoire/media/exceptions/unknown_media.rb
|
17
|
-
lib/repertoire/media/
|
18
|
-
lib/repertoire/media/
|
19
|
-
lib/repertoire/media/
|
16
|
+
lib/repertoire/media/extensions.rb
|
17
|
+
lib/repertoire/media/extensions/meta.rb
|
18
|
+
lib/repertoire/media/extensions/meta/object.rb
|
20
19
|
lib/repertoire/media/media.rb
|
21
20
|
lib/repertoire/media/type.rb
|
22
21
|
lib/repertoire/media/types.rb
|
23
|
-
lib/repertoire/media/types/
|
24
|
-
lib/repertoire/media/types/darcs.rb
|
22
|
+
lib/repertoire/media/types/hg.rb
|
25
23
|
lib/repertoire/media/types/git.rb
|
26
24
|
lib/repertoire/media/types/rsync.rb
|
27
25
|
lib/repertoire/media/types/svn.rb
|
28
26
|
lib/repertoire/repository.rb
|
29
27
|
lib/repertoire/repertoire.rb
|
30
28
|
lib/repertoire/version.rb
|
31
|
-
|
29
|
+
tasks/spec.rb
|
30
|
+
spec/helpers/repository.rb
|
31
|
+
spec/helpers/repository/.hg/.keep
|
32
|
+
spec/helpers/repository/file.txt
|
33
|
+
spec/helpers/repository/dir/file.txt
|
34
|
+
spec/helpers/repository/dir/file2.txt
|
35
|
+
spec/spec_helper.rb
|
36
|
+
spec/compat_spec.rb
|
37
|
+
spec/repository_spec.rb
|
38
|
+
spec/media/type_spec.rb
|
39
|
+
spec/media/media_spec.rb
|
40
|
+
spec/media/types/hg_spec.rb
|
41
|
+
spec/media/types/git_spec.rb
|
42
|
+
spec/media/types/rsync_spec.rb
|
43
|
+
spec/media/types/svn_spec.rb
|
44
|
+
spec/repertoire_spec.rb
|
data/README.txt
CHANGED
@@ -1,32 +1,57 @@
|
|
1
1
|
= R'epertoire
|
2
2
|
|
3
3
|
* http://repertoire.rubyforge.org/
|
4
|
-
*
|
4
|
+
* http://github.com/postmodern/repertoire/
|
5
|
+
* Postmodern (postmodern.mod3 at gmail.com)
|
5
6
|
|
6
7
|
== DESCRIPTION:
|
7
8
|
|
8
9
|
R'epertoire is a Ruby library for quickly checking-out and updating
|
9
10
|
code-bases from various SCMs. R'epertoire currently supports Subversion,
|
10
|
-
|
11
|
+
Git, Mercurial and even RSync.
|
11
12
|
|
12
13
|
== FEATURES/PROBLEMS:
|
13
14
|
|
14
15
|
* Currently supports checking-out and updating from:
|
15
|
-
*
|
16
|
+
* Mercurial (Hg)
|
16
17
|
* Git
|
17
|
-
* Darcs
|
18
|
-
* CVS
|
19
18
|
* RSync
|
19
|
+
* Subversion (SVN)
|
20
20
|
|
21
21
|
== INSTALL:
|
22
22
|
|
23
23
|
$ sudo gem install repertoire
|
24
24
|
|
25
|
+
== EXAMPLES:
|
26
|
+
|
27
|
+
* Checkout a repository using a URI:
|
28
|
+
|
29
|
+
Repertoire.checkout(
|
30
|
+
:uri => 'svn://rubyforge.org/var/svn/repertoire/trunk',
|
31
|
+
:path => 'repertoire'
|
32
|
+
)
|
33
|
+
|
34
|
+
* Checkout a repository of a specific media type:
|
35
|
+
|
36
|
+
Repertoire.checkout(
|
37
|
+
:uri => 'http://repertoire.rubyforge.org/svn/trunk',
|
38
|
+
:media => :svn,
|
39
|
+
:path => 'repertoire'
|
40
|
+
)
|
41
|
+
|
42
|
+
* Update a previously checked-out repository:
|
43
|
+
|
44
|
+
Repertoire.update(:path => 'repertoire')
|
45
|
+
|
46
|
+
* Update a previously checked-out repository of a specific media type:
|
47
|
+
|
48
|
+
Repertoire.update(:path => 'path/to/rsynced_data', :media => :rsync)
|
49
|
+
|
25
50
|
== LICENSE:
|
26
51
|
|
27
52
|
The MIT License
|
28
53
|
|
29
|
-
Copyright (c) 2008 Hal Brodigan
|
54
|
+
Copyright (c) 2008-2009 Hal Brodigan
|
30
55
|
|
31
56
|
Permission is hereby granted, free of charge, to any person obtaining
|
32
57
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
+
require './tasks/spec.rb'
|
5
6
|
require './lib/repertoire/version.rb'
|
6
7
|
|
7
8
|
Hoe.new('repertoire', Repertoire::VERSION) do |p|
|
8
9
|
p.rubyforge_name = 'repertoire'
|
9
|
-
p.developer('Postmodern
|
10
|
+
p.developer('Postmodern','postmodern.mod3@gmail.com')
|
10
11
|
p.remote_rdoc_dir = ''
|
11
12
|
end
|
12
13
|
|
data/lib/repertoire/compat.rb
CHANGED
@@ -17,9 +17,10 @@ module Repertoire
|
|
17
17
|
# If the +PATH+ environment variable is not setup, an empty array will
|
18
18
|
# be returned.
|
19
19
|
#
|
20
|
-
# Compat.
|
20
|
+
# Compat.paths
|
21
|
+
# #=> ["/bin", "/usr/bin"]
|
21
22
|
#
|
22
|
-
def self.
|
23
|
+
def self.paths
|
23
24
|
# return an empty array in case
|
24
25
|
# the PATH variable does not exist
|
25
26
|
return [] unless ENV['PATH']
|
@@ -38,7 +39,7 @@ module Repertoire
|
|
38
39
|
# Compat.find_program('as') #=> "/usr/bin/as"
|
39
40
|
#
|
40
41
|
def self.find_program(name)
|
41
|
-
self.
|
42
|
+
self.paths.each do |dir|
|
42
43
|
full_path = File.expand_path(File.join(dir,name))
|
43
44
|
|
44
45
|
return full_path if File.file?(full_path)
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,16 +6,16 @@ class Object # :nodoc:
|
|
6
6
|
|
7
7
|
# A class_eval version of meta_eval
|
8
8
|
def metaclass_eval(&blk); metaclass.class_eval(&blk); end
|
9
|
+
|
10
|
+
# A class_def version of meta_def
|
11
|
+
def metaclass_def(name, &blk)
|
12
|
+
metaclass_eval { define_method(name, &blk) }
|
13
|
+
end
|
9
14
|
|
10
15
|
# Adds methods to a metaclass
|
11
16
|
def meta_def(name, &blk)
|
12
17
|
meta_eval { define_method(name, &blk) }
|
13
18
|
end
|
14
|
-
|
15
|
-
# Adds class methods to a metaclass
|
16
|
-
def metaclass_def(name, &blk)
|
17
|
-
metaclass_eval { define_method(name, &blk) }
|
18
|
-
end
|
19
19
|
|
20
20
|
# Defines an instance method within a class
|
21
21
|
def class_def(name, &blk)
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'repertoire/media/extensions/meta/object'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'repertoire/extensions/meta'
|
@@ -1,10 +1,4 @@
|
|
1
1
|
require 'repertoire/media/exceptions/unknown_media'
|
2
|
-
require 'repertoire/media/exceptions/repository_exists'
|
3
|
-
require 'repertoire/media/exceptions/checkout_failed'
|
4
|
-
require 'repertoire/media/exceptions/update_failed'
|
5
|
-
require 'repertoire/extensions/uri'
|
6
|
-
|
7
|
-
require 'fileutils'
|
8
2
|
|
9
3
|
module Repertoire
|
10
4
|
module Media
|
@@ -30,7 +24,7 @@ module Repertoire
|
|
30
24
|
name = name.to_sym
|
31
25
|
|
32
26
|
unless Media.supports?(name)
|
33
|
-
raise(UnknownMedia,"media type #{name
|
27
|
+
raise(UnknownMedia,"media type #{name} is not registered",caller)
|
34
28
|
end
|
35
29
|
|
36
30
|
return Media.types[name]
|
@@ -114,9 +108,7 @@ module Repertoire
|
|
114
108
|
# specified _uri_.
|
115
109
|
#
|
116
110
|
def Media.guess_from_uri(uri)
|
117
|
-
|
118
|
-
|
119
|
-
return [scheme, Media.supports_scheme(scheme)]
|
111
|
+
Media.supports_scheme(URI(uri).scheme)
|
120
112
|
end
|
121
113
|
|
122
114
|
#
|
@@ -133,110 +125,5 @@ module Repertoire
|
|
133
125
|
|
134
126
|
raise(UnknownMedia,"the media type for #{path.dump} is unknown",caller)
|
135
127
|
end
|
136
|
-
|
137
|
-
#
|
138
|
-
# Checkout the repository at the specified _options_. If a _block_
|
139
|
-
# is given, it will be passed the path of the local repository
|
140
|
-
# after the repository is successfully checked out.
|
141
|
-
#
|
142
|
-
# _options_ must contain the following key:
|
143
|
-
# <tt>:uri</tt>:: The URI of the repository to checkout.
|
144
|
-
#
|
145
|
-
# _options_ may also contain the additional keys:
|
146
|
-
# <tt>:path</tt>:: Path to checkout the repository to.
|
147
|
-
# <tt>:media</tt>:: The media type of the repository. Defaults to the
|
148
|
-
# value of Media.get_for_uri.
|
149
|
-
# <tt>:into</tt>:: Checkout the repository into the given directory.
|
150
|
-
# Cannot be used with <tt>:path</tt>.
|
151
|
-
#
|
152
|
-
def Media.checkout(options={},&block)
|
153
|
-
uri = options[:uri].to_s
|
154
|
-
path = options[:path]
|
155
|
-
into = options[:into]
|
156
|
-
media = options[:media]
|
157
|
-
|
158
|
-
unless path
|
159
|
-
if into
|
160
|
-
into = File.expand_path(into)
|
161
|
-
|
162
|
-
unless File.directory?(into)
|
163
|
-
FileUtils.mkdir_p(into)
|
164
|
-
end
|
165
|
-
|
166
|
-
path = File.join(into,URI.repo_name(uri))
|
167
|
-
else
|
168
|
-
path = URI.repo_name(uri)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
path = File.expand_path(path)
|
173
|
-
if File.exists?(path)
|
174
|
-
raise(RepositoryExists,"the repository #{path.dump} already exists",caller)
|
175
|
-
end
|
176
|
-
|
177
|
-
if media
|
178
|
-
handler = Media.get(media)
|
179
|
-
else
|
180
|
-
media, handler = Media.guess_from_uri(uri)
|
181
|
-
end
|
182
|
-
|
183
|
-
begin
|
184
|
-
handler.checkout(uri,path)
|
185
|
-
rescue CommandFailed
|
186
|
-
raise(CheckoutFailed,"failed to checkout the repository located at #{uri.dump}",caller)
|
187
|
-
end
|
188
|
-
|
189
|
-
block.call(path,media,uri) if block
|
190
|
-
return {:path => path, :media => media, :uri => uri}
|
191
|
-
end
|
192
|
-
|
193
|
-
#
|
194
|
-
# Update the repository with the specified _options_. If a _block_
|
195
|
-
# is given, it will be passed the path of the local repository
|
196
|
-
# after the repository is successfully updated.
|
197
|
-
#
|
198
|
-
# _options_ must contain the following keys:
|
199
|
-
# <tt>:path</tt>:: The path of the repository to update.
|
200
|
-
#
|
201
|
-
# _options_ may also contain the additional keys:
|
202
|
-
# <tt>:uri</tt>:: The URI to update against.
|
203
|
-
# <tt>:media</tt>:: The type of the repository. Defaults to
|
204
|
-
# Media.guess_from_uri if <tt>:uri</tt> is given,
|
205
|
-
# otherwise Media.guess_from_path.
|
206
|
-
#
|
207
|
-
def Media.update(options={},&block)
|
208
|
-
path = File.expand_path(options[:path])
|
209
|
-
uri = options[:uri]
|
210
|
-
media = options[:media]
|
211
|
-
|
212
|
-
if media
|
213
|
-
handler = Media.get(media)
|
214
|
-
elsif uri
|
215
|
-
media, handler = Media.guess_from_uri(uri)
|
216
|
-
else
|
217
|
-
handler = Media.guess_from_path(path)
|
218
|
-
end
|
219
|
-
|
220
|
-
begin
|
221
|
-
handler.update(path,uri)
|
222
|
-
rescue CommandFailed
|
223
|
-
raise(UpdateFailed,"failed to update the repository at #{path.dump}",caller)
|
224
|
-
end
|
225
|
-
|
226
|
-
block.call(media,path,uri) if block
|
227
|
-
return {:media => media, :path => path, :uri => uri}
|
228
|
-
end
|
229
|
-
|
230
|
-
#
|
231
|
-
# Delete the repository at the specified _path_. If a _block_ is
|
232
|
-
# given, it will be passed the _path_ before it is deleted.
|
233
|
-
#
|
234
|
-
def Media.delete(path,&block)
|
235
|
-
path = File.expand_path(path)
|
236
|
-
|
237
|
-
block.call(path) if block
|
238
|
-
FileUtils.rm_r(path.to_s,:force => true, :secure => true)
|
239
|
-
return nil
|
240
|
-
end
|
241
128
|
end
|
242
129
|
end
|
@@ -1,84 +1,102 @@
|
|
1
|
+
require 'repertoire/media/extensions/meta'
|
1
2
|
require 'repertoire/media/media'
|
2
|
-
require 'repertoire/extensions/meta'
|
3
3
|
require 'repertoire/compat'
|
4
4
|
|
5
5
|
module Repertoire
|
6
6
|
module Media
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
class Type
|
8
|
+
#
|
9
|
+
# The name of the Media Type.
|
10
|
+
#
|
11
|
+
def self.name
|
12
|
+
nil
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
#
|
16
|
+
# The supports URI schemes of the Media Type.
|
17
|
+
#
|
18
|
+
def self.schemes
|
19
|
+
[]
|
20
|
+
end
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
#
|
23
|
+
# The directory which is used by the Media Type to store metadata.
|
24
|
+
#
|
25
|
+
def self.directory
|
26
|
+
nil
|
27
|
+
end
|
20
28
|
|
21
|
-
|
22
|
-
@directory ||= nil
|
23
|
-
end
|
29
|
+
protected
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
#
|
32
|
+
# Register a Media type with the specified _names_.
|
33
|
+
#
|
34
|
+
# known_as :svn
|
35
|
+
#
|
36
|
+
def self.known_as(name)
|
37
|
+
name = name.to_sym
|
38
|
+
|
39
|
+
meta_def(:name) { name }
|
40
|
+
|
41
|
+
Media.types[name] = self
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# Register a Media type for the specified _schemes_.
|
46
|
+
#
|
47
|
+
# uses_schemes 'svn'
|
48
|
+
#
|
49
|
+
# uses_schemes 'svn', 'svn+ssh'
|
50
|
+
#
|
51
|
+
def self.uses_schemes(*schemes)
|
52
|
+
meta_def(:schemes) { schemes }
|
28
53
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
# Register a Media type with the specified _names_.
|
35
|
-
#
|
36
|
-
# known_as :svn
|
37
|
-
#
|
38
|
-
def self.known_as(name)
|
39
|
-
name = name.to_sym
|
40
|
-
|
41
|
-
self.name = name
|
42
|
-
Media.types[name] = self
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Register a Media type for the specified _schemes_.
|
47
|
-
#
|
48
|
-
# uses_schemes 'cvs'
|
49
|
-
#
|
50
|
-
# uses_schemes 'svn', 'svn+ssh'
|
51
|
-
#
|
52
|
-
def self.uses_schemes(*schemes)
|
53
|
-
schemes.each do |scheme|
|
54
|
-
scheme = scheme.to_s
|
55
|
-
|
56
|
-
self.schemes << scheme
|
57
|
-
Media.schemes[scheme] = self
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
#
|
62
|
-
# Registers a Media type that uses the directory of the specified
|
63
|
-
# _name_ to store media information.
|
64
|
-
#
|
65
|
-
# uses_directory '.svn'
|
66
|
-
#
|
67
|
-
def self.uses_directory(name)
|
68
|
-
name = name.to_s
|
69
|
-
|
70
|
-
self.directory = name
|
71
|
-
Media.directories[name] = self
|
72
|
-
end
|
73
|
-
|
74
|
-
#
|
75
|
-
# See Compat.sh.
|
76
|
-
#
|
77
|
-
def self.sh(program,*args)
|
78
|
-
Compat.sh(program,*args)
|
79
|
-
end
|
54
|
+
schemes.each do |scheme|
|
55
|
+
scheme = scheme.to_s
|
56
|
+
|
57
|
+
Media.schemes[scheme] = self
|
80
58
|
end
|
81
59
|
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Registers a Media type that uses the directory of the specified
|
63
|
+
# _name_ to store media information.
|
64
|
+
#
|
65
|
+
# uses_directory '.svn'
|
66
|
+
#
|
67
|
+
def self.uses_directory(name)
|
68
|
+
name = name.to_s
|
69
|
+
|
70
|
+
meta_def(:directory) { name }
|
71
|
+
|
72
|
+
Media.directories[name] = self
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Changes the current working directory to the specified _path_.
|
77
|
+
#
|
78
|
+
def self.cd(path)
|
79
|
+
Dir.chdir(path.to_s)
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Switches to the specified _path_, calls the given _block_ and then
|
84
|
+
# switches back to the previous directory.
|
85
|
+
#
|
86
|
+
def self.switch_dir(path,&block)
|
87
|
+
current = Dir.pwd
|
88
|
+
|
89
|
+
cd path
|
90
|
+
block.call if block
|
91
|
+
cd current
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# See Compat.sh.
|
96
|
+
#
|
97
|
+
def self.sh(program,*args)
|
98
|
+
Compat.sh(program,*args)
|
99
|
+
end
|
82
100
|
end
|
83
101
|
end
|
84
102
|
end
|
@@ -2,9 +2,7 @@ require 'repertoire/media/type'
|
|
2
2
|
|
3
3
|
module Repertoire
|
4
4
|
module Media
|
5
|
-
class Git
|
6
|
-
|
7
|
-
include Type
|
5
|
+
class Git < Type
|
8
6
|
|
9
7
|
known_as :git
|
10
8
|
|
@@ -12,18 +10,20 @@ module Repertoire
|
|
12
10
|
uses_directory '.git'
|
13
11
|
|
14
12
|
#
|
15
|
-
# Checks out the Git repository located at the specified _uri_ into
|
16
|
-
# specified _path_.
|
13
|
+
# Checks out the Git repository located at the specified _uri_ into
|
14
|
+
# the specified _path_.
|
17
15
|
#
|
18
16
|
def self.checkout(uri,path)
|
19
|
-
sh
|
17
|
+
sh 'git', 'clone', uri, path
|
20
18
|
end
|
21
19
|
|
22
20
|
#
|
23
21
|
# Updated the Git repository located at the specified _path_.
|
24
22
|
#
|
25
23
|
def self.update(path,uri=nil)
|
26
|
-
|
24
|
+
switch_dir(path) do
|
25
|
+
sh 'git', 'pull'
|
26
|
+
end
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'repertoire/media/type'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
module Media
|
5
|
+
class Hg < Type
|
6
|
+
|
7
|
+
known_as :hg
|
8
|
+
|
9
|
+
uses_directory '.hg'
|
10
|
+
|
11
|
+
#
|
12
|
+
# Checks out the Mercurial repository located at the specified _uri_
|
13
|
+
# into the specified _path_.
|
14
|
+
#
|
15
|
+
def self.checkout(uri,path)
|
16
|
+
sh 'hg', 'clone', uri, path
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# Updated the Mercurial repository located at the specified _path_.
|
21
|
+
#
|
22
|
+
def self.update(path,uri=nil)
|
23
|
+
switch_dir(path) do
|
24
|
+
sh 'hg', 'pull', '-u'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -2,9 +2,7 @@ require 'repertoire/media/type'
|
|
2
2
|
|
3
3
|
module Repertoire
|
4
4
|
module Media
|
5
|
-
class Rsync
|
6
|
-
|
7
|
-
include Type
|
5
|
+
class Rsync < Type
|
8
6
|
|
9
7
|
known_as :rsync
|
10
8
|
|
@@ -15,15 +13,15 @@ module Repertoire
|
|
15
13
|
# the specified _path_.
|
16
14
|
#
|
17
15
|
def self.checkout(uri,path)
|
18
|
-
sh
|
16
|
+
sh 'rsync', '-av', uri, path
|
19
17
|
end
|
20
18
|
|
21
19
|
#
|
22
|
-
# Updated the Rsync repository located at the specified _path_ with
|
23
|
-
# remote repository at the specified _uri_.
|
20
|
+
# Updated the Rsync repository located at the specified _path_ with
|
21
|
+
# the remote repository at the specified _uri_.
|
24
22
|
#
|
25
23
|
def self.update(path,uri)
|
26
|
-
sh
|
24
|
+
sh 'rsync', '-av', '--delete-after', uri, path
|
27
25
|
end
|
28
26
|
|
29
27
|
end
|
@@ -2,9 +2,7 @@ require 'repertoire/media/type'
|
|
2
2
|
|
3
3
|
module Repertoire
|
4
4
|
module Media
|
5
|
-
class SVN
|
6
|
-
|
7
|
-
include Type
|
5
|
+
class SVN < Type
|
8
6
|
|
9
7
|
known_as :svn
|
10
8
|
|
@@ -12,18 +10,18 @@ module Repertoire
|
|
12
10
|
uses_directory '.svn'
|
13
11
|
|
14
12
|
#
|
15
|
-
# Checks out the SVN repository located at the specified _uri_ into
|
16
|
-
# specified _path_.
|
13
|
+
# Checks out the SVN repository located at the specified _uri_ into
|
14
|
+
# the specified _path_.
|
17
15
|
#
|
18
16
|
def self.checkout(uri,path)
|
19
|
-
sh
|
17
|
+
sh 'svn', 'co', uri, path
|
20
18
|
end
|
21
19
|
|
22
20
|
#
|
23
21
|
# Updated the SVN repository located at the specified _path_.
|
24
22
|
#
|
25
23
|
def self.update(path,uri=nil)
|
26
|
-
sh
|
24
|
+
sh 'svn', 'up', path
|
27
25
|
end
|
28
26
|
|
29
27
|
end
|