didgood 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30468ec76fd6ef7bcf9811dd6b789a0dcf5a01b97d7cbadddaacda4e9efee011
4
- data.tar.gz: e7dd28d517d84ffaaf3dc0c7b34bf945efd59ea84f57a66f30184c5c1759c8b7
3
+ metadata.gz: 52b48699d65d87fddc805c6f80857546c5fb09fc9b6707140b28dd71b70d637f
4
+ data.tar.gz: 570e8f325a14587968a1fda5dd660fe9e4781b2326f614c12697fd696c37cf59
5
5
  SHA512:
6
- metadata.gz: 34f947738281d597651c2dd87037dabfcb91ca3e8422335b6a4b8710b64850d62fd59504b0973ff816a4177ff22336b1f8758d0aa8830f4e4ed3671a80a54eb8
7
- data.tar.gz: da573cf10011fc0e6a15c8d9d822d4acc47603953ffd85b9330dfb36fe524352f4f3f0ba68adf208f34553d1fb9f75f8577b0d40adaa5375311094d480cbf6ea
6
+ metadata.gz: 554dce72220b582911f37c948e0f93429e75872a73b11366d7975237e13de56b6a3e6d04e97eab9ff23e0724464308fe5f69af1b04f64a7789227c9b262ae6ee
7
+ data.tar.gz: e7ab49d442c7a929ad9983a5f1a277887d2527234f96b0f861593621ce0066429669d1ec9520a77b9a18382976f8cd16d3921e0f661763ccdac78bc035ae2a45
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- didgood (0.1.0)
4
+ didgood (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- DidGood needs a .goods file for each library you intend to use, or it needs the information that would normally have been in that .goods file. DidGood keeps its various settings in JSON.
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.
@@ -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
- raise "Expected a top-level JSON array in dgd.didgood!" unless contents.is_a?(Array)
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 json_to_specs(item)
205
- raise "Expected every spec to be a JSON object, not #{item.inspect}!" unless item.is_a?(Hash)
206
- return [] if item.size == 0 || item.all? { |k, v| k == "" }
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 item["unbundled_goods"]
209
- raise "Unbundled_goods must have only one key!" unless item.size == 1
207
+ if contents["unbundled_goods"]
208
+ raise "Unbundled_goods must be an array!" unless contents["unbundled_goods"].is_a?(Array)
210
209
 
211
- return [unbundled_json_to_spec(item["unbundled_goods"])]
210
+ @specs += contents["unbundled_goods"].map { |item| unbundled_json_to_spec(item) }
212
211
  end
213
212
 
214
- # A string-to-string mapping means a list of names and Goods URLs
215
- if item.is_a?(Hash) && item.all? { |k, v| k.is_a?(String) && v.is_a?(String) }
216
- return item.map do |name, goods_url|
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
- contents = JSON.parse(URI.open(goods_url).read)
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(contents)
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)
@@ -1,3 +1,3 @@
1
1
  module DidGood
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: didgood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Gibbs