Submit Search
Upload
Plugman code-reading
•
0 likes
•
650 views
Motokazu Nishimura
Follow
Study of Plugman, which is installer/uninstaller for Apache Cordova Plugins.
Read less
Read more
Technology
Report
Share
Report
Share
1 of 14
Download now
Download to read offline
Recommended
CruiseControl.NET設置
CruiseControl.NET設置
Kuniaki Igarashi
SubversionServer設置
SubversionServer設置
Kuniaki Igarashi
Nseg20120929
Nseg20120929
hiro345
テスト環境まるごとAwsにのっけてみた
テスト環境まるごとAwsにのっけてみた
Kazuaki Fujikura
Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術
finoue
How to manage Cakephp @CakePHP_Fukuoka_2
How to manage Cakephp @CakePHP_Fukuoka_2
ichikaway
PHPでOpenCVしてみた
PHPでOpenCVしてみた
直也 堀松
[MR08] 知っておくべき UWP アプリ開発の A to Z
[MR08] 知っておくべき UWP アプリ開発の A to Z
de:code 2017
Recommended
CruiseControl.NET設置
CruiseControl.NET設置
Kuniaki Igarashi
SubversionServer設置
SubversionServer設置
Kuniaki Igarashi
Nseg20120929
Nseg20120929
hiro345
テスト環境まるごとAwsにのっけてみた
テスト環境まるごとAwsにのっけてみた
Kazuaki Fujikura
Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術
finoue
How to manage Cakephp @CakePHP_Fukuoka_2
How to manage Cakephp @CakePHP_Fukuoka_2
ichikaway
PHPでOpenCVしてみた
PHPでOpenCVしてみた
直也 堀松
[MR08] 知っておくべき UWP アプリ開発の A to Z
[MR08] 知っておくべき UWP アプリ開発の A to Z
de:code 2017
phpspecで始めるBDD
phpspecで始めるBDD
Yuuki Takezawa
JavaScriptでWebDriverのテストコードを書きましょ
JavaScriptでWebDriverのテストコードを書きましょ
Kohki Nakashima
Appsody でnodejsのアプリを立ち上げよう!
Appsody でnodejsのアプリを立ち上げよう!
Daisuke Hiraoka
nGrinder3 : だれもが簡単にできる性能テスト
nGrinder3 : だれもが簡単にできる性能テスト
JunHo Yoon
cpanfile
cpanfile
Yoshihiro Sasaki
Klocwork 2018.0 アップデート
Klocwork 2018.0 アップデート
Masaru Horioka
MoteMote Compiler Plugin
MoteMote Compiler Plugin
yoshiaki iwanaga
OpenShift from Easy way to Hard ? Way
OpenShift from Easy way to Hard ? Way
ロフト くん
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
ichikaway
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Tomomi Kawabe
Vagrant+Chef
Vagrant+Chef
Daisuke Ando
バージョン管理#01 -Subversion編-
バージョン管理#01 -Subversion編-
hakoika-itwg
Niigata.pm #1
Niigata.pm #1
hayajo Imai
Ansibleで始めるinfraTDD(初級編)
Ansibleで始めるinfraTDD(初級編)
佐久本正太
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Tasuku Otani
CakePHP 1 to 2 Migration tips 100
CakePHP 1 to 2 Migration tips 100
ichikaway
Klocwork C/C++解析チューニング 概要
Klocwork C/C++解析チューニング 概要
Masaru Horioka
継続的インテグレーション3分クッキング
継続的インテグレーション3分クッキング
Takayuki Kondou
認証機能で学ぶ Laravel 5 アプリケーション
認証機能で学ぶ Laravel 5 アプリケーション
Masashi Shinbara
Taming robotframework
Taming robotframework
泰 増田
Sensmon couchdb
Sensmon couchdb
Motokazu Nishimura
Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014
Motokazu Nishimura
More Related Content
What's hot
phpspecで始めるBDD
phpspecで始めるBDD
Yuuki Takezawa
JavaScriptでWebDriverのテストコードを書きましょ
JavaScriptでWebDriverのテストコードを書きましょ
Kohki Nakashima
Appsody でnodejsのアプリを立ち上げよう!
Appsody でnodejsのアプリを立ち上げよう!
Daisuke Hiraoka
nGrinder3 : だれもが簡単にできる性能テスト
nGrinder3 : だれもが簡単にできる性能テスト
JunHo Yoon
cpanfile
cpanfile
Yoshihiro Sasaki
Klocwork 2018.0 アップデート
Klocwork 2018.0 アップデート
Masaru Horioka
MoteMote Compiler Plugin
MoteMote Compiler Plugin
yoshiaki iwanaga
OpenShift from Easy way to Hard ? Way
OpenShift from Easy way to Hard ? Way
ロフト くん
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
ichikaway
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Tomomi Kawabe
Vagrant+Chef
Vagrant+Chef
Daisuke Ando
バージョン管理#01 -Subversion編-
バージョン管理#01 -Subversion編-
hakoika-itwg
Niigata.pm #1
Niigata.pm #1
hayajo Imai
Ansibleで始めるinfraTDD(初級編)
Ansibleで始めるinfraTDD(初級編)
佐久本正太
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Tasuku Otani
CakePHP 1 to 2 Migration tips 100
CakePHP 1 to 2 Migration tips 100
ichikaway
Klocwork C/C++解析チューニング 概要
Klocwork C/C++解析チューニング 概要
Masaru Horioka
継続的インテグレーション3分クッキング
継続的インテグレーション3分クッキング
Takayuki Kondou
認証機能で学ぶ Laravel 5 アプリケーション
認証機能で学ぶ Laravel 5 アプリケーション
Masashi Shinbara
Taming robotframework
Taming robotframework
泰 増田
What's hot
(20)
phpspecで始めるBDD
phpspecで始めるBDD
JavaScriptでWebDriverのテストコードを書きましょ
JavaScriptでWebDriverのテストコードを書きましょ
Appsody でnodejsのアプリを立ち上げよう!
Appsody でnodejsのアプリを立ち上げよう!
nGrinder3 : だれもが簡単にできる性能テスト
nGrinder3 : だれもが簡単にできる性能テスト
cpanfile
cpanfile
Klocwork 2018.0 アップデート
Klocwork 2018.0 アップデート
MoteMote Compiler Plugin
MoteMote Compiler Plugin
OpenShift from Easy way to Hard ? Way
OpenShift from Easy way to Hard ? Way
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
脆弱性もバグ、だからテストしよう PHPカンファンレス2015
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Alfresco勉強会#30 alfrescoとshareのJavaScriptをデバッグしよう
Vagrant+Chef
Vagrant+Chef
バージョン管理#01 -Subversion編-
バージョン管理#01 -Subversion編-
Niigata.pm #1
Niigata.pm #1
Ansibleで始めるinfraTDD(初級編)
Ansibleで始めるinfraTDD(初級編)
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
Alfresco勉強会#33 alfresco 5.1でコンテンツ自動削除を実装してみた
CakePHP 1 to 2 Migration tips 100
CakePHP 1 to 2 Migration tips 100
Klocwork C/C++解析チューニング 概要
Klocwork C/C++解析チューニング 概要
継続的インテグレーション3分クッキング
継続的インテグレーション3分クッキング
認証機能で学ぶ Laravel 5 アプリケーション
認証機能で学ぶ Laravel 5 アプリケーション
Taming robotframework
Taming robotframework
Viewers also liked
Sensmon couchdb
Sensmon couchdb
Motokazu Nishimura
Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014
Motokazu Nishimura
Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -
Motokazu Nishimura
Lean geo-location-data-format
Lean geo-location-data-format
Motokazu Nishimura
UXのための心理学(仮)
UXのための心理学(仮)
Naruhito Kubota
ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)
Naruhito Kubota
デザインの価値のお話
デザインの価値のお話
Naruhito Kubota
Freer Monads, More Extensible Effects
Freer Monads, More Extensible Effects
Hiromi Ishii
Viewers also liked
(8)
Sensmon couchdb
Sensmon couchdb
Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014
Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -
Lean geo-location-data-format
Lean geo-location-data-format
UXのための心理学(仮)
UXのための心理学(仮)
ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)
デザインの価値のお話
デザインの価値のお話
Freer Monads, More Extensible Effects
Freer Monads, More Extensible Effects
Similar to Plugman code-reading
Capistranoで自動デプロイ
Capistranoで自動デプロイ
toyoshi
環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介
Etsuji Nakai
はじめての Elastic Beanstalk
はじめての Elastic Beanstalk
Amazon Web Services Japan
10分で作る Node.js Auto Scale 環境 with CloudFormation
10分で作る Node.js Auto Scale 環境 with CloudFormation
Kazuyuki Honda
Capistrano
Capistrano
Yasuharu Fukuda
試して学べるクラウド技術! OpenShift
試して学べるクラウド技術! OpenShift
Etsuji Nakai
Scoop!
Scoop!
NipponAlgorithm
Gws 20130315 gradle_handson
Gws 20130315 gradle_handson
Nobuhiro Sue
Grails 2.0.0.M1の話
Grails 2.0.0.M1の話
Tsuyoshi Yamamoto
Klocwork カスタムチェッカー紹介
Klocwork カスタムチェッカー紹介
Masaru Horioka
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入
Yu Nobuoka
成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略
Hiroshi SHIBATA
Dockerでデプロイ
Dockerでデプロイ
oshiro_seiya
10分でわかるFuelPHP @ 2013/04 FuelPHP入門ハンズオン vol.1
10分でわかるFuelPHP @ 2013/04 FuelPHP入門ハンズオン vol.1
kenjis
NPAPIを使ったandroid標準ブラウザの拡張方法
NPAPIを使ったandroid標準ブラウザの拡張方法
Naruto TAKAHASHI
Driverについて
Driverについて
幸雄 村上
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
Yuki Morishita
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
Takayoshi Tanaka
Isomorphic web development with scala and scala.js
Isomorphic web development with scala and scala.js
TanUkkii
Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識
shigeya
Similar to Plugman code-reading
(20)
Capistranoで自動デプロイ
Capistranoで自動デプロイ
環境構築自動化ツールのご紹介
環境構築自動化ツールのご紹介
はじめての Elastic Beanstalk
はじめての Elastic Beanstalk
10分で作る Node.js Auto Scale 環境 with CloudFormation
10分で作る Node.js Auto Scale 環境 with CloudFormation
Capistrano
Capistrano
試して学べるクラウド技術! OpenShift
試して学べるクラウド技術! OpenShift
Scoop!
Scoop!
Gws 20130315 gradle_handson
Gws 20130315 gradle_handson
Grails 2.0.0.M1の話
Grails 2.0.0.M1の話
Klocwork カスタムチェッカー紹介
Klocwork カスタムチェッカー紹介
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入
成長を加速する minne の技術基盤戦略
成長を加速する minne の技術基盤戦略
Dockerでデプロイ
Dockerでデプロイ
10分でわかるFuelPHP @ 2013/04 FuelPHP入門ハンズオン vol.1
10分でわかるFuelPHP @ 2013/04 FuelPHP入門ハンズオン vol.1
NPAPIを使ったandroid標準ブラウザの拡張方法
NPAPIを使ったandroid標準ブラウザの拡張方法
Driverについて
Driverについて
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
サンプルアプリケーションで学ぶApache Cassandraを使ったJavaアプリケーションの作り方
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
Isomorphic web development with scala and scala.js
Isomorphic web development with scala and scala.js
Windows PowerShell 2.0 の基礎知識
Windows PowerShell 2.0 の基礎知識
Plugman code-reading
1.
Plugmancode reading Plugman =
version": "0.21.1-dev"
2.
plugman • Plugman is
.. • A command line tool to install and uninstall plugins for use with Apache Cordova projects. • https://github.com/apache/cordova- plugman
3.
plugman install plugman install --plugins_dir
plugins --plugin com.phonegap.plugins.barcodescanner --platform android --project android/native --www android/js pluginが保管されている場所 pluginの名前 対象プラットフォーム android用のプラグインファイル (java, libs )を配置する対象ディレクトリ plugins/*.js cordova_plugins.js が配置される ex) platform android
4.
files • このあたりを見る • main.js •
plugman.js • install.js • prepare.js
5.
main.js • 一番始めに呼ばれる • cli
のオプションの検証 • plugman のconsole eventの設定 • オプションに基づいた plugman の関数の実行 ! • commands は plugman.js 内で定義される • ここでいう [cmd] は config, install などのコマンドのこと L81. var result = plugman.commands[cmd](cli_opts);
6.
plugman.js • plugman のメイン部分 •
plugman.commands の中に実行可能なコマンド列が並ぶ • 実行される中身は、addPropertyで対応するモジュールをsrcからrequire ! • 読み込んだ function を plugman objectのプロパティとして登録 L62. addProperty(plugman, 'install', './src/install', true);
7.
install.js src/install.js • install command
の中身 • Install flow • installPlugin -> possiblyFetch -> runInstall -> handleInstall • installPlugin(platform, project_dir, id, plugins_dir, options) • platformのチェック • possiblyFetch(actions, platform, project_dir, id, plugins_dir, options) • plugin の fetch を行い runInstall に進む
8.
install.js / runInstall •
Plugin内にあるplugin.xml をパース、plugin名, IDを取得 • pluginがインストールされているかを確認 • 確認対象のファイルは platform 毎に違うので、platforms/*.js を参照する • plugin がインストールされていなければ続く • getEngines でplugin.xml に記載されている処理エンジンを取得(記載無しの 場合は default-engineを利用) • util/default-engines.js に記述のあるengine であれば、scriptSrcのパスが セットされる。存在しない場合は以下のルールで追加される。 <engines> <engine name="cordova" version="1.8.1" /> <engine name="worklight" version="1.0.0" /> </engines> util/default-engines.js [存在する場合] L6. { 'platform':'*', 'scriptSrc': path.join(project_dir,'cordova','version') }, [存在しない場合] { 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':path.resolve(plugin_dir, engine.attrib["scriptSrc"]), 'minVersion' : engine.attrib["version"]}
9.
install.js / runInstall •
取得した engine のscriptSrcをchild_processで起動 : callEngineScripts • scriptSrcの中身は version を出力するシェル • platforms/ios/cordova/version • 実行可能なversionという名前のシェルがあるをチェックし ている • 取得したバージョンと plugin.xml に書いてあるバージョンを比 較して、サポートバージョンかどうかを確認 : checkEngines
10.
install.js / runInstall L223
- L333 • plugin.xml 内の preference があれば、コマンド引数 (options)に存在するかを確認。なければそこでコマンド 終了 • plugin.xml 内の dependency があれば、install済み pluginを確認。無ければ、local, git からpluginを取得し てくる (fetch.js) • 準備完了。handleInstallを呼ぶ handleInstall(actions, plugin_id, plugin_et, platform, project_dir, plugins_dir, install_plugin_dir, filtered_variables, options.www_dir, options.is_top_level);
11.
install.js / handleInstall •
plugin.xml の platform タグ内を対象に実際に ファイルなどを移動させる ! ! • platforms/*.js から対応するプラットフォーム のコマンドを実行準備 var sourceFiles = platformTag.findall('./source-file'), headerFiles = platformTag.findall('./header-file'), resourceFiles = platformTag.findall('./resource-file'), frameworkFiles = platformTag.findall('./framework[@custom="true"]'), libFiles = platformTag.findall('./lib-file'), assets = assets.concat(platformTag.findall('./asset')); L516. actions.push(actions.createAction(handler[ source-file"].install,
12.
install.js / handleInstall •
コピー先を決定してファイルを移動させる ! ! • actions.process(platform, project_dir) • 失敗したら uninstall が呼ばれる • 成功すれば install 処理完了 [platforms/android.js] install:function(source_el, plugin_dir, project_dir, plugin_id) { var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src'])); ! common.copyNewFile(plugin_dir, source_el.attrib['src'], project_dir, dest); },
13.
prepare.js • plugin ファイルへの
cordova.defineの追加 ! • cordova_plugins.js ファイルの作成 pluginファイルに自動挿入される cordova.define( com.phonegap.plugins. L182. scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) { ' + scriptContent + 'n});n'; L217: var final_contents = "cordova.define('cordova/plugin_list', function(require, exports, module) {n"; L218: final_contents += 'module.exports = ' + JSON.stringify(moduleObjects,null,' ') + ;n'; … L226: fs.writeFileSync(path.join(wwwDir, 'cordova_plugins.js'), final_contents, 'utf-8');
14.
End of Slides
Download now