Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: src/site/docs/pub-package-manager/index.markdown

Issue 10700168: massive CL is massive (Closed) Base URL: https://code.google.com/p/dartlang-site/@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/site/docs/library-tour/index.markdown ('k') | src/site/docs/sdk/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 --- 1 ---
2 layout: default 2 layout: default
3 title: "pub: The Dart Package Manager" 3 title: "pub: The Dart Package Manager"
4 description: "With pub, you can use third-party Dart libraries in 4 description: "With pub, you can use third-party Dart libraries in
5 your web and command-line Dart apps." 5 your web and command-line Dart apps."
6 --- 6 ---
7 7
8 # {{ page.title }} 8 # {{ page.title }}
9 9
10 <aside class="note"> 10 <aside>
11 <b>Note:</b> pub is under active development, so expect 11 <div class="alert alert-info">
12 some changes to the functionality of the tool and these docs. 12 <strong>Note:</strong>
13 Pub is under active development, so expect
14 some changes to the functionality of the tool and these docs.
15 </div>
13 </aside> 16 </aside>
14 17
15 This page tells you how to use the _pub_ tool (`bin/pub`) 18 This page tells you how to use the _pub_ tool (`bin/pub`)
16 to manage Dart packages. A Dart package is simply 19 to manage Dart packages. A Dart package is simply
17 a directory containing any number of Dart libraries and their dependencies. 20 a directory containing any number of Dart libraries and their dependencies.
18 21
19 The `bin/pub` executable is in the [Dart SDK](/docs/sdk/). 22 The `bin/pub` executable is in the [Dart SDK](/docs/sdk/).
20 You can either [download the SDK separately](/docs/sdk/#download) 23 You can either [download the SDK separately](/docs/sdk/#download)
21 or get it as part of the [Dart Editor package](/docs/editor/#download). 24 or get it as part of the [Dart Editor package](/docs/editor/#download).
22 25
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 This command creates a _packages_ directory inside the current directory, 58 This command creates a _packages_ directory inside the current directory,
56 cloning the git repositories into the packages directory. 59 cloning the git repositories into the packages directory.
57 60
58 The packages directory also contains any _transitive 61 The packages directory also contains any _transitive
59 dependencies_. 62 dependencies_.
60 For example, if the `awesome` package is dependent on the `sweet` package, 63 For example, if the `awesome` package is dependent on the `sweet` package,
61 the pub tool will also download and install the `sweet` package. 64 the pub tool will also download and install the `sweet` package.
62 65
63 ## Using libraries from the SDK 66 ## Using libraries from the SDK
64 67
65 <aside class="note"> 68 <aside>
66 <b>Note:</b> The functionality described in this section is temporary. 69 <div class="alert alert-info">
67 It's possible that some libraries 70 <strong>Note:</strong>
68 that currently ship in the SDK will be pulled out of the SDK and installable 71 The functionality described in this section is temporary.
69 directly from pub. 72 It's possible that some libraries
73 that currently ship in the SDK will be pulled out of the SDK and installable
74 directly from pub.
75 </div>
70 </aside> 76 </aside>
71 77
72 Not all libraries that ship with the SDK are available in the `dart:` 78 Not all libraries that ship with the SDK are available in the `dart:`
73 namespace. To use those libraries (for example, unittest) in your app, 79 namespace. To use those libraries (for example, unittest) in your app,
74 add an `sdk` source to your `pubspec.yaml` file. For example: 80 add an `sdk` source to your `pubspec.yaml` file. For example:
75 81
76 {% highlight yaml %} 82 {% highlight yaml %}
77 dependencies: 83 dependencies:
78 unittest: 84 unittest:
79 sdk: unittest 85 sdk: unittest
(...skipping 16 matching lines...) Expand all
96 and the Dart VM. 102 and the Dart VM.
97 103
98 If you use the `pub install` command, the packages directory is created 104 If you use the `pub install` command, the packages directory is created
99 for you next to the pubspec.yaml file. 105 for you next to the pubspec.yaml file.
100 106
101 ### Mapping packages for the Dart Editor 107 ### Mapping packages for the Dart Editor
102 108
103 To help the Dart Editor understand how to find packages, go to Preferences 109 To help the Dart Editor understand how to find packages, go to Preferences
104 and point the "Package directory" to `/path/to/your/app/packages`. 110 and point the "Package directory" to `/path/to/your/app/packages`.
105 111
106 <aside class="note"> 112 <aside>
107 <b>Note:</b> In the future, you'll be able to configure the packages 113 <div class="alert alert-info">
108 mapping per project, instead of globally. 114 <strong>Note:</strong>
115 In the future, you'll be able to configure the packages
116 mapping per project, instead of globally.
117 </div>
109 </aside> 118 </aside>
110 119
111 ### Mapping packages for the Dart VM 120 ### Mapping packages for the Dart VM
112 121
113 For command-line Dart applications that use packages, use the 122 For command-line Dart applications that use packages, use the
114 `--package-root` option to specify the packages location. 123 `--package-root` option to specify the packages location.
115 124
116 For example: 125 For example:
117 126
118 {% highlight bash %} 127 {% highlight bash %}
119 $DART_SDK/bin/dart --package-root=./packages/ app.dart 128 $DART_SDK/bin/dart --package-root=./packages/ app.dart
120 {% endhighlight %} 129 {% endhighlight %}
121 130
122 Note the required trailing slash when specifying the `./packages/` directory. 131 Note the required trailing slash when specifying the `./packages/` directory.
123 132
124 ## Importing libraries from packages 133 ## Importing libraries from packages
125 134
126 To import libraries found in packages, use the `package:` prefix. 135 To import libraries found in packages, use the `package:` prefix.
127 136
128 {% highlight dart %} 137 {% highlight dart %}
129 #import('package:awesome/awesome.dart'); 138 #import('package:awesome/awesome.dart');
130 {% endhighlight %} 139 {% endhighlight %}
131 140
132 ## Additional options 141 ## Additional options
133 142
134 Run `$DART_SDK/bin/pub --help` for a list of commands. 143 Run `$DART_SDK/bin/pub --help` for a list of commands.
135 144
136 145
OLDNEW
« no previous file with comments | « src/site/docs/library-tour/index.markdown ('k') | src/site/docs/sdk/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698