Skip to content

Commit

Permalink
Merge pull request #21 from drashland/issue-#3-update-tests
Browse files Browse the repository at this point in the history
Issue #3 update tests
  • Loading branch information
ebebbington authored Jun 30, 2020
2 parents 068206b + 5837bf3 commit a18155d
Show file tree
Hide file tree
Showing 11 changed files with 555 additions and 108 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
deno: ["1.1.0"]
os: [ubuntu-latest, macos-latest, windows-latest]
deno: ["1.1.1"]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Unit
run: |
deno cache mod.ts
deno test --allow-read --allow-run --allow-net
deno test --allow-read --allow-run --allow-write --allow-net
linting:
strategy:
matrix:
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ As dmm only needs to read and write to your `deps.ts`, as well as requiring netw

*Install*
```
$ deno install --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts
$ deno install --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts
$ dmm ...
```

*Through the URL*

If you are using this method, be sure to use the latest version of dmm in the command below
```
$ deno run <permissions> https://deno.land/x/dmm@v1.1.0/mod.ts ...
$ deno run <permissions> https://deno.land/x/dmm@v1.1.1/mod.ts ...
```

In the examples below, dmm is installed and we will be using it that way to make the commands easier to read.
Expand All @@ -78,10 +78,10 @@ Information on fmt
- Name: fmt
- Description: Cannot retrieve descriptions for std modules
- deno.land Link: https://deno.land/std@0.57.0/fmt
- deno.land Link: https://deno.land/std@0.58.0/fmt
- GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt
- Import Statement: import * as fmt from "https://deno.land/std@0.57.0/fmt";
- Latest Version: 0.57.0
- Import Statement: import * as fmt from "https://deno.land/std@0.58.0/fmt";
- Latest Version: 0.58.0
```

Expand All @@ -94,7 +94,7 @@ export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date

import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date

import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date
import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts"; // up to date

export { fs, colors }
```
Expand All @@ -109,7 +109,7 @@ Now we want to check if any of our dependencies need updating, but we don't want
$ dmm check
...
drash can be updated from v1.0.0 to v1.0.5
fs can be updated from 0.53.0 to 0.57.0
fs can be updated from 0.53.0 to 0.58.0
...
```

Expand All @@ -121,7 +121,7 @@ Lets update our dependencies as some are out of date:
$ dmm update
...
drash was updated from v1.0.0 to v1.0.5
fs was updated from 0.53.0 to 0.57.0
fs was updated from 0.53.0 to 0.58.0
...
```

Expand All @@ -130,9 +130,9 @@ Now lets check the `deps.ts` file, and you will notice the versions have been mo
```typescript
export { Drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // was out of date

import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // was out of date
import * as fs from "https://deno.land/std@0.58.0/fs/mod.ts"; // was out of date

import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts";
import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts";

export { fs, colors }
```
Expand All @@ -147,7 +147,7 @@ $ dmm --help
A module manager for Deno.
USAGE:
deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES]
deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES]
dmm [ARGS] [MODULES]
Expand All @@ -171,9 +171,9 @@ OPTIONS:
EXAMPLE USAGE:
Assume you are importing an out of date version of `fs` from `std`.
deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs
deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs
deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http
deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs
deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs
deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http
dmm info http
```
Expand Down
15 changes: 11 additions & 4 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ export async function update(dependencies: string[]): Promise<void> {
if (module.importedVersion === module.latestRelease) {
return;
}
depsContent = depsContent.replace(
"std@" + module.importedVersion + "/" + module.name,
"std@" + module.latestRelease + "/" + module.name,
);
if (module.std) {
depsContent = depsContent.replace(
"std@" + module.importedVersion + "/" + module.name,
"std@" + module.latestRelease + "/" + module.name,
);
} else {
depsContent = depsContent.replace(
module.name + "@" + module.importedVersion,
module.name + "@" + module.latestRelease,
);
}
console.info(
colours.green(
module.name + " was updated from " + module.importedVersion + " to " +
Expand Down
8 changes: 4 additions & 4 deletions src/options/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const helpMessage: string = "\n" +
"\n" +
"USAGE:" +
"\n" +
" deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES]" +
" deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES]" +
"\n" +
"\n" +
" dmm [ARGS] [MODULES]" +
Expand Down Expand Up @@ -45,11 +45,11 @@ export const helpMessage: string = "\n" +
"\n" +
" Assume you are importing an out of date version of `fs` from `std`." +
"\n" +
" deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs" +
" deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs" +
"\n" +
" deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs" +
" deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs" +
"\n" +
" deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http" +
" deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http" +
"\n" +
" dmm info http" +
"\n";
2 changes: 1 addition & 1 deletion src/options/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const version = "1.1.0";
const version = "1.1.1";
export const versionMessage = `dmm ${version}`;
8 changes: 4 additions & 4 deletions tests/help_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Deno.test({
"A module manager for Deno.\n" +
"\n" +
"USAGE:\n" +
" deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES]\n" +
" deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES]\n" +
"\n" +
" dmm [ARGS] [MODULES]\n" +
"\n" +
Expand Down Expand Up @@ -51,9 +51,9 @@ Deno.test({
"\n" +
"EXAMPLE USAGE:\n" +
" Assume you are importing an out of date version of `fs` from `std`.\n" +
" deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs\n" +
" deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs\n" +
" deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http\n" +
" deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs\n" +
" deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs\n" +
" deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http\n" +
" dmm info http\n" +
"\n",
);
Expand Down
2 changes: 0 additions & 2 deletions tests/out-of-date-deps/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date

import * as colors from "https://deno.land/std@v0.53.0/fmt/colors.ts"; // out to date

import { Drash as drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date

export { Drash, fs, colors };
7 changes: 7 additions & 0 deletions tests/out-of-date-deps/original_deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date

import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date

import * as colors from "https://deno.land/std@v0.53.0/fmt/colors.ts"; // out to date

export { Drash, fs, colors };
6 changes: 2 additions & 4 deletions tests/up-to-date-deps/deps.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date

import * as fs from "https://deno.land/std@0.58.0/fs/mod.ts"; // up to date
import * as fs from "https://deno.land/std@0.59.0/fs/mod.ts"; // up to date

import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts"; // up to date

import { Drash as drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date
import * as colors from "https://deno.land/std@0.59.0/fmt/colors.ts"; // up to date

export { Drash, fs, colors };
7 changes: 7 additions & 0 deletions tests/up-to-date-deps/original_deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date

import * as fs from "https://deno.land/std@0.59.0/fs/mod.ts"; // up to date

import * as colors from "https://deno.land/std@0.59.0/fmt/colors.ts"; // up to date

export { Drash, fs, colors };
Loading

0 comments on commit a18155d

Please sign in to comment.