repertoire 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig ADDED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ === 0.2.3 / 2009-09-21
2
+
3
+ * Require Hoe >= 2.3.3.
4
+ * Require YARD >= 0.2.3.5.
5
+ * Require RSpec >= 1.2.8.
6
+ * Use 'hoe/signing' for signed RubyGems.
7
+ * Moved to YARD based documentation.
8
+ * All specs pass on JRuby 1.3.1.
9
+
1
10
  === 0.2.2 / 2009-04-13
2
11
 
3
12
  * Rewrote Repository.name to not use the URI module.
data/README.txt CHANGED
@@ -18,10 +18,6 @@ Git, Mercurial and even RSync.
18
18
  * RSync
19
19
  * Subversion (SVN)
20
20
 
21
- == INSTALL:
22
-
23
- $ sudo gem install repertoire
24
-
25
21
  == EXAMPLES:
26
22
 
27
23
  * Checkout a repository using a URI:
@@ -47,6 +43,14 @@ Git, Mercurial and even RSync.
47
43
 
48
44
  Repertoire.update(:path => 'path/to/rsynced_data', :media => :rsync)
49
45
 
46
+ == REQUIREMENTS:
47
+
48
+ * {YARD}[http://yard.soen.ca/] >= 0.2.3.5
49
+
50
+ == INSTALL:
51
+
52
+ $ sudo gem install repertoire
53
+
50
54
  == LICENSE:
51
55
 
52
56
  The MIT License
data/Rakefile CHANGED
@@ -2,13 +2,23 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
+ require 'hoe/signing'
5
6
  require './tasks/spec.rb'
6
- require './lib/repertoire/version.rb'
7
+ require './tasks/yard.rb'
7
8
 
8
- Hoe.new('repertoire', Repertoire::VERSION) do |p|
9
- p.rubyforge_name = 'repertoire'
10
- p.developer('Postmodern','postmodern.mod3@gmail.com')
11
- p.remote_rdoc_dir = ''
9
+ Hoe.spec('repertoire') do
10
+ self.rubyforge_name = 'repertoire'
11
+ self.developer('Postmodern','postmodern.mod3@gmail.com')
12
+ self.remote_rdoc_dir = ''
13
+ self.extra_deps = [
14
+ ['yard', '>=0.2.3.5']
15
+ ]
16
+
17
+ self.extra_dev_deps = [
18
+ ['rspec', '>=1.2.8']
19
+ ]
20
+
21
+ self.spec_extras = {:has_rdoc => 'yard'}
12
22
  end
13
23
 
14
24
  # vim: syntax=Ruby
@@ -4,8 +4,10 @@ require 'repertoire/exceptions/command_failed'
4
4
  module Repertoire
5
5
  module Compat
6
6
  #
7
- # Returns the native _platform_.
7
+ # @return [String]
8
+ # The native platform.
8
9
  #
10
+ # @example
9
11
  # Compat.arch #=> "linux"
10
12
  #
11
13
  def self.platform
@@ -13,10 +15,10 @@ module Repertoire
13
15
  end
14
16
 
15
17
  #
16
- # Returns an array representing the +PATH+ environment variable.
17
- # If the +PATH+ environment variable is not setup, an empty array will
18
- # be returned.
18
+ # @return [Array]
19
+ # +PATH+ environment variable.
19
20
  #
21
+ # @example
20
22
  # Compat.paths
21
23
  # #=> ["/bin", "/usr/bin"]
22
24
  #
@@ -33,10 +35,15 @@ module Repertoire
33
35
  end
34
36
 
35
37
  #
36
- # Finds the program matching _name_ and returns it's full path.
37
- # If the program was not found, +nil+ will be returned.
38
+ # Finds the program matching name.
38
39
  #
39
- # Compat.find_program('as') #=> "/usr/bin/as"
40
+ # @return [String, nil]
41
+ # The full path of the program, or +nil+ if the program could not be
42
+ # found.
43
+ #
44
+ # @example
45
+ # Compat.find_program('as')
46
+ # #=> "/usr/bin/as"
40
47
  #
41
48
  def self.find_program(name)
42
49
  self.paths.each do |dir|
@@ -49,10 +56,21 @@ module Repertoire
49
56
  end
50
57
 
51
58
  #
52
- # Runs the command specified by _program_ and the given _args_.
53
- # If _program_ cannot be found on the system, a ProgramNotFound
54
- # exception will be raised.
59
+ # Runs the command.
60
+ #
61
+ # @param [String] program
62
+ # The name of the program to run.
63
+ #
64
+ # @param [Array] args
65
+ # Optional arguments to run the program with.
66
+ #
67
+ # @raise [ProgramNotFound]
68
+ # The specified _program_ could not be found.
69
+ #
70
+ # @raise [CommandFailed]
71
+ # The command failed to run.
55
72
  #
73
+ # @example
56
74
  # Compat.sh('ls','-la','/')
57
75
  #
58
76
  def Compat.sh(program,*args)
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
- class CheckoutFailed < RuntimeError
2
+ class CheckoutFailed < StandardError
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
- class CommandFailed < RuntimeError
2
+ class CommandFailed < StandardError
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
- class ProgramNotFound < RuntimeError
2
+ class ProgramNotFound < StandardError
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
- class RepositoryExists < RuntimeError
2
+ class RepositoryExists < StandardError
3
3
  end
4
4
  end
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
- class UpdateFailed < RuntimeError
2
+ class UpdateFailed < StandardError
3
3
  end
4
4
  end
@@ -1,6 +1,6 @@
1
1
  module Repertoire
2
2
  module Media
3
- class UnknownMedia < RuntimeError
3
+ class UnknownMedia < StandardError
4
4
  end
5
5
  end
6
6
  end
@@ -3,22 +3,37 @@ require 'repertoire/media/exceptions/unknown_media'
3
3
  module Repertoire
4
4
  module Media
5
5
  #
6
- # Returns the +Hash+ of all registered Media types.
6
+ # All registered media types.
7
+ #
8
+ # @return [Hash]
9
+ # The media types.
7
10
  #
8
11
  def Media.types
9
12
  @@media_types ||= {}
10
13
  end
11
14
 
12
15
  #
13
- # Returns +true+ if there is a Media type registered with the matching
14
- # _name_.
16
+ # Determines if a media type has been registered.
17
+ #
18
+ # @param [Symbol, String] name
19
+ # The name of the media type to check for.
20
+ #
21
+ # @return [Boolean]
22
+ # Specifies whether there is a Media type registered with the
23
+ # matching name.
15
24
  #
16
25
  def Media.supports?(name)
17
26
  Media.types.has_key?(name.to_sym)
18
27
  end
19
28
 
20
29
  #
21
- # Returns the Media type with the matching _name_.
30
+ # Finds a media type by name.
31
+ #
32
+ # @param [Symbol, String] name
33
+ # The name of the media type to search for.
34
+ #
35
+ # @return [Type]
36
+ # The Media type with the matching name.
22
37
  #
23
38
  def Media.get(name)
24
39
  name = name.to_sym
@@ -31,30 +46,47 @@ module Repertoire
31
46
  end
32
47
 
33
48
  #
34
- # Returns the +Hash+ of all registered Media types and their associated
35
- # URI schemes.
49
+ # The media types associated to various URI schemes.
50
+ #
51
+ # @return [Hash]
52
+ # All registered Media types and their associated URI schemes.
36
53
  #
37
54
  def Media.schemes
38
55
  @@media_schemes ||= {}
39
56
  end
40
57
 
41
58
  #
42
- # Returns an +Array+ of all registered URI schemes.
59
+ # URI schemes associated to media types.
60
+ #
61
+ # @return [Array]
62
+ # All registered URI schemes.
43
63
  #
44
64
  def Media.registered_schemes
45
65
  Media.schemes.keys
46
66
  end
47
67
 
48
68
  #
49
- # Returns +true+ if a Media type was registered for the specified
50
- # _scheme_, returns +false+ otherwise.
69
+ # Determines whether a given URI scheme is supported.
70
+ #
71
+ # @param [String, Symbol] scheme
72
+ # The URI scheme to check for.
73
+ #
74
+ # @return [Boolean]
75
+ # Specifies whether a Media type was registered for the specified
76
+ # scheme.
51
77
  #
52
78
  def Media.supports_scheme?(scheme)
53
79
  Media.schemes.has_key?(scheme.to_s)
54
80
  end
55
81
 
56
82
  #
57
- # Returns the Media type that was registered for the specified _scheme_.
83
+ # Finds the media type that supports a given URI scheme.
84
+ #
85
+ # @param [String, Symbol] name
86
+ # The URI scheme to search for.
87
+ #
88
+ # @return [Type]
89
+ # The Media type that was registered for the specified scheme.
58
90
  #
59
91
  def Media.supports_scheme(name)
60
92
  name = name.to_s
@@ -67,31 +99,50 @@ module Repertoire
67
99
  end
68
100
 
69
101
  #
70
- # Returns the +Hash+ of all registered Media types and their
71
- # associated media storage directories.
102
+ # Media types associated to media storage directories.
103
+ #
104
+ # @return [Hash]
105
+ # All registered Media types and their associated media storage
106
+ # directories.
72
107
  #
73
108
  def Media.directories
74
109
  @@media_directories ||= {}
75
110
  end
76
111
 
77
112
  #
78
- # Returns an +Array+ of all registered directories.
113
+ # Media storage directories associated with media types.
114
+ #
115
+ # @return [Array]
116
+ # All registered media storage directories.
79
117
  #
80
118
  def Media.registered_directories
81
119
  Media.directories.keys
82
120
  end
83
121
 
84
122
  #
85
- # Returns +true+ if a Media type was registered with the specified
86
- # _directory_, returns +false+ otherwise.
123
+ # Determines if the media storage directory is recognized by any
124
+ # media type.
125
+ #
126
+ # @param [String, Symbol] name
127
+ # The media storage directory to search for.
128
+ #
129
+ # @return [Boolean]
130
+ # Specifies whether a Media type was registered with the specified
131
+ # media storage directory.
87
132
  #
88
133
  def Media.recognizes_directory?(name)
89
134
  Media.directories.has_key?(name.to_s)
90
135
  end
91
136
 
92
137
  #
93
- # Returns the Media type that was registered for the specified
94
- # _directory_.
138
+ # Finds the media type which uses a given media storage directory.
139
+ #
140
+ # @param [String, Symbol] name
141
+ # The media storage directory to search for.
142
+ #
143
+ # @return [Type]
144
+ # The Media type that was registered for the specified media storage
145
+ # directory.
95
146
  #
96
147
  def Media.recognizes_directory(name)
97
148
  name = name.to_s
@@ -104,15 +155,27 @@ module Repertoire
104
155
  end
105
156
 
106
157
  #
107
- # Get the Media type that was registered for the scheme of the
108
- # specified _uri_.
158
+ # Get the Media type that was registered for the scheme of the given
159
+ # URI.
160
+ #
161
+ # @param [String, URI::HTTP] uri
162
+ # The URI to infer the media type from.
163
+ #
164
+ # @return [Type]
165
+ # The media type which handles the specified URI.
109
166
  #
110
167
  def Media.guess_from_uri(uri)
111
168
  Media.supports_scheme(uri.to_s.scan(/^[^:\/@]+:/).first.chop)
112
169
  end
113
170
 
114
171
  #
115
- # Attempts to determine the correct Media type for the specified _path_.
172
+ # Attempts to determine the correct Media type for a given path.
173
+ #
174
+ # @param [String] path
175
+ # The path to infer the media type from.
176
+ #
177
+ # @return [Type]
178
+ # The media type which handles the repository at the specified path.
116
179
  #
117
180
  def Media.guess_from_path(path)
118
181
  path = File.expand_path(path)
@@ -29,8 +29,12 @@ module Repertoire
29
29
  protected
30
30
 
31
31
  #
32
- # Register a Media type with the specified _names_.
32
+ # Register a Media type with a given names.
33
33
  #
34
+ # @param [Symbol, String] name
35
+ # The name to give the media type.
36
+ #
37
+ # @example
34
38
  # known_as :svn
35
39
  #
36
40
  def self.known_as(name)
@@ -42,10 +46,15 @@ module Repertoire
42
46
  end
43
47
 
44
48
  #
45
- # Register a Media type for the specified _schemes_.
49
+ # Register a Media type for given schemes.
50
+ #
51
+ # @param [Array<String, Symbol>] schemes
52
+ # The URI schemes supported by the media type.
46
53
  #
54
+ # @example
47
55
  # uses_schemes 'svn'
48
56
  #
57
+ # @example
49
58
  # uses_schemes 'svn', 'svn+ssh'
50
59
  #
51
60
  def self.uses_schemes(*schemes)
@@ -59,9 +68,12 @@ module Repertoire
59
68
  end
60
69
 
61
70
  #
62
- # Registers a Media type that uses the directory of the specified
63
- # _name_ to store media information.
71
+ # Registers a Media type that uses a given directory name for storage.
64
72
  #
73
+ # @param [String] name
74
+ # The media storage directory used by the media type.
75
+ #
76
+ # @example
65
77
  # uses_directory '.svn'
66
78
  #
67
79
  def self.uses_directory(name)
@@ -73,15 +85,27 @@ module Repertoire
73
85
  end
74
86
 
75
87
  #
76
- # Changes the current working directory to the specified _path_.
88
+ # Changes the current working directory.
89
+ #
90
+ # @param [String] path
91
+ # The directory to change to.
92
+ #
93
+ # @see http://www.ruby-doc.org/core/classes/Dir.html#M002314
77
94
  #
78
95
  def self.cd(path)
79
96
  Dir.chdir(path.to_s)
80
97
  end
81
98
 
82
99
  #
83
- # Switches to the specified _path_, calls the given _block_ and then
84
- # switches back to the previous directory.
100
+ # Changes the current working directory, calls a given block, then
101
+ # changes the current working directory back.
102
+ #
103
+ # @param [String] path
104
+ # The directory to temporarily switch to.
105
+ #
106
+ # @yield []
107
+ # If a block is given, it will be called after the current working
108
+ # directory has been changed.
85
109
  #
86
110
  def self.switch_dir(path,&block)
87
111
  current = Dir.pwd
@@ -92,7 +116,7 @@ module Repertoire
92
116
  end
93
117
 
94
118
  #
95
- # See Compat.sh.
119
+ # @see Compat.sh.
96
120
  #
97
121
  def self.sh(program,*args)
98
122
  Compat.sh(program,*args)
@@ -8,19 +8,42 @@ require 'fileutils'
8
8
 
9
9
  module Repertoire
10
10
  #
11
- # Checkout the repository at the specified _options_. If a _block_
12
- # is given, it will be passed a newly created Repository object
13
- # for the checked out repository.
11
+ # Checkout the repository.
14
12
  #
15
- # _options_ must contain the following key:
16
- # <tt>:uri</tt>:: The URI of the repository to checkout.
13
+ # @param [Hash] options
14
+ # Additional options.
17
15
  #
18
- # _options_ may also contain the additional keys:
19
- # <tt>:path</tt>:: Path to checkout the repository to.
20
- # <tt>:media</tt>:: The media type of the repository. Defaults to the
21
- # value of Media.get_for_uri.
22
- # <tt>:into</tt>:: Checkout the repository into the given directory.
23
- # Cannot be used with <tt>:path</tt>.
16
+ # @option options [String, URI::HTTP] :uri
17
+ # The URI of the repository to checkout.
18
+ #
19
+ # @option options [String] :path
20
+ # Path to checkout the repository to.
21
+ #
22
+ # @option options [Symbol] :media
23
+ # The media type of the repository. Defaults to the value of
24
+ # {Media.guess_from_uri}.
25
+ #
26
+ # @option options [String] :into
27
+ # Checkout the repository into the given directory. Cannot be used
28
+ # with +:path+.
29
+ #
30
+ # @yield [repo]
31
+ # If a block is given, it will be passed the checked out repository.
32
+ #
33
+ # @yieldparam [Repository] repo
34
+ # The checked out repository.
35
+ #
36
+ # @return [Repository]
37
+ # The newly checked out repository.
38
+ #
39
+ # @raise [ArgumentError]
40
+ # The +:uri+ option was not specified.
41
+ #
42
+ # @raise [RepositoryExists]
43
+ # The destination path already exists.
44
+ #
45
+ # @raise [CheckoutFailed]
46
+ # The checkout command failed.
24
47
  #
25
48
  def Repertoire.checkout(options={},&block)
26
49
  unless options[:uri]
@@ -67,18 +90,36 @@ module Repertoire
67
90
  end
68
91
 
69
92
  #
70
- # Update the repository with the specified _options_. If a _block_
71
- # is given, it will be passed a newly created Repository object
72
- # for the updated repository.
93
+ # Update an existing repository.
94
+ #
95
+ # @param [Hash] options
96
+ # Additional options.
73
97
  #
74
- # _options_ must contain the following keys:
75
- # <tt>:path</tt>:: The path of the repository to update.
98
+ # @option options [String] :path
99
+ # The path of the repository to update.
76
100
  #
77
- # _options_ may also contain the additional keys:
78
- # <tt>:uri</tt>:: The URI to update against.
79
- # <tt>:media</tt>:: The type of the repository. Defaults to
80
- # Media.guess_from_uri if <tt>:uri</tt> is given,
81
- # otherwise Media.guess_from_path.
101
+ # @option options [String, URI::HTTP] :uri
102
+ # The URI to update against.
103
+ #
104
+ # @option options [Symbol] :media
105
+ # The type of the repository. Defaults to {Media.guess_from_uri}
106
+ # if the +:uri+ option is given, otherwise {Media.guess_from_path}
107
+ # is used.
108
+ #
109
+ # @yield [repo]
110
+ # If a block is given, it will be passed the updated repository.
111
+ #
112
+ # @yield [Repository] repo
113
+ # The updated repository.
114
+ #
115
+ # @return [Repository]
116
+ # The updated repository.
117
+ #
118
+ # @raise [ArgumentError]
119
+ # The +:path+ option was not specified.
120
+ #
121
+ # @raise [UpdateFailed]
122
+ # The update command failed.
82
123
  #
83
124
  def Repertoire.update(options={},&block)
84
125
  unless options[:path]
@@ -107,8 +148,16 @@ module Repertoire
107
148
  end
108
149
 
109
150
  #
110
- # Delete the repository at the specified _path_. If a _block_ is
111
- # given, it will be passed the _path_ before it is deleted.
151
+ # Delete an existing repository.
152
+ #
153
+ # @param [String] path
154
+ # The path of the repository to delete.
155
+ #
156
+ # @yield [path]
157
+ # If a block is given, it will be passed the path to be deleted.
158
+ #
159
+ # @yieldparam [String] path
160
+ # The path to be deleted.
112
161
  #
113
162
  def Repertoire.delete(path,&block)
114
163
  path = File.expand_path(path)
@@ -11,12 +11,25 @@ module Repertoire
11
11
  attr_reader :media
12
12
 
13
13
  #
14
- # Creates a new Repository object with the specified _path_ and _media_
15
- # type. If a _block_ is given, it will be passed the newly created
16
- # Repository object.
14
+ # Creates a new Repository object.
17
15
  #
16
+ # @param [String] path
17
+ # The path of the repository.
18
+ #
19
+ # @param [Media::Type, nil] media
20
+ # The media type of the repository.
21
+ #
22
+ # @yield [repo]
23
+ # If a block is given, it will be passed the newly created
24
+ # repository.
25
+ #
26
+ # @yieldparam [Repository] repo
27
+ # The newly created repository.
28
+ #
29
+ # @example
18
30
  # Repository.new('path/to/repo',Media::SVN)
19
31
  #
32
+ # @example
20
33
  # Repository.new('path/to/svn_repo',Media::SVN) do |repo|
21
34
  # puts repo['**/']
22
35
  # end
@@ -34,13 +47,20 @@ module Repertoire
34
47
  end
35
48
 
36
49
  #
37
- # Returns the _basename_ of the specified _uri_, unless the _basename_
38
- # is +trunk+ then the _basename_ of the parent directory within the
39
- # _uri_ is returned.
50
+ # Infers the repository name from a given URI.
40
51
  #
52
+ # @param [String, URI::HTTP] uri
53
+ # The URI to inerfer the repository name from.
54
+ #
55
+ # @return [String]
56
+ # The basename of the specified URI. If the basename is +trunk+, then
57
+ # the basename of the parent directory within the URI is returned.
58
+ #
59
+ # @example
41
60
  # Repertoire.name('http://www.today.com/is/now')
42
61
  # # => "now"
43
62
  #
63
+ # @example
44
64
  # Repertoire.name('svn://svn.repo.com/var/svn/awesome/trunk')
45
65
  # # => "awesome"
46
66
  #
@@ -65,8 +85,10 @@ module Repertoire
65
85
  end
66
86
 
67
87
  #
68
- # Returns the name of the media used for the repository. If the media
69
- # could not be guessed, +nil+ will be returned.
88
+ # The name of the media used for the repository.
89
+ #
90
+ # @return [Symbol, nil]
91
+ # The name of the media, or +nil+ if the media could not be detected.
70
92
  #
71
93
  def media_name
72
94
  return @media.name if @media
@@ -76,6 +98,12 @@ module Repertoire
76
98
  #
77
99
  # Update the repository.
78
100
  #
101
+ # @param [String, URI::HTTP] uri
102
+ # The URI to update from.
103
+ #
104
+ # @return [Boolean]
105
+ # Specifies whether the update was a success or not.
106
+ #
79
107
  def update(uri=nil)
80
108
  if @media
81
109
  @media.update(@path,uri)
@@ -93,14 +121,31 @@ module Repertoire
93
121
  end
94
122
 
95
123
  #
96
- # Similar to <tt>Dir.glob</tt>, except the media's directory is omitted
97
- # from the returned results. If a _block_ is given, it will be passed
98
- # each resulting path.
124
+ # Similar to +Dir.glob+, except the media's directory is omitted
125
+ # from the returned results.
126
+ #
127
+ # @param [String] pattern
128
+ # The pattern to match file-names with.
129
+ #
130
+ # @param [Integer] flags
131
+ # +Dir.glob+ flags.
132
+ #
133
+ # @yield [path]
134
+ # If a block is given, it will be passed each globbed path.
135
+ #
136
+ # @yieldparam [String] path
137
+ # A path that matches the glob pattern.
138
+ #
139
+ # @return [Array]
140
+ # The paths that match the given pattern.
99
141
  #
142
+ # @example
100
143
  # repo = Repository.new('path/to/my_svn')
101
144
  # repo.glob('sub_path/.svn/*') # => []
102
145
  # repo.glob('sub_path/**/') # => [...]
103
146
  #
147
+ # @see http://www.ruby-doc.org/core/classes/Dir.html#M002322
148
+ #
104
149
  def glob(pattern,flags=0,&block)
105
150
  pattern = File.expand_path(File.join(@path,pattern))
106
151
  paths = filter(Dir.glob(pattern,flags))
@@ -110,40 +155,68 @@ module Repertoire
110
155
  end
111
156
 
112
157
  #
113
- # Returns +true+ if the directory contains the specified _sub_path_,
114
- # returns +false+ otherwise.
158
+ # Determines whether the repository contains a specific sub-path.
159
+ #
160
+ # @param [String] sub_path
161
+ # The sub-path to search for.
162
+ #
163
+ # @return [Boolean]
164
+ # Specifies whether the directory contains the specified sub-path.
115
165
  #
116
166
  def has_path?(sub_path)
117
167
  !(glob(sub_path).empty?)
118
168
  end
119
169
 
120
170
  #
121
- # Returns an +Array+ of the files matching the _sub_path_ within the
122
- # directory.
171
+ # Finds files within the repository.
172
+ #
173
+ # @param [String] sub_path
174
+ # The glob pattern to match paths with.
175
+ #
176
+ # @return [Array]
177
+ # The files within the repository that match the given pattern.
123
178
  #
124
179
  def files(sub_path='*')
125
180
  glob(sub_path).select { |path| File.file?(path) }
126
181
  end
127
182
 
128
183
  #
129
- # Returns +true+ if there is a file with the _sub_path_ within the
130
- # directory, returns +false+ otherwise.
184
+ # Determines if the repository has a given sub-path.
185
+ #
186
+ # @param [String] sub_path
187
+ # The sbu-path to search for.
188
+ #
189
+ # @return [Boolean]
190
+ # Specifies whether there is a file with the matching sub-path
191
+ # within the repository.
131
192
  #
132
193
  def has_file?(sub_path)
133
194
  !(files(sub_path).empty?)
134
195
  end
135
196
 
136
197
  #
137
- # Returns an +Array+ of the directories matching the _sub_path_ within
138
- # the directory.
198
+ # Finds directories within the repository.
199
+ #
200
+ # @param [String] sub_path
201
+ # The glob pattern to match paths with.
202
+ #
203
+ # @return [Array]
204
+ # The directories within the repository that match the given pattern.
139
205
  #
140
206
  def directories(sub_path='*')
141
207
  glob(sub_path).select { |path| File.directory?(path) }
142
208
  end
143
209
 
144
210
  #
145
- # Returns +true+ if there is a directory with the _sub_path_ within the
146
- # directory, returns +false+ otherwise.
211
+ # Determines if the repository contains a directory matching a given
212
+ # sub-path.
213
+ #
214
+ # @param [String] sub_path
215
+ # The sub-path to search for.
216
+ #
217
+ # @return [Boolean]
218
+ # Specifies whether there is a directory with the matching sub-path
219
+ # within the repository.
147
220
  #
148
221
  def has_directory?(sub_path)
149
222
  !(directories(sub_path).empty?)
@@ -152,7 +225,10 @@ module Repertoire
152
225
  alias [] glob
153
226
 
154
227
  #
155
- # Returns the path of the directory in +String+ form.
228
+ # Converts the repository to a String.
229
+ #
230
+ # @return [String]
231
+ # The path of the repository.
156
232
  #
157
233
  def to_s
158
234
  @path.to_s
@@ -161,8 +237,14 @@ module Repertoire
161
237
  protected
162
238
 
163
239
  #
164
- # Filter the specified _paths_, removing any path that contains
165
- # the media's directory.
240
+ # Filter the given paths, removing any path that containing directoires
241
+ # used by the media.
242
+ #
243
+ # @param [Array<String>] paths
244
+ # The paths to filter.
245
+ #
246
+ # @return [Array]
247
+ # The filtered paths.
166
248
  #
167
249
  def filter(paths)
168
250
  return paths unless @media
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
2
  # Repertoire version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  end
data/tasks/spec.rb CHANGED
@@ -6,4 +6,5 @@ Spec::Rake::SpecTask.new(:spec) do |t|
6
6
  t.spec_opts = ['--colour', '--format', 'specdoc']
7
7
  end
8
8
 
9
+ task :test => :spec
9
10
  task :default => :spec
metadata CHANGED
@@ -1,17 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repertoire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDQDCCAiigAwIBAgIBADANBgkqhkiG9w0BAQUFADBGMRgwFgYDVQQDDA9wb3N0
14
+ bW9kZXJuLm1vZDMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
15
+ ARkWA2NvbTAeFw0wOTA2MDMwNDU5MDNaFw0xMDA2MDMwNDU5MDNaMEYxGDAWBgNV
16
+ BAMMD3Bvc3Rtb2Rlcm4ubW9kMzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYK
17
+ CZImiZPyLGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
18
+ 1wvANkTDHFgVih5XLjuTwTZjgBq1lBGybXJiH6Id1lY2JOMqM5FB1DDHVvvij94i
19
+ mJabN0zkzu6VKWC70y0IwOxY7CPokr0eFdK/D0y7mCq1P8QITv76i2YqAl0eYqIt
20
+ W+IhIkANQ7E6uMZIZcdnfadC6lPAtlKkqtd9crvRbFgr6e3kyflmohbRnTEJHoRd
21
+ 7SHHsybE6DSn7oTDs6XBTNrNIn5VfZA0z01eeos/+zBm1zKJOK2+/7xtLLDuDU9G
22
+ +Rd+ltUBbvxUrMNZmDG29pnmN2xTRH+Q8HxD2AxlvM5SRpK6OeZaHV7PaCCAVZ4L
23
+ T9BFl1sfMvRlABeGEkSyuQIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE
24
+ sDAdBgNVHQ4EFgQUKwsd+PqEYmBvyaTyoL+uRuk+PhEwDQYJKoZIhvcNAQEFBQAD
25
+ ggEBAB4TvHsrlbcXcKg6gX5BIb9tI+zGkpzo0Z7jnxMEcNO7NGGwmzafDBI/xZYv
26
+ xkRH3/HXbGGYDOi6Q6gWt5GujSx0bOImDtYTJTH8jnzN92HzEK5WdScm1QpZKF1e
27
+ cezArMbxbSPaosxTCtG6LQTkE28lFQsmFZ5xzouugS4h5+LVJiVMmiP+l3EfkjFa
28
+ GOURU+rNEMPWo8MCWivGW7jes6BMzWHcW7DQ0scNVmIcCIgdyMmpscuAEOSeghy9
29
+ /fFs57Ey2OXBL55nDOyvN/ZQ2Vab05UH4t+GCxjAPeirzL/29FBtePT6VD44c38j
30
+ pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
31
+ -----END CERTIFICATE-----
11
32
 
12
- date: 2009-04-13 00:00:00 -07:00
33
+ date: 2009-09-25 00:00:00 -07:00
13
34
  default_executable:
14
35
  dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.2.3.5
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ type: :development
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.8
55
+ version:
15
56
  - !ruby/object:Gem::Dependency
16
57
  name: hoe
17
58
  type: :development
@@ -20,9 +61,12 @@ dependencies:
20
61
  requirements:
21
62
  - - ">="
22
63
  - !ruby/object:Gem::Version
23
- version: 1.12.1
64
+ version: 2.3.3
24
65
  version:
25
- description: R'epertoire is a Ruby library for quickly checking-out and updating code-bases from various SCMs. R'epertoire currently supports Subversion, Git, Mercurial and even RSync.
66
+ description: |-
67
+ R'epertoire is a Ruby library for quickly checking-out and updating
68
+ code-bases from various SCMs. R'epertoire currently supports Subversion,
69
+ Git, Mercurial and even RSync.
26
70
  email:
27
71
  - postmodern.mod3@gmail.com
28
72
  executables: []
@@ -78,8 +122,10 @@ files:
78
122
  - spec/media/types/rsync_spec.rb
79
123
  - spec/media/types/svn_spec.rb
80
124
  - spec/repertoire_spec.rb
81
- has_rdoc: true
125
+ has_rdoc: yard
82
126
  homepage: http://repertoire.rubyforge.org/
127
+ licenses: []
128
+
83
129
  post_install_message:
84
130
  rdoc_options:
85
131
  - --main
@@ -101,9 +147,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
147
  requirements: []
102
148
 
103
149
  rubyforge_project: repertoire
104
- rubygems_version: 1.3.1
150
+ rubygems_version: 1.3.5
105
151
  signing_key:
106
- specification_version: 2
152
+ specification_version: 3
107
153
  summary: R'epertoire is a Ruby library for quickly checking-out and updating code-bases from various SCMs
108
154
  test_files: []
109
155
 
metadata.gz.sig ADDED
Binary file