Skip to content

Commit c334f02

Browse files
committed
Merge pull request #23 from buskamuza/optional-github-auth
Optional GitHub auth
2 parents 85c942a + 0571349 commit c334f02

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

README.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* [Installation steps](#installation-steps)
1111
* [Default credentials and settings](#default-credentials-and-settings)
1212
* [Getting updates and fixes](#getting-updates-and-fixes)
13-
* [GitHub limitations](#github-limitations)
1413
* [Day-to-day development scenarios](#day-to-day-development-scenarios)
1514
* [Reinstall Magento](#reinstall-magento)
1615
* [Clear magento cache](#clear-magento-cache)
@@ -71,8 +70,12 @@ Software listed below should be available in [PATH](https://en.wikipedia.org/wik
7170
git clone git@github.com:paliarush/magento2-vagrant-for-developers.git vagrant-magento
7271
```
7372

74-
1. Copy [etc/composer/auth.json.dist](etc/composer/auth.json.dist) to `etc/composer/auth.json` and specify your [GitHub OAuth token](https://github.com/settings/tokens) there. See [API rate limit and OAuth tokens](https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) for more information
75-
73+
1. Optionally, if you use private repositories on GitHub or download packages from Magento Marketplace
74+
75+
- copy [etc/composer/auth.json.dist](etc/composer/auth.json.dist) to `etc/composer/auth.json`
76+
- specify your GitHub token by adding `"github.com": "your-github-token"` to `github-oauth` section for GitHub authorization
77+
- add Magento Marketplace keys for Marketplace authorization
78+
7679
1. Optionally, copy [etc/config.yaml.dist](etc/config.yaml.dist) as `etc/config.yaml` and make necessary customizations
7780

7881
1. Initialize project, configure environment, install Magento, configure PHPStorm project:
@@ -121,16 +124,6 @@ Current vagrant project follows [semantic versioning](http://semver.org/spec/v2.
121124
For example your current branch is `2.0`, then it will be safe to pull any changes from `origin/2.0`. However branch `3.0` will contain changes backward incompatible with `2.0`.
122125
Note, that semantic versioning is only used for `x.0` branches (not for `develop`).
123126

124-
### GitHub limitations
125-
126-
Be aware that you may encounter GitHub limits on the number of downloads (used by Composer to download Magento dependencies).
127-
128-
These limits may significantly slow down the installation since all of the libraries will be cloned from GitHub repositories instead of downloaded as ZIP archives. In the worst case, these limitations may even terminate the installation.
129-
130-
If you have a GitHub account, you can bypass these limitations by using an OAuth token in the Composer configuration. See [API rate limit and OAuth tokens](https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) for more information.
131-
132-
For the Vagrant configuration you may specify your token in `etc/github.oauth.token` file after cloning the repository. The file is a basic text file and is ignored by Git, so you'll need to create it yourself. Simply write your OAuth token in this file making sure to avoid any empty spaces, and it will be read during deployment.
133-
134127
## Day-to-day development scenarios
135128

136129
### Reinstall Magento

etc/composer/auth.json.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"github-oauth": {
3-
"github.com": "your-github-token"
43
},
54
"http-basic": {
65
"repo.magento.com": {

scripts/host/check_requirements.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22

33
vagrant_dir=$(cd "$(dirname "$0")/../.."; pwd)
4-
composer_auth_json="${vagrant_dir}/etc/composer/auth.json"
54
php_executable=$(bash "${vagrant_dir}/scripts/host/get_path_to_php.sh")
65

76
# Enable trace printing and exit on the first error
@@ -10,10 +9,3 @@ set -ex
109
if ! ${php_executable} -v | grep -q 'Copyright' ; then
1110
bash "${vagrant_dir}/scripts/host/install_php.sh"
1211
fi
13-
14-
if [ ! -f ${composer_auth_json} ]; then
15-
set +x
16-
echo "Please specify GitHub token in ${composer_auth_json} to bypass GitHub rate limits (see https://github.com/paliarush/magento2-vagrant-for-developers/tree/develop#github-limitations)"
17-
exit 255
18-
set -x
19-
fi

scripts/host/composer.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ fi
2323

2424
# Configure composer credentials
2525
cd ${current_dir}
26-
cp ${composer_auth_json} "${PWD}/auth.json"
26+
if [ -f ${composer_auth_json} ]; then
27+
cp ${composer_auth_json} "${PWD}/auth.json"
28+
fi
2729

2830
host_os=$(bash "${vagrant_dir}/scripts/host/get_host_os.sh")
2931
if [[ $(bash "${vagrant_dir}/scripts/get_config_value.sh" "environment_composer_prefer_source") == 1 ]]; then
@@ -32,4 +34,7 @@ if [[ $(bash "${vagrant_dir}/scripts/get_config_value.sh" "environment_composer_
3234
else
3335
${php_executable} ${composer_phar} --ignore-platform-reqs "$@"
3436
fi
35-
rm "${PWD}/auth.json"
37+
38+
if [ -f "${PWD}/auth.json" ]; then
39+
rm "${PWD}/auth.json"
40+
fi

scripts/host/configure_php_storm.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22

33
vagrant_dir=$(cd "$(dirname "$0")/../.."; pwd)
4-
composer_auth_json="${vagrant_dir}/etc/composer/auth.json"
54

65
# Enable trace printing and exit on the first error
76
set +x

scripts/provision/configure_environment.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ if [ -f ${composer_auth_json} ]; then
6565
if [ ! -d /home/vagrant/.composer ] ; then
6666
sudo -H -u vagrant bash -c 'mkdir /home/vagrant/.composer'
6767
fi
68-
cp ${composer_auth_json} /home/vagrant/.composer/auth.json
68+
if [ -f ${composer_auth_json} ]; then
69+
cp ${composer_auth_json} /home/vagrant/.composer/auth.json
70+
fi
6971
fi
7072

7173
# Declare path to scripts supplied with vagrant and Magento

0 commit comments

Comments
 (0)