2014年3月16日日曜日

Cordova(PhoneGap)のアップデートについて

Cordovaは頻繁にアップデートされているようで、2014/03/05現在の最新バージョンは、3.4.0-0.1.3です。
※http://cordova.apache.org/から確認できます。

そこで、今回は、cordovaのアップデートについて、まとめてみました。


①開発環境に於ける現在のcordovaバージョンを確認してみます。

>cordova -v
3.3.1-0.1.2


②最新の状態ではなかったので、cordovaのアップデートを実施します。

>npm update cordova -g
npm http GET https://registry.npmjs.org/cordova/latest
npm http 200 https://registry.npmjs.org/cordova/latest
npm http GET https://registry.npmjs.org/cordova
---
---
---
cordova@3.4.0-0.1.3 xxx\AppData\Roaming\npm\node_modules\cordova
├── mime@1.2.11
├── q@0.9.7
├── semver@2.0.11
├── underscore@1.4.4
├── shelljs@0.1.4
├── optimist@0.6.0 (minimist@0.0.8, wordwrap@0.0.2)
├── plist-with-patches@0.5.1 (xmlbuilder@0.4.3, xmldom@0.1.19)
├── elementtree@0.1.5 (sax@0.3.5)
├── npmconf@0.1.13 (once@1.3.0, inherits@2.0.1, osenv@0.0.3, ini@1.1.0, mkdirp@0.3.5, nopt@2.2.0, config-chain@1.1.8)
├── xcode@0.6.6 (node-uuid@1.3.3, pegjs@0.6.2)
├── tar@0.1.19 (inherits@2.0.1, block-stream@0.0.7, fstream@0.1.25)
├── request@2.21.0 (forever-agent@0.5.2, qs@0.6.6, tunnel-agent@0.3.0, aws-sign@0.3.0, json-stringify-safe@4.0.0, oauth-sign@0.3.0, node-uuid@1.4.1, cookie-jar@0.3.0, hawk@0.13.1, http-signature@0.
9.11, form-data@0.0.8)
└── plugman@0.20.2 (bplist-parser@0.0.5, nopt@1.0.10, rc@0.3.0, dep-graph@1.1.0, glob@3.2.9, request@2.22.0, npm@1.3.4)


③アップデート後の確認をします。

>cordova -v
3.4.0-0.1.3

正常にアップデートされたことが確認できました。


これで、cordovaのアップデートは完了なのですが、旧バージョンで作成したプロジェクトについても、必要に応じてアップデートしておきたいところです。


④旧バージョンで作成したプロジェクトを確認してみます。

>cordova platform check
android @ 3.3.0 could be updated to: 3.4.0

cordova 3.3.0によって作成されたandroidプラットフォームのプロジェクトが、3.4.0へアップデートできることが確認できました。

実際にプロジェクト内のcordova.jsを確認してみました。

xxx\hello\platforms\android\assets\www\cordova.js

// Platform: android
// 3.3.0
/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

確かにバージョンは3.3.0になっています。


⑤プロジェクトのアップデートを行ってみます。

>cordova platform update android
---
Android project is now at version 3.4.0
If you updated from a pre-3.2.0 version and use an IDE, we now require that you import the "CordovaLib" library project.

これで、アップデートは完了です。


⑥アップデート後の確認をします。

>cordova platform check
All platforms are up-to-date.

全てのプラットフォームが最新の状態であることが確認できました。


実際にプロジェクト内のcordova.jsを確認してみました。

xxx\hello\platforms\android\assets\www\cordova.js

// Platform: android
// 3.4.0
/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

確かに、バージョンが3.4.0になっています。


これで、cordovaのアップデート及び、既存プロジェクトのアップデートは完了です。


0 件のコメント:

コメントを投稿