| OLD | NEW |
| 1 --- | 1 --- |
| 2 layout: default | 2 layout: default |
| 3 title: "Pub: Getting Started" | 3 title: "Pub: Getting Started" |
| 4 description: "How to get up and running with pub." | 4 description: "How to get up and running with pub." |
| 5 has-permalinks: true | 5 has-permalinks: true |
| 6 --- | 6 --- |
| 7 | 7 |
| 8 # {{ page.title }} | 8 # {{ page.title }} |
| 9 | 9 |
| 10 <!-- TODO(rnystrom): Link **terms** to glossary when that exists. --> | 10 <!-- TODO(rnystrom): Link **terms** to glossary when that exists. --> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 <!-- TODO(rnystrom): Enable this when that doc exists. | 78 <!-- TODO(rnystrom): Enable this when that doc exists. |
| 79 <a href="package-layout.html" style="text-align: right;"> | 79 <a href="package-layout.html" style="text-align: right;"> |
| 80 <i class="icon-hand-right icon-white"> </i> | 80 <i class="icon-hand-right icon-white"> </i> |
| 81 Learn more about packages | 81 Learn more about packages |
| 82 </a> | 82 </a> |
| 83 --> | 83 --> |
| 84 | 84 |
| 85 To turn your app into an application package so it can use other packages, you | 85 To turn your app into an application package so it can use other packages, you |
| 86 just need to give it a **pubspec**. This file is written using the | 86 just need to give it a **pubspec**. This file is written using the |
| 87 [YAML language](http://yaml.org) and is named `pubspec.yaml`. The simplest | 87 [YAML language](http://yaml.org) and is named `pubspec.yaml`. The simplest |
| 88 possible pubspec contains nothing, so just create an empty file and save it as | 88 possible pubspec just contains the name of the package. Save the pubspec file as |
| 89 `pubspec.yaml` in the root directory of your app. | 89 `pubspec.yaml` in the root directory of your app. |
| 90 | 90 |
| 91 $ cd path/to/your_app | 91 Behold, the most simple `pubspec.yaml`: |
| 92 $ touch pubspec.yaml | |
| 93 | 92 |
| 94 <aside class="alert alert-info"> | 93 {% highlight yaml %} |
| 95 If you're on Windows or don't rock the command line, just make an empty file | 94 name: my_app |
| 96 and save it as <tt>pubspec.yaml</tt> in the root directory of your app. | 95 {% endhighlight %} |
| 97 </aside> | |
| 98 | 96 |
| 99 Now `your_app` is a pub package! | 97 Now `my_app` is a pub package! |
| 100 | 98 |
| 101 <a href="pubspec.html"> | 99 <a href="pubspec.html"> |
| 102 <i class="icon-hand-right icon-white"> </i> | 100 <i class="icon-hand-right icon-white"> </i> |
| 103 Learn more about the pubspec format | 101 Learn more about the pubspec format |
| 104 </a> | 102 </a> |
| 105 | 103 |
| 106 ## Adding a dependency | 104 ## Adding a dependency |
| 107 | 105 |
| 108 One of pub's main jobs is managing **dependencies**. A dependency is just | 106 One of pub's main jobs is managing **dependencies**. A dependency is just |
| 109 another package that your package relies on. If your app is using some | 107 another package that your package relies on. If your app is using some |
| 110 templating framework called "handle_stache", then your app package will depend | 108 templating framework called "handle_stache", then your app package will depend |
| 111 on the `handle_stache` package. | 109 on the `handle_stache` package. |
| 112 | 110 |
| 113 <!-- TODO(rnystrom): Use a real package here when we have one. --> | 111 <!-- TODO(rnystrom): Use a real package here when we have one. --> |
| 114 | 112 |
| 115 You specify your package's dependencies in the pubspec, like so: | 113 You specify your package's dependencies in the pubspec file immediately after |
| 114 your package name. For example: |
| 116 | 115 |
| 117 {% highlight yaml %} | 116 {% highlight yaml %} |
| 117 name: my_app |
| 118 dependencies: | 118 dependencies: |
| 119 handle_stache: | 119 handle_stache: |
| 120 git: git://github.com/munificent/handle_stache.git | 120 git: git://github.com/munificent/handle_stache.git |
| 121 {% endhighlight %} | 121 {% endhighlight %} |
| 122 | 122 |
| 123 Here, we are declaring a dependency on some (fictional) `handle_stache` package | 123 Here, we are declaring a dependency on some (fictional) `handle_stache` package |
| 124 that we want to install from [Git](http://git-scm.com/) using the given URL. | 124 that we want to install from [Git](http://git-scm.com/) using the given URL. |
| 125 | 125 |
| 126 <!-- TODO(rnystrom): Use a pub.dartlang.org dep when that's live. --> | 126 <!-- TODO(rnystrom): Use a pub.dartlang.org dep when that's live. --> |
| 127 | 127 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 <aside class="alert alert-info"> | 229 <aside class="alert alert-info"> |
| 230 In the future, you'll be able to set this per project, instead of globally. | 230 In the future, you'll be able to set this per project, instead of globally. |
| 231 </aside> | 231 </aside> |
| 232 | 232 |
| 233 ## Learning more | 233 ## Learning more |
| 234 | 234 |
| 235 <a href="versioning.html"> | 235 <a href="versioning.html"> |
| 236 <i class="icon-hand-right icon-white"> </i> | 236 <i class="icon-hand-right icon-white"> </i> |
| 237 Learn more about pub's approach to versioning | 237 Learn more about pub's approach to versioning |
| 238 </a> | 238 </a> |
| OLD | NEW |