pullr 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.1.2 / 2010-03-23
2
+
3
+ * Added {Pullr::LocalRepository#name}.
4
+ * Added {Pullr::RemoteRepository#name}.
5
+
1
6
  ### 0.1.1 / 2010-03-14
2
7
 
3
8
  * Initial release.
data/README.md CHANGED
@@ -48,7 +48,7 @@ Pull down a repository:
48
48
 
49
49
  Pull down a repository into a specific directory:
50
50
 
51
- remote = Pullr::RemoteRepository.new(:uri => 'git://github.com/datamapper/dm-rails.git /home/deploy/dm-rails')
51
+ remote = Pullr::RemoteRepository.new(:uri => 'git://github.com/datamapper/dm-rails.git')
52
52
  remote.pull('/home/deploy/dm-rails')
53
53
  # => #<Pullr::LocalRepository: ...>
54
54
 
@@ -46,6 +46,18 @@ module Pullr
46
46
  extend SCM.lookup(@scm)
47
47
  end
48
48
 
49
+ #
50
+ # The name of the repository.
51
+ #
52
+ # @return [String]
53
+ # The local repository name.
54
+ #
55
+ # @since 0.1.2
56
+ #
57
+ def name
58
+ File.basename(@path)
59
+ end
60
+
49
61
  #
50
62
  # The control directory used by the SCM.
51
63
  #
@@ -37,6 +37,33 @@ module Pullr
37
37
  extend SCM.lookup(@scm)
38
38
  end
39
39
 
40
+ #
41
+ # The name of the repository.
42
+ #
43
+ # @return [String]
44
+ # The remote repository name.
45
+ #
46
+ # @since 0.1.2
47
+ #
48
+ def name
49
+ dirs = File.expand_path(@uri.path).split(File::SEPARATOR)
50
+
51
+ unless dirs.empty?
52
+ if @scm == :sub_version
53
+ if dirs[-1] == 'trunk'
54
+ dirs.pop
55
+ elsif (dirs[-2] == 'branches' || dirs[-2] == 'tags')
56
+ dirs.pop
57
+ dirs.pop
58
+ end
59
+ elsif @scm == :git
60
+ dirs.last.gsub!(/\.git$/,'') if dirs.last =~ /\.git$/
61
+ end
62
+ end
63
+
64
+ return (dirs.last || @uri.host)
65
+ end
66
+
40
67
  #
41
68
  # Clones the remote repository into the given destination.
42
69
  #
data/lib/pullr/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Pullr
2
2
  # pullr version
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
data/pullr.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pullr}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Postmodern"]
12
- s.date = %q{2010-03-14}
12
+ s.date = %q{2010-03-23}
13
13
  s.default_executable = %q{pullr}
14
14
  s.description = %q{Pullr is a Ruby library for quickly pulling down or updating any Repository. Pullr currently supports Git, Mercurial (Hg), SubVersion (SVN) and Rsync. Pullr provides a command-line utility and an API which can be used by other frameworks.}
15
15
  s.email = %q{postmodern.mod3@gmail.com}
@@ -46,7 +46,9 @@ Gem::Specification.new do |s|
46
46
  "lib/pullr/scm/sub_version.rb",
47
47
  "lib/pullr/version.rb",
48
48
  "pullr.gemspec",
49
+ "spec/local_repository_spec.rb",
49
50
  "spec/pullr_spec.rb",
51
+ "spec/remote_repository_spec.rb",
50
52
  "spec/scm_spec.rb",
51
53
  "spec/spec_helper.rb"
52
54
  ]
@@ -59,7 +61,9 @@ Gem::Specification.new do |s|
59
61
  s.test_files = [
60
62
  "spec/spec_helper.rb",
61
63
  "spec/pullr_spec.rb",
62
- "spec/scm_spec.rb"
64
+ "spec/scm_spec.rb",
65
+ "spec/local_repository_spec.rb",
66
+ "spec/remote_repository_spec.rb"
63
67
  ]
64
68
 
65
69
  if s.respond_to? :specification_version then
@@ -0,0 +1,16 @@
1
+ require 'pullr/local_repository'
2
+
3
+ require 'spec_helper'
4
+
5
+ describe LocalRepository do
6
+ before(:all) do
7
+ @repo = LocalRepository.new(
8
+ :scm => :rsync,
9
+ :path => File.join('some','repository')
10
+ )
11
+ end
12
+
13
+ it "should have a name" do
14
+ @repo.name.should == 'repository'
15
+ end
16
+ end
@@ -0,0 +1,45 @@
1
+ require 'pullr/remote_repository'
2
+
3
+ require 'spec_helper'
4
+
5
+ describe RemoteRepository do
6
+ describe "SubVersion" do
7
+ it "should have a name for URIs pointing to trunk/" do
8
+ repo = RemoteRepository.new(
9
+ :scm => :sub_version,
10
+ :uri => 'http://www.example.com/var/svn/project/trunk'
11
+ )
12
+
13
+ repo.name.should == 'project'
14
+ end
15
+
16
+ it "should have a name for URIs pointing into branches/" do
17
+ repo = RemoteRepository.new(
18
+ :scm => :sub_version,
19
+ :uri => 'http://www.example.com/var/svn/project/branches/awesome'
20
+ )
21
+
22
+ repo.name.should == 'project'
23
+ end
24
+
25
+ it "should have a name for URIs pointing into tags/" do
26
+ repo = RemoteRepository.new(
27
+ :scm => :sub_version,
28
+ :uri => 'http://www.example.com/var/svn/project/tags/0.1.0'
29
+ )
30
+
31
+ repo.name.should == 'project'
32
+ end
33
+ end
34
+
35
+ describe "Git" do
36
+ it "should have a name" do
37
+ repo = RemoteRepository.new(
38
+ :scm => :git,
39
+ :uri => 'http://www.example.com/var/git/project.git'
40
+ )
41
+
42
+ repo.name.should == 'project'
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Postmodern
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-14 00:00:00 -08:00
17
+ date: 2010-03-23 00:00:00 -07:00
18
18
  default_executable: pullr
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -96,7 +96,9 @@ files:
96
96
  - lib/pullr/scm/sub_version.rb
97
97
  - lib/pullr/version.rb
98
98
  - pullr.gemspec
99
+ - spec/local_repository_spec.rb
99
100
  - spec/pullr_spec.rb
101
+ - spec/remote_repository_spec.rb
100
102
  - spec/scm_spec.rb
101
103
  - spec/spec_helper.rb
102
104
  has_rdoc: yard
@@ -133,3 +135,5 @@ test_files:
133
135
  - spec/spec_helper.rb
134
136
  - spec/pullr_spec.rb
135
137
  - spec/scm_spec.rb
138
+ - spec/local_repository_spec.rb
139
+ - spec/remote_repository_spec.rb