{"__v":5,"_id":"551f404b6886f8230055f02f","category":{"__v":5,"_id":"54fa1d3fe7a0ba2f00306309","pages":["54fa1d54e7a0ba2f0030630c","54fa1d5de7a0ba2f0030630e","54fa1d65961fea210092064f","54fa1dcff63cf9210041c4c0","551f404b6886f8230055f02f"],"project":"54d53c7b23010a0d001aca0c","version":"54d5635532d98b0d00384afb","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-06T21:33:51.375Z","from_sync":false,"order":6,"slug":"runners-debuggers","title":"Runners & Debuggers"},"parentDoc":null,"project":"54d53c7b23010a0d001aca0c","user":"54cfa8e1a8a4fd0d00b7fd1d","version":{"__v":10,"_id":"54d5635532d98b0d00384afb","forked_from":"54d53c7c23010a0d001aca0f","project":"54d53c7b23010a0d001aca0c","createdAt":"2015-02-07T00:59:01.934Z","releaseDate":"2015-02-07T00:59:01.934Z","categories":["54d5635632d98b0d00384afc","54d5635632d98b0d00384afd","54d5635632d98b0d00384afe","54d5635632d98b0d00384aff","54d5635632d98b0d00384b00","54d5635632d98b0d00384b01","54d5635632d98b0d00384b02","54d652097e05890d006f153e","54dd1315ca1e5219007e9daa","54e21e2b22de1c230094b147","54e68e62a43fe13500db3879","54fa1d3fe7a0ba2f00306309","551c453a23a1ee190034d19a","551df586e52a0b23000c62b6","551f39be6886f8230055f02a","55a6720751457325000e4d97"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.1.0","version":"0.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-04T01:37:15.676Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Builders are small JSON files that describe how to build files of a certain type. When a user hits the `build` menu item in Cloud9 it will use the filename to determine which builder to choose and use that builder to build that file. Users can use the run menu to select a builder of choice to build the current file with. Optionally the user can choose to run builders automatically when saving a file.\n\n# Creating a New Builder\n\nYou'll want to include one or more builders in your package when you are adding support for a new runtime or pre-processor.\n\nCreate a new builder via the menu `Run / Build System / New Build System` or copy the following template.\n\n```\n{\n    \"cmd\": [\"ls\", \"$file\", \"$args\"],\n    \"env\": {},\n    \"selector\": \"source.ext\"\n}\n```\n\nThe `cmd` property takes an array of command line arguments and replaces any of the accepted variables to build a command that is executed through bash. The command is run with any environment variables set in `env`.\n\nThe `selector` property is a regular expression used by Cloud9 to identify the filenames that apply to that builder.\n\nThese are the supported variables.\n[block:html]\n{\n  \"html\": \"<table>\\n<tr><th>Variable</th><th>               Description</th></tr>\\n<tr><td>$file_path</td><td>           The directory of the current file, e.g. /home/ubuntu.</td></tr>\\n<tr><td>$file</td><td>                The full path to the current file, e.g. /home/ubuntu/server.js.</td></tr>\\n<tr><td>$args</td><td>                Any arguments entered after the file name.</td></tr>\\n<tr><td>$file_name</td><td>           The name portion of the current file, e.g. server.js.</td></tr>\\n<tr><td>$file_extension</td><td>      The extension portion of the current file, e.g. js.</td></tr>\\n<tr><td>$file_base_name</td><td>      The name only portion of the current file, e.g. server.</td></tr>\\n<tr><td>$packages</td><td>            The full path to the Packages folder.</td></tr>\\n<tr><td>$project</td><td>             The full path to the current project file.</td></tr>\\n<tr><td>$project_path</td><td>        The directory of the current project file.</td></tr>\\n<tr><td>$project_name</td><td>        The name portion of the current project file.</td></tr>\\n<tr><td>$project_extension</td><td>   The extension portion of the current project file.</td></tr>\\n<tr><td>$project_base_name</td><td>   The name only portion of the current project file.</td></tr>\\n<tr><td>$hostname</td><td>            The hostname of the workspace.</td></tr>\\n<tr><td>$hostname_path</td><td>       The hostname of the workspace together with the relative path of the project file.</td></tr>\\n<tr><td>$url</td><td>                 The full url to access the workspace.</td></tr>\\n<tr><td>$port</td><td>                The port assigned to the workspace.</td></tr>\\n<tr><td>$ip</td><td>                  The ip address to run a process against in the workspace.</td></tr>\\n</table>\"\n}\n[/block]\nThe following declarations can be used to add defaults or regexp\nreplacements to the these variables:\n\n    ${debug?--debug}\n\nThis will emit --debug if the debug option is set to true\n\n    ${project_name:Default}\n\nThis will emit the name of the current project if there is one, otherwise Default.\n\n    ${file/\\.php/\\.txt/}\n\nThis will emit the full path of the current file, replacing .php with .txt.\n\nPlease check out the [reference guide](https://docs.c9.io/api/#!/api/run-method-run) for more information on each of the properties that are accepted for builders.","excerpt":"","slug":"builders","type":"basic","title":"Builders"}
Builders are small JSON files that describe how to build files of a certain type. When a user hits the `build` menu item in Cloud9 it will use the filename to determine which builder to choose and use that builder to build that file. Users can use the run menu to select a builder of choice to build the current file with. Optionally the user can choose to run builders automatically when saving a file. # Creating a New Builder You'll want to include one or more builders in your package when you are adding support for a new runtime or pre-processor. Create a new builder via the menu `Run / Build System / New Build System` or copy the following template. ``` { "cmd": ["ls", "$file", "$args"], "env": {}, "selector": "source.ext" } ``` The `cmd` property takes an array of command line arguments and replaces any of the accepted variables to build a command that is executed through bash. The command is run with any environment variables set in `env`. The `selector` property is a regular expression used by Cloud9 to identify the filenames that apply to that builder. These are the supported variables. [block:html] { "html": "<table>\n<tr><th>Variable</th><th> Description</th></tr>\n<tr><td>$file_path</td><td> The directory of the current file, e.g. /home/ubuntu.</td></tr>\n<tr><td>$file</td><td> The full path to the current file, e.g. /home/ubuntu/server.js.</td></tr>\n<tr><td>$args</td><td> Any arguments entered after the file name.</td></tr>\n<tr><td>$file_name</td><td> The name portion of the current file, e.g. server.js.</td></tr>\n<tr><td>$file_extension</td><td> The extension portion of the current file, e.g. js.</td></tr>\n<tr><td>$file_base_name</td><td> The name only portion of the current file, e.g. server.</td></tr>\n<tr><td>$packages</td><td> The full path to the Packages folder.</td></tr>\n<tr><td>$project</td><td> The full path to the current project file.</td></tr>\n<tr><td>$project_path</td><td> The directory of the current project file.</td></tr>\n<tr><td>$project_name</td><td> The name portion of the current project file.</td></tr>\n<tr><td>$project_extension</td><td> The extension portion of the current project file.</td></tr>\n<tr><td>$project_base_name</td><td> The name only portion of the current project file.</td></tr>\n<tr><td>$hostname</td><td> The hostname of the workspace.</td></tr>\n<tr><td>$hostname_path</td><td> The hostname of the workspace together with the relative path of the project file.</td></tr>\n<tr><td>$url</td><td> The full url to access the workspace.</td></tr>\n<tr><td>$port</td><td> The port assigned to the workspace.</td></tr>\n<tr><td>$ip</td><td> The ip address to run a process against in the workspace.</td></tr>\n</table>" } [/block] The following declarations can be used to add defaults or regexp replacements to the these variables: ${debug?--debug} This will emit --debug if the debug option is set to true ${project_name:Default} This will emit the name of the current project if there is one, otherwise Default. ${file/\.php/\.txt/} This will emit the full path of the current file, replacing .php with .txt. Please check out the [reference guide](https://docs.c9.io/api/#!/api/run-method-run) for more information on each of the properties that are accepted for builders.