サイト改装への道(11) 「Yii2のインストール」

まずは、「はじめに:インストール」を参考に、次のページからダウンロード。
http://www.yiiframework.com/
と思ったら、Composerでインストールする手も。
最近、使う機会が多いが、Mac OS Xでのインストール方法は、

$ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading…
Composer successfully installed to: /Users/username/composer.phar
Use it: php composer.phar

以上!

あれ?インストール先が/Users/username/になってる。

移動しとこう。

$ mv composer.phar /usr/local/bin/composer

これによって、

$ php composer.phar 〜

と、コマンドを実行するところ、

$ composer 〜

で、実行できるようになる。

本題に戻って、Yiiをインストール、と思ったら、先にプラグインのインストールが必要。

$ composer global require “fxp/composer-asset-plugin:1.0.0”
Changed current directory to /Users/username/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
– Installing fxp/composer-asset-plugin (v1.0.0)
Downloading: 100%
Writing lock file
Generating autoload files
で、やっとYiiをインストール。今度こそ。

基本的なテンプレートか、アドバンスドなテンプレートか選びますが、今回は基本的な方を選んで、

$ composer create-project yiisoft/yii2-app-basic basic 2.0.4
Installing yiisoft/yii2-app-basic (2.0.4)  – Installing yiisoft/yii2-app-basic (2.0.4)    Downloading: 100%         
Created project in basicLoading composer repositories with package informationInstalling dependencies (including require-dev)Reading bower.json of bower-asset/jquery.inputmask (3.1.56)Could not fetch https://api.github.com/repos/RobinHerbots/jquery.inputmask/contents/bower.json?ref=xxxxxxxxxxxxxxxxx, please create a GitHub OAuth token to go over the API rate limitHead to https://github.com/settings/tokens/new?scopes=repo&description=yyyyyyyyyyyyto retrieve a token. It will be stored in “/Users/username/.composer/auth.json” for future use by Composer.Token (hidden): 

と、なんだか途中で止まってしまいました。

調べてみると、Githubへのアクセスは、認証なしの場合、同じIPアドレスから1時間で60回までとなっているようで、それを超えたようです。
因みに、次のコマンドで、あと何回アクセスできるかが分かります。

$ curl -i https://api.github.com/users/whatever
HTTP/1.1 403 Forbidden
Server: GitHub.com
Date: Sat, 06 Jun 2015 11:58:23 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 257
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1433594536

60回中、残り0。はい。もうダメです。

因みに、リセットされるのは、1433594536っていう時間。
Macだと、次のコマンドで何時何分かが分かります。

$ date -r 1433594536
2015年 6月 6日 土曜日 21時42分16秒 JST

では、Githubのアカウントを持っているであろう事を祈りつつ、次のページに行って、
https://github.com/settings/tokens

[Generate new token]ボタンをクリックして、トークンを入手してください。

因みに、次のコマンドで、残りが確認できます。

$ curl -i -H “Authorization: token 12345678901234567890123456789012” https://api.github.com/users/whatever
HTTP/1.1 200 OK
Server: GitHub.com
Date: Sat, 06 Jun 2015 12:35:33 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1096
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4843
X-RateLimit-Reset: 1433596872

5000回だって。


ま、取得したトークンを入力して続ければ、インストールされる。

$ composer create-project yiisoft/yii2-app-basic basic 2.0.4
Installing yiisoft/yii2-app-basic (2.0.4)
  – Installing yiisoft/yii2-app-basic (2.0.4)
    Loading from cache
Created project in basic
Loading composer repositories with package information
Installing dependencies (including require-dev)
  – Installing yiisoft/yii2-composer (2.0.3)            
    Loading from cache
  – Installing ezyang/htmlpurifier (v4.6.0)
    Downloading: 100%      
  – Installing cebe/markdown (1.1.0)
    Downloading: 100%      
  – Installing bower-asset/jquery (2.1.4)
    Downloading: 100%      
  – Installing bower-asset/jquery.inputmask (3.1.63)
    Downloading: 100%      
  – Installing bower-asset/punycode (v1.3.2)
    Downloading: 100%      
  – Installing bower-asset/yii2-pjax (v2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2 (2.0.4)
    Downloading: 100%      
  – Installing swiftmailer/swiftmailer (v5.4.0)
    Downloading: 100%      
  – Installing yiisoft/yii2-swiftmailer (2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-codeception (2.0.4)
    Downloading: 100%      
  – Installing bower-asset/bootstrap (v3.3.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-bootstrap (2.0.4)
    Downloading: 100%      
  – Installing yiisoft/yii2-debug (2.0.4)
    Downloading: 100%      
  – Installing bower-asset/typeahead.js (v0.10.5)
    Downloading: 100%      
  – Installing phpspec/php-diff (v1.0.2)
    Downloading: 100%      
  – Installing yiisoft/yii2-gii (2.0.4)
    Downloading: 100%      
  – Installing fzaninotto/faker (v1.5.0)
    Downloading: 100%      
  – Installing yiisoft/yii2-faker (2.0.3)
    Downloading: 100%      
fzaninotto/faker suggests installing ext-intl (*)
Writing lock file
Generating autoload files
chmod(‘runtime’, 0777)…done.
chmod(‘web/assets’, 0777)…done.
chmod(‘yii’, 0755)…done.
で?

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です