Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #279 from CocoaPods/keychain_thingy
Browse files Browse the repository at this point in the history
Add the Git Credential Helper to the destroot - fixes #259
  • Loading branch information
nwest committed Apr 15, 2016
2 parents affdf30 + f34be74 commit 8ae0693
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
55 changes: 49 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BUNDLED_ENV_VERSION = 2
BUNDLED_ENV_VERSION = 3
# ^ This has to be at line 0
# This is so that a build on CP.app can be fast,
# it can make assumptions that removing `BUNDLED_ENV_VERSION = `
Expand Down Expand Up @@ -113,6 +113,8 @@ OPENSSL_VERSION = '1.0.2'
OPENSSL_PATCH = 'd'
OPENSSL_URL = "https://www.openssl.org/source/old/#{OPENSSL_VERSION}/openssl-#{OPENSSL_VERSION}#{OPENSSL_PATCH}.tar.gz"

ROOT_CA_URL = "https://pki.google.com/roots.pem"

NCURSES_VERSION = '5.9'
NCURSES_URL = "http://ftpmirror.gnu.org/ncurses/ncurses-#{NCURSES_VERSION}.tar.gz"

Expand Down Expand Up @@ -146,6 +148,9 @@ BZR_URL = "https://launchpad.net/bzr/2.6/2.6.0/+download/bzr-#{BZR_VERSION}.tar.
MERCURIAL_VERSION = '3.3.3'
MERCURIAL_URL = "http://mercurial.selenic.com/release/mercurial-#{MERCURIAL_VERSION}.tar.gz"

# see https://help.github.com/articles/caching-your-github-password-in-git/
GIT_CREDENTIALS_URL = "https://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain"

# ------------------------------------------------------------------------------
# Bundle Build Tools
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -824,16 +829,53 @@ end
installed_bzr = bzr_tasks.installed_path

# ------------------------------------------------------------------------------
# Root Certificates
# Git Credentials Helper
# ------------------------------------------------------------------------------

installed_cacert = File.join(BUNDLE_DESTROOT, 'share/cacert.pem')
file installed_cacert do
%w{ /Library/Keychains/System.keychain /System/Library/Keychains/SystemRootCertificates.keychain }.each do |keychain|
execute 'Certificates', ['/usr/bin/security', 'find-certificate', '-a', '-p', keychain], installed_cacert
class DownloadOnlyTasks < BundleDependencyTasks

# Make the installed file executable?
attr_accessor :is_executable

# NOP
def unpack_command
end
def unpack_task
end
def build_task
end

def install_task
cp File.join(DOWNLOAD_DIR, artefact_file), File.join(BUNDLE_PREFIX, installed_file)
execute 'chmod', 'u+x', File.join(BUNDLE_PREFIX, installed_file) if is_executable
end
end

git_creds_tasks = DownloadOnlyTasks.define do |t|
t.url = GIT_CREDENTIALS_URL
t.artefact_file = 'git-credential-osxkeychain'
t.installed_file = 'bin/git-credential-osxkeychain'
t.prefix = BUNDLE_PREFIX
t.dependencies = [installed_libcurl]
t.is_executable = true
end

installed_git_creds = git_creds_tasks.installed_path

# ------------------------------------------------------------------------------
# Root Certificates
# ------------------------------------------------------------------------------

root_ca_tasks = DownloadOnlyTasks.define do |t|
t.url = ROOT_CA_URL
t.artefact_file = 'roots.pem'
t.installed_file = 'share/roots.pem'
t.prefix = BUNDLE_PREFIX
t.dependencies = [installed_libcurl]
end

installed_cacert = root_ca_tasks.installed_path

# ------------------------------------------------------------------------------
# Bundle tasks
# ------------------------------------------------------------------------------
Expand All @@ -844,6 +886,7 @@ namespace :bundle do
installed_pod_bin,
installed_cocoapods_plugins_install,
installed_git,
installed_git_creds,
installed_svn,
installed_bzr,
installed_mercurial,
Expand Down
2 changes: 1 addition & 1 deletion app/CPReflectionService/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2016.03.30</string>
<string>2016.04.06</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 CocoaPods. All rights reserved.</string>
<key>XPCService</key>
Expand Down
2 changes: 1 addition & 1 deletion app/CocoaPods/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2016.03.30</string>
<string>2016.04.06</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
4 changes: 2 additions & 2 deletions bundle-env
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ BIN=$(cd "$(dirname "$0")"; pwd)
PREFIX=$(dirname $BIN)
export PATH=$BIN:/usr/bin:/bin:/usr/sbin:/sbin
export PYTHONPATH=$PREFIX/lib/python2.7/site-packages
export GIT_SSL_CAINFO=$PREFIX/share/cacert.pem
export GIT_SSL_CAINFO=$PREFIX/share/roots.pem
export GIT_TEMPLATE_DIR=$PREFIX/share/git-core/templates
export GIT_EXEC_PATH=$PREFIX/libexec/git-core
export LANG=en_GB.UTF-8
export LC_CTYPE=UTF-8
export SSL_CERT_FILE=$PREFIX/share/cacert.pem
export SSL_CERT_FILE=$PREFIX/share/roots.pem

# Ensure these env variables we need are set.
if [ -z "$HOME" ]; then
Expand Down

0 comments on commit 8ae0693

Please sign in to comment.