knod 0.7.0 → 0.8.0
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/knod.gemspec +1 -1
- data/lib/knod/file_utilities.rb +1 -1
- data/lib/knod/server.rb +3 -1
- data/lib/knod/version.rb +1 -1
- data/test/test_knod.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24db330e2ed1cad1a1765169a47239723f4387da
|
4
|
+
data.tar.gz: c744a80528dfeb1dc3e9597299239362a7782aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b9650afbf606e35421ca86390e43812db7fe922e74fae0f8a93d55e9aa8f5624c3839260566ed767c779ba3ed0ae8d0032c6207687b5e4e28814a6aa07ba5f
|
7
|
+
data.tar.gz: f4e6215b5e0d7252427c829e1049140ec9158ec762f7e89adbe1c0d1fc006c27efd71bcc62c9b140a0e2be98806e8f56e5d59582942ffc584db0f306f69ae8f8
|
data/Gemfile.lock
CHANGED
data/knod.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'knod/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = 'knod'
|
8
8
|
gem.version = Knod::VERSION
|
9
|
-
gem.date = '2014-06-
|
9
|
+
gem.date = '2014-06-25'
|
10
10
|
gem.authors = ['Ryan Moser']
|
11
11
|
gem.email = 'ryanpmoser@gmail.com'
|
12
12
|
gem.homepage = 'https://github.com/moserrya/knod'
|
data/lib/knod/file_utilities.rb
CHANGED
data/lib/knod/server.rb
CHANGED
@@ -102,7 +102,7 @@ module Knod
|
|
102
102
|
|
103
103
|
def max_id_in_path(path)
|
104
104
|
records = Dir.glob(path + '/*.json')
|
105
|
-
records.map { |r| File.basename(r, '.json') }.
|
105
|
+
records.map { |r| File.basename(r, '.json').to_i }.max || 0
|
106
106
|
end
|
107
107
|
|
108
108
|
def merge_json(file, request_body)
|
@@ -132,6 +132,7 @@ module Knod
|
|
132
132
|
header = "HTTP/1.1 #{status_code} #{STATUS_CODE_MAPPINGS.fetch(status_code)}\r\n"
|
133
133
|
header << "Content-Type: application/json\r\n" unless message.empty?
|
134
134
|
header << "Content-Length: #{message.size}\r\n"
|
135
|
+
header << "Access-Control-Allow-Origin: *\r\n"
|
135
136
|
header << "Connection: close\r\n\r\n"
|
136
137
|
end
|
137
138
|
|
@@ -144,6 +145,7 @@ module Knod
|
|
144
145
|
"HTTP/1.1 200 OK\r\n" \
|
145
146
|
"Content-Type: #{content_type(file)}\r\n" \
|
146
147
|
"Content-Length: #{file.size}\r\n" \
|
148
|
+
"Access-Control-Allow-Origin: *\r\n" \
|
147
149
|
"Connection: close\r\n\r\n"
|
148
150
|
end
|
149
151
|
|
data/lib/knod/version.rb
CHANGED
data/test/test_knod.rb
CHANGED
@@ -62,6 +62,11 @@ describe Knod, "a tiny http server" do
|
|
62
62
|
response.code.must_equal '204'
|
63
63
|
end
|
64
64
|
|
65
|
+
it 'responds with Cross-Origin Resource Sharing header' do
|
66
|
+
response = connection.get @path
|
67
|
+
response['Access-Control-Allow-Origin'].must_equal '*'
|
68
|
+
end
|
69
|
+
|
65
70
|
describe 'contatenates files into a json array' do
|
66
71
|
let(:path) {'index'}
|
67
72
|
let(:data) { 3.times.map { |i| { id: i+1, state: 'squiddy' } } }
|
@@ -73,7 +78,12 @@ describe Knod, "a tiny http server" do
|
|
73
78
|
|
74
79
|
it 'should concatenate file contents into an array' do
|
75
80
|
response = connection.get path
|
76
|
-
response.body.
|
81
|
+
response.body.must_equal data
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'responds with Cross-Origin Resource Sharing header' do
|
85
|
+
response = connection.get path
|
86
|
+
response['Access-Control-Allow-Origin'].must_equal '*'
|
77
87
|
end
|
78
88
|
|
79
89
|
after do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|