flok 0.0.78 → 0.0.79

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: 643d6a1724b1aedb183f9cbd43c65d591d61676a
4
- data.tar.gz: d12f16b669ea1daf652cb8290a8e7c2327d8f539
3
+ metadata.gz: aca1d7de35bb76f6ca3adf9142e6ba509161a5de
4
+ data.tar.gz: 07984726091817ae868f9a864ad38108510f26e5
5
5
  SHA512:
6
- metadata.gz: 688cb125e1c43ae4ef30f598247fd6c5d61c194d53e5a03f2f783370af2e0af4a56b5d6f76f5c3f9674a623556c3a1def3d3bc29d9742d4278995a4280204d8e
7
- data.tar.gz: df70bbefccb28bf756fae5b224e22f2d03b60f509828017fbd5e502b8b3910ed572230d95f6ba0758388e002b34d32534b50ad4a22e9f85e5ebaa85e81659f2b
6
+ metadata.gz: 5eec59b970ba96dda10d87394323839c35ed7dba250be6c250d03c289c4e1ee7f0a2f909cd09c9da1c2137d2d6da8cfbd1e4c1d8ff4afa4d18f1a00ba9541252
7
+ data.tar.gz: 57f42e576fe8cb437f5d01df8e07dda29df8093d248abb90d3aedfaa7284b52904a9881f6feb47903720df2a247f7e75610fdbfd6908dc496d3186dea7f910a4
@@ -494,7 +494,7 @@ module Flok
494
494
  end
495
495
 
496
496
  class UserCompilerAction
497
- attr_accessor :controller, :name, :ons, :every_handlers
497
+ attr_accessor :controller, :name, :ons, :every_handlers, :on_entry_has_goto
498
498
  include UserCompilerMacro
499
499
 
500
500
  def initialize controller, name, ctx, &block
@@ -504,6 +504,7 @@ module Flok
504
504
  @_on_entry_src = ""
505
505
  @ons = [] #Event handlers
506
506
  @every_handlers = []
507
+ @on_entry_has_goto = false
507
508
 
508
509
  self.instance_eval(&block)
509
510
  end
@@ -511,6 +512,8 @@ module Flok
511
512
  def on_entry js_src
512
513
  #returns a string
513
514
  @_on_entry_src = _macro(js_src)
515
+
516
+ @on_entry_has_goto = (js_src =~ /Goto/) != nil
514
517
  end
515
518
 
516
519
  def on_entry_src
@@ -582,6 +585,8 @@ module Flok
582
585
 
583
586
  def choose_action &block
584
587
  @ctx.action self, :choose_action, &block
588
+
589
+ raise "choose_action must contain Goto" unless @ctx.actions.detect{|e| e.name == :choose_action}.on_entry_has_goto
585
590
  end
586
591
 
587
592
  #Names of spots
data/lib/flok/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flok
2
- VERSION = "0.0.78"
2
+ VERSION = "0.0.79"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  controller :my_controller do
2
- services "vm"
2
+ services "test"
3
3
 
4
4
  on_entry %{
5
5
  context.secret = "foo";
@@ -0,0 +1,19 @@
1
+ controller :my_controller do
2
+ services :test
3
+
4
+ on_entry %{
5
+ var info = {
6
+ foo: "bar"
7
+ }
8
+ Request("test", "test_async", info);
9
+ }
10
+
11
+ action :my_action do
12
+ on_entry %{
13
+ }
14
+
15
+ on "test_async_res", %{
16
+ test_async_res_params = params;
17
+ }
18
+ end
19
+ end
@@ -732,20 +732,20 @@ RSpec.describe "kern:controller_spec" do
732
732
 
733
733
  it "Does allow service macros in the global on_entry function" do
734
734
  #Compile the controller
735
- ctx = flok_new_user File.read('./spec/kern/assets/global_on_entry5.rb'), File.read("./spec/kern/assets/vm/config5.rb")
735
+ ctx = flok_new_user File.read('./spec/kern/assets/test_service/controller1b.rb'), File.read("./spec/kern/assets/test_service/config0.rb")
736
736
 
737
737
  #Run the embed function
738
- secret = SecureRandom.hex
739
- ctx.eval %{
738
+ dump = ctx.evald %{
740
739
  global_on_entry_called_count = 0;
741
740
 
742
741
  //Call embed on main root view
743
742
  base = _embed("my_controller", 0, {}, null);
744
743
 
745
744
  int_dispatch([]);
745
+ dump.test_async_res_params = test_async_res_params;
746
746
  }
747
747
 
748
- expect(ctx.eval("read_res_called")).to eq(true)
748
+ expect(dump["test_async_res_params"]).to eq({"foo" => "bar"})
749
749
  end
750
750
 
751
751
  it "Does allow interval (every) events" do
@@ -980,8 +980,8 @@ RSpec.describe "kern:controller_spec" do
980
980
  end
981
981
 
982
982
  it "Not setting a Goto will result in an exception" do
983
- ctx = flok_new_user File.read('./spec/kern/assets/choose_action_sync_no_goto.rb'), File.read("./spec/kern/assets/test_service/config0.rb")
984
983
  expect {
984
+ ctx = flok_new_user File.read('./spec/kern/assets/choose_action_sync_no_goto.rb'), File.read("./spec/kern/assets/test_service/config0.rb")
985
985
  ctx.evald %{
986
986
  base = _embed("my_controller", 0, {}, null);
987
987
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.78
4
+ version: 0.0.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - seo
@@ -1197,6 +1197,7 @@ files:
1197
1197
  - spec/kern/assets/test_service/config0.rb
1198
1198
  - spec/kern/assets/test_service/controller0.rb
1199
1199
  - spec/kern/assets/test_service/controller1.rb
1200
+ - spec/kern/assets/test_service/controller1b.rb
1200
1201
  - spec/kern/assets/test_service/controller2.rb
1201
1202
  - spec/kern/assets/test_service/controller3.rb
1202
1203
  - spec/kern/assets/test_service_config.rb
@@ -2144,6 +2145,7 @@ test_files:
2144
2145
  - spec/kern/assets/test_service/config0.rb
2145
2146
  - spec/kern/assets/test_service/controller0.rb
2146
2147
  - spec/kern/assets/test_service/controller1.rb
2148
+ - spec/kern/assets/test_service/controller1b.rb
2147
2149
  - spec/kern/assets/test_service/controller2.rb
2148
2150
  - spec/kern/assets/test_service/controller3.rb
2149
2151
  - spec/kern/assets/test_service_config.rb