Skip to content

Commit

Permalink
Merge pull request #771 from nathanrboyer/patch-1
Browse files Browse the repository at this point in the history
Update cookbook.md
  • Loading branch information
pfitzseb authored Dec 8, 2023
2 parents b996346 + ad42eb8 commit d2d508d
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions docs/src/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,22 @@ Generating project MyPkg:
In the first few lines you can see the location of your new package, here
the directory `/home/tim/.julia/dev/MyPkg`.

Before doing anything else, let's try it out:
Press `]` to enter the [Pkg REPL](https://pkgdocs.julialang.org/v1/getting-started/#Basic-Usage).
Then add the new package to your current environment with the `dev` command.

```julia
(<environment>) pkg> dev MyPkg # the dev command will look in the ~/.julia/dev folder automatically
```

Press the backspace key to return to the Julia REPL.

Now let's try it out:

```julia
julia> using Revise # you must do this before loading any revisable packages

julia> using MyPkg
[ Info: Precompiling MyPkg [102b5b08-597c-4d40-b98a-e9249f4d01f4]

julia> MyPkg.greet()
Hello World!
```
(It's perfectly fine if you see a different string of digits and letters after the "Precompiling MyPkg" message.)
Expand All @@ -99,28 +105,28 @@ You should see something like this:
```julia
module MyPkg

greet() = print("Hello World!")
# Write your package code here.

end # module
end
```
This is the basic package created by PkgTemplates. Let's modify `greet` to return
a different message:
This is the basic package created by PkgTemplates.
Let's create a simple `greet` function to return a message:
```julia
module MyPkg

greet() = print("Hello, revised World!")
greet() = print("Hello World!")

end # module
```
Now go back to that same Julia session, and try calling `greet` again.
Now go back to that same Julia session, and try calling `greet`.
After a pause (while Revise's internal code compiles), you should see
```julia
julia> MyPkg.greet()
Hello, revised World!
Hello World!
```
From this point forward, revisions should be fast. You can modify `MyPkg.jl`
Expand All @@ -136,7 +142,7 @@ above, you might first have to delete the package with `Pkg.rm("MyPkg")` followi
a complete removal from your `dev` directory.)
```julia
julia> using Pkg
julia> using Revise, Pkg

julia> cd(Pkg.devdir()) # take us to the standard "development directory"

Expand Down

0 comments on commit d2d508d

Please sign in to comment.