repertoire 0.2.1 → 0.2.2

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 CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.2 / 2009-04-13
2
+
3
+ * Rewrote Repository.name to not use the URI module.
4
+ * Rewrote Media.guess_from_uri to not use the URI module.
5
+
1
6
  === 0.2.1 / 2009-03-26
2
7
 
3
8
  * Fixed typo in Repository#update.
data/README.txt CHANGED
@@ -26,26 +26,26 @@ Git, Mercurial and even RSync.
26
26
 
27
27
  * Checkout a repository using a URI:
28
28
 
29
- Repertoire.checkout(
30
- :uri => 'svn://rubyforge.org/var/svn/repertoire/trunk',
31
- :path => 'repertoire'
32
- )
29
+ Repertoire.checkout(
30
+ :uri => 'svn://rubyforge.org/var/svn/repertoire/trunk',
31
+ :path => 'repertoire'
32
+ )
33
33
 
34
34
  * Checkout a repository of a specific media type:
35
35
 
36
- Repertoire.checkout(
37
- :uri => 'http://repertoire.rubyforge.org/svn/trunk',
38
- :media => :svn,
39
- :path => 'repertoire'
40
- )
36
+ Repertoire.checkout(
37
+ :uri => 'http://repertoire.rubyforge.org/svn/trunk',
38
+ :media => :svn,
39
+ :path => 'repertoire'
40
+ )
41
41
 
42
42
  * Update a previously checked-out repository:
43
43
 
44
- Repertoire.update(:path => 'repertoire')
44
+ Repertoire.update(:path => 'repertoire')
45
45
 
46
46
  * Update a previously checked-out repository of a specific media type:
47
47
 
48
- Repertoire.update(:path => 'path/to/rsynced_data', :media => :rsync)
48
+ Repertoire.update(:path => 'path/to/rsynced_data', :media => :rsync)
49
49
 
50
50
  == LICENSE:
51
51
 
@@ -108,7 +108,7 @@ module Repertoire
108
108
  # specified _uri_.
109
109
  #
110
110
  def Media.guess_from_uri(uri)
111
- Media.supports_scheme(URI(uri).scheme)
111
+ Media.supports_scheme(uri.to_s.scan(/^[^:\/@]+:/).first.chop)
112
112
  end
113
113
 
114
114
  #
@@ -1,8 +1,6 @@
1
1
  require 'repertoire/media'
2
2
  require 'repertoire/repository'
3
3
 
4
- require 'uri'
5
-
6
4
  module Repertoire
7
5
  class Repository
8
6
 
@@ -36,9 +34,9 @@ module Repertoire
36
34
  end
37
35
 
38
36
  #
39
- # Returns the +basename+ of the specified _uri_, unless the +basename+ is
40
- # +'trunk'+ then the +basename+ of the parent directory within the _uri_
41
- # is returned.
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.
42
40
  #
43
41
  # Repertoire.name('http://www.today.com/is/now')
44
42
  # # => "now"
@@ -47,24 +45,20 @@ module Repertoire
47
45
  # # => "awesome"
48
46
  #
49
47
  def Repository.name(uri)
50
- uri = URI(uri.to_s)
51
-
52
- if uri.path.empty?
53
- path = File::SEPARATOR
54
- else
55
- path = File.expand_path(uri.path)
56
- end
57
-
58
- name = File.basename(path)
59
-
60
- if name == 'trunk'
61
- name = File.basename(File.dirname(path))
62
- elsif name =~ /\.git$/
63
- name.gsub!(/\.git$/,'')
48
+ names = uri.to_s.split(/[:\/@]+/)
49
+ name = nil
50
+
51
+ names.reverse_each do |part|
52
+ unless (part == 'trunk' || part == '.' || part == '..')
53
+ name = part
54
+ break
55
+ end
64
56
  end
65
57
 
66
- if (name.empty? || name == File::SEPARATOR)
67
- name = uri.host
58
+ if name
59
+ if name =~ /\.git$/
60
+ name.gsub!(/\.git$/,'')
61
+ end
68
62
  end
69
63
 
70
64
  return name
@@ -1,4 +1,4 @@
1
1
  module Repertoire
2
2
  # Repertoire version
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repertoire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-26 00:00:00 -07:00
12
+ date: 2009-04-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.11.0
23
+ version: 1.12.1
24
24
  version:
25
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.
26
26
  email: