Permalink
Browse files

[Bazaar] Add Bazaar support

  • Loading branch information...
1 parent 89ac71d commit 0a81b9ef7a8e9e1d844cdfceae16edc3e7c27a28 @fmccann fmccann committed Nov 28, 2013
Showing with 109 additions and 1 deletion.
  1. +1 −1 lib/cocoapods/command/spec.rb
  2. +30 −0 lib/cocoapods/external_sources.rb
  3. +3 −0 spec/fixtures/bzr-repo/.bzr/README
  4. +1 −0 spec/fixtures/bzr-repo/.bzr/branch-format
  5. 0 spec/fixtures/bzr-repo/.bzr/branch/branch.conf
  6. +1 −0 spec/fixtures/bzr-repo/.bzr/branch/format
  7. +1 −0 spec/fixtures/bzr-repo/.bzr/branch/last-revision
  8. 0 spec/fixtures/bzr-repo/.bzr/branch/tags
  9. +1 −0 spec/fixtures/bzr-repo/.bzr/checkout/conflicts
  10. BIN spec/fixtures/bzr-repo/.bzr/checkout/dirstate
  11. +1 −0 spec/fixtures/bzr-repo/.bzr/checkout/format
  12. 0 spec/fixtures/bzr-repo/.bzr/checkout/views
  13. +1 −0 spec/fixtures/bzr-repo/.bzr/repository/format
  14. BIN spec/fixtures/bzr-repo/.bzr/repository/indices/5b3f31ef63699074fdad6fa3b0e55305.cix
  15. BIN spec/fixtures/bzr-repo/.bzr/repository/indices/5b3f31ef63699074fdad6fa3b0e55305.iix
  16. +8 −0 spec/fixtures/bzr-repo/.bzr/repository/indices/5b3f31ef63699074fdad6fa3b0e55305.rix
  17. +5 −0 spec/fixtures/bzr-repo/.bzr/repository/indices/5b3f31ef63699074fdad6fa3b0e55305.six
  18. +8 −0 spec/fixtures/bzr-repo/.bzr/repository/indices/5b3f31ef63699074fdad6fa3b0e55305.tix
  19. +7 −0 spec/fixtures/bzr-repo/.bzr/repository/indices/c70a743dc767dc376699c48c5e9cf925.cix
  20. BIN spec/fixtures/bzr-repo/.bzr/repository/indices/c70a743dc767dc376699c48c5e9cf925.iix
  21. BIN spec/fixtures/bzr-repo/.bzr/repository/indices/c70a743dc767dc376699c48c5e9cf925.rix
  22. +5 −0 spec/fixtures/bzr-repo/.bzr/repository/indices/c70a743dc767dc376699c48c5e9cf925.six
  23. BIN spec/fixtures/bzr-repo/.bzr/repository/indices/c70a743dc767dc376699c48c5e9cf925.tix
  24. BIN spec/fixtures/bzr-repo/.bzr/repository/pack-names
  25. BIN spec/fixtures/bzr-repo/.bzr/repository/packs/5b3f31ef63699074fdad6fa3b0e55305.pack
  26. BIN spec/fixtures/bzr-repo/.bzr/repository/packs/c70a743dc767dc376699c48c5e9cf925.pack
  27. +10 −0 spec/fixtures/bzr-repo/BazaarSource.podspec
  28. +1 −0 spec/fixtures/bzr-repo/README
  29. +25 −0 spec/unit/external_sources_spec.rb
@@ -512,7 +512,7 @@ def spec_template(data)
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
- # Supports git, hg, svn and HTTP.
+ # Supports git, hg, bzr, svn and HTTP.
#
s.source = { :git => "#{data[:source_url]}", #{data[:ref_type]} => "#{data[:ref]}" }
@@ -16,6 +16,7 @@ def self.from_dependency(dependency, podfile_path)
klass = if params.key?(:git) then GitSource
elsif params.key?(:svn) then SvnSource
elsif params.key?(:hg) then MercurialSource
+ elsif params.key?(:bzr) then BazaarSource
elsif params.key?(:podspec) then PodspecSource
elsif params.key?(:path) then PathSource
end
@@ -261,6 +262,35 @@ def description
#-------------------------------------------------------------------------#
+ # Provides support for fetching a specification file from a Bazaar
+ # source remote.
+ #
+ # Supports all the options of the downloader (is similar to the git key of
+ # `source` attribute of a specification).
+ #
+ # @note The podspec must be in the root of the repository and should have a
+ # name matching the one of the dependency.
+ #
+ class BazaarSource < AbstractExternalSource
+
+ # @see AbstractExternalSource#fetch
+ #
+ def fetch(sandbox)
+ pre_download(sandbox)
+ end
+
+ # @see AbstractExternalSource#description
+ #
+ def description
+ "from `#{params[:bzr]}`".tap do |description|
+ description << ", tag `#{params[:tag]}`" if params[:tag]
+ description << ", revision `#{params[:revision]}`" if params[:revision]
+ end
+ end
+ end
+
+ #-------------------------------------------------------------------------#
+
# Provides support for fetching a specification file from an URL. Can be
# http, file, etc.
#
@@ -0,0 +1,3 @@
+This is a Bazaar control directory.
+Do not change any files in this directory.
+See http://bazaar.canonical.com/ for more information about Bazaar.
@@ -0,0 +1 @@
+Bazaar-NG meta directory, format 1
@@ -0,0 +1 @@
+Bazaar Branch Format 7 (needs bzr 1.6)
@@ -0,0 +1 @@
+2 fred@sharpnoodles.com-20131030202140-gg5dfrrtaotfxlrh
No changes.
@@ -0,0 +1 @@
+BZR conflict list format 1
Binary file not shown.
@@ -0,0 +1 @@
+Bazaar Working Tree Format 6 (bzr 1.14)
No changes.
@@ -0,0 +1 @@
+Bazaar repository format 2a (needs bzr 1.16 or later)
@@ -0,0 +1,8 @@
+B+Tree Graph Index 2
+node_ref_lists=1
+key_elements=1
+len=1
+row_lengths=1
+x��Q
+� �;�0޺�tK-�R4�n���?'oC�wK;l-W�.�6l�
+���"��ǰ�^c��:��BMF@��,B
@@ -0,0 +1,5 @@
+B+Tree Graph Index 2
+node_ref_lists=0
+key_elements=1
+len=0
+row_lengths=
@@ -0,0 +1,8 @@
+B+Tree Graph Index 2
+node_ref_lists=1
+key_elements=2
+len=3
+row_lengths=1
+x���M�0@a֜� �Lg ԅ�71�P,�ȏ��-+���M� W'ܦ5�C��H>xi�&��(�"ü��k��A�bo��ax{o�ļ��#P�B][��а^��IR`�2�
+4i�����,FE�;;��t
+"���t�J57�s�L :*��7�}�v�� e�
@@ -0,0 +1,7 @@
+B+Tree Graph Index 2
+node_ref_lists=0
+key_elements=1
+len=1
+row_lengths=1
+x���� P�L�Z
+��8�'@8x0ы������&V|6�H�����cr7e�yhZC��b����r"&s�?�-
@@ -0,0 +1,5 @@
+B+Tree Graph Index 2
+node_ref_lists=0
+key_elements=1
+len=0
+row_lengths=
Binary file not shown.
@@ -0,0 +1,10 @@
+Pod::Spec.new do |s|
+ s.name = "BazaarSource"
+ s.version = "0.0.1"
+ s.summary = "A short description of BazaarSource."
+ s.homepage = "http://EXAMPLE/BazaarSource"
+ s.license = 'MIT (example)'
+ s.author = { "Fred McCann" => "fred@sharpnoodles.com" }
+ s.source = { :git => "http://EXAMPLE/BazaarSource.git", :tag => "0.0.1" }
+ s.source_files = 'Classes', 'Classes/**/*.{h,m}'
+end
@@ -0,0 +1 @@
+second commit
@@ -148,6 +148,31 @@ module Pod
#---------------------------------------------------------------------------#
+ describe ExternalSources::BazaarSource do
+
+ before do
+ dependency = Dependency.new("BazaarSource", :bzr => fixture('bzr-repo'))
+ @external_source = ExternalSources.from_dependency(dependency, nil)
+ end
+
+ it "creates a copy of the podspec" do
+ @external_source.fetch(config.sandbox)
+ path = config.sandbox.root + 'Local Podspecs/BazaarSource.podspec'
+ path.should.exist?
+ end
+
+ it "marks a LocalPod as downloaded" do
+ @external_source.fetch(config.sandbox)
+ config.sandbox.predownloaded_pods.should == ["BazaarSource"]
+ end
+
+ it "returns the description" do
+ @external_source.description.should.match %r|from `.*/bzr-repo`|
+ end
+ end
+
+ #---------------------------------------------------------------------------#
+
describe ExternalSources::PodspecSource do
before do

0 comments on commit 0a81b9e

Please sign in to comment.