sumomo 0.8.0 → 0.8.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
  SHA1:
3
- metadata.gz: 7e272e7159b46a624aad9e1fd27d42206ff0089d
4
- data.tar.gz: be5daaba9aa97814db24f976f6e0aa7f32496275
3
+ metadata.gz: b697bb92beda3ff58f8c91b086b5ee111e5a8e3d
4
+ data.tar.gz: 7dc99637fb60756dbe02b06bcbcd1784ca75eefb
5
5
  SHA512:
6
- metadata.gz: 2b526710d8fb56ca84de1b0f7e7d8979534a82f8b7e8608428a804340d52e80bcf54eb7360488fdf1e33f03125b4ff45f9338319012fed37f5cfd168442387c4
7
- data.tar.gz: 8c2e126517ea84d32df7b2ee77b99a7c5eba3f4d9fbfb8ac41b2cdf8e5102d952234357b22f943f7744ff0da2269856a8b0ea989071b0bb8f69a55d0e3067682
6
+ metadata.gz: 8b219359222421263e7d239005cf296cfc2843542868efd108678023e36ae4a07b47f45ca1e5f27a2293333c6f3bbefd71ab13d0aea1299c63be3378e4ce5f23
7
+ data.tar.gz: 3ed862487717d29ae36e7465ff58698388cf2111dfe52cd6aa27ce679d2a0fed4d6b2765bd32e4d199235e2a901e5763005d84ae003dc7e7950dcdc15872a398
@@ -209,15 +209,15 @@ module Sumomo
209
209
  if test_name
210
210
  puts "Testing API #{test_name}"
211
211
  apigen = Stack::APIGenerator.new(pretty_print: pretty_print, &tester.apis[test_name])
212
-
213
212
 
214
213
  script = File.read(File.join(Gem.loaded_specs['sumomo'].full_gem_path, "data", "sumomo", "api_modules", "test_script.js"))
215
214
  script.sub!("// {{ ROUTES }}", apigen.generate);
216
215
  script.gsub!("{{ SCRIPT }}", apigen.init_script);
217
216
 
218
217
  File.write(".test.js", script)
218
+ Stack::APIGenerator.combine_modules(".test_modules")
219
219
 
220
- exec "NODE_PATH=#{File.join(Gem.loaded_specs['sumomo'].full_gem_path, "data", "sumomo", "api_modules", "node_modules")} node .test.js"
220
+ exec "NODE_PATH=.test_modules node .test.js"
221
221
  end
222
222
  end
223
223
 
@@ -9,7 +9,7 @@ module Sumomo
9
9
 
10
10
  def apply(&block)
11
11
  @allowed_origins = []
12
- @allowed_headers = ['origin', 'content-type', 'accept', 'cache-control', 'x-requested-with', 'if-modified-since']
12
+ @allowed_headers = []
13
13
  instance_eval(&block) if block
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ module Sumomo
17
17
  @allowed_origins << value
18
18
  end
19
19
 
20
- def AllowHeaders(value)
20
+ def AllowHeader(value)
21
21
  @allowed_headers << value
22
22
  end
23
23
  end
@@ -29,6 +29,12 @@ module Sumomo
29
29
  # defaults
30
30
  @cors.apply do
31
31
  AllowOrigin "*"
32
+ AllowHeader 'origin'
33
+ AllowHeader 'content-type'
34
+ AllowHeader 'accept'
35
+ AllowHeader 'cache-control'
36
+ AllowHeader 'x-requested-with'
37
+ AllowHeader 'if-modified-since'
32
38
  end
33
39
  @pretty_print = pretty_print
34
40
  instance_eval(&block)
@@ -60,6 +66,13 @@ module Sumomo
60
66
  @script
61
67
  end
62
68
 
69
+ def self.combine_modules(dest)
70
+ orig_modules = File.join(Gem.loaded_specs['sumomo'].full_gem_path, "data", "sumomo", "api_modules", "node_modules")
71
+
72
+ `cp -Rad #{orig_modules}/ #{dest}/`
73
+ `cp -Rad node_modules/* #{dest}/`
74
+ end
75
+
63
76
  def generate
64
77
 
65
78
  if @pretty_print
@@ -161,7 +174,9 @@ module Sumomo
161
174
  script.gsub!("{{ BUCKET }}", @bucket_name);
162
175
  script.gsub!("{{ STORE_PREFIX }}", "functions/" + name);
163
176
 
164
- module_dir = File.join(Gem.loaded_specs['sumomo'].full_gem_path, "data", "sumomo", "api_modules")
177
+ module_dir = ".build_modules"
178
+
179
+ APIGenerator.combine_modules(module_dir)
165
180
 
166
181
  files = Dir[File.join(module_dir, "**/*")].select{|x| File.file?(x)}.map do |x|
167
182
  { name: x.sub(/^#{module_dir}\//, ""), code: File.read(x) }
@@ -269,4 +284,4 @@ module Sumomo
269
284
  end
270
285
 
271
286
  end
272
- end
287
+ end
@@ -1,3 +1,3 @@
1
1
  module Sumomo
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-15 00:00:00.000000000 Z
11
+ date: 2018-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler