occam-open-cli 5.0.126 → 5.0.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -28
- package/bin/operation/cloneReleases.js +10 -6
- package/bin/operation/openReleases.js +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,22 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
[Occam](https://github.com/djalbat/occam)'s c**o**mmand line **p**ackag**e** manageme**n**t tool.
|
|
4
4
|
|
|
5
|
+
*This readme file is mostly for developers. For instructions tailored to end users, see the following:*
|
|
6
|
+
|
|
7
|
+
https://openmathematics.org/how-to-contribute
|
|
8
|
+
|
|
5
9
|
### Contents
|
|
6
10
|
|
|
7
|
-
- [Introduction](#introduction)
|
|
8
11
|
- [Installation](#installation)
|
|
9
12
|
- [Usage](#usage)
|
|
10
13
|
- [Building](#building)
|
|
11
14
|
- [Contact](#contact)
|
|
12
15
|
|
|
13
|
-
## Introduction
|
|
14
|
-
|
|
15
|
-
The `open` command line tool provides similar functionality to [`npm`](https://www.npmjs.com/), but for[Occam packages. Published packages appear on the [Open Mathematics](https://openmathematics.org) website and can be utilised in Occam.
|
|
16
|
-
|
|
17
16
|
## Installation
|
|
18
17
|
|
|
19
|
-
If you are an end user, you can install `open` via `npm`. Instructions for doing so, together with other relevant information, can be found in the 'How to contribute' section on the front page of the aforementioned Open Mathematics website.
|
|
20
|
-
|
|
21
18
|
If you would like to contribute or would simply like to have a look at the code, you can clone the repository with [Git](https://git-scm.com/)...
|
|
22
19
|
|
|
23
20
|
git clone https://github.com/djalbat/occam-open-cli.git
|
|
@@ -72,27 +69,7 @@ Options:
|
|
|
72
69
|
--yes|-y Initially answer yes to prompts
|
|
73
70
|
```
|
|
74
71
|
|
|
75
|
-
This is slightly different from `npm` in that `open` is usually executed from the parent directory of a project rather than from within the project sub-directory itself.
|
|
76
|
-
|
|
77
|
-
open initialise
|
|
78
|
-
|
|
79
|
-
This will create a hidden `.openrc` file which you should never share. The reason is that if you log in to or register with the Open Mathematics site, your access token will be stored in this hidden file.
|
|
80
|
-
|
|
81
|
-
If you wish to publish the `induction` package, say, assuming that you have a sub-directory called `induction` for that package, run the following:
|
|
82
|
-
|
|
83
|
-
open publish induction
|
|
84
|
-
|
|
85
|
-
Actually you can in fact get away with publishing from within projects' sub-directories by running `open publish` in them, in which cases `open` will go up one directory in order to find the `.openrc` file and figure out the package name for itself.
|
|
86
|
-
|
|
87
|
-
Bear in mind that Occam does not as yet directly support packages. Therefore for now it is best to clone them, which you can again do with `open`. For example:
|
|
88
|
-
|
|
89
|
-
open clone natural-numbers
|
|
90
|
-
|
|
91
|
-
In these cases `open` will recover the underlying GitHub repository from the package's meta-data and clone the repository for you. If you just wanted the bare package and not the repository, the following would suffice:
|
|
92
|
-
|
|
93
|
-
open natural-numbers
|
|
94
|
-
|
|
95
|
-
Both Occam and the Open Mathematics site are works in progress, as indeed is `open`. The remainder of this readme file gives some of the current thinking on versioning and so forth that has yet to be implemented.
|
|
72
|
+
This is slightly different from `npm` in that `open` is usually executed from the parent directory of a project rather than from within the project sub-directory itself.
|
|
96
73
|
|
|
97
74
|
## Building
|
|
98
75
|
|
|
@@ -31,13 +31,11 @@ function cloneReleasePromptOperation(release, next, done, context, index) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const { name } = release,
|
|
34
|
+
const { name, quietly } = release,
|
|
35
35
|
entryPath = name, ///
|
|
36
36
|
entryExists = checkEntryExists(entryPath);
|
|
37
37
|
|
|
38
38
|
if (entryExists) {
|
|
39
|
-
const { quietly } = context;
|
|
40
|
-
|
|
41
39
|
if (!quietly) {
|
|
42
40
|
console.log(`Cannot clone the '${name}' package because a directory of that name already exists.`);
|
|
43
41
|
}
|
|
@@ -49,10 +47,10 @@ function cloneReleasePromptOperation(release, next, done, context, index) {
|
|
|
49
47
|
|
|
50
48
|
done = next; ///
|
|
51
49
|
|
|
52
|
-
cloneRelease(release, done);
|
|
50
|
+
cloneRelease(release, quietly, done);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
function cloneRelease(release, done) {
|
|
53
|
+
function cloneRelease(release, quietly, done) {
|
|
56
54
|
let repository = repositoryFromRelease(release)
|
|
57
55
|
|
|
58
56
|
const options = getOptions(),
|
|
@@ -71,6 +69,12 @@ function cloneRelease(release, done) {
|
|
|
71
69
|
console.log(error);
|
|
72
70
|
}
|
|
73
71
|
|
|
72
|
+
if (!quietly) {
|
|
73
|
+
const { name } = release;
|
|
74
|
+
|
|
75
|
+
console.log(name);
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
done();
|
|
75
79
|
});
|
|
76
80
|
}
|
|
@@ -85,4 +89,4 @@ function repositoryFromRelease(release) {
|
|
|
85
89
|
const repository = entries.getRepository();
|
|
86
90
|
|
|
87
91
|
return repository;
|
|
88
|
-
}
|
|
92
|
+
}
|
|
@@ -22,12 +22,12 @@ function openReleasesOperation(proceed, abort, context) {
|
|
|
22
22
|
module.exports = openReleasesOperation;
|
|
23
23
|
|
|
24
24
|
function openReleasePromptOperation(release, next, done, context) {
|
|
25
|
-
const { name } = release,
|
|
25
|
+
const { name, quietly } = release,
|
|
26
26
|
entryPath = name, ///
|
|
27
27
|
entryExists = checkEntryExists(entryPath);
|
|
28
28
|
|
|
29
29
|
if (!entryExists) {
|
|
30
|
-
openRelease(release);
|
|
30
|
+
openRelease(release, quietly);
|
|
31
31
|
|
|
32
32
|
next();
|
|
33
33
|
|
|
@@ -37,8 +37,6 @@ function openReleasePromptOperation(release, next, done, context) {
|
|
|
37
37
|
const entryDirectory = isEntryDirectory(entryPath);
|
|
38
38
|
|
|
39
39
|
if (entryDirectory) {
|
|
40
|
-
const { quietly } = context;
|
|
41
|
-
|
|
42
40
|
if (!quietly) {
|
|
43
41
|
console.log(`Cannot open the '${name}' package because a directory of that name already exists.`);
|
|
44
42
|
}
|
|
@@ -71,7 +69,7 @@ function openReleasePromptOperation(release, next, done, context) {
|
|
|
71
69
|
if (affirmative) {
|
|
72
70
|
removeEntry(entryPath);
|
|
73
71
|
|
|
74
|
-
openRelease(release);
|
|
72
|
+
openRelease(release, quietly);
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
next();
|
|
@@ -79,7 +77,7 @@ function openReleasePromptOperation(release, next, done, context) {
|
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
function openRelease(release) {
|
|
80
|
+
function openRelease(release, quietly) {
|
|
83
81
|
const { name } = release,
|
|
84
82
|
filePath = name, ///
|
|
85
83
|
releaseJSON = release, ///
|
|
@@ -87,4 +85,8 @@ function openRelease(release) {
|
|
|
87
85
|
content = releaseJSONString; ///
|
|
88
86
|
|
|
89
87
|
writeFile(filePath, content);
|
|
88
|
+
|
|
89
|
+
if (!quietly) {
|
|
90
|
+
console.log(name);
|
|
91
|
+
}
|
|
90
92
|
}
|
package/package.json
CHANGED