Commit 59b1b018 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into feature-frameworks-bundles

* master:
  [Changelog]
  [Changelog]
  Remove an incorrect unit test.
  Add a note to the CHANGELOG about directory restructure.
  Clean up config/sources manager interfaces to not be polluted with old directory structure stuff.
  Add a test for migrating repos to new repo dir.
  Move tempo repos generated by spec_helper to a repos subdir.
  Fix up some comments and add a missing test for config.
  Migrate existing repos when running setup.
  rename cocoapods_dir to home_dir
  Fix some text references to .cocoapods to be .cocoapods/repos
  Move config.yml path back to cocoapods dir.
  Move repos_dir to .cocoapods/repos
  [UI] Add copy&paste friendly dependency to descriptions of Pods

Conflicts:
	CHANGELOG.md
	Gemfile.lock
parents f0bc470a cc29d1a4
...@@ -17,10 +17,30 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -17,10 +17,30 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
* Added support for bundled libraries. * Added support for bundled libraries.
[#809](https://github.com/CocoaPods/CocoaPods/issues/809), [#809](https://github.com/CocoaPods/CocoaPods/issues/809),
[#1075](https://github.com/CocoaPods/CocoaPods/issues/1075) [#1075](https://github.com/CocoaPods/CocoaPods/issues/1075)
* Added license information to `podfile-info` subcommand.
[#1219](https://github.com/CocoaPods/CocoaPods/issues/1219)
* Restructured `.cocoapods` folder to contain repos in a subdirectory.
[#1150](https://github.com/CocoaPods/CocoaPods/issues/1150)
[Ian Ynda-Hummel](https://github.com/ianyh)
* Improved `pod spec create` template.
[#1223](https://github.com/CocoaPods/CocoaPods/issues/1223)
* Added copy&paste-friendly dependency to `pod search`.
[#1073](https://github.com/CocoaPods/CocoaPods/issues/1073)
* Improved performance of the installation of Pods with git
sources which specify a tag.
[#1077](https://github.com/CocoaPods/CocoaPods/issues/1077)
* Core Data `xcdatamodeld` files are now properly referenced from the Pods
project.
[#1155](https://github.com/CocoaPods/CocoaPods/issues/1155)
* Removed punctuation check from specification validations.
[#1155](https://github.com/CocoaPods/CocoaPods/issues/1155)
* Deprecated the `documentation` DSL attribute of the podspec format.
[Core#20](https://github.com/CocoaPods/Core/issues/20)
###### Bug Fixes ###### Bug Fixes
......
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 8a8ace23f5e6ecd4a32b26192d8f1be138a39604 revision: 0bcb90602afc9fdd5772b8079ab77bd20d9ef3a4
branch: feature-frameworks-bundles branch: feature-frameworks-bundles
specs: specs:
cocoapods-core (0.22.3) cocoapods-core (0.22.3)
......
...@@ -214,7 +214,7 @@ namespace :spec do ...@@ -214,7 +214,7 @@ namespace :spec do
title 'Running the specs' title 'Running the specs'
sh "bundle exec bacon #{specs('**')}" sh "bundle exec bacon #{specs('**')}"
unless Pathname.new(ENV['HOME']+'/.cocoapods/master').exist? unless Pathname.new(ENV['HOME']+'/.cocoapods/repos/master').exist?
title 'Ensuring specs repo is up to date' title 'Ensuring specs repo is up to date'
sh "./bin/pod setup" sh "./bin/pod setup"
end end
......
...@@ -9,8 +9,8 @@ module Pod ...@@ -9,8 +9,8 @@ module Pod
self.description = <<-DESC self.description = <<-DESC
Validates NAME.podspec or `*.podspec' in the current working dir, creates Validates NAME.podspec or `*.podspec' in the current working dir, creates
a directory and version folder for the pod in the local copy of a directory and version folder for the pod in the local copy of
REPO (~/.cocoapods/[REPO]), copies the podspec file into the version directory, REPO (~/.cocoapods/repos/[REPO]), copies the podspec file into the version
and finally it pushes REPO to its remote. directory, and finally it pushes REPO to its remote.
DESC DESC
self.arguments = 'REPO [NAME.podspec]' self.arguments = 'REPO [NAME.podspec]'
......
...@@ -13,7 +13,7 @@ module Pod ...@@ -13,7 +13,7 @@ module Pod
self.summary = 'Add a spec repo.' self.summary = 'Add a spec repo.'
self.description = <<-DESC self.description = <<-DESC
Clones `URL` in the local spec-repos directory at `~/.cocoapods`. The Clones `URL` in the local spec-repos directory at `~/.cocoapods/repos/`. The
remote can later be referred to by `NAME`. remote can later be referred to by `NAME`.
DESC DESC
...@@ -48,7 +48,7 @@ module Pod ...@@ -48,7 +48,7 @@ module Pod
self.description = <<-DESC self.description = <<-DESC
Updates the local clone of the spec-repo `NAME`. If `NAME` is omitted Updates the local clone of the spec-repo `NAME`. If `NAME` is omitted
this will update all spec-repos in `~/.cocoapods`. this will update all spec-repos in `~/.cocoapods/repos`.
DESC DESC
self.arguments = '[NAME]' self.arguments = '[NAME]'
......
require 'fileutils'
module Pod module Pod
class Command class Command
class Setup < Command class Setup < Command
...@@ -30,6 +32,8 @@ module Pod ...@@ -30,6 +32,8 @@ module Pod
set_master_repo_url set_master_repo_url
set_master_repo_branch set_master_repo_branch
update_master_repo update_master_repo
elsif old_master_repo_dir.exist?
migrate_repos
else else
add_master_repo add_master_repo
end end
...@@ -43,6 +47,21 @@ module Pod ...@@ -43,6 +47,21 @@ module Pod
# @!group Setup steps # @!group Setup steps
# Migrates any repos from the old directory structure to the new directory
# structure.
#
# @return [void]
def migrate_repos
config.repos_dir.mkpath
Dir.foreach old_master_repo_dir.parent do |repo_dir|
source_repo_dir = old_master_repo_dir.parent + repo_dir
target_repo_dir = config.repos_dir + repo_dir
if not repo_dir =~ /\.+/ and source_repo_dir != config.repos_dir
FileUtils.mv source_repo_dir, target_repo_dir
end
end
end
# Sets the url of the master repo according to whether it is push. # Sets the url of the master repo according to whether it is push.
# #
# @return [void] # @return [void]
...@@ -129,6 +148,12 @@ module Pod ...@@ -129,6 +148,12 @@ module Pod
def master_repo_dir def master_repo_dir
SourcesManager.master_repo_dir SourcesManager.master_repo_dir
end end
# @return [Pathname] the directory of the old master repo.
#
def old_master_repo_dir
Pathname.new('~/.cocoapods/master').expand_path
end
end end
end end
end end
...@@ -132,10 +132,17 @@ module Pod ...@@ -132,10 +132,17 @@ module Pod
# @!group Paths # @!group Paths
# @return [Pathname] the directory where repos, templates and configuration
# files are stored.
#
def home_dir
@home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || "~/.cocoapods").expand_path
end
# @return [Pathname] the directory where the CocoaPods sources are stored. # @return [Pathname] the directory where the CocoaPods sources are stored.
# #
def repos_dir def repos_dir
@repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || "~/.cocoapods").expand_path @repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || "~/.cocoapods/repos").expand_path
end end
attr_writer :repos_dir attr_writer :repos_dir
...@@ -261,7 +268,7 @@ module Pod ...@@ -261,7 +268,7 @@ module Pod
# @return [Pathname] The path of the file which contains the user settings. # @return [Pathname] The path of the file which contains the user settings.
# #
def user_settings_file def user_settings_file
repos_dir + "config.yaml" home_dir + "config.yaml"
end end
# Sets the values of the attributes with the given hash. # Sets the values of the attributes with the given hash.
......
...@@ -164,6 +164,7 @@ module Pod ...@@ -164,6 +164,7 @@ module Pod
pod = Specification::Set::Presenter.new(set, statistics_provider) pod = Specification::Set::Presenter.new(set, statistics_provider)
title("\n-> #{pod.name} (#{pod.version})".green, '', 1) do title("\n-> #{pod.name} (#{pod.version})".green, '', 1) do
puts_indented pod.summary puts_indented pod.summary
puts_indented "pod '#{pod.name}', '~> #{pod.version}'"
labeled('Homepage', pod.homepage) labeled('Homepage', pod.homepage)
labeled('Source', pod.source_url) labeled('Source', pod.source_url)
labeled('Versions', pod.verions_by_source) labeled('Versions', pod.verions_by_source)
......
...@@ -45,5 +45,26 @@ module Pod ...@@ -45,5 +45,26 @@ module Pod
Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` } Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` }
command('setup').url.should == 'git@github.com:CocoaPods/Specs.git' command('setup').url.should == 'git@github.com:CocoaPods/Specs.git'
end end
before do
FileUtils.rm_rf(test_repo_path)
set_up_old_test_repo
config.repos_dir = SpecHelper.temporary_directory + 'cocoapods/repos'
Command::Setup.any_instance.stubs(:old_master_repo_dir).returns(SpecHelper.temporary_directory + 'cocoapods/master')
end
it "migrates repos from the old directory structure to the new one" do
source = SpecHelper.temporary_directory + 'cocoapods/master'
target = config.repos_dir + 'master'
source.should.exist?
target.should.not.exist?
output = run_command('setup')
source.should.not.exist?
target.should.exist?
end
end end
end end
...@@ -45,7 +45,7 @@ module SpecHelper ...@@ -45,7 +45,7 @@ module SpecHelper
repo_path('master') repo_path('master')
end end
# Sets up a lighweight master repo in `tmp/cocoapods/master` with the # Sets up a lighweight master repo in `tmp/cocoapods/repos/master` with the
# contents of `spec/fixtures/spec-repos/test_repo`. # contents of `spec/fixtures/spec-repos/test_repo`.
# #
def set_up_test_repo def set_up_test_repo
...@@ -57,10 +57,26 @@ module SpecHelper ...@@ -57,10 +57,26 @@ module SpecHelper
repo_make('master') repo_make('master')
end end
def test_old_repo_path
repo_path('../master')
end
# Sets up a lighweight master repo in `tmp/cocoapods/master` with the
# contents of `spec/fixtures/spec-repos/test_repo`.
#
def set_up_old_test_repo
require 'fileutils'
test_old_repo_path.mkpath
origin = ROOT + 'spec/fixtures/spec-repos/test_repo/.'
destination = tmp_repos_path + '../master'
FileUtils.cp_r(origin, destination)
repo_make('../master')
end
#--------------------------------------# #--------------------------------------#
def tmp_repos_path def tmp_repos_path
SpecHelper.temporary_directory + 'cocoapods' SpecHelper.temporary_directory + 'cocoapods/repos'
end end
module_function :tmp_repos_path module_function :tmp_repos_path
......
...@@ -15,12 +15,12 @@ module Pod ...@@ -15,12 +15,12 @@ module Pod
@sut.should.be.instance_of Config @sut.should.be.instance_of Config
end end
it "returns the path to the spec-repos dir" do it "returns the path to the home dir" do
@sut.repos_dir.should == Pathname.new("~/.cocoapods").expand_path @sut.home_dir.should == Pathname.new("~/.cocoapods").expand_path
end end
it "returns the path to the spec-repos dir" do it "returns the path to the spec-repos dir" do
@sut.repos_dir.should == Pathname.new("~/.cocoapods").expand_path @sut.repos_dir.should == Pathname.new("~/.cocoapods/repos").expand_path
end end
it "allows to specify whether the aggressive cache should be used with an environment variable" do it "allows to specify whether the aggressive cache should be used with an environment variable" do
...@@ -30,6 +30,12 @@ module Pod ...@@ -30,6 +30,12 @@ module Pod
ENV.delete('CP_AGGRESSIVE_CACHE') ENV.delete('CP_AGGRESSIVE_CACHE')
end end
it "allows to specify the home dir with an environment variable" do
ENV['CP_HOME_DIR'] = '~/custom_home_dir'
@sut.home_dir.should == Pathname.new("~/custom_home_dir").expand_path
ENV.delete('CP_HOME_DIR')
end
it "allows to specify the repos dir with an environment variable" do it "allows to specify the repos dir with an environment variable" do
ENV['CP_REPOS_DIR'] = '~/custom_repos_dir' ENV['CP_REPOS_DIR'] = '~/custom_repos_dir'
@sut.repos_dir.should == Pathname.new("~/custom_repos_dir").expand_path @sut.repos_dir.should == Pathname.new("~/custom_repos_dir").expand_path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment