[
  {
    "path": ".gitignore",
    "content": ".DS_Store\nnode_modules"
  },
  {
    "path": "bin/elementary-electron",
    "content": "#!/usr/bin/env node\n\nrequire('../index.js').execute(process.argv.slice(2))\n"
  },
  {
    "path": "exercises/cat_annotation/exercise.js",
    "content": "var path = require('path')\nvar checkAll = require('../../lib/checkAll.js')\nvar fsCheck = require('../../lib/fsCheck.js')\n\nmodule.exports = function () {\n  var problem = {}\n  problem.requireSubmission = false\n  problem.problem = {file: path.join(__dirname, 'problem.{lang}.md')}\n  problem.verify = function (args, cb) {\n    checkAll([\n      fsCheck(path.join('.', 'index.js')),\n      fsCheck(path.join('.', 'node_modules', 'cat-picture')),\n      fsCheck(path.join('.', 'node_modules', 'lightning-image-poly'))\n    ], '', '{{exercise.cat_annotation.fail}}', cb)\n  }\n  return problem\n}\n"
  },
  {
    "path": "exercises/cat_annotation/problem.en.md",
    "content": "# Cat Annotation\n\nNow we're going to add a feature: draw polygon regions on the image!\n\nThis could be useful for labeling objects or defining regions on a map.\n\nAdd the following line to the `<body>` section of your `index.html`, which adds an empty `div` element to hold our visualization. **Make sure** this comes **before** the `<script>` tag so that the code runs after the `div` is created.\n\n```\n<div id='visualization'></div>\n```\n\nNext modify `index.js`. The first line should require our cat picture, and also assign it to a variable:\n\n```\nvar picture = require('cat-picture')\n```\n\nWe actually just want the source data for the picture, so get it, then remove the image from the page.\n\n```\nvar src = picture.src\npicture.remove()\n```\n\nNow install a visualization module for drawing polygons by typing `npm install lightning-image-poly --save`.\n\nDouble check that your `package.json` has a new entry!\n\nRequire the module by adding the line:\n\n```\nvar image = require('lightning-image-poly')\n```\n\nThen render the image data we stored above by creating a new `image` visualization.\n\n```\nvar viz = new image('#visualization', null, [src], {hullAlgorithm: 'convex'})\n```\n\nIf you run `electron app.js` you should see a cat, and be able to draw polygons on it with the mouse!\n\nWhen you think you are done with this challenge, run `elementary-electron verify`\n"
  },
  {
    "path": "exercises/cat_annotation/problem.ja.md",
    "content": "# Cat Annotation\n\nここでは、さらに新しい機能を追加します！これから追加する新しい機能、それは「ポリゴンで指定した領域を描画する」です。\n\nこの機能は、地図で指定した範囲を描画したり、ラベリングをするのに役に立ちます。\n\n下記の一行を `index.html` の `<body>` の中に追加してください。このタグは、ビジュアライゼーションを行うための空の `div` です。**気をつけてほしいのが、** このタグは、`<script>` タグより **前** に設置してください。そうすることで、`index.js` を `div` が認識されたあとに実行することができるようになります。\n\n```\n<div id='visualization'></div>\n```\n\n次に、`index.js` を編集します。最初の一行は、require した `cat-picture` を変数にします。\n\n```\nvar picture = require('cat-picture')\n```\n\nいま実際に欲しいのは画像のデータです。変数に保存したら、ページから画像を削除しましょう。\n\n```\nvar src = picture.src\npicture.remove()\n```\n\n次に、ポリゴンを描画するためのモジュールをインストールしましょう。次のコマンドを実行してください: `npm install lightning-image-poly --save`\n\nこれで `package.json` に新しい行が追加されているはずです。確認してみてください！\n\n次の行を追加して、いまインストールしたモジュールを使いましょう:\n\n```\nvar image = require('lightning-image-poly')\n```\n\n完了したら、先ほど変数に保存した画像を `image` 変数を使い描画してみましょう。\n\n```\nvar viz = new image('#visualization', null, [src], {hullAlgorithm: 'convex'})\n```\n\nこれで、`electron app.js` を実行してアプリを開くと、猫の写真が表示されるだけでなく、マウスでポリゴンを描けるようになります。\n\nこの課題が完了したら　`elementary-electron verify` を実行してください。\n"
  },
  {
    "path": "exercises/cat_annotation/problem.ko.md",
    "content": "# 고양이 사진과 다각형\n\n새로운 기능을 추가해 볼까요? 이미지 위에 다각형 영역을 그려 봅시다.\n\n이 기능은 어떤 물체에 표시할 때나, 지도 위에 일정 지역을 나타낼 때 유용합니다.\n\n`index.html` 파일의 `<body>` 부분에 다음 코드 한 줄을 넣어 보세요. 이곳은 사진이 위치할 빈 `div` 요소입니다. **조심하세요.** 이 코드는 `<script>` 태그 **앞에** 위치해야 합니다. 그래야 `div` 요소가 생성된 뒤에 `<script>`내의 코드가 실행됩니다.\n\n```\n<div id='visualization'></div>\n```\n\n다음은 `index.js`를 수정해 볼까요? 맨 처음 줄에 require를 이용해서 고양이 사진을 변수에 저장해 봅시다.\n\n```\nvar picture = require('cat-picture')\n```\n\n사실 필요한 것은 고양이 사진의 소스 데이터뿐이니, 변수에 저장한 뒤에 사진을 페이지에서 지웁시다.\n\n```\nvar src = picture.src\npicture.remove()\n```\n\n이제 다각형을 그려주는 모듈을 설치해 봅시다. `npm install lightning-image-poly --save`를 입력해 주세요.\n\n`package.json`에 새로운 항목이 추가되었는지 다시 한번 확인하세요.\n\n다음 코드를 추가해서 설치한 모듈을 사용해봅시다.\n\n```\nvar image = require('lightning-image-poly')\n```\n\n위에서 변수에 저장한 이미지 데이터를 사용해,  visualization `image`를 새로 만들어 이미지를 그려봅시다.\n\n```\nvar viz = new image('#visualization', null, [src], {hullAlgorithm: 'convex'})\n```\n\n`electron app.js`를 실행하면 고양이가 보일 거예요. 그리고 이제 마우스로 다각형을 그릴 수 있습니다!\n\n위의 과정을 전부 완료했다면, `elementary-electron verify`를 실행해주세요.\n"
  },
  {
    "path": "exercises/cat_picture/exercise.js",
    "content": "var path = require('path')\nvar chalk = require('chalk')\nvar checkAll = require('../../lib/checkAll.js')\nvar cheerio = require('cheerio')\nvar fs = require('fs')\nvar fsCheck = require('../../lib/fsCheck.js')\nvar pkgDependencyCheck = require('../../lib/pkgDependencyCheck.js')\n\nmodule.exports = function () {\n  var problem = {}\n  problem.requireSubmission = false\n  problem.problem = {file: path.join(__dirname, 'problem.{lang}.md')}\n  problem.verify = function (args, cb) {\n    var htmlPath = 'index.html'\n\n    checkAll([\n      fsCheck(htmlPath),\n      fsCheck('index.js'),\n      fsCheck(path.join('node_modules', 'cat-picture')),\n      pkgDependencyCheck('cat-picture'),\n      function (messages) {\n        var html\n        try {\n          html = fs.readFileSync(htmlPath, 'utf-8')\n        } catch (e) {\n          console.log(e)\n          messages.push('  - ' + chalk.red(htmlPath) + ' [{{exercise.cat_picture.cant_read}}]')\n          return 0\n        }\n        var $\n        try {\n          $ = cheerio.load(html)\n        } catch (e) {\n          console.log(e)\n          messages.push('  - ' + chalk.red(htmlPath) + ' [{{exercise.cat_picture.invalid_html}}]')\n          return 0\n        }\n        var script = $('script')\n        if (script.length === 0) {\n          messages.push('  - ' + chalk.red(htmlPath) + ' [{{exercise.cat_picture.missing_script_tag}}]')\n          return 0\n        }\n        var body = $('body')\n        if (body.length === 0) {\n          messages.push('  - ' + chalk.red(htmlPath) + ' [{{exercise.cat_picture.missing_body_tag}}]')\n          return 0\n        }\n        if (!$.contains(body[0], script[0])) {\n          messages.push('  - ' + chalk.red(htmlPath) + ' [{{exercise.cat_picture.script_not_in_body}}]')\n          return 0\n        }\n        messages.push('  - ' + chalk.green(htmlPath) + ' ✔')\n        return 1\n      }\n    ], '{{exercise.cat_picture.success}}', '{{exercise.cat_picture.fail}}', cb)\n  }\n  return problem\n}\n"
  },
  {
    "path": "exercises/cat_picture/problem.en.md",
    "content": "# Cat Picture\n\nNow that we have a working skeleton structure we can add our first feature: render a cat picture.\n\nWe could write the code to do this ourselves, but (like many other common programming tasks) somebody else has already written code to do this for us. Node.js provides a way for authors to package up chunks of pre-written code for easy re-use, and also provides a program called `npm` to produce, download, and install such packages (which Node refers to as \"modules\"). If you're familiar with R, `npm` is very similar to the `install.packages()` command.\n\nSo, back to our task: add a glorious cat picture to our app. To do this we can use a module from npmjs.org called `cat-picture`. It does one thing: adds a cat picture to a web page.\n\nWe will use the `npm` command line tool to download and install the `cat-picture` module. Before we can work with modules, though, we need to give Node a little bit more information about what we are doing with our app. The best way to do this is actually to _create our own_ module!\n\nTo do this, all we need to do is create a file called `package.json` that will contain certain information about our module, notably including a list of what other modules we depend on. `npm` can do this for us!\n\nRun the command `npm init` It will ask you some questions to fill out; if you're not sure about the answer, you can just hit \"enter\" to accept its default.\n\nWhen the command is complete, you should see a new file in your directory called `package.json`. Check it out! You can open `package.json` in your text editor. \n\nNow, run the following command: `npm install cat-picture --save`\n\nThis will download the `cat-picture` module into a folder called `node_modules` and will also add cat-picture to your `package.json`. If you open `package.json` in your editor again, you should see a mention of the `cat-picture` module.\n\nNow that we have installed the module, we can use it in our application. Add this to your `index.html` file, inside the `<body>` section but _after_ the `<h1>` section:\n  \n```\n<script type=\"text/javascript\" src=\"index.js\"></script>\n```\n\nThen, use your text editor to create a new file in your directory called `index.js` with this line of code in it:\n\n```\nrequire('cat-picture')\n```\n\nNow when you run your app with `electron app.js` you should see a cat!\n\nWhen you think you are done with this challenge, run `elementary-electron verify`\n"
  },
  {
    "path": "exercises/cat_picture/problem.ja.md",
    "content": "# 猫の写真\n\nこれで作業をする土台が完成したので、新しい機能を実装することができます。\nこれから追加する新しい機能、それは「猫の写真を描画する」です。\n\nこの新しい機能を実装するのに、0からコードを書いても良いです。しかし、一般的なプログラミングのタスクと同様に他の誰かが既にコードを書いてくれているようです。Node.js は開発者に作成したコードのまとまりをパッケージ化して簡単に再利用する方法を提供しており、そのようなパッケージ(Node.js からは \"modules\" と呼ばれています)を作成・ダウンロード・インストールを行うための `npm` と呼ばれるプログラムも提供しています。もしあなたが R 言語に精通しているならば、`install.packages()` コマンドに非常に近いものといえば分かりやすいかもしれません。\n\nそれでは本題に戻ります。輝く猫の写真をアプリに追加しましょう。これを作るのに、`cat-picture` と呼ばれるモジュールを npmjs.org からインストールして使ってみましょう。このモジュールは、ウェブページに猫の写真を追加するためのものです。\n\nこの `cat-picture` モジュールをダウンロード・インストールするのに、`npm` コマンドを使います。しかし、その作業をする前に、このアプリケーションは何をするためのものか、Node.js にもう少し情報を伝えてみましょう。これを行うベストな方法は、_あなたのモジュール_ を作成することです！\n\n自分のモジュールを作成するには、私たちのモジュールに関するいくつかの詳細、例えば依存している他のモジュールのリストなどを含んだ `package.json`というファイルを作成する必要があります。そして、`npm` は私たちのかわりにこれを行ってくれます！\n\n`npm init`コマンドを実行してみてください。このコマンドを実行すると、いくつかの質問が表示されるので回答してください。また、 答えがわからない場合は \"enter\" で飛ばすとデフォルトの回答がセットされます。\n\nこのコマンドが完了すると、コマンドを実行したディレクトリで `package.json` という名前のファイルが生成されます。チェックしてみてください！エディタで `package.json` を開いてみましょう。\n\n次に、このコマンドを実行してみてください: `npm install cat-picture --save`\n\nこの一連の流れは、`cat-picture` モジュールを `node_modules` という名前のフォルダにダウンロードし、cat-picture を `package.json`に追加するというものです。もし今 `package.json` をエディタで改めて開いてみると `cat-picture` の記述を確認することができるでしょう。\n\nさて、モジュールのインストールが完了したので、いよいよアプリケーションで実際に使ってみましょう。まずは、 `index.html` ファイルを作成し、下記の一行を `<body>` の中、かつ `<h1>` の _あと_ に追加してみてください:\n\n```\n<script type=\"text/javascript\" src=\"index.js\"></script>\n```\n\n完了したら、同じディレクトリに `index.js` を追加し、エディタで開いて下記の一行を追加してみてください:\n\n```\nrequire('cat-picture')\n```\n\nこれで、`electron app.js` を実行してアプリを開くと、猫の写真を見ることができます！\n\nこのチャレンジが完了したら、`elementary-electron verify` を実行してください。\n"
  },
  {
    "path": "exercises/cat_picture/problem.ko.md",
    "content": "# 고양이 사진\n\n이제 새로운 기능들을 추가할 작업대가 만들어졌습니다. 그럼 첫 번째 기능을 추가해볼까요? 고양이 사진을 그려봅시다.\n\n기능을 추가하기 위해 아예 처음부터 만드는 방법도 있습니다만, 여타 다른 프로그래밍 작업처럼, 누군가가 우리가 필요로 하는 기능을 이미 만든 경우가 많습니다. Node.js는 개발자가 자신이 작성한 프로그램을 패키지화해서 재사용을 쉽게 하도록 해줍니다. 또한 `npm`이라는 프로그램을 제공하여 그러한 프로그램(Node는 이걸 \"modules\"라고 부릅니다)들을 만들고, 내려받고, 설치하게 해줍니다. R을 사용해보신 적이 있다면 `npm`은 `install.packages()`와 비슷하다고 생각하시면 됩니다.\n\n자 이제 본론으로 돌아와서 아름다운 고양이 사진을 앱에 추가해봅시다. 그러려면 `cat-picture`라는 모듈을 npmjs.org로부터 설치할 필요가 있습니다. 이 모듈은 웹 페이지에 고양이 사진을 추가하는 단순한 프로그램입니다.\n\n`cat-picture` 모듈을 설치하기 위해 `npm`이라는 명령어를 사용할것입니다. 이 작업을 하기 전에, 지금 만들고 있는 앱은 무엇을 하는 프로그램인지에 대해 Node.js에 알려줘야 합니다. 가장 좋은 방법은 실제로 _당신이 직접_ 모듈을 작성하는 것입니다.\n\n모듈을 작성하려면 `package.json`이라는 파일을 만들면 됩니다. 이 파일에 우리가 만든 모듈에 대해서, 그리고 우리의 모듈이 의존하고 있는 모듈들의 리스트를 작성해야 합니다. 고맙게도 `npm`은 이 작업을 우리 대신 해줍니다!\n\n`npm init`을 실행해보세요. 몇 가지 질문에 응답해야 합니다. 뭐라고 답을 해야 할지 모르겠다면 그냥 엔터를 입력해서 디폴트로 설정하세요.\n\n`npm init`의 실행이 완료되면, 현재 디렉터리에 `package.json`이라는 파일이 생길 것입니다. 텍스트 에디터로 내용을 확인해보세요.\n\n이제 다음 명령어를 실행해보세요. `npm install cat-picture --save`\n\n그러면 `cat-picture` 모듈이 `node_modules`라는 폴더에 저장되고, `package.json`에도 모듈 이름이 표시될 것입니다. `package.json`을 텍스트 에디터로 열어보면, `cat-picture` 모듈이 언급되어 있을 것입니다.\n\n이제 모듈을 설치했으니 우리의 앱에서 사용해 봅시다. 다음 코드를 `index.html`의 `<body>` 태그 안에 작성하세요. 단 `<h1>` 태그의 _뒤에_ 와야 하는 것에 주의하세요.\n\n```\n<script type=\"text/javascript\" src=\"index.js\"></script>\n```\n\n텍스트 에디터를 사용해서, 현재 디렉터리에 `index.js`라는 파일을 만들고 다음 코드를 작성하세요.\n\n```\nrequire('cat-picture')\n```\n\n이제 `electron app.js`으로 앱을 실행하세요. 고양이가 보일 겁니다!\n\n위의 과정을 완료하셨다면 `elementary-electron verify`를 실행해주세요.\n"
  },
  {
    "path": "exercises/hello_world/exercise.js",
    "content": "var path = require('path')\nvar checkAll = require('../../lib/checkAll.js')\nvar fsCheck = require('../../lib/fsCheck.js')\n\nmodule.exports = function () {\n  var problem = {}\n  problem.requireSubmission = false\n  problem.problem = {file: path.join(__dirname, 'problem.{lang}.md')}\n\n  problem.verify = function (args, cb) {\n    checkAll([\n      fsCheck(path.join('.', 'index.html')),\n      fsCheck(path.join('.', 'app.js'))\n    ], '{{exercise.hello_world.success}}', '{{exercise.hello_world.fail}}', cb)\n  }\n  return problem\n}\n"
  },
  {
    "path": "exercises/hello_world/problem.en.md",
    "content": "# Hello World\n\nLet's set up a simple electron application.\n\nFirst, create a new empty folder and do the rest of these steps inside that new folder.\n\nUsing a text editor (such as TextEdit, Notepad, etc.), create a file called `index.html` in the folder you just created with the following contents:\n\n```\n<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n  <h1>Hello World</h1>\n</body>\n</html>\n```\n\nThen create a file (in the same folder) called `app.js` with the following contents:\n\n```\nvar electron = require('electron')\n\nelectron.app.on('ready', function () {\n  var mainWindow = new electron.BrowserWindow({width: 600, height: 800, webPreferences: { nodeIntegration: true, enableRemoteModule: true }})\n  mainWindow.loadURL('file://' + __dirname + '/index.html')\n})\n```\n\nFinally, run `electron app.js` in your terminal. You should see an application open that displays Hello World!\n\nWhen you think you are done with this challenge, run `elementary-electron verify`\n"
  },
  {
    "path": "exercises/hello_world/problem.ja.md",
    "content": "# ハローワールド\n\nシンプルな electron のアプリケーションを作ってみましょう。\n\n最初に、空のフォルダを作り、下記の手順を作ったフォルダの中で実施していきましょう。\n\nテキストエディタ（TextEdit, Notepadなど）を使って、以下の内容の `index.html` をフォルダの中に作成してください：\n\n```\n<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n  <h1>Hello World</h1>\n</body>\n</html>\n```\n\n次に、以下の内容の `app.js`というファイルを（同じフォルダ内に）作成します：\n\n```\nvar electron = require('electron')\n\nelectron.app.on('ready', function () {\n  var mainWindow = new electron.BrowserWindow({width: 600, height: 800, webPreferences: { nodeIntegration: true, enableRemoteModule: true }})\n  mainWindow.loadURL('file://' + __dirname + '/index.html')\n})\n```\n\n最後に、ターミナルで `electron app.js` を実行してください。Hello World が表示されたアプリケーションが開いているはずです。\n\nこの課題が完了したら　`elementary-electron verify` を実行してください。\n"
  },
  {
    "path": "exercises/hello_world/problem.ko.md",
    "content": "# 헬로 월드\n\n간단한 electron 앱을 만들어 봅시다.\n\n먼저, 새로운 폴더를 만들고 그 폴더에서 앞으로의 작업을 진행해 주세요.\n\n텍스트 에디터(TextEdit, Notepad 등)를 사용해서 방금 만든 폴더에 `index.html`을 만들고, 다음 내용을 작성하세요.\n\n\n```\n<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n  <h1>Hello World</h1>\n</body>\n</html>\n```\n\n같은 폴더에 `app.js`라는 파일을 만들고 다음 내용을 작성하세요.\n\n```\nvar electron = require('electron')\n\nelectron.app.on('ready', function () {\n  var mainWindow = new electron.BrowserWindow({width: 600, height: 800, webPreferences: { nodeIntegration: true, enableRemoteModule: true }})\n  mainWindow.loadURL('file://' + __dirname + '/index.html')\n})\n```\n\n마지막으로, `electron app.js`를 터미널에서 실행하세요. Hello World가 출력되는 앱이 보이실 겁니다.\n\n위의 과정을 완료하셨다면 `elementary-electron verify`를 실행해주세요.\n"
  },
  {
    "path": "exercises/installing/exercise.js",
    "content": "var path = require('path')\nvar which = require('which')\nvar chalk = require('chalk')\n\nmodule.exports = function () {\n  var problem = {}\n  problem.requireSubmission = false\n  problem.problem = {file: path.join(__dirname, 'problem.{lang}.md')}\n\n  problem.verify = function (args, cb) {\n    which('electron', function (err, resolvedPath) {\n      if (err) {\n        return cb(null, false, chalk.green('{{ee.fail}}') + ' {{exercise.installing.fail}}')\n      }\n      cb(null, true, chalk.green('{{ee.success}}') + ' {{exercise.installing.success}}')\n    })\n  }\n  return problem\n}\n"
  },
  {
    "path": "exercises/installing/problem.en.md",
    "content": "# Installing\n\nYou have to install `electron` into your command line environment.\n\nRun `npm install electron -g`\n\nIf you receive an EACCES error read this guide:\n\nhttps://docs.npmjs.com/getting-started/fixing-npm-permissions\n\nWhen you think you are done with this challenge, run `elementary-electron verify`\n"
  },
  {
    "path": "exercises/installing/problem.ja.md",
    "content": "# インストール\n\nまずは `electron` を、\nあなたのコマンドライン環境にインストールしてみましょう。\n\n`npm install electron -g` を実行してください。\n\nもし `EACCES` というエラーが表示された場合は、\nこちらのガイドを読んでみて下さい：\n\nhttps://docs.npmjs.com/getting-started/fixing-npm-permissions\n\n完了したら `elementary-electron verify` を実行してください。\n"
  },
  {
    "path": "exercises/installing/problem.ko.md",
    "content": "# electron 설치\n\n먼저 `electron`을 커맨드 라인 환경에 설치해 봅시다.\n\n`npm install electron -g`를 실행해주세요.\n\n만약 `EACCES`라는 에러가 발생한다면 다음 가이드를 읽어주세요.\n\nhttps://docs.npmjs.com/getting-started/fixing-npm-permissions\n\n위의 과정을 완료하셨다면 `elementary-electron verify`를 실행해주세요."
  },
  {
    "path": "exercises/save_pdf/exercise.js",
    "content": "var path = require('path')\nvar checkAll = require('../../lib/checkAll.js')\nvar fsCheck = require('../../lib/fsCheck.js')\n\nmodule.exports = function () {\n  var problem = {}\n  problem.requireSubmission = false\n  problem.problem = {file: path.join(__dirname, 'problem.{lang}.md')}\n\n  problem.verify = function (args, cb) {\n    checkAll([\n      fsCheck(path.join('.', 'annotation.pdf'))\n    ], '{{exercise.save_pdf.success}}', '{{exercise.save_pdf.success}}', cb)\n  }\n\n  return problem\n}\n"
  },
  {
    "path": "exercises/save_pdf/problem.en.md",
    "content": "# Save PDF\n\nLet's make it so when you hit the `P` key it will save a PDF of your annotations.\n\nRequire a couple extra modules in your `index.js`:\n\n```\nvar remote = require('electron').remote\nvar fs = require('fs')\n```\n\nThen define a function that will save the current window to a PDF.\n\n```\nfunction save () {\n  remote.getCurrentWebContents().printToPDF({\n    portrait: true\n  }, function (err, data) {\n    fs.writeFile('annotation.pdf', data, function (err) {\n      if (err) alert('error generating pdf! ' + err.message)\n      else alert('pdf saved!')\n    })\n  })  \n}\n```\n\nAnd finally set up an event listener that will call your `save()` function when you press `P`.\n\n```\nwindow.addEventListener('keydown', function (e) {\n  if (e.keyCode == 80) save()\n})\n```\n\nNow if you run your app and hit `P` it should save `annotation.pdf` into your project folder.\n\nWhen you think you are done with this challenge, run `elementary-electron verify`\n"
  },
  {
    "path": "exercises/save_pdf/problem.ja.md",
    "content": "# Save PDF\n\n最後に、`P` キーを押したら描画したポリゴンを PDF に保存する機能を追加しましょう。\n\nいくつかのモジュールを `index.js` 内で読み込みます:\n\n```\nvar remote = require('electron').remote\nvar fs = require('fs')\n```\n\n次に、現在のページを保存する function を作ります。\n\n```\nfunction save () {\n  remote.getCurrentWebContents().printToPDF({\n    portrait: true\n  }, function (err, data) {\n    fs.writeFile('annotation.pdf', data, function (err) {\n      if (err) alert('error generating pdf! ' + err.message)\n      else alert('pdf saved!')\n    })\n  })  \n}\n```\n\n最後に、`P` キーが押された際に `save()` が実行されるイベントリスナーを準備します。\n\n```\nwindow.addEventListener('keydown', function (e) {\n  if (e.keyCode == 80) save()\n})\n```\n\nこれで、`P` キーが押されたら `annotation.pdf` として現在のフォルダに保存されるようになりました。アプリを実行してみましょう。\n\nこの課題が完了したら　`elementary-electron verify` を実行してください。\n"
  },
  {
    "path": "exercises/save_pdf/problem.ko.md",
    "content": "# PDF 저장\n\n`P` 키를 누르면 이제까지 그린 다각형을 PDF로 저장하는 기능을 만들어 봅시다.\n\n`index.js`에서 모듈 몇 개를 읽어 들이세요.\n\n```\nvar remote = require('electron').remote\nvar fs = require('fs')\n```\n\n그리고 현재 창을 PDF로 저장하는 함수를 만드세요.\n\n```\nfunction save () {\n  remote.getCurrentWindow().webContents.printToPDF({\n    portrait: true\n  }, function (err, data) {\n    fs.writeFile('annotation.pdf', data, function (err) {\n      if (err) alert('error generating pdf! ' + err.message)\n      else alert('pdf saved!')\n    })\n  })  \n}\n```\n\n마지막으로 `P`를 누르면 방금 만든 `save()` 함수가 실행되도록, 이벤트 리스너에 등록하세요.\n\n```\nwindow.addEventListener('keydown', function (e) {\n  if (e.keyCode == 80) save()\n})\n```\n\n이제 앱을 실행해서 `P` 키를 누르면 현재 폴더에 `annotation.pdf`가 저장될 것입니다.\n\n\n위의 과정을 완료하셨다면 `elementary-electron verify`를 실행해주세요."
  },
  {
    "path": "i18n/en.json",
    "content": "{\n  \"ee\": {\n    \"success\": \"SUCCESS!\",\n    \"fail\": \"FAIL!\"\n  },\n  \"exercise\": {\n    \"cat_annotation\": {\n      \"success\": \"\",\n      \"fail\": \"Your app has some issues.\"\n    },\n    \"cat_picture\": {\n      \"success\": \"Your app folder looks good.\",\n      \"fail\": \"Your app folder is missing some things!\",\n      \"cant_read\": \"Can not access the file\",\n      \"invalid_html\": \"Not valid html\",\n      \"missing_script_tag\": \"Missing script tag\",\n      \"missing_body_tag\": \"Missing body tag\",\n      \"script_not_in_body\": \"Script not in body\"\n    },\n    \"hello_world\": {\n      \"success\": \"Your app looks good.\\n\\nWhen you type `electron app.js` it should start the Welcome to Electron application.\",\n      \"fail\": \"Your app has some issues.\"\n    },\n    \"installing\": {\n      \"success\": \"Found `electron` in your PATH.\",\n      \"fail\": \"Failed to find the command `electron` in your PATH.\"\n    },\n    \"save_pdf\": {\n      \"success\": \"You did it!\\n\\nFor more Electron ideas check out https://github.com/sindresorhus/awesome-electron\\nFor more workshops like this check out http://nodeschool.io\\n\",\n      \"fail\": \"Your app has some issues.\"\n    }\n  }\n}\n"
  },
  {
    "path": "i18n/ja.json",
    "content": "{\n  \"ee\": {\n    \"success\": \"成功！\",\n    \"fail\": \"失敗！\"\n  },\n  \"exercise\": {\n    \"cat_annotation\": {\n      \"success\": \"正しく描画されたようです。\",\n      \"fail\": \"何かがうまく行っていないようです。\"\n    },\n    \"cat_picture\": {\n      \"success\": \"あなたのアプリのフォルダ内は良い感じです。\",\n      \"fail\": \"あなたのアプリのフォルダ内は、何かが足りないようです！\",\n      \"cant_read\": \"ファイルのアクセスができないようです。\",\n      \"invalid_html\": \"html ファイルが正しくないようです。\",\n      \"missing_script_tag\": \"script タグが抜けているようです。\",\n      \"missing_body_tag\": \"body タグが抜けているようです。\",\n      \"script_not_in_body\": \"script タグが body タグの中にないようです。\"\n    },\n    \"hello_world\": {\n      \"success\": \"あなたのアプリは正しく動作しているようです。\\n\\n`electron app.js` を実行すると Electron アプリケーションの世界に入ることができるでしょう。\",\n      \"fail\": \"あなたのアプリは正しく動作していないようです。\"\n    },\n    \"installing\": {\n      \"success\": \"`electron` コマンドが、あなたの PATH に追加されました！\",\n      \"fail\": \"`electron` コマンドが、あなたの PATH に追加されていないようです。\"\n    },\n    \"save_pdf\": {\n      \"success\": \"完成したようですね！\\n\\nもっと Electron に関するアイデアを見たい方はこちらを確認してみてください: https://github.com/sindresorhus/awesome-electron\\n他のワークショップを見たい方はこちらへ: http://nodeschool.io\\n\",\n      \"fail\": \"何かがうまく行っていないようです。\"\n    }\n  }\n}\n"
  },
  {
    "path": "i18n/ko.json",
    "content": "{\n  \"ee\": {\n    \"success\": \"성공!\",\n    \"fail\": \"실패!\"\n  },\n  \"exercise\": {\n    \"cat_annotation\": {\n      \"success\": \"성공적입니다.\",\n      \"fail\": \"뭔가 문제가 있습니다.\"\n    },\n    \"cat_picture\": {\n      \"success\": \"현재 앱 폴더와 폴더 내의 파일들이 정상적입니다.\",\n      \"fail\": \"현재 앱 폴더는 뭔가가 부족합니다.\",\n      \"cant_read\": \"파일에 접근할 수 없습니다.\",\n      \"invalid_html\": \"html 파일에 문제가 있습니다.\",\n      \"missing_script_tag\": \"script 태그를 찾을 수 없습니다.\",\n      \"missing_body_tag\": \"body 태그를 찾을 수 없습니다.\",\n      \"script_not_in_body\": \"script 태그가 body 태그 내에 존재하지 않습니다.\"\n    },\n    \"hello_world\": {\n      \"success\": \"앱이 정상입니다.\\n\\n`electron app.js`를 실행하면 Electron 세계로부터의 환영 메시지가 출력될 것입니다.\",\n      \"fail\": \"앱에 문제가 있습니다.\"\n    },\n    \"installing\": {\n      \"success\": \"`electron` 명령어가 PATH에 추가되었습니다.\",\n      \"fail\": \"`electron` 명령어가 PATH에 추가되어있지 않습니다.\"\n    },\n    \"save_pdf\": {\n      \"success\": \"잘하셨어요!\\n\\nElectron에 관해 더 알고 싶으신 분은 여길 참조하세요. https://github.com/sindresorhus/awesome-electron\\n다른 워크숍에 관한 정보는 여길 참조하세요. http://nodeschool.io\\n\",\n      \"fail\": \"앱에 문제가 있습니다.\"\n    }\n  }\n}\n"
  },
  {
    "path": "index.js",
    "content": "#!/usr/bin/env node\n\nvar elementaryElectron = require('workshopper-adventure')({\n  appDir: __dirname,\n  languages: ['en', 'ja', 'ko']\n})\n\nelementaryElectron.addAll([\n  'Installing',\n  'Hello World',\n  'Cat Picture',\n  'Cat Annotation',\n  'Save PDF'\n])\n\nmodule.exports = elementaryElectron\n"
  },
  {
    "path": "lib/checkAll.js",
    "content": "var chalk = require('chalk')\n\nmodule.exports = function (checks, success, error, cb) {\n  var messages = ['Checking Requirements:']\n  var total = checks.length\n  var ok = 0\n  messages.push('')\n  for (var i = 0; i < checks.length; i++) {\n    var check = checks[i]\n    ok += check(messages)\n  }\n  messages.push('')\n  if (ok === total) {\n    messages.push(chalk.green('{{ee.success}}') + '\\n\\n' + success)\n  } else {\n    messages.push(chalk.red('{{ee.fail}}') + '\\n\\n' + error)\n  }\n  messages.push('')\n  cb(null, ok === total, messages.join('\\n'))\n}\n"
  },
  {
    "path": "lib/fsCheck.js",
    "content": "var chalk = require('chalk')\nvar path = require('path')\nvar fs = require('fs')\n\nmodule.exports = function appendFileCheck (file) {\n  return function (messages) {\n    try {\n      fs.statSync(path.join(process.cwd(), file))\n    } catch (err) {\n      messages.push('  - ' + chalk.red(file) + ' [?]')\n      return 0\n    }\n    messages.push('  - ' + chalk.green(file) + ' ✔')\n    return 1\n  }\n}\n"
  },
  {
    "path": "lib/pkgDependencyCheck.js",
    "content": "var chalk = require('chalk')\nvar path = require('path')\n\nmodule.exports = function appendDependencyCheck (pkgName) {\n  return function (messages) {\n    try {\n      var pkg = require(path.join(process.cwd(), 'package.json'))\n    } catch (e) {\n      messages.push(chalk.red('  - No package.json!!!'))\n      return 0\n    }\n    if (Object.keys(pkg.dependencies).indexOf(pkgName) === -1) {\n      messages.push('  - Dependency in package.json: ' + chalk.red(pkgName) + ' [?]')\n      return 0\n    }\n    messages.push('  - Dependency in package.json: ' + chalk.green(pkgName) + ' ✔')\n    return 1\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"elementary-electron\",\n  \"version\": \"1.5.2\",\n  \"description\": \"nodeschool workshop to learn electron\",\n  \"main\": \"index.js\",\n  \"bin\": {\n    \"elementary-electron\": \"bin/elementary-electron\"\n  },\n  \"scripts\": {\n    \"test\": \"standard\"\n  },\n  \"keywords\": [\n    \"nodeschool\",\n    \"workshopper\",\n    \"adventure\",\n    \"tutorial\",\n    \"electron\"\n  ],\n  \"contributors\": [\n    \"Max Ogden (https://github.com/maxogden)\",\n    \"freeman-lab (https://github.com/freeman-lab)\"\n  ],\n  \"author\": \"Max Ogden\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"chalk\": \"^1.1.1\",\n    \"cheerio\": \"^0.20.0\",\n    \"which\": \"^1.2.4\",\n    \"workshopper-adventure\": \"^5.1.8\"\n  },\n  \"devDependencies\": {\n    \"standard\": \"^8.0.0\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/maxogden/elementary-electron.git\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/maxogden/elementary-electron/issues\"\n  },\n  \"homepage\": \"https://github.com/maxogden/elementary-electron#readme\"\n}\n"
  },
  {
    "path": "readme.md",
    "content": "# Elementary Electron\n\nA nodeschool workshop that teaches electron.\n\nPlease open issues to propose new exercises if you have some cool ideas.\n\nRun `npm install elementary-electron -g`, and then `elementary-electron` to start.\n\n![](cool-app.png)\n"
  }
]