Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 7a5728a

Browse files
committed
everything passing with hyper-operation as a base
1 parent f791b15 commit 7a5728a

File tree

16 files changed

+202
-120
lines changed

16 files changed

+202
-120
lines changed

Gemfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
source 'https://rubygems.org'
22
# Specify your gem's dependencies in synchromesh.gemspec
3-
gem 'hyper-trace'
4-
gem 'opal-browser'
5-
gem 'hyper-operation', git: 'https://github.com/ruby-hyperloop/hyper-operation.git' #path: '../hyper-operation'
3+
# gem 'hyper-trace'
4+
# gem 'opal-browser'
5+
# gem 'hyper-operation', path: '../hyper-operation' #git: 'https://github.com/ruby-hyperloop/hyper-operation.git' #
6+
# gem 'hyper-component', path: '../hyper-component'
7+
# gem 'hyper-react', path: '../hyper-react'
8+
# gem 'hyper-store', path: '../hyper-store'
9+
# gem 'hyperloop-config', path: '../hyperloop-config'
610
gemspec

Rakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ require "rspec/core/rake_task"
33

44
RSpec::Core::RakeTask.new(:spec)
55

6-
task :default => :spec
6+
task :default do
7+
sh 'DRIVER=ff bundle exec rspec spec/batch1'
8+
sh 'DRIVER=ff bundle exec rspec spec/batch2'
9+
sh 'DRIVER=ff bundle exec rspec spec/batch3-from-reactive-record'
10+
end

hyper-mesh.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Gem::Specification.new do |s|
2323
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
2424
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
2525
s.require_paths = ['lib']
26+
2627
s.add_dependency 'activerecord', '>= 0.3.0'
27-
s.add_dependency 'hyper-react', '>= 0.10.0'
2828
s.add_dependency 'hyper-operation'
2929

3030
s.add_development_dependency 'bundler', '~> 1.8'
@@ -82,6 +82,6 @@ Gem::Specification.new do |s|
8282
s.add_development_dependency 'jquery-rails'
8383
s.add_development_dependency 'pry-byebug'
8484
s.add_development_dependency 'hyper-spec'
85-
#s.add_development_dependency 'hyper-trace'
85+
s.add_development_dependency 'hyper-trace'
8686
end
8787
end

lib/hyper-mesh.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require 'set'
22
if RUBY_ENGINE == 'opal'
3-
require "hyper-react"
43
require 'hyper-operation'
54
require 'active_support'
65
require 'time'
@@ -33,10 +32,8 @@
3332
require_relative 'opal/equality_patches'
3433
else
3534
require 'opal'
36-
require 'hyper-react'
3735
require 'hyper-operation'
3836
require "reactive_record/permissions"
39-
#require "reactive_record/engine"
4037
require "reactive_record/server_data_cache"
4138
require "reactive_record/active_record/reactive_record/operations"
4239
require 'synchromesh/broadcast'
@@ -46,14 +43,9 @@
4643
require "reactive_record/pry"
4744
require_relative 'active_record_base'
4845
require 'hypermesh/version'
49-
#require 'synchromesh/connection'
50-
#require 'synchromesh/synchromesh'
51-
#require 'synchromesh/policy'
52-
#require 'synchromesh/synchromesh_controller'
5346

5447
Opal.append_path File.expand_path('../sources/', __FILE__).untaint
5548
Opal.append_path File.expand_path('../', __FILE__).untaint
5649
Opal.append_path File.expand_path('../../vendor', __FILE__).untaint
5750
end
5851
require 'enumerable/pluck'
59-
#require_relative 'synchromesh/client_drivers'

lib/reactive_record/active_record/reactive_record/collection.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ def method_missing(method, *args, &block)
483483
elsif ScopeDescription.find(@target_klass, method) || (args.count == 1 && method =~ /^find_by_/)
484484
apply_scope(method, *args)
485485
elsif @target_klass.respond_to?(method) && ScopeDescription.find(@target_klass, "_#{method}")
486-
puts "here we are..."
487486
apply_scope("_#{method}", *args).first
488487
else
489488
super

lib/reactive_record/active_record/reactive_record/while_loading.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def hide_while_loading
228228

229229
end
230230

231-
module Component
231+
module Component # not this needs to be rewritten
232232

233233
alias_method :original_component_did_mount, :component_did_mount
234234

@@ -299,6 +299,6 @@ def reactive_record_link_set_while_loading_container_class
299299

300300
end
301301

302-
end if RUBY_ENGINE == 'opal'
302+
end if false && RUBY_ENGINE == 'opal'
303303

304304
end

lib/synchromesh/broadcast.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ class Broadcast
33

44
def self.after_commit(operation, model)
55
Hyperloop::InternalPolicy.regulate_broadcast(model) do |data|
6-
if !Hyperloop.on_server? && Connection.root_path
6+
if !Hyperloop.on_server? && Hyperloop::Connection.root_path
77
send_to_server(operation, data)
88
else
99
SendPacket.run(data, operation: operation)
1010
end
1111
end
12+
rescue ActiveRecord::StatementInvalid => e
13+
raise e unless e.message == "Could not find table 'hyperloop_connections'"
1214
end unless RUBY_ENGINE == 'opal'
1315

1416
def self.send_to_server(operation, data)
1517
salt = SecureRandom.hex
16-
authorization = authorization(salt, data)
17-
raise 'no server running' unless Connection.root_path
18+
authorization = Hyperloop.authorization(salt, data[:channel], data[:broadcast_id])
19+
raise 'no server running' unless Hyperloop::Connection.root_path
1820
SendPacket.remote(
19-
Connection.root_path,
21+
Hyperloop::Connection.root_path,
2022
data,
2123
operation: operation,
2224
salt: salt,
@@ -39,8 +41,8 @@ class SendPacket < Hyperloop::ServerOp
3941
unless RUBY_ENGINE == 'opal'
4042
validate do
4143
params.authorization.nil? ||
42-
authorization = Hyperloop.authorization(
43-
params.channel, params.salt, params.broadcast_id
44+
Hyperloop.authorization(
45+
params.salt, params.channel, params.broadcast_id
4446
) == params.authorization
4547
end
4648
dispatch_to { params.channel }

reactive_record_test_app/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ gem 'pry-rescue'
1414
gem 'opal-rspec-rails', github: 'opal/opal-rspec-rails', ref: '65de2771a539cda44a84c75082306869284b2ab4' # 10.0
1515
gem 'hyper-react'
1616
gem 'hyper-mesh', path: "../"
17-
gem 'hyper-operation', git: 'https://github.com/ruby-hyperloop/hyper-operation.git' # path: '../../hyper-operation'
17+
gem 'hyper-operation'
1818
gem 'web-console'
1919
gem 'hyper-trace'
2020
gem 'pry'

reactive_record_test_app/Gemfile.lock

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,12 @@ GIT
88
opal-rails (~> 0.9.0)
99
opal-rspec (~> 0.6.0)
1010

11-
PATH
12-
remote: ../../hyper-operation
13-
specs:
14-
hyper-operation (0.1.0)
15-
activerecord (>= 0.3.0)
16-
hyper-react
17-
hyperloop-config
18-
mutations
19-
opal-activesupport
20-
2111
PATH
2212
remote: ../
2313
specs:
2414
hyper-mesh (0.5.4)
2515
activerecord (>= 0.3.0)
2616
hyper-operation
27-
hyper-react (>= 0.10.0)
2817

2918
GEM
3019
remote: http://rubygems.org/
@@ -63,6 +52,8 @@ GEM
6352
minitest (~> 5.1)
6453
thread_safe (~> 0.3, >= 0.3.4)
6554
tzinfo (~> 1.1)
55+
addressable (2.5.0)
56+
public_suffix (~> 2.0, >= 2.0.2)
6657
arel (6.0.4)
6758
babel-source (5.8.35)
6859
babel-transpiler (0.7.0)
@@ -76,18 +67,51 @@ GEM
7667
coffee-script-source (1.12.2)
7768
concurrent-ruby (1.0.5)
7869
connection_pool (2.2.1)
70+
cookiejar (0.3.3)
71+
daemons (1.2.4)
7972
debug_inspector (0.0.2)
73+
em-http-request (1.1.5)
74+
addressable (>= 2.3.4)
75+
cookiejar (!= 0.3.1)
76+
em-socksify (>= 0.3)
77+
eventmachine (>= 1.0.3)
78+
http_parser.rb (>= 0.6.0)
79+
em-socksify (0.3.1)
80+
eventmachine (>= 1.0.0.beta.4)
81+
em-websocket (0.5.1)
82+
eventmachine (>= 0.12.9)
83+
http_parser.rb (~> 0.6.0)
8084
erubis (2.7.0)
85+
eventmachine (1.2.3)
8186
execjs (2.7.0)
8287
globalid (0.3.7)
8388
activesupport (>= 4.1.0)
8489
hike (1.2.3)
85-
hyper-react (0.11.0)
90+
http_parser.rb (0.6.0)
91+
httpclient (2.8.3)
92+
hyper-component (0.12.2)
93+
hyper-react (>= 0.12.0)
94+
hyperloop-config (>= 0.9.2)
95+
opal-rails (~> 0.9.0)
96+
react-rails (< 1.10.0)
97+
hyper-operation (0.5.0)
98+
activerecord (>= 0.3.0)
99+
hyper-component (>= 0.12.2)
100+
hyperloop-config (>= 0.9.2)
101+
mutations
102+
opal-activesupport
103+
pusher
104+
pusher-fake
105+
hyper-react (0.12.2)
106+
hyper-store (>= 0.2.1)
107+
hyperloop-config (>= 0.9.2)
86108
opal (>= 0.8.0)
87109
opal-activesupport (>= 0.2.0)
88-
react-rails
110+
hyper-store (0.2.1)
111+
hyperloop-config (>= 0.9.2)
89112
hyper-trace (0.3.1)
90-
hyperloop-config (0.8.1)
113+
hyperloop-config (0.9.2)
114+
opal
91115
i18n (0.8.1)
92116
interception (0.5)
93117
jquery-cookie-rails (1.3.1.1)
@@ -107,6 +131,7 @@ GEM
107131
mime-types-data (3.2016.0521)
108132
mini_portile2 (2.1.0)
109133
minitest (5.10.1)
134+
multi_json (1.12.1)
110135
mutations (0.8.1)
111136
activesupport
112137
nokogiri (1.7.0.1)
@@ -143,6 +168,17 @@ GEM
143168
pry-rescue (1.4.4)
144169
interception (>= 0.5)
145170
pry
171+
public_suffix (2.0.5)
172+
pusher (1.3.1)
173+
httpclient (~> 2.7)
174+
multi_json (~> 1.0)
175+
pusher-signature (~> 0.1.8)
176+
pusher-fake (1.8.0)
177+
em-http-request (~> 1.1)
178+
em-websocket (~> 0.5)
179+
multi_json (~> 1.6)
180+
thin (~> 1.5)
181+
pusher-signature (0.1.8)
146182
rack (1.6.5)
147183
rack-test (0.6.3)
148184
rack (>= 1.0)
@@ -171,7 +207,7 @@ GEM
171207
rake (>= 0.8.7)
172208
thor (>= 0.18.1, < 2.0)
173209
rake (12.0.0)
174-
react-rails (1.10.0)
210+
react-rails (1.9.0)
175211
babel-transpiler (>= 0.7.0)
176212
coffee-script-source (~> 1.8)
177213
connection_pool
@@ -192,6 +228,10 @@ GEM
192228
therubyracer (0.12.2)
193229
libv8 (~> 3.16.14.0)
194230
ref
231+
thin (1.7.0)
232+
daemons (~> 1.0, >= 1.0.9)
233+
eventmachine (~> 1.0, >= 1.0.4)
234+
rack (>= 1, < 3)
195235
thor (0.19.4)
196236
thread_safe (0.3.6)
197237
tilt (2.0.6)
@@ -209,7 +249,7 @@ PLATFORMS
209249
DEPENDENCIES
210250
byebug
211251
hyper-mesh!
212-
hyper-operation!
252+
hyper-operation
213253
hyper-react
214254
hyper-trace
215255
jquery-cookie-rails

reactive_record_test_app/config/application.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ class Application < Rails::Application
6363
config.opal.arity_check = false
6464
config.opal.const_missing = true
6565
config.opal.dynamic_require_severity = :ignore
66-
#config.opal.source_map_enabled = false
66+
config.opal.source_map_enabled = false
6767

6868
# Enable/disable /opal_specs route
6969
config.opal.enable_specs = true
7070

7171
config.opal.spec_location = 'spec-opal'
7272
config.web_console.development_only = false
73+
config.hyperloop.auto_config = false
7374
end
7475
end

0 commit comments

Comments
 (0)