didgood 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +47 -5
- data/lib/didgood.rb +14 -16
- data/lib/didgood/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52b48699d65d87fddc805c6f80857546c5fb09fc9b6707140b28dd71b70d637f
|
4
|
+
data.tar.gz: 570e8f325a14587968a1fda5dd660fe9e4781b2326f614c12697fd696c37cf59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 554dce72220b582911f37c948e0f93429e75872a73b11366d7975237e13de56b6a3e6d04e97eab9ff23e0724464308fe5f69af1b04f64a7789227c9b262ae6ee
|
7
|
+
data.tar.gz: e7ab49d442c7a929ad9983a5f1a277887d2527234f96b0f861593621ce0066429669d1ec9520a77b9a18382976f8cd16d3921e0f661763ccdac78bc035ae2a45
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,22 +22,64 @@ If you have a DGD application that uses didgood, run `didgood install` to downlo
|
|
22
22
|
|
23
23
|
## Using DidGood with your DGD Application
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
Your app will need a dgd.didgood file, which is a lot like NPM's package.json file.
|
26
|
+
|
27
|
+
Here's an example:
|
28
|
+
|
29
|
+
```
|
30
|
+
{
|
31
|
+
"name": "eOS",
|
32
|
+
"version": "1.0.0",
|
33
|
+
"description": "A game platform from the folks at ChatTheatre",
|
34
|
+
"app": "app",
|
35
|
+
"goods": [
|
36
|
+
"https://raw.githubusercontent.com/noahgibbs/DidGood/main/goods/skotos_httpd.goods"
|
37
|
+
],
|
38
|
+
"unbundled_goods": [
|
39
|
+
{
|
40
|
+
"name": "kernellib",
|
41
|
+
"git": {
|
42
|
+
"url": "https://github.com/dworkin/cloud-server.git",
|
43
|
+
"branch": "master"
|
44
|
+
},
|
45
|
+
"paths": {
|
46
|
+
"src/doc/kernel": "doc/kernel",
|
47
|
+
"src/include/kernel": "include/kernel",
|
48
|
+
"src/kernel": "kernel"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
```
|
54
|
+
|
55
|
+
DidGood needs a .goods file for each of your dependencies - or it needs the equivalent of that .goods file, in the form of unbundled_goods. That one line in "goods" is basically the same information in unbundled_goods, just stored at a URL that DidGood can download for you.
|
56
|
+
|
57
|
+
A DidGood-enabled DGD codebase can provide Goods files directly and you can use them by their URLs. A non-DidGood codebase may require you to create your own .goods files, or use them directly and unbundled in the dgd.didgood file for your app.
|
28
58
|
|
29
59
|
## Creating the Goods
|
30
60
|
|
31
61
|
To create a new DidGood-usable library, you'll want to create a Goods file for it.
|
32
62
|
|
63
|
+
Here's what those look like:
|
64
|
+
|
65
|
+
```
|
66
|
+
{
|
67
|
+
"name": "SkotOS HTTPD",
|
68
|
+
"git": {
|
69
|
+
"url": "https://github.com/ChatTheatre/SkotOS.git"
|
70
|
+
},
|
71
|
+
"paths": {
|
72
|
+
"skoot/usr/HTTP": "usr/HTTP"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
33
77
|
## Design Notes on Libraries
|
34
78
|
|
35
79
|
The Kernel Library allows changing some config settings, including the name of the "/usr" dir. Consider some other name? Should definitely decide which direction to set "persistent" and stick with it.
|
36
80
|
|
37
81
|
Having admin users exist as library-ettes next to libraries seems highly dubious. But to avoid it, there would need to be a whole other permissions system sitting on top of the Kernel Library (like SkotOS, but more so.)
|
38
82
|
|
39
|
-
|
40
|
-
|
41
83
|
## Development
|
42
84
|
|
43
85
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
data/lib/didgood.rb
CHANGED
@@ -173,9 +173,7 @@ CONTENTS
|
|
173
173
|
raise("No such dgd.didgood file as #{path.inspect}!") unless File.exist?(path)
|
174
174
|
contents = JSON.load(File.read(path))
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
@specs = contents.flat_map { |item| json_to_specs(item) }
|
176
|
+
read_didgood_file(contents)
|
179
177
|
|
180
178
|
paths = @specs.flat_map { |s| s.paths }
|
181
179
|
unless paths == paths.uniq
|
@@ -201,30 +199,30 @@ CONTENTS
|
|
201
199
|
nil
|
202
200
|
end
|
203
201
|
|
204
|
-
def
|
205
|
-
raise "Expected
|
206
|
-
|
202
|
+
def read_didgood_file(contents)
|
203
|
+
raise "Expected a top-level JSON object in dgd.didgood!" unless contents.is_a?(Hash)
|
204
|
+
|
205
|
+
@specs = []
|
207
206
|
|
208
|
-
if
|
209
|
-
raise "Unbundled_goods must
|
207
|
+
if contents["unbundled_goods"]
|
208
|
+
raise "Unbundled_goods must be an array!" unless contents["unbundled_goods"].is_a?(Array)
|
210
209
|
|
211
|
-
|
210
|
+
@specs += contents["unbundled_goods"].map { |item| unbundled_json_to_spec(item) }
|
212
211
|
end
|
213
212
|
|
214
|
-
|
215
|
-
|
216
|
-
|
213
|
+
if contents["goods"]
|
214
|
+
raise "Goods must be an array!" unless contents["goods"].is_a?(Array)
|
215
|
+
|
216
|
+
@specs += contents["goods"].map do |goods_url|
|
217
217
|
begin
|
218
|
-
|
218
|
+
json_contents = JSON.parse(URI.open(goods_url).read)
|
219
219
|
rescue
|
220
220
|
STDERR.puts "Error reading or parsing by URL: #{goods_url.inspect}"
|
221
221
|
raise
|
222
222
|
end
|
223
|
-
unbundled_json_to_spec(
|
223
|
+
unbundled_json_to_spec(json_contents)
|
224
224
|
end
|
225
225
|
end
|
226
|
-
|
227
|
-
raise "Didn't recognize JSON objects as Goods specs in dgd.didgood!"
|
228
226
|
end
|
229
227
|
|
230
228
|
def unbundled_json_to_spec(fields)
|
data/lib/didgood/version.rb
CHANGED