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

Commit 6141e25

Browse files
committed
synchromesh tests passing
1 parent 2c35682 commit 6141e25

File tree

5,676 files changed

+494001
-21
lines changed

Some content is hidden

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

5,676 files changed

+494001
-21
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ReactiveRecord
2+
class ApplicationController < ActionController::Base
3+
end
4+
end
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
require 'reactive_record/server_data_cache'
2+
3+
module ReactiveRecord
4+
5+
class ReactiveRecordController < ::ApplicationController
6+
7+
def fetch
8+
render :json => ReactiveRecord::ServerDataCache[
9+
(json_params[:models] || []).map(&:with_indifferent_access),
10+
(json_params[:associations] || []).map(&:with_indifferent_access),
11+
json_params[:pending_fetches],
12+
acting_user
13+
]
14+
rescue Exception => e
15+
render json: {error: e.message, backtrace: e.backtrace}, status: 500
16+
end
17+
18+
def save
19+
render :json => ReactiveRecord::Base.save_records(
20+
(json_params[:models] || []).map(&:with_indifferent_access),
21+
(json_params[:associations] || []).map(&:with_indifferent_access),
22+
acting_user,
23+
json_params[:validate],
24+
true
25+
)
26+
rescue Exception => e
27+
render json: {error: e.message, backtrace: e.backtrace}, status: 500
28+
end
29+
30+
def destroy
31+
render :json => ReactiveRecord::Base.destroy_record(
32+
json_params[:model],
33+
json_params[:id],
34+
json_params[:vector],
35+
acting_user
36+
)
37+
rescue Exception => e
38+
render json: {error: e.message, backtrace: e.backtrace}, status: 500
39+
end
40+
41+
private
42+
43+
def json_params
44+
JSON.parse(params[:json]).symbolize_keys
45+
end
46+
47+
end
48+
49+
end

config/routes.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ReactiveRecord::Engine.routes.draw do
2+
root :to => "reactive_record#fetch", via: :post
3+
match 'save', to: 'reactive_record#save', via: :post
4+
match 'destroy', to: 'reactive_record#destroy', via: :post
5+
match 'syncromesh-subscribe', to: 'syncromesh#subscribe', via: :get
6+
match 'syncromesh-read/:subscriber', to: 'syncromesh#read', via: :get
7+
end

examples/simple-poller/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore the default SQLite database.
11+
/db/*.sqlite3
12+
/db/*.sqlite3-journal
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore Byebug command history file.
21+
.byebug_history

examples/simple-poller/Gemfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
source 'https://rubygems.org'
2+
3+
4+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5+
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
6+
# Use sqlite3 as the database for Active Record
7+
gem 'sqlite3'
8+
# Use Puma as the app server
9+
gem 'puma', '~> 3.0'
10+
# Use SCSS for stylesheets
11+
gem 'sass-rails', '~> 5.0'
12+
# Use Uglifier as compressor for JavaScript assets
13+
gem 'uglifier', '>= 1.3.0'
14+
# Use CoffeeScript for .coffee assets and views
15+
gem 'coffee-rails', '~> 4.2'
16+
# See https://github.com/rails/execjs#readme for more supported runtimes
17+
# gem 'therubyracer', platforms: :ruby
18+
19+
# Use jquery as the JavaScript library
20+
gem 'jquery-rails'
21+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
22+
gem 'turbolinks', '~> 5'
23+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24+
gem 'jbuilder', '~> 2.5'
25+
# Use Redis adapter to run Action Cable in production
26+
# gem 'redis', '~> 3.0'
27+
# Use ActiveModel has_secure_password
28+
# gem 'bcrypt', '~> 3.1.7'
29+
30+
# Use Capistrano for deployment
31+
# gem 'capistrano-rails', group: :development
32+
gem 'synchromesh', path: '../..' #git: 'https://github.com/reactrb/synchromesh', branch: 'authorization-policies'
33+
#gem 'pusher'
34+
#gem 'pusher-fake'
35+
36+
group :development, :test do
37+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
38+
gem 'byebug', platform: :mri
39+
end
40+
41+
group :development do
42+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
43+
gem 'web-console'
44+
gem 'listen', '~> 3.0.5'
45+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
46+
gem 'spring'
47+
gem 'spring-watcher-listen', '~> 2.0.0'
48+
gem 'reactrb-rails-generator'
49+
gem 'pry-rescue'
50+
gem 'hyper-trace', path: '../../../hyper-trace'
51+
end
52+
53+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
54+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
55+
56+
gem 'reactrb'
57+
gem 'react-rails', '>= 1.3.0'
58+
gem 'opal-rails', '>= 0.8.1'
59+
gem 'therubyracer', platforms: :ruby
60+
gem 'react-router-rails', '~> 0.13.3'
61+
gem 'reactrb-router'
62+
gem 'reactive-record', '>= 0.8.0'
63+
gem 'pusher'
64+
gem 'moneta'

0 commit comments

Comments
 (0)