push_routes 0.0.6 → 0.0.7

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: e2fc62c4419b2bdc9565ce9bf8927b4b7a2471a1
4
- data.tar.gz: 7633da272cc55d16f82565d28673408ad284a448
3
+ metadata.gz: 0b6ad2fe0f61744703ed792941851361b60145b6
4
+ data.tar.gz: 32098dd6a7914c565398a4dfc8b535d8b7fc2c12
5
5
  SHA512:
6
- metadata.gz: 246d3adb2af66d5526abbbeedd1afea48fd06f12a80c2686d7d6d44fc45204499e83e5e173a1296c6314c5942bb74a5937098ab730a23dc25ce74ae4fc1603f8
7
- data.tar.gz: ee1563ed13fc69a321cfb766256eb1bbb599dd4b72d524a6b573ad22e11fe34096c771f7b4d12ee83fd8c7092141103540f4917dd1e89bf0e40a707c2f0c988b
6
+ metadata.gz: 824f034d6af434fa8a22f963f81caf4677505c2314c4348bd624e7621f592e3916cfe4585359a736d977d8387fb79793df538a3759e2f3f3fb6e4ecca78b8559
7
+ data.tar.gz: 73b05c9554af038cb4079c5028e39c86f2c1ad5d5aba7ce7f4540251eafff56f182b2af822e5a38105e8dbba4f77811118157f60d2deb10adae04f418d00795d
data/lib/push_routes.rb CHANGED
@@ -32,6 +32,16 @@ module PushRoutes
32
32
  @@redis.client.options[:url] if @@redis
33
33
  end
34
34
 
35
+ def self.trigger(route, type: '', data: 'placeholder')
36
+ begin
37
+ #TODO: Abstract away redis server as a transport
38
+ #This try catch repetition is bad
39
+ PushRoutes.redis.publish 'rt-change', {channel: route, type: type, data: data}.to_json
40
+ rescue Redis::CannotConnectError => e
41
+ warn "PushRoutes cannot reach the redis server"
42
+ end
43
+ end
44
+
35
45
  def self.REDIS_URL= (x)
36
46
  begin
37
47
  @@redis = Redis.new(:url => x);
@@ -131,15 +131,7 @@ module PushRoute
131
131
  if (result)
132
132
  result = [result] unless result.kind_of?(Array)
133
133
  result.each do |params|
134
- update_path = this.push_routes[action].notification_string(params)
135
- msg = {channel: update_path, type: "", data: "placeholder"}
136
- begin
137
- #TODO: Abstract away redis server as a transport
138
- #This try catch repetition is bad
139
- PushRoutes.redis.publish 'rt-change', msg.to_json
140
- rescue Redis::CannotConnectError => e
141
- warn "PushRoutes cannot reach the redis server"
142
- end
134
+ PushRoutes.trigger(this.push_routes[action].notification_string(params))
143
135
  end
144
136
  end
145
137
  end
@@ -1,3 +1,3 @@
1
1
  module PushRoutes
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -33951,3 +33951,245 @@ TriggerTest: test_trigger_specific_age
33951
33951
  SQL (0.2ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 81], ["updated_at", "2017-06-28 14:36:11.199599"], ["id", 1]]
33952
33952
   (0.0ms) RELEASE SAVEPOINT active_record_1
33953
33953
   (2.5ms) rollback transaction
33954
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
33955
+  (0.1ms) begin transaction
33956
+ ----------------------------------------------------
33957
+ NewGetRouteTest: test_returns_correct_new_get_routes
33958
+ ----------------------------------------------------
33959
+  (0.0ms) rollback transaction
33960
+  (0.0ms) begin transaction
33961
+ ----------------------------------
33962
+ EnableRoutesTest: test_nested_path
33963
+ ----------------------------------
33964
+  (0.0ms) rollback transaction
33965
+  (0.0ms) begin transaction
33966
+ -------------------------------------------------------------------
33967
+ EnableRoutesTest: test_doesn't_let_you_enable_action_with_no_routes
33968
+ -------------------------------------------------------------------
33969
+  (0.0ms) rollback transaction
33970
+  (0.0ms) begin transaction
33971
+ -----------------------------------
33972
+ EnableRoutesTest: test_add_on_twice
33973
+ -----------------------------------
33974
+  (0.0ms) rollback transaction
33975
+  (0.0ms) begin transaction
33976
+ --------------------------------
33977
+ EnableRoutesTest: test_added_url
33978
+ --------------------------------
33979
+  (0.0ms) rollback transaction
33980
+  (0.0ms) begin transaction
33981
+ --------------------------------
33982
+ EnableRoutesTest: test_basic_url
33983
+ --------------------------------
33984
+  (0.0ms) rollback transaction
33985
+  (0.0ms) begin transaction
33986
+ --------------------------------------
33987
+ EnableRoutesTest: test_url_with_params
33988
+ --------------------------------------
33989
+  (0.0ms) rollback transaction
33990
+  (0.0ms) begin transaction
33991
+ -----------------------------------------------------
33992
+ EnableRoutesTest: test_can_add_witout_explecit_enable
33993
+ -----------------------------------------------------
33994
+  (0.0ms) rollback transaction
33995
+  (0.0ms) begin transaction
33996
+ ------------------------------------------------
33997
+ EnableRoutesTest: test_add_on_existing_url_error
33998
+ ------------------------------------------------
33999
+  (0.0ms) rollback transaction
34000
+  (0.0ms) begin transaction
34001
+ ---------------------------------
34002
+ EnableRoutesTest: test_basic_path
34003
+ ---------------------------------
34004
+  (0.0ms) rollback transaction
34005
+  (0.0ms) begin transaction
34006
+ ----------------------------------------------------------------------------------------------
34007
+ NonStandardControllerTest: test_shouldn't_crash_when_there_is_a_controller_in_the_wrong_folder
34008
+ ----------------------------------------------------------------------------------------------
34009
+  (0.0ms) rollback transaction
34010
+  (0.0ms) begin transaction
34011
+ ---------------------------------------------
34012
+ NotificationStringTest: test_params_wrong_key
34013
+ ---------------------------------------------
34014
+  (0.0ms) rollback transaction
34015
+  (0.0ms) begin transaction
34016
+ ----------------------------------------
34017
+ NotificationStringTest: test_params_okay
34018
+ ----------------------------------------
34019
+  (0.0ms) rollback transaction
34020
+  (0.0ms) begin transaction
34021
+ -------------------------------------------
34022
+ NotificationStringTest: test_no_params_okay
34023
+ -------------------------------------------
34024
+  (0.0ms) rollback transaction
34025
+  (0.0ms) begin transaction
34026
+ -------------------------------------------------
34027
+ NotificationStringTest: test_no_params_okay_false
34028
+ -------------------------------------------------
34029
+  (0.0ms) rollback transaction
34030
+  (0.0ms) begin transaction
34031
+ --------------------------------------------
34032
+ NotificationStringTest: test_params_not_hash
34033
+ --------------------------------------------
34034
+  (0.0ms) rollback transaction
34035
+  (0.0ms) begin transaction
34036
+ ---------------------------------------
34037
+ TriggerTest: test_specific_trigger_fail
34038
+ ---------------------------------------
34039
+  (0.1ms) SAVEPOINT active_record_1
34040
+ SQL (0.8ms) INSERT INTO "people" ("age", "created_at", "updated_at") VALUES (?, ?, ?) [["age", 100], ["created_at", "2017-08-24 21:55:41.103626"], ["updated_at", "2017-08-24 21:55:41.103626"]]
34041
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34042
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34043
+  (0.0ms) SAVEPOINT active_record_1
34044
+ SQL (0.4ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 60], ["updated_at", "2017-08-24 21:55:41.116945"], ["id", 1]]
34045
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34046
+  (2.6ms) rollback transaction
34047
+  (0.1ms) begin transaction
34048
+ ---------------------------------------------------
34049
+ TriggerTest: test_specific_trigger_function_success
34050
+ ---------------------------------------------------
34051
+  (0.1ms) SAVEPOINT active_record_1
34052
+ SQL (0.4ms) INSERT INTO "people" ("age", "created_at", "updated_at") VALUES (?, ?, ?) [["age", 100], ["created_at", "2017-08-24 21:55:42.639992"], ["updated_at", "2017-08-24 21:55:42.639992"]]
34053
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34054
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34055
+  (0.0ms) SAVEPOINT active_record_1
34056
+ SQL (0.3ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 81], ["updated_at", "2017-08-24 21:55:42.645665"], ["id", 1]]
34057
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34058
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34059
+  (0.0ms) SAVEPOINT active_record_1
34060
+ SQL (0.0ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 79], ["updated_at", "2017-08-24 21:55:42.650427"], ["id", 1]]
34061
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34062
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34063
+  (0.0ms) SAVEPOINT active_record_1
34064
+ SQL (0.0ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 78], ["updated_at", "2017-08-24 21:55:42.654698"], ["id", 1]]
34065
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34066
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34067
+  (0.0ms) SAVEPOINT active_record_1
34068
+ SQL (0.0ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 82], ["updated_at", "2017-08-24 21:55:42.658026"], ["id", 1]]
34069
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34070
+  (2.6ms) rollback transaction
34071
+  (0.1ms) begin transaction
34072
+ ------------------------------------------
34073
+ TriggerTest: test_specific_trigger_success
34074
+ ------------------------------------------
34075
+  (0.1ms) SAVEPOINT active_record_1
34076
+ SQL (0.4ms) INSERT INTO "people" ("age", "created_at", "updated_at") VALUES (?, ?, ?) [["age", 100], ["created_at", "2017-08-24 21:55:44.171249"], ["updated_at", "2017-08-24 21:55:44.171249"]]
34077
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34078
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34079
+  (0.0ms) SAVEPOINT active_record_1
34080
+ SQL (0.3ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 60], ["updated_at", "2017-08-24 21:55:44.177228"], ["id", 1]]
34081
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34082
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34083
+  (0.0ms) SAVEPOINT active_record_1
34084
+ SQL (0.0ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 40], ["updated_at", "2017-08-24 21:55:44.182732"], ["id", 1]]
34085
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34086
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34087
+  (0.0ms) SAVEPOINT active_record_1
34088
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34089
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34090
+  (0.0ms) SAVEPOINT active_record_1
34091
+ SQL (0.0ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 51], ["updated_at", "2017-08-24 21:55:44.189881"], ["id", 1]]
34092
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34093
+  (2.5ms) rollback transaction
34094
+  (0.1ms) begin transaction
34095
+ --------------------------------------
34096
+ TriggerTest: test_trigger_specific_age
34097
+ --------------------------------------
34098
+  (0.1ms) SAVEPOINT active_record_1
34099
+ SQL (1.4ms) INSERT INTO "people" ("age", "created_at", "updated_at") VALUES (?, ?, ?) [["age", 100], ["created_at", "2017-08-24 21:55:45.702502"], ["updated_at", "2017-08-24 21:55:45.702502"]]
34100
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34101
+ Person Load (0.1ms) SELECT "people".* FROM "people" ORDER BY "people"."id" DESC LIMIT 1
34102
+  (0.0ms) SAVEPOINT active_record_1
34103
+ SQL (0.3ms) UPDATE "people" SET "age" = ?, "updated_at" = ? WHERE "people"."id" = ? [["age", 81], ["updated_at", "2017-08-24 21:55:45.709582"], ["id", 1]]
34104
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34105
+  (2.6ms) rollback transaction
34106
+  (0.1ms) begin transaction
34107
+ -------------------------------
34108
+ TriggerTest: test_basic_trigger
34109
+ -------------------------------
34110
+  (0.1ms) SAVEPOINT active_record_1
34111
+ SQL (0.4ms) INSERT INTO "people" ("age", "created_at", "updated_at") VALUES (?, ?, ?) [["age", 100], ["created_at", "2017-08-24 21:55:47.227388"], ["updated_at", "2017-08-24 21:55:47.227388"]]
34112
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34113
+  (2.3ms) rollback transaction
34114
+  (0.1ms) begin transaction
34115
+ ----------------------------------------------
34116
+ SmarterAddTest: test_allows_adding_id_triggers
34117
+ ----------------------------------------------
34118
+  (0.1ms) rollback transaction
34119
+  (0.1ms) begin transaction
34120
+ ----------------------------------------------------------------------------------------
34121
+ SmarterAddTest: test_the_id_triggers_with_infered_response_type_and_infered_trigger_type
34122
+ ----------------------------------------------------------------------------------------
34123
+  (0.1ms) SAVEPOINT active_record_1
34124
+ SQL (2.3ms) INSERT INTO "clubs" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2017-08-24 21:55:49.252843"], ["updated_at", "2017-08-24 21:55:49.252843"]]
34125
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34126
+  (2.3ms) rollback transaction
34127
+  (0.1ms) begin transaction
34128
+ ----------------------------------------------
34129
+ SmarterAddTest: test_id_triggers_actually_fire
34130
+ ----------------------------------------------
34131
+  (0.1ms) SAVEPOINT active_record_1
34132
+ SQL (0.4ms) INSERT INTO "people" ("club_id", "created_at", "updated_at") VALUES (?, ?, ?) [["club_id", 20], ["created_at", "2017-08-24 21:55:50.769573"], ["updated_at", "2017-08-24 21:55:50.769573"]]
34133
+ Club Load (0.1ms) SELECT "clubs".* FROM "clubs" WHERE "clubs"."id" = ? LIMIT 1 [["id", 20]]
34134
+  (0.0ms) RELEASE SAVEPOINT active_record_1
34135
+  (2.3ms) rollback transaction
34136
+  (0.1ms) begin transaction
34137
+ ---------------------------------------------------------------
34138
+ SmarterAddTest: test_the_id_triggers_with_infered_response_type
34139
+ ---------------------------------------------------------------
34140
+  (0.1ms) SAVEPOINT active_record_1
34141
+ SQL (0.4ms) INSERT INTO "clubs" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2017-08-24 21:55:52.292327"], ["updated_at", "2017-08-24 21:55:52.292327"]]
34142
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34143
+  (0.1ms) SAVEPOINT active_record_1
34144
+ SQL (0.3ms) INSERT INTO "people" ("club_id", "created_at", "updated_at") VALUES (?, ?, ?) [["club_id", 1], ["created_at", "2017-08-24 21:55:52.295691"], ["updated_at", "2017-08-24 21:55:52.295691"]]
34145
+  (0.1ms) RELEASE SAVEPOINT active_record_1
34146
+  (2.6ms) rollback transaction
34147
+  (0.1ms) begin transaction
34148
+ --------------------------------------------------------------
34149
+ PushRoutesUrlParamsAssociationsTest: test_works_not_at_the_end
34150
+ --------------------------------------------------------------
34151
+  (0.1ms) rollback transaction
34152
+  (0.0ms) begin transaction
34153
+ ----------------------------------------------------------------------------------
34154
+ PushRoutesUrlParamsAssociationsTest: test_works_not_at_the_end_with_trailing_slash
34155
+ ----------------------------------------------------------------------------------
34156
+  (0.0ms) rollback transaction
34157
+  (0.0ms) begin transaction
34158
+ ---------------------------------------------------------------
34159
+ PushRoutesUrlParamsAssociationsTest: test_finds_multiple_params
34160
+ ---------------------------------------------------------------
34161
+  (0.0ms) rollback transaction
34162
+  (0.0ms) begin transaction
34163
+ -------------------------------------------------------
34164
+ PushRoutesUrlParamsAssociationsTest: test_empty_if_none
34165
+ -------------------------------------------------------
34166
+  (0.0ms) rollback transaction
34167
+  (0.0ms) begin transaction
34168
+ -----------------------------------------
34169
+ ReloadTest: test_reloading_keeps_triggers
34170
+ -----------------------------------------
34171
+  (0.2ms) begin transaction
34172
+ -----------------------------------------------
34173
+ PushRoutesUrlMatcherTest: test_url_matcher_okay
34174
+ -----------------------------------------------
34175
+  (0.0ms) rollback transaction
34176
+  (0.0ms) begin transaction
34177
+ --------------------------------------------------------------
34178
+ PushRoutesUrlMatcherTest: test_url_matcher_reject_ending_slash
34179
+ --------------------------------------------------------------
34180
+  (0.0ms) rollback transaction
34181
+  (0.0ms) begin transaction
34182
+ ------------------------------------
34183
+ PushRoutesUrlMatcherTest: test_truth
34184
+ ------------------------------------
34185
+  (0.0ms) rollback transaction
34186
+  (0.0ms) begin transaction
34187
+ ---------------------------------------------------------------
34188
+ PushRoutesUrlMatcherTest: test_url_matcher_reject_missing_param
34189
+ ---------------------------------------------------------------
34190
+  (0.0ms) rollback transaction
34191
+  (0.0ms) begin transaction
34192
+ -------------------------------
34193
+ EngineTest: test_class_prefixes
34194
+ -------------------------------
34195
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: push_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4'
27
27
  - !ruby/object:Gem::Dependency
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1'
54
+ version: '0'
55
55
  description: See summary
56
56
  email:
57
57
  - matthew@callnine.com