repertoire 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +17 -0
- data/Manifest.txt +15 -5
- data/README.txt +1 -1
- data/lib/repertoire.rb +1 -0
- data/lib/repertoire/compat.rb +29 -0
- data/lib/repertoire/exceptions.rb +2 -0
- data/lib/repertoire/exceptions/command_failed.rb +4 -0
- data/lib/repertoire/exceptions/program_not_found.rb +4 -0
- data/lib/repertoire/extensions/meta.rb +1 -0
- data/lib/repertoire/extensions/meta/object.rb +24 -0
- data/lib/repertoire/extensions/uri.rb +6 -4
- data/lib/repertoire/media.rb +1 -4
- data/lib/repertoire/media/exceptions.rb +3 -1
- data/lib/repertoire/media/exceptions/checkout_failed.rb +4 -0
- data/lib/repertoire/media/exceptions/repository_exists.rb +4 -0
- data/lib/repertoire/media/exceptions/update_failed.rb +4 -0
- data/lib/repertoire/media/media.rb +175 -67
- data/lib/repertoire/media/type.rb +84 -0
- data/lib/repertoire/media/types.rb +4 -0
- data/lib/repertoire/media/types/cvs.rb +31 -0
- data/lib/repertoire/media/types/darcs.rb +30 -0
- data/lib/repertoire/media/types/rsync.rb +31 -0
- data/lib/repertoire/media/types/svn.rb +31 -0
- data/lib/repertoire/repertoire.rb +24 -0
- data/lib/repertoire/version.rb +1 -1
- metadata +59 -56
- data/bin/repertoire +0 -0
- data/lib/repertoire/media/cvs.rb +0 -32
- data/lib/repertoire/media/darcs.rb +0 -32
- data/lib/repertoire/media/rsync.rb +0 -25
- data/lib/repertoire/media/svn.rb +0 -32
data/History.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
== 0.1.1 / 2008-02-09
|
2
|
+
|
3
|
+
* Added the Type module to add meta-programming methods to Media types.
|
4
|
+
* Added metaid.rb.
|
5
|
+
* Added method Media.schemes.
|
6
|
+
* Added method Media.registered_schemes
|
7
|
+
* Added method Media.supports_scheme?.
|
8
|
+
* Added method Media.supports_scheme.
|
9
|
+
* Added method Media.directories.
|
10
|
+
* Added method Media.registered_directories.
|
11
|
+
* Added method Media.recognizes_directory?.
|
12
|
+
* Added method Media.recognizes_directory.
|
13
|
+
* Use :media instead of :type within the options passed to Media.checkout
|
14
|
+
and Media.update.
|
15
|
+
* Fixed Manifest to include
|
16
|
+
lib/repertoire/exceptions/program_not_found.
|
17
|
+
|
1
18
|
== 0.1.0 / 2008-01-17
|
2
19
|
|
3
20
|
* Initial release.
|
data/Manifest.txt
CHANGED
@@ -2,18 +2,28 @@ History.txt
|
|
2
2
|
Manifest.txt
|
3
3
|
README.txt
|
4
4
|
Rakefile
|
5
|
-
bin/repertoire
|
6
5
|
lib/repertoire.rb
|
7
6
|
lib/repertoire/compat.rb
|
8
7
|
lib/repertoire/extensions.rb
|
8
|
+
lib/repertoire/extensions/meta.rb
|
9
|
+
lib/repertoire/extensions/meta/object.rb
|
9
10
|
lib/repertoire/extensions/uri.rb
|
11
|
+
lib/repertoire/exceptions.rb
|
12
|
+
lib/repertoire/exceptions/program_not_found.rb
|
13
|
+
lib/repertoire/exceptions/command_failed.rb
|
10
14
|
lib/repertoire/media.rb
|
11
15
|
lib/repertoire/media/exceptions.rb
|
12
16
|
lib/repertoire/media/exceptions/unknown_media.rb
|
17
|
+
lib/repertoire/media/exceptions/repository_exists.rb
|
18
|
+
lib/repertoire/media/exceptions/checkout_failed.rb
|
19
|
+
lib/repertoire/media/exceptions/update_failed.rb
|
13
20
|
lib/repertoire/media/media.rb
|
14
|
-
lib/repertoire/media/
|
15
|
-
lib/repertoire/media/
|
16
|
-
lib/repertoire/media/
|
17
|
-
lib/repertoire/media/
|
21
|
+
lib/repertoire/media/type.rb
|
22
|
+
lib/repertoire/media/types.rb
|
23
|
+
lib/repertoire/media/types/cvs.rb
|
24
|
+
lib/repertoire/media/types/darcs.rb
|
25
|
+
lib/repertoire/media/types/rsync.rb
|
26
|
+
lib/repertoire/media/types/svn.rb
|
27
|
+
lib/repertoire/repertoire.rb
|
18
28
|
lib/repertoire/version.rb
|
19
29
|
test/test_repertoire.rb
|
data/README.txt
CHANGED
@@ -8,7 +8,7 @@ R'epertoire is a Ruby library and utility for quickly checking-out and updating
|
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
11
|
-
* Currently supports checking-out and updating from
|
11
|
+
* Currently supports checking-out and updating from:
|
12
12
|
* Subversion (SVN)
|
13
13
|
* Darcs
|
14
14
|
* CVS
|
data/lib/repertoire.rb
CHANGED
data/lib/repertoire/compat.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'repertoire/exceptions/program_not_found'
|
2
|
+
require 'repertoire/exceptions/command_failed'
|
3
|
+
|
1
4
|
module Repertoire
|
2
5
|
module Compat
|
3
6
|
#
|
@@ -43,5 +46,31 @@ module Repertoire
|
|
43
46
|
|
44
47
|
return nil
|
45
48
|
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Runs the command specified by _program_ and the given _args_.
|
52
|
+
# If _program_ cannot be found on the system, a ProgramNotFound
|
53
|
+
# exception will be raised.
|
54
|
+
#
|
55
|
+
# Compat.sh('ls','-la','/')
|
56
|
+
#
|
57
|
+
def Compat.sh(program,*args)
|
58
|
+
program = program.to_s
|
59
|
+
|
60
|
+
program_path = Compat.find_program(program)
|
61
|
+
unless program_path
|
62
|
+
raise(ProgramNotFound,"the program #{program.dump} was not found",caller)
|
63
|
+
end
|
64
|
+
|
65
|
+
# stringify the args
|
66
|
+
args = args.map { |arg| arg.to_s }
|
67
|
+
|
68
|
+
unless system(program_path,*args)
|
69
|
+
command = program_path
|
70
|
+
command += ' ' + args.join(' ') unless args.empty?
|
71
|
+
|
72
|
+
raise(CommandFailed,"the command #{command.dump} failed",caller)
|
73
|
+
end
|
74
|
+
end
|
46
75
|
end
|
47
76
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'repertoire/extensions/meta/object'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# metaprogramming assistant -- metaid.rb
|
2
|
+
class Object # :nodoc:
|
3
|
+
# The hidden singleton lurks behind everyone
|
4
|
+
def metaclass; class << self; self; end; end
|
5
|
+
def meta_eval(&blk); metaclass.instance_eval(&blk); end
|
6
|
+
|
7
|
+
# A class_eval version of meta_eval
|
8
|
+
def metaclass_eval(&blk); metaclass.class_eval(&blk); end
|
9
|
+
|
10
|
+
# Adds methods to a metaclass
|
11
|
+
def meta_def(name, &blk)
|
12
|
+
meta_eval { define_method(name, &blk) }
|
13
|
+
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
|
+
|
20
|
+
# Defines an instance method within a class
|
21
|
+
def class_def(name, &blk)
|
22
|
+
class_eval { define_method(name, &blk) }
|
23
|
+
end
|
24
|
+
end
|
@@ -12,11 +12,13 @@ module URI
|
|
12
12
|
# "awesome"
|
13
13
|
#
|
14
14
|
def URI.repo_name(uri)
|
15
|
-
|
16
|
-
name = File.basename(path)
|
15
|
+
uri = URI.parse(uri)
|
16
|
+
name = File.basename(uri.path)
|
17
17
|
|
18
|
-
if name
|
19
|
-
name =
|
18
|
+
if name.empty? || name==File::SEPARATOR
|
19
|
+
name = uri.host
|
20
|
+
elsif name=='trunk'
|
21
|
+
name = File.basename(File.dirname(uri.path))
|
20
22
|
end
|
21
23
|
|
22
24
|
return name
|
data/lib/repertoire/media.rb
CHANGED
@@ -1,134 +1,242 @@
|
|
1
1
|
require 'repertoire/media/exceptions/unknown_media'
|
2
|
-
require 'repertoire/media/exceptions/
|
2
|
+
require 'repertoire/media/exceptions/repository_exists'
|
3
|
+
require 'repertoire/media/exceptions/checkout_failed'
|
4
|
+
require 'repertoire/media/exceptions/update_failed'
|
3
5
|
require 'repertoire/extensions/uri'
|
4
|
-
require 'repertoire/compat'
|
5
6
|
|
6
7
|
require 'fileutils'
|
7
8
|
|
8
9
|
module Repertoire
|
9
|
-
|
10
|
-
|
10
|
+
module Media
|
11
11
|
#
|
12
|
-
# Returns the Hash of all registered Media types.
|
12
|
+
# Returns the +Hash+ of all registered Media types.
|
13
13
|
#
|
14
14
|
def Media.types
|
15
|
-
|
15
|
+
@@media_types ||= {}
|
16
16
|
end
|
17
17
|
|
18
18
|
#
|
19
|
-
# Returns +true+ if a Media type
|
20
|
-
#
|
19
|
+
# Returns +true+ if there is a Media type registered with the matching
|
20
|
+
# _name_.
|
21
21
|
#
|
22
|
-
def Media.
|
23
|
-
Media.types.has_key?(
|
22
|
+
def Media.supports?(name)
|
23
|
+
Media.types.has_key?(name.to_sym)
|
24
24
|
end
|
25
25
|
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Returns the Media type with the matching _name_.
|
28
28
|
#
|
29
|
-
def Media.get(
|
30
|
-
|
31
|
-
|
29
|
+
def Media.get(name)
|
30
|
+
name = name.to_sym
|
31
|
+
|
32
|
+
unless Media.supports?(name)
|
33
|
+
raise(UnknownMedia,"media type #{name.dump} is not registered",caller)
|
32
34
|
end
|
33
35
|
|
34
|
-
return Media.types[
|
36
|
+
return Media.types[name]
|
35
37
|
end
|
36
38
|
|
37
39
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
+
# Returns the +Hash+ of all registered Media types and their associated
|
41
|
+
# URI schemes.
|
40
42
|
#
|
41
|
-
def Media.
|
42
|
-
|
43
|
+
def Media.schemes
|
44
|
+
@@media_schemes ||= {}
|
43
45
|
end
|
44
46
|
|
45
47
|
#
|
46
|
-
#
|
48
|
+
# Returns an +Array+ of all registered URI schemes.
|
47
49
|
#
|
48
|
-
def Media.
|
49
|
-
|
50
|
+
def Media.registered_schemes
|
51
|
+
Media.schemes.keys
|
52
|
+
end
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
#
|
55
|
+
# Returns +true+ if a Media type was registered for the specified
|
56
|
+
# _scheme_, returns +false+ otherwise.
|
57
|
+
#
|
58
|
+
def Media.supports_scheme?(scheme)
|
59
|
+
Media.schemes.has_key?(scheme.to_s)
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Returns the Media type that was registered for the specified _scheme_.
|
64
|
+
#
|
65
|
+
def Media.supports_scheme(name)
|
66
|
+
name = name.to_s
|
67
|
+
|
68
|
+
unless Media.supports_scheme?(name)
|
69
|
+
raise(UnknownMedia,"media type for scheme #{name.dump} is not registered",caller)
|
55
70
|
end
|
56
71
|
|
57
|
-
|
72
|
+
return Media.schemes[name]
|
58
73
|
end
|
59
74
|
|
60
75
|
#
|
61
|
-
#
|
76
|
+
# Returns the +Hash+ of all registered Media types and their
|
77
|
+
# associated media storage directories.
|
62
78
|
#
|
63
|
-
def Media.
|
64
|
-
|
65
|
-
|
66
|
-
else
|
67
|
-
path = URI.repo_name(uri)
|
68
|
-
end
|
79
|
+
def Media.directories
|
80
|
+
@@media_directories ||= {}
|
81
|
+
end
|
69
82
|
|
70
|
-
|
83
|
+
#
|
84
|
+
# Returns an +Array+ of all registered directories.
|
85
|
+
#
|
86
|
+
def Media.registered_directories
|
87
|
+
Media.directories.keys
|
71
88
|
end
|
72
89
|
|
73
90
|
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
# type of the repository, see Media.guess.
|
91
|
+
# Returns +true+ if a Media type was registered with the specified
|
92
|
+
# _directory_, returns +false+ otherwise.
|
77
93
|
#
|
78
|
-
def Media.
|
79
|
-
|
94
|
+
def Media.recognizes_directory?(name)
|
95
|
+
Media.directories.has_key?(name.to_s)
|
96
|
+
end
|
80
97
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
98
|
+
#
|
99
|
+
# Returns the Media type that was registered for the specified
|
100
|
+
# _directory_.
|
101
|
+
#
|
102
|
+
def Media.recognizes_directory(name)
|
103
|
+
name = name.to_s
|
104
|
+
|
105
|
+
unless Media.recognizes_directory?(name)
|
106
|
+
raise(UnknownMedia,"media type for directory #{name.dump} is not registered",caller)
|
85
107
|
end
|
86
108
|
|
87
|
-
return
|
109
|
+
return Media.directories[name]
|
88
110
|
end
|
89
111
|
|
90
112
|
#
|
91
|
-
#
|
113
|
+
# Get the Media type that was registered for the scheme of the
|
114
|
+
# specified _uri_.
|
92
115
|
#
|
93
|
-
def Media.
|
94
|
-
|
116
|
+
def Media.guess_from_uri(uri)
|
117
|
+
scheme = URI(uri).scheme
|
118
|
+
|
119
|
+
return [scheme, Media.supports_scheme(scheme)]
|
95
120
|
end
|
96
121
|
|
97
|
-
|
122
|
+
#
|
123
|
+
# Attempts to determine the correct Media type for the specified _path_.
|
124
|
+
#
|
125
|
+
def Media.guess_from_path(path)
|
126
|
+
path = File.expand_path(path)
|
127
|
+
|
128
|
+
Media.directories.each do |directory,media|
|
129
|
+
if File.directory?(File.join(path,directory))
|
130
|
+
return media
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
raise(UnknownMedia,"the media type for #{path.dump} is unknown",caller)
|
135
|
+
end
|
98
136
|
|
99
137
|
#
|
100
|
-
#
|
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.
|
101
141
|
#
|
102
|
-
#
|
142
|
+
# _options_ must contain the following key:
|
143
|
+
# <tt>:uri</tt>:: The URI of the repository to checkout.
|
103
144
|
#
|
104
|
-
#
|
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>.
|
105
151
|
#
|
106
|
-
def
|
107
|
-
|
108
|
-
|
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
|
109
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}
|
110
191
|
end
|
111
192
|
|
112
193
|
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
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.
|
116
200
|
#
|
117
|
-
#
|
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.
|
118
206
|
#
|
119
|
-
def
|
120
|
-
|
207
|
+
def Media.update(options={},&block)
|
208
|
+
path = File.expand_path(options[:path])
|
209
|
+
uri = options[:uri]
|
210
|
+
media = options[:media]
|
121
211
|
|
122
|
-
|
123
|
-
|
124
|
-
|
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)
|
125
218
|
end
|
126
219
|
|
127
|
-
|
128
|
-
|
220
|
+
begin
|
221
|
+
handler.update(path,uri)
|
222
|
+
rescue CommandFailed
|
223
|
+
raise(UpdateFailed,"failed to update the repository at #{path.dump}",caller)
|
224
|
+
end
|
129
225
|
|
130
|
-
|
226
|
+
block.call(media,path,uri) if block
|
227
|
+
return {:media => media, :path => path, :uri => uri}
|
131
228
|
end
|
132
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
|
133
241
|
end
|
134
242
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'repertoire/media/media'
|
2
|
+
require 'repertoire/extensions/meta'
|
3
|
+
require 'repertoire/compat'
|
4
|
+
|
5
|
+
module Repertoire
|
6
|
+
module Media
|
7
|
+
module Type
|
8
|
+
def self.included(base)
|
9
|
+
base.meta_def(:name) do
|
10
|
+
@name ||= nil
|
11
|
+
end
|
12
|
+
|
13
|
+
base.meta_def('name=') do |name|
|
14
|
+
@name = name.to_sym
|
15
|
+
end
|
16
|
+
|
17
|
+
base.meta_def(:schemes) do
|
18
|
+
@schemes ||= []
|
19
|
+
end
|
20
|
+
|
21
|
+
base.meta_def(:directory) do
|
22
|
+
@directory ||= nil
|
23
|
+
end
|
24
|
+
|
25
|
+
base.meta_def('directory=') do |dir|
|
26
|
+
@directory = dir.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
base.module_eval do
|
30
|
+
|
31
|
+
protected
|
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
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'repertoire/media/type'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
module Media
|
5
|
+
class CVS
|
6
|
+
|
7
|
+
include Type
|
8
|
+
|
9
|
+
known_as :cvs
|
10
|
+
|
11
|
+
uses_schemes 'cvs'
|
12
|
+
uses_directory 'CVS'
|
13
|
+
|
14
|
+
#
|
15
|
+
# Checks out the CVS repository located at the specified _uri_ into the
|
16
|
+
# specified _path_.
|
17
|
+
#
|
18
|
+
def self.checkout(uri,path)
|
19
|
+
sh('cvs','-d',path,'co',uri)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Updated the CVS repository located at the specified _path_.
|
24
|
+
#
|
25
|
+
def self.update(path,uri=nil)
|
26
|
+
sh('cvs','up',path)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'repertoire/media/type'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
module Media
|
5
|
+
class Darcs
|
6
|
+
|
7
|
+
include Type
|
8
|
+
|
9
|
+
known_as :darcs
|
10
|
+
|
11
|
+
uses_directory '_darcs'
|
12
|
+
|
13
|
+
#
|
14
|
+
# Checks out the Darcs repository located at the specified _uri_ into
|
15
|
+
# the specified _path_.
|
16
|
+
#
|
17
|
+
def self.checkout(uri,path=nil)
|
18
|
+
sh('darcs','get','--partial',uri,path)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Updated the Darcs repository located at the specified _path_.
|
23
|
+
#
|
24
|
+
def self.update(uri,path)
|
25
|
+
sh('darcs','pull','-a',path)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'repertoire/media/type'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
module Media
|
5
|
+
class Rsync
|
6
|
+
|
7
|
+
include Type
|
8
|
+
|
9
|
+
known_as :rsync
|
10
|
+
|
11
|
+
uses_schemes 'rsync'
|
12
|
+
|
13
|
+
#
|
14
|
+
# Checks out the Rsync repository located at the specified _uri_ into
|
15
|
+
# the specified _path_.
|
16
|
+
#
|
17
|
+
def self.checkout(uri,path)
|
18
|
+
sh('rsync','-av',uri,path)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Updated the Rsync repository located at the specified _path_ with the
|
23
|
+
# remote repository at the specified _uri_.
|
24
|
+
#
|
25
|
+
def self.update(path,uri)
|
26
|
+
sh('rsync','-av','--delete-after',uri,path)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'repertoire/media/type'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
module Media
|
5
|
+
class SVN
|
6
|
+
|
7
|
+
include Type
|
8
|
+
|
9
|
+
known_as :svn
|
10
|
+
|
11
|
+
uses_schemes 'svn', 'svn+ssh'
|
12
|
+
uses_directory '.svn'
|
13
|
+
|
14
|
+
#
|
15
|
+
# Checks out the SVN repository located at the specified _uri_ into the
|
16
|
+
# specified _path_.
|
17
|
+
#
|
18
|
+
def self.checkout(uri,path)
|
19
|
+
sh('svn','co',uri,path)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Updated the SVN repository located at the specified _path_.
|
24
|
+
#
|
25
|
+
def self.update(path,uri=nil)
|
26
|
+
sh('svn','up',path)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'repertoire/media'
|
2
|
+
|
3
|
+
module Repertoire
|
4
|
+
#
|
5
|
+
# See Media.checkout.
|
6
|
+
#
|
7
|
+
def Repertoire.checkout(options={},&block)
|
8
|
+
Media.checkout(options,&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
#
|
12
|
+
# See Media.update.
|
13
|
+
#
|
14
|
+
def Repertoire.update(options={},&block)
|
15
|
+
Media.update(options,&block)
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# See Media.delete.
|
20
|
+
#
|
21
|
+
def Repertoire.delete(path,&block)
|
22
|
+
Media.delete(path,&block)
|
23
|
+
end
|
24
|
+
end
|
data/lib/repertoire/version.rb
CHANGED
metadata
CHANGED
@@ -1,82 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
2
4
|
name: repertoire
|
3
5
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2008-02-09 00:00:00 -08:00
|
8
|
+
summary: R'epertoire is a Ruby library and utility for quickly checking-out and updating code-bases from various SCMs. R'epertoire currently supports Subversion, Darcs, CVS, and even RSync.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: postmodern.mod3@gmail.com
|
12
|
+
homepage: " by Postmodern Modulus III"
|
13
|
+
rubyforge_project: repertoire
|
14
|
+
description: "== FEATURES/PROBLEMS: * Currently supports checking-out and updating from: * Subversion (SVN) * Darcs * CVS * RSync == INSTALL: $ sudo gem install repertoire == LICENSE:"
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
5
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
6
29
|
authors:
|
7
30
|
- Postmodern Modulus III
|
8
|
-
autorequire:
|
9
|
-
bindir: bin
|
10
|
-
cert_chain: []
|
11
|
-
|
12
|
-
date: 2008-01-17 00:00:00 -08:00
|
13
|
-
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: hoe
|
17
|
-
version_requirement:
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.4.0
|
23
|
-
version:
|
24
|
-
description: "== FEATURES/PROBLEMS: * Currently supports checking-out and updating from... * Subversion (SVN) * Darcs * CVS * RSync == INSTALL: $ sudo gem install repertoire == LICENSE:"
|
25
|
-
email: postmodern.mod3@gmail.com
|
26
|
-
executables:
|
27
|
-
- repertoire
|
28
|
-
extensions: []
|
29
|
-
|
30
|
-
extra_rdoc_files:
|
31
|
-
- History.txt
|
32
|
-
- Manifest.txt
|
33
|
-
- README.txt
|
34
31
|
files:
|
35
32
|
- History.txt
|
36
33
|
- Manifest.txt
|
37
34
|
- README.txt
|
38
35
|
- Rakefile
|
39
|
-
- bin/repertoire
|
40
36
|
- lib/repertoire.rb
|
41
37
|
- lib/repertoire/compat.rb
|
42
38
|
- lib/repertoire/extensions.rb
|
39
|
+
- lib/repertoire/extensions/meta.rb
|
40
|
+
- lib/repertoire/extensions/meta/object.rb
|
43
41
|
- lib/repertoire/extensions/uri.rb
|
42
|
+
- lib/repertoire/exceptions.rb
|
43
|
+
- lib/repertoire/exceptions/program_not_found.rb
|
44
|
+
- lib/repertoire/exceptions/command_failed.rb
|
44
45
|
- lib/repertoire/media.rb
|
45
46
|
- lib/repertoire/media/exceptions.rb
|
46
47
|
- lib/repertoire/media/exceptions/unknown_media.rb
|
48
|
+
- lib/repertoire/media/exceptions/repository_exists.rb
|
49
|
+
- lib/repertoire/media/exceptions/checkout_failed.rb
|
50
|
+
- lib/repertoire/media/exceptions/update_failed.rb
|
47
51
|
- lib/repertoire/media/media.rb
|
48
|
-
- lib/repertoire/media/
|
49
|
-
- lib/repertoire/media/
|
50
|
-
- lib/repertoire/media/
|
51
|
-
- lib/repertoire/media/
|
52
|
+
- lib/repertoire/media/type.rb
|
53
|
+
- lib/repertoire/media/types.rb
|
54
|
+
- lib/repertoire/media/types/cvs.rb
|
55
|
+
- lib/repertoire/media/types/darcs.rb
|
56
|
+
- lib/repertoire/media/types/rsync.rb
|
57
|
+
- lib/repertoire/media/types/svn.rb
|
58
|
+
- lib/repertoire/repertoire.rb
|
52
59
|
- lib/repertoire/version.rb
|
53
60
|
- test/test_repertoire.rb
|
54
|
-
|
55
|
-
|
56
|
-
post_install_message:
|
61
|
+
test_files:
|
62
|
+
- test/test_repertoire.rb
|
57
63
|
rdoc_options:
|
58
64
|
- --main
|
59
65
|
- README.txt
|
60
|
-
|
61
|
-
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: "0"
|
73
|
-
version:
|
66
|
+
extra_rdoc_files:
|
67
|
+
- History.txt
|
68
|
+
- Manifest.txt
|
69
|
+
- README.txt
|
70
|
+
executables: []
|
71
|
+
|
72
|
+
extensions: []
|
73
|
+
|
74
74
|
requirements: []
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
-
|
76
|
+
dependencies:
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: hoe
|
79
|
+
version_requirement:
|
80
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.5.0
|
85
|
+
version:
|
data/bin/repertoire
DELETED
File without changes
|
data/lib/repertoire/media/cvs.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'repertoire/media/media'
|
2
|
-
|
3
|
-
module Repertoire
|
4
|
-
class CVS < Media
|
5
|
-
|
6
|
-
uses_schemes 'cvs'
|
7
|
-
|
8
|
-
#
|
9
|
-
# Returns +true+ if the repository located at the specified _path_
|
10
|
-
# contains the +CVS+ directory, returns +false+ otherwise.
|
11
|
-
#
|
12
|
-
def self.is_repo?(path)
|
13
|
-
File.directory?(File.join(path,'CVS'))
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Checks out the CVS repository located at the specified _uri_ into the
|
18
|
-
# specified _path_.
|
19
|
-
#
|
20
|
-
def self.checkout(uri,path)
|
21
|
-
sh('cvs','-d',path,'co',uri)
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# Updated the CVS repository located at the specified _path_.
|
26
|
-
#
|
27
|
-
def self.update(path,uri=nil)
|
28
|
-
sh('cvs','up',path)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'repertoire/media/media'
|
2
|
-
|
3
|
-
module Repertoire
|
4
|
-
class Darcs < Media
|
5
|
-
|
6
|
-
uses_schemes 'darcs'
|
7
|
-
|
8
|
-
#
|
9
|
-
# Returns +true+ if the repository located at the specified _path_
|
10
|
-
# contains the +_darcs+ directory, returns +false+ otherwise.
|
11
|
-
#
|
12
|
-
def self.is_repo?(path)
|
13
|
-
File.directory?(File.join(path,'_darcs'))
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Checks out the Darcs repository located at the specified _uri_ into
|
18
|
-
# the specified _path_.
|
19
|
-
#
|
20
|
-
def self.checkout(uri,path=nil)
|
21
|
-
sh('darcs','get','--partial',uri,path)
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# Updated the Darcs repository located at the specified _path_.
|
26
|
-
#
|
27
|
-
def self.update(uri,path)
|
28
|
-
sh('darcs','pull','-a',path)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'repertoire/media/media'
|
2
|
-
|
3
|
-
module Repertoire
|
4
|
-
class Rsync < Media
|
5
|
-
|
6
|
-
uses_schemes 'rsync'
|
7
|
-
|
8
|
-
#
|
9
|
-
# Checks out the Rsync repository located at the specified _uri_ into
|
10
|
-
# the specified _path_.
|
11
|
-
#
|
12
|
-
def self.checkout(uri,path)
|
13
|
-
sh('rsync','-av',uri,path)
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Updated the Rsync repository located at the specified _path_ with the
|
18
|
-
# remote repository at the specified _uri_.
|
19
|
-
#
|
20
|
-
def self.update(path,uri)
|
21
|
-
sh('rsync','-av','--delete-after',uri,path)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
data/lib/repertoire/media/svn.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'repertoire/media/media'
|
2
|
-
|
3
|
-
module Repertoire
|
4
|
-
class SVN < Media
|
5
|
-
|
6
|
-
uses_schemes 'svn', 'svn+ssh'
|
7
|
-
|
8
|
-
#
|
9
|
-
# Returns +true+ if the repository located at the specified _path_
|
10
|
-
# contains the +.svn+ directory, returns +false+ otherwise.
|
11
|
-
#
|
12
|
-
def self.is_repo?(path)
|
13
|
-
File.directory?(File.join(path,'.svn'))
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Checks out the SVN repository located at the specified _uri_ into the
|
18
|
-
# specified _path_.
|
19
|
-
#
|
20
|
-
def self.checkout(uri,path)
|
21
|
-
sh('svn','co',uri,path)
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# Updated the SVN repository located at the specified _path_.
|
26
|
-
#
|
27
|
-
def self.update(path,uri=nil)
|
28
|
-
sh('svn','up',path)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|