brief 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/brief/document.rb +0 -4
- data/lib/brief/repository.rb +3 -2
- data/lib/brief/server.rb +1 -0
- data/lib/brief/server/handlers/modify.rb +2 -2
- data/lib/brief/server/route.rb +4 -1
- data/lib/brief/version.rb +1 -1
- data/spec/acceptance/modifying_spec.rb +20 -1
- data/spec/fixtures/example/models/concept.rb +14 -0
- data/spec/lib/brief/briefcase_spec.rb +2 -2
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bff2a020e24fc30bab2b5b93c854ec96c70d3af
|
4
|
+
data.tar.gz: 711b3c62cdb58b3c67d4acb2ca7e3d2298305182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f118758e7e59399b8b0dd438bf226943d2ed2ff84f2f2f5941f8a64a5f23d32d192684ab82c8db6f7aa2280f764a159a5415826d25ffe5c73c109bf6d092091d
|
7
|
+
data.tar.gz: 457b6b9cd33a3a3597dd1f728a97bd4198fc0a6faa7054a67fae45e431c771e3cabf7da060a932707b8799fbb9d24c9f5c9a0cbfc8e9a15540dd9d2eeda62d43
|
data/Gemfile.lock
CHANGED
data/lib/brief/document.rb
CHANGED
data/lib/brief/repository.rb
CHANGED
@@ -18,7 +18,8 @@ module Brief
|
|
18
18
|
|
19
19
|
def document_at(path)
|
20
20
|
path = normalize_path(path)
|
21
|
-
|
21
|
+
found = documents.find {|doc| doc.path == path }
|
22
|
+
found || Brief::Document.new(path).in_briefcase(briefcase)
|
22
23
|
end
|
23
24
|
|
24
25
|
def documents_at!(*paths)
|
@@ -34,7 +35,7 @@ module Brief
|
|
34
35
|
|
35
36
|
paths.map! {|p| normalize_path(p) }
|
36
37
|
|
37
|
-
paths.map {|p| p &&
|
38
|
+
paths.map {|p| p && document_at(p) }
|
38
39
|
end
|
39
40
|
|
40
41
|
def models_at(*paths)
|
data/lib/brief/server.rb
CHANGED
@@ -19,6 +19,7 @@ class Brief::Server
|
|
19
19
|
headers["Content-Length"] = Rack::Utils.bytesize(body).to_s
|
20
20
|
headers["Access-Control-Allow-Origin"] = "*"
|
21
21
|
headers["Access-Control-Allow-Methods"] = "GET, POST, PUT"
|
22
|
+
headers["X-BRIEF-HANDLER"] = request.send(:handler).try(:to_s)
|
22
23
|
|
23
24
|
[status, headers, [body]]
|
24
25
|
end
|
@@ -6,7 +6,7 @@ module Brief::Server::Handlers
|
|
6
6
|
|
7
7
|
writer = Writer.new(briefcase, path_args, request.params.symbolize_keys)
|
8
8
|
|
9
|
-
headers = {"Content-Type"=>"application/json"}
|
9
|
+
headers = {"Content-Type"=>"application/json", "X-BRIEF-MODIFY-ACTION"=>action}
|
10
10
|
|
11
11
|
response = writer.run(action)
|
12
12
|
|
@@ -87,7 +87,7 @@ module Brief::Server::Handlers
|
|
87
87
|
contents = params[:content] || params[:contents]
|
88
88
|
raw = params[:raw]
|
89
89
|
|
90
|
-
document
|
90
|
+
document = briefcase.document_at(path)
|
91
91
|
|
92
92
|
if document.nil? || !document.exist?
|
93
93
|
@errors[:document] = "No document was found at #{ path_args }"
|
data/lib/brief/server/route.rb
CHANGED
@@ -23,9 +23,12 @@ class Brief::Server::Route
|
|
23
23
|
resp = handler.handle(path_args, briefcase, request: request, action: path_action)
|
24
24
|
|
25
25
|
self.code = resp[0]
|
26
|
-
self.headers.merge(resp[1])
|
26
|
+
self.headers.merge!(resp[1])
|
27
27
|
self.body = resp[2]
|
28
28
|
|
29
|
+
headers["X-BRIEF-PATH-ACTION"] = path_action.to_s
|
30
|
+
headers["X-BRIEF-PATH-ARGS"] = path_args.to_s
|
31
|
+
|
29
32
|
[code, headers, body]
|
30
33
|
end
|
31
34
|
|
data/lib/brief/version.rb
CHANGED
@@ -35,10 +35,29 @@ describe "Modifying Documents", :type => :request do
|
|
35
35
|
expect(last_response.status).to eq(200)
|
36
36
|
end
|
37
37
|
|
38
|
+
it "updates both the content and the data" do
|
39
|
+
needle = rand(36**36).to_s(36)
|
40
|
+
post "/update/concept.html.md", content: "# Modified Content #{ needle }", data: {needle: needle}
|
41
|
+
|
42
|
+
doc = Brief::Document.new(Brief.example_path.join("docs","concept.html.md"))
|
43
|
+
|
44
|
+
expect(doc.data.values).to include(needle)
|
45
|
+
expect(doc.content).to include(needle)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "refreshes the browse endpoint data after an update" do
|
49
|
+
needle = rand(36**36).to_s(36)
|
50
|
+
post "/update/concept.html.md", content: "# Modified Content #{ needle }", data: {needle: needle}
|
51
|
+
get("/browse/concepts")
|
52
|
+
|
53
|
+
needles = json.map {|h| h["data"]["needle"] }
|
54
|
+
expect(needles).to include(needle)
|
55
|
+
end
|
56
|
+
|
38
57
|
it "lets me update just the metadata for an existing document" do
|
39
58
|
needle = rand(36**36).to_s(36)
|
40
59
|
post "/update/concept.html.md", data: {needle: needle}
|
41
|
-
|
60
|
+
expect(json["data"]["needle"]).to eq(needle)
|
42
61
|
expect(last_response.status).to eq(200)
|
43
62
|
end
|
44
63
|
|
@@ -21,11 +21,11 @@ describe "The Briefcase" do
|
|
21
21
|
|
22
22
|
context "Model Loading" do
|
23
23
|
it "loads the model definitions from the models folder" do
|
24
|
-
expect(Brief::Model.classes.length).to eq(
|
24
|
+
expect(Brief::Model.classes.length).to eq(4)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "loads the model definitions from the DSL in the config file" do
|
28
|
-
expect(Brief::Model.classes.length).to eq(
|
28
|
+
expect(Brief::Model.classes.length).to eq(4)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "caches the output" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brief
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Soeder
|
@@ -292,6 +292,7 @@ files:
|
|
292
292
|
- spec/fixtures/example/docs/resource.html.md
|
293
293
|
- spec/fixtures/example/docs/user_story.html.md
|
294
294
|
- spec/fixtures/example/docs/wireframe.html.md
|
295
|
+
- spec/fixtures/example/models/concept.rb
|
295
296
|
- spec/fixtures/example/models/epic.rb
|
296
297
|
- spec/fixtures/example/models/page.rb
|
297
298
|
- spec/fixtures/example/settings.yml
|
@@ -354,6 +355,7 @@ test_files:
|
|
354
355
|
- spec/fixtures/example/docs/resource.html.md
|
355
356
|
- spec/fixtures/example/docs/user_story.html.md
|
356
357
|
- spec/fixtures/example/docs/wireframe.html.md
|
358
|
+
- spec/fixtures/example/models/concept.rb
|
357
359
|
- spec/fixtures/example/models/epic.rb
|
358
360
|
- spec/fixtures/example/models/page.rb
|
359
361
|
- spec/fixtures/example/settings.yml
|