@@ -35,15 +35,16 @@ This makes sense, as we haven't gotten it from anywhere yet! Luckily for us,
3535used like this:
3636
3737~~~ {.notrust}
38- $ rustpkg install fragment
38+ $ rustpkg install pkg_id
3939~~~
4040
41- This will install a package named 'fragment' into your current Rust
42- environment. I called it 'fragment' in this example because when using it with
43- an external package like this, it's often a URI fragment. You see, Rust has no
44- central authority for packages. You can build your own ` hello ` library if you
45- want, and that's fine. We'd both host them in different places and different
46- projects would rely on whichever version they preferred.
41+ This will install a package named 'pkg_id' into your current Rust environment.
42+ I called it 'pkg_id' in this example because ` rustpkg ` calls this a 'package
43+ identifier.' When using it with an external package like this, it's often a
44+ URI fragment. You see, Rust has no central authority for packages. You can
45+ build your own ` hello ` library if you want, and that's fine. We'd both host
46+ them in different places and different projects would rely on whichever version
47+ they preferred.
4748
4849To install the ` hello ` library, simply run this in your terminal:
4950
@@ -71,10 +72,10 @@ Simple! That's all it takes.
7172
7273Before we can talk about how to make packages of your own, you have to
7374understand the big concept with ` rustpkg ` : workspaces. A 'workspace' is simply
74- a directory that has certain folders that ` rustpkg ` expects. Different Rust
75- projects will go into different workspaces.
75+ a directory that has certain sub-directories that ` rustpkg ` expects. Different
76+ Rust projects will go into different workspaces.
7677
77- A workspace consists of any folder that has the following
78+ A workspace consists of any directory that has the following
7879directories:
7980
8081* ` src ` : The directory where all the source code goes.
@@ -94,11 +95,11 @@ to wherever you keep your personal projects, and let's make all of the
9495directories we'll need. I'll refer to this personal project directory as
9596` ~/src ` for the rest of this tutorial.
9697
97- ### Creating neccesary files
98+ ### Creating our workspace
9899
99100~~~ {.notrust}
100101$ cd ~/src
101- $ mkdir -p hello/{ src/hello,build,lib,bin}
102+ $ mkdir -p hello/src/hello
102103$ cd hello
103104~~~
104105
@@ -125,28 +126,22 @@ $ git commit -am "Initial commit."
125126~~~
126127
127128If you're not familliar with the ` cat > ` idiom, it will make files with the
128- text you type insie . Control-D (` ^D ` ) ends the text for the file.
129+ text you type inside . Control-D (` ^D ` ) ends the text for the file.
129130
130131Anyway, we've got a README and a ` .gitignore ` . Let's talk about that
131132` .gitignore ` for a minute: we are ignoring two directories, ` build ` and
132133` .rust ` . ` build ` , as we discussed earlier, is for build artifacts, and we don't
133- want to check those into a repository. ` .rust ` is a folder that ` rustpkg ` uses
134- to keep track of its own settings, as well as the source code of any other
134+ want to check those into a repository. ` .rust ` is a directory that ` rustpkg `
135+ uses to keep track of its own settings, as well as the source code of any other
135136external packages that this workspace uses. This is where that `rustpkg
136137install` puts all of its files. Those are also not to go into our repository,
137138so we ignore it all as well.
138139
139140Next, let's add a source file:
140141
141142~~~
142- #[link(name = "hello",
143- vers = "0.1.0",
144- uuid = "0028fbe0-1f1f-11e3-8224-0800200c9a66",
145- url = "https://github.com/YOUR_USERNAME/hello")];
146-
147143#[desc = "A hello world Rust package."];
148144#[license = "MIT"];
149- #[crate_type = "lib"];
150145
151146pub fn world() {
152147 println("Hello, world.");
@@ -157,28 +152,12 @@ Put this into `src/hello/lib.rs`. Let's talk about each of these attributes:
157152
158153### Crate attributes for packages
159154
160- ` crate_type ` is the simplest: we're building a library here, so we set it to
161- ` "lib" ` . If we were making an executable of some kind, we'd set this to ` "bin" `
162- instead.
163-
164155` license ` is equally simple: the license we want this code to have. I chose MIT
165156here, but you should pick whatever license makes the most sense for you.
166157
167158` desc ` is a description of the package and what it does. This should just be a
168159sentence or two.
169160
170- ` link ` is the big complex attribute here. It's still not too complex: ` name ` is
171- the name of the package, and ` vers ` is the version. If you're building a
172- library, consider using [ Semantic Versioning] ( http://semver.org/ ) as your
173- versioning scheme. Future versions of ` rustpkg ` will assume SemVer.
174-
175- ` uuid ` is simply a unique identifier. You can generate a UUID by visiting [ this
176- page] ( http://www.famkruithof.net/uuid/uuidgen ) . Just copy whatever it puts out
177- into the value for ` uuid ` . For more on UUIDs, see
178- [ RFC4122] ( http://www.ietf.org/rfc/rfc4122.txt ) .
179-
180- Finally, ` url ` is a URL where this package is located. Easy.
181-
182161### Building your package
183162
184163Building your package is simple:
0 commit comments