-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jcampbell05/f/MultipleSourcesSupport
F/multiple sources support
- Loading branch information
Showing
13 changed files
with
116 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
cocoapods-deploy (0.0.5) | ||
cocoapods-deploy (0.0.6) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,52 @@ | ||
module Pod | ||
class DeployDownloader | ||
|
||
attr_accessor :dependency | ||
|
||
def initialize(dependency) | ||
@dependency = dependency | ||
end | ||
|
||
def download(config) | ||
if @dependency.external_source.key?(:podspec) | ||
download_podspec(config) | ||
else | ||
download_source(config) | ||
end | ||
end | ||
|
||
def download_source(config) | ||
source = ExternalSources.from_dependency(dependency, config.podfile.defined_in_file) | ||
source.fetch | ||
end | ||
|
||
def download_podspec(config) | ||
dependencies_for_sources(config).each do |dep| | ||
source = ExternalSources.from_dependency(dep, config.podfile.defined_in_file) | ||
|
||
begin | ||
return source.fetch | ||
rescue | ||
end | ||
end | ||
|
||
raise Informative, "Failed to deploy podspec for `#{@dependency.name}`." | ||
end | ||
|
||
def podfile_sources(config) | ||
return ["https://github.com/CocoaPods/CocoaPods.git"] if config.podfile.sources.empty? | ||
return config.podfile.sources | ||
end | ||
|
||
def dependencies_for_sources(config) | ||
podfile_sources(config).map do |source| | ||
filename = File.basename(source, ".*") | ||
raw_url = File.join( File.dirname(source), filename ) | ||
root_url = "#{raw_url}/raw" | ||
source = @dependency.external_source[:podspec].gsub('{root-url}', root_url) | ||
|
||
Dependency.new(@dependency.name, {:podspec => source}) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 1,3 @@ | ||
module CocoapodsDeploy | ||
VERSION = "0.0.5" | ||
VERSION = "0.0.6" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 1,5 @@ | ||
require 'cocoapods-deploy/deploy_analyzer' | ||
require 'cocoapods-deploy/deploy_downloader' | ||
require 'cocoapods-deploy/deploy_installer' | ||
require 'cocoapods-deploy/deploy_transformer' | ||
require 'cocoapods-deploy/command' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/command/deploy_analyzer_Spec.rb → spec/deploy_analyzer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,38 @@ | ||
require File.expand_path('../spec_helper', __FILE__) | ||
|
||
class MockExternalSource | ||
def initialize | ||
end | ||
|
||
def fetch | ||
end | ||
end | ||
|
||
module Pod | ||
describe DeployDownloader do | ||
|
||
before do | ||
@podfile = Podfile.new | ||
Config.instance.stubs(:podfile).returns(@podfile) | ||
|
||
@source = MockExternalSource.new | ||
ExternalSources.stubs(:from_dependency).returns(@source) | ||
end | ||
|
||
it "should external source outside of repo" do | ||
dependency = Dependency.new("AFNetworking", { :git => "https://github.com/gowalla/AFNetworking.git"}) | ||
downloader = DeployDownloader.new(dependency) | ||
|
||
@source.expects(:fetch) | ||
downloader.download(Config.instance) | ||
end | ||
|
||
it "should download source from main repo" do | ||
dependency = Dependency.new("AFNetworking", { :podspec => "{root-url}/master/Specs/AFNetworking/1.0/AFNetworking.podspec.json"}) | ||
downloader = DeployDownloader.new(dependency) | ||
|
||
@source.expects(:fetch) | ||
downloader.download(Config.instance) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,6 @@ | ||
require File.expand_path('../spec_helper', __FILE__) | ||
|
||
module Pod | ||
describe DeployInstaller do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters