Skip to content

Commit d4a73c8

Browse files
committed
specs should be passing with new APIs
1 parent 2b424c5 commit d4a73c8

File tree

69 files changed

+760
-634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+760
-634
lines changed

ruby/hyper-model/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ source 'https://rubygems.org'
22
#gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
33
# hyper-model is still using an ancient inlined version of hyper-spec
44
#gem 'hyper-spec', path: '../hyper-spec'
5-
gem 'hyperloop-config', path: '../hyperloop-config'
5+
gem 'hyperstack-config', path: '../hyperstack-config'
6+
gem 'hyper-state', path: '../hyper-state'
67
gem 'hyper-store', path: '../hyper-store'
78
gem 'hyper-component', path: '../hyper-component'
89
gem 'hyper-operation', path: '../hyper-operation'

ruby/hyper-model/Gemfile.lock

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
GIT
2-
remote: https://github.com/opal/opal-jquery.git
3-
revision: 6249dfaf406ecd7199079b4f4d9dc67cfdf4d602
4-
branch: master
5-
specs:
6-
opal-jquery (0.4.3)
7-
opal (>= 0.10.0, < 0.12.0)
8-
91
PATH
102
remote: ../hyper-component
113
specs:
12-
hyper-component (1.0.0.lap28)
13-
hyper-store (= 1.0.0.lap28)
14-
hyperloop-config (= 1.0.0.lap28)
4+
hyper-component (0.1)
5+
hyper-state (= 0.1)
6+
hyperstack-config (= 0.1)
157
libv8 (~> 6.3.0)
168
mini_racer (~> 0.1.15)
179
opal (>= 0.11.0, < 0.12.0)
@@ -21,37 +13,48 @@ PATH
2113
PATH
2214
remote: ../hyper-operation
2315
specs:
24-
hyper-operation (1.0.0.lap28)
16+
hyper-operation (0.1)
2517
activerecord (>= 4.0.0)
26-
hyper-component (= 1.0.0.lap28)
18+
hyper-component (= 0.1)
2719
mutations
2820
opal-activesupport (~> 0.3.1)
2921

22+
PATH
23+
remote: ../hyper-state
24+
specs:
25+
hyper-state (0.1)
26+
hyperstack-config (= 0.1)
27+
opal (>= 0.11.0, < 0.12.0)
28+
3029
PATH
3130
remote: ../hyper-store
3231
specs:
33-
hyper-store (1.0.0.lap28)
34-
hyperloop-config (= 1.0.0.lap28)
32+
hyper-store (0.1)
33+
hyper-state (= 0.1)
34+
hyperstack-config (= 0.1)
3535
opal (>= 0.11.0, < 0.12.0)
3636

3737
PATH
38-
remote: ../hyperloop-config
38+
remote: ../hyperstack-config
3939
specs:
40-
hyperloop-config (1.0.0.lap28)
40+
hyperstack-config (0.1)
4141
libv8 (~> 6.3.0)
42+
listen (~> 3.0)
4243
mini_racer (~> 0.1.15)
4344
opal (>= 0.11.0, < 0.12.0)
4445
opal-browser (~> 0.2.0)
4546
uglifier
47+
websocket
4648

4749
PATH
4850
remote: .
4951
specs:
50-
hyper-model (1.0.0.lap28)
52+
hyper-model (0.1)
5153
activemodel
5254
activerecord (>= 4.0.0)
53-
hyper-component (= 1.0.0.lap28)
54-
hyper-operation (= 1.0.0.lap28)
55+
hyper-component (= 0.1)
56+
hyper-operation (= 0.1)
57+
hyper-store (= 0.1)
5558

5659
GEM
5760
remote: https://rubygems.org/
@@ -161,19 +164,6 @@ GEM
161164
hike (1.2.3)
162165
http_parser.rb (0.6.0)
163166
httpclient (2.8.3)
164-
hyper-spec (1.0.0.lap28)
165-
capybara
166-
chromedriver-helper
167-
method_source
168-
opal (>= 0.11.0, < 0.12.0)
169-
parser (>= 2.3.3.1)
170-
pry
171-
rspec-rails
172-
selenium-webdriver
173-
timecop (~> 0.8.1)
174-
uglifier
175-
unparser
176-
webdrivers
177167
i18n (1.1.0)
178168
concurrent-ruby (~> 1.0)
179169
ice_nine (0.11.2)
@@ -184,6 +174,10 @@ GEM
184174
railties (>= 4.2.0)
185175
thor (>= 0.14, < 2.0)
186176
libv8 (6.3.292.48.1)
177+
listen (3.1.5)
178+
rb-fsevent (~> 0.9, >= 0.9.4)
179+
rb-inotify (~> 0.9, >= 0.9.7)
180+
ruby_dep (~> 1.2)
187181
loofah (2.2.2)
188182
crass (~> 1.0.2)
189183
nokogiri (>= 1.5.9)
@@ -217,6 +211,8 @@ GEM
217211
opal-browser (0.2.0)
218212
opal
219213
paggio
214+
opal-jquery (0.4.3)
215+
opal (>= 0.10.0, < 0.12.0)
220216
opal-rails (0.9.5)
221217
jquery-rails
222218
opal (>= 0.11.0, < 0.12)
@@ -283,6 +279,9 @@ GEM
283279
rainbow (2.2.2)
284280
rake
285281
rake (12.3.1)
282+
rb-fsevent (0.10.3)
283+
rb-inotify (0.9.10)
284+
ffi (>= 0.5.0, < 2)
286285
react-rails (2.4.7)
287286
babel-transpiler (>= 0.7.0)
288287
connection_pool
@@ -329,6 +328,7 @@ GEM
329328
ruby-progressbar (~> 1.7)
330329
unicode-display_width (~> 1.0, >= 1.0.1)
331330
ruby-progressbar (1.10.0)
331+
ruby_dep (1.5.0)
332332
rubyzip (1.2.2)
333333
selenium-webdriver (3.14.0)
334334
childprocess (~> 0.5)
@@ -373,10 +373,7 @@ GEM
373373
equalizer (~> 0.0.9)
374374
parser (>= 2.3.1.2, < 2.6)
375375
procto (~> 0.0.2)
376-
webdrivers (3.4.0)
377-
nokogiri (~> 1.6)
378-
rubyzip (~> 1.0)
379-
selenium-webdriver (~> 3.0)
376+
websocket (1.2.8)
380377
websocket-driver (0.7.0)
381378
websocket-extensions (>= 0.1.0)
382379
websocket-extensions (0.1.3)
@@ -395,13 +392,14 @@ DEPENDENCIES
395392
hyper-component!
396393
hyper-model!
397394
hyper-operation!
398-
hyper-spec (= 1.0.0.lap28)
395+
hyper-state!
399396
hyper-store!
400-
hyperloop-config!
397+
hyperstack-config!
398+
libv8 (~> 6.3.0)
399+
mini_racer (~> 0.1.15)
401400
mysql2
402401
opal-activesupport (~> 0.3.1)
403402
opal-browser (~> 0.2.0)
404-
opal-jquery!
405403
opal-rails (~> 0.9.4)
406404
parser
407405
pry
@@ -421,6 +419,7 @@ DEPENDENCIES
421419
rspec-steps (~> 2.1.1)
422420
rspec-wait
423421
rubocop (~> 0.51.0)
422+
selenium-webdriver
424423
shoulda
425424
shoulda-matchers
426425
spring-commands-rspec

ruby/hyper-model/hyper-model.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Gem::Specification.new do |spec|
1313
'API. HyperModel also implements push notifications (via a number of '\
1414
'possible technologies) so changes to records on the server are '\
1515
'dynamically updated on all authorised clients.'
16-
spec.homepage = 'http://ruby-hyperloop.org'
16+
spec.homepage = 'http://ruby-hyperstack.org'
1717
spec.license = 'MIT'
1818
# spec.metadata = {
19-
# "homepage_uri" => 'http://ruby-hyperloop.org',
20-
# "source_code_uri" => 'https://github.com/ruby-hyperloop/hyper-component'
19+
# "homepage_uri" => 'http://ruby-hyperstack.org',
20+
# "source_code_uri" => 'https://github.com/ruby-hyperstack/hyper-component'
2121
# }
2222

2323
spec.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(examples|gemfiles|pkg|reactive_record_test_app|spec)/}) }
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
2929
spec.add_dependency 'activerecord', '>= 4.0.0'
3030
spec.add_dependency 'hyper-component', HyperModel::VERSION
3131
spec.add_dependency 'hyper-operation', HyperModel::VERSION
32+
spec.add_dependency 'hyper-store', HyperModel::VERSION # only for Hyperstack::Internal::Store::State which should be moved
3233
spec.add_development_dependency 'bundler'
3334
spec.add_development_dependency 'capybara'
3435
spec.add_development_dependency 'chromedriver-helper', '1.2.0'

ruby/hyper-model/lib/active_record_base.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Monkey patches to ActiveRecord for scoping, security, and to synchronize models
22
module ActiveRecord
3-
# hyperloop adds new features to scopes to allow for computing scopes on client side
3+
# hyperstack adds new features to scopes to allow for computing scopes on client side
44
# and for hinting at what joins are involved in a scope. _synchromesh_scope_args_check
55
# processes these arguments, and the will always leave the true server side scoping
66
# proc in the `:server` opts. This method is common to client and server.
@@ -43,7 +43,7 @@ def __secure_collection_check(acting_user)
4343
return self if __synchromesh_permission_granted
4444
return self if __secure_remote_access_to_all(self, acting_user).__synchromesh_permission_granted
4545
return self if __secure_remote_access_to_unscoped(self, acting_user).__synchromesh_permission_granted
46-
Hyperloop::InternalPolicy.raise_operation_access_violation(:scoped_permission_not_granted, "Last relation: #{self}, acting_user: #{acting_user}")
46+
Hyperstack::InternalPolicy.raise_operation_access_violation(:scoped_permission_not_granted, "Last relation: #{self}, acting_user: #{acting_user}")
4747
end
4848
end
4949
# Monkey patches and extensions to base
@@ -53,11 +53,11 @@ class << self
5353
# __secure_remote_access_to_
5454

5555
# The wrapper method may simply return the normal result or may act to secure the data.
56-
# The simpliest case is for the method to call `denied!` which will raise a Hyperloop
56+
# The simpliest case is for the method to call `denied!` which will raise a Hyperstack
5757
# access protection fault.
5858

5959
def denied!
60-
Hyperloop::InternalPolicy.raise_operation_access_violation(:scoped_denied, "#{self} regulation denies scope access. Called from #{caller_locations(1)}")
60+
Hyperstack::InternalPolicy.raise_operation_access_violation(:scoped_denied, "#{self} regulation denies scope access. Called from #{caller_locations(1)}")
6161
end
6262

6363
# Here we set up the base `all` and `unscoped` methods. See below for more on how
@@ -199,7 +199,7 @@ def regulate_default_scope(*args, &block)
199199
regulate_scope(:all, &block)
200200
end
201201

202-
# monkey patch scope and default_scope macros to process hyperloop special opts,
202+
# monkey patch scope and default_scope macros to process hyperstack special opts,
203203
# and add regulations if present
204204

205205
alias pre_synchromesh_scope scope
@@ -276,7 +276,7 @@ def __secure_remote_access_to_find_by(_self, _acting_user, *args)
276276
end
277277

278278
def denied!
279-
Hyperloop::InternalPolicy.raise_operation_access_violation(:scoped_denied, "#{self.class} regulation denies scope access. Called from #{caller_locations(1)}")
279+
Hyperstack::InternalPolicy.raise_operation_access_violation(:scoped_denied, "#{self.class} regulation denies scope access. Called from #{caller_locations(1)}")
280280
end
281281

282282
# call do_not_synchronize to block synchronization of a model
@@ -314,9 +314,9 @@ def synchromesh_after_destroy
314314
ReactiveRecord::Broadcast.after_commit :destroy, self
315315
end
316316

317-
def __hyperloop_secure_attributes(acting_user)
317+
def __hyperstack_secure_attributes(acting_user)
318318
accessible_attributes =
319-
Hyperloop::InternalPolicy.accessible_attributes_for(self, acting_user)
319+
Hyperstack::InternalPolicy.accessible_attributes_for(self, acting_user)
320320
attributes.select { |attr| accessible_attributes.include? attr.to_sym }
321321
end
322322

ruby/hyper-model/lib/hyper-model.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'set'
2-
require 'hyperloop-config'
2+
require 'hyperstack-config'
33
require 'hyper-component'
44
if RUBY_ENGINE == 'opal'
55
require 'hyper-operation'
@@ -9,6 +9,8 @@
99
require 'kernel/itself' unless Object.instance_methods.include?(:itself)
1010
require 'object/tap'
1111
require 'active_model_client_stubs'
12+
require 'hyper-state'
13+
require 'hyper-store'
1214
require "reactive_record/active_record_error"
1315
require "reactive_record/active_record/errors"
1416
require "reactive_record/active_record/error"
@@ -36,14 +38,14 @@
3638
require "reactive_record/active_record/instance_methods"
3739
require "reactive_record/active_record/base"
3840
require 'hyper_react/input_tags'
39-
require 'hyperloop/model/load'
41+
require 'hyperstack/model/load'
4042
require_relative 'hyper_model/version'
4143
require_relative 'opal/parse_patch'
4244
require_relative 'opal/set_patches'
4345
require_relative 'opal/equality_patches'
44-
React::IsomorphicHelpers.log(
46+
Hyperstack::Component::IsomorphicHelpers.log(
4547
"The gem 'hyper-mesh' is deprecated. Use gem 'hyper-model' instead.", :warning
46-
) unless defined? Hyperloop::Model
48+
) unless defined? Hyperstack::Model
4749
else
4850
require 'opal'
4951
require 'hyper-operation'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module HyperModel
2-
VERSION = '0.99.3'
2+
VERSION = '0.1'
33
end

ruby/hyper-model/lib/hyper_react/input_tags.rb

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,43 @@
77
# flag then we know that within that expression there is a value still being loaded, and the react
88
# key will be set accordingly.
99

10-
module React
11-
module Component
12-
module Tags
13-
%i[INPUT SELECT TEXTAREA].each do |component|
14-
remove_method component
15-
send(:remove_const, component)
16-
tag = component.downcase
17-
klass = Class.new(Hyperloop::Component) do
18-
collect_other_params_as :opts
19-
render do
20-
opts = props.dup # should be opts = params.opts.dup but requires next release candiate of hyper-react
21-
default_value = opts[:defaultValue] || opts[:defaultChecked]
22-
if default_value.respond_to? :call
23-
begin
24-
saved_waiting_on_resources = React::RenderingContext.waiting_on_resources
25-
React::RenderingContext.waiting_on_resources = false
26-
default_value = default_value.call
27-
opts[:key] = React::RenderingContext.waiting_on_resources
28-
if opts[:defaultValue]
29-
opts[:defaultValue] = default_value
30-
else
31-
opts[:defaultChecked] = default_value
10+
module Hyperstack
11+
module Internal
12+
module Component
13+
module Tags
14+
%i[INPUT SELECT TEXTAREA].each do |component|
15+
remove_method component
16+
send(:remove_const, component)
17+
tag = component.downcase
18+
klass = Class.new do
19+
include Hyperstack::Component
20+
collect_other_params_as :opts
21+
render do
22+
opts = props.dup # should be opts = params.opts.dup but requires next release candiate of hyper-react
23+
default_value = opts[:defaultValue] || opts[:defaultChecked]
24+
if default_value.respond_to? :call
25+
begin
26+
saved_waiting_on_resources = Hyperstack::Internal::Component::RenderingContext.waiting_on_resources
27+
Hyperstack::Internal::Component::RenderingContext.waiting_on_resources = false
28+
default_value = default_value.call
29+
opts[:key] = Hyperstack::Internal::Component::RenderingContext.waiting_on_resources
30+
if opts[:defaultValue]
31+
opts[:defaultValue] = default_value
32+
else
33+
opts[:defaultChecked] = default_value
34+
end
35+
ensure
36+
Hyperstack::Internal::Component::RenderingContext.waiting_on_resources = !!saved_waiting_on_resources
3237
end
33-
ensure
34-
React::RenderingContext.waiting_on_resources = !!saved_waiting_on_resources
38+
else
39+
opts[:key] = !!default_value.loading?
3540
end
36-
else
37-
opts[:key] = !!default_value.loading?
41+
opts[:value] = opts[:value].to_s if opts.key? :value # this may not be needed
42+
Hyperstack::Internal::Component::RenderingContext.render(tag, opts) { children.each(&:render) }
3843
end
39-
opts[:value] = opts[:value].to_s if opts.key? :value # this may not be needed
40-
React::RenderingContext.render(tag, opts) { children.each(&:render) }
4144
end
45+
const_set component, klass
4246
end
43-
const_set component, klass
4447
end
4548
end
4649
end

ruby/hyper-model/lib/hyperloop/model/load.rb renamed to ruby/hyper-model/lib/hyperstack/model/load.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Hyperloop
1+
module Hyperstack
22
module Model
33
def self.load(&block)
44
ReactiveRecord.load(&block)

0 commit comments

Comments
 (0)