rhoconnect 4.0.0.beta.12 → 4.0.0.beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +34 -0
- data/Gemfile +5 -8
- data/Gemfile.lock +34 -32
- data/Rakefile +2 -12
- data/bench/run_bench.sh +1 -1
- data/bench/spec/bench_spec_helper.rb +3 -5
- data/bin/rhoconnect +20 -13
- data/commands/dtach/dtach_install.rb +3 -3
- data/commands/generators/update.rb +1 -0
- data/commands/parser.rb +180 -0
- data/commands/rhoconnect/config.rb +8 -4
- data/commands/rhoconnect/get_token.rb +3 -1
- data/commands/rhoconnect/routes.rb +34 -0
- data/commands/rhoconnect/secret.rb +1 -1
- data/commands/rhoconnect/set_admin_password.rb +2 -1
- data/commands/rhoconnect/startbg.rb +4 -4
- data/commands/rhoconnect/stop.rb +2 -2
- data/commands/rhoconnect_console/console.rb +6 -6
- data/commands/rhoconnect_spec/spec.rb +2 -1
- data/commands/rhoconnect_war/war.rb +1 -0
- data/commands/utilities/redis_runner.rb +2 -2
- data/doc/data-partitioning.txt +20 -7
- data/doc/extending-rhoconnect-server.txt +36 -7
- data/doc/push-client-setup-rps.txt +3 -3
- data/doc/source-adapters-js.txt +41 -4
- data/doc/source-adapters.txt +3 -0
- data/generators/templates/application/rcgemfile +1 -5
- data/generators/templates/application/spec/spec_helper.rb +0 -9
- data/generators/templates/source/models/js/model.js +8 -0
- data/generators/templates/source/models/ruby/model.rb +5 -11
- data/install.sh +2 -2
- data/installer/unix-like/rho_connect_install_constants.rb +3 -3
- data/installer/utils/delete_from_s3.rb +3 -6
- data/installer/utils/download_from_s3.rb +5 -9
- data/installer/utils/verify_checksum.rb +16 -11
- data/js-adapters/ballroom.js +9 -0
- data/js-adapters/exceptions.js +60 -0
- data/js-adapters/node.rb +14 -5
- data/js-adapters/node_channel.rb +68 -48
- data/js-adapters/rhoconnect_helpers.js +8 -2
- data/js-adapters/router.js +16 -14
- data/lib/rhoconnect.rb +5 -5
- data/lib/rhoconnect/client.rb +2 -2
- data/lib/rhoconnect/condition/add_parameter.rb +21 -0
- data/lib/rhoconnect/controller/clients_controller.rb +1 -1
- data/lib/rhoconnect/controller/js_base.rb +1 -2
- data/lib/rhoconnect/controller/system_controller.rb +33 -10
- data/lib/rhoconnect/db_adapter.rb +1 -1
- data/lib/rhoconnect/document.rb +11 -3
- data/lib/rhoconnect/handler/changes.rb +20 -19
- data/lib/rhoconnect/handler/changes/engine.rb +48 -25
- data/lib/rhoconnect/handler/changes/hooks.rb +36 -0
- data/lib/rhoconnect/handler/changes/runner.rb +12 -2
- data/lib/rhoconnect/handler/helpers.rb +4 -4
- data/lib/rhoconnect/jobs/source_job.rb +1 -1
- data/lib/rhoconnect/model/base.rb +32 -8
- data/lib/rhoconnect/model/helpers.rb +15 -0
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +85 -0
- data/lib/rhoconnect/model/js_base.rb +23 -28
- data/lib/rhoconnect/server.rb +23 -18
- data/lib/rhoconnect/source.rb +10 -17
- data/lib/rhoconnect/store.rb +36 -57
- data/lib/rhoconnect/test_methods.rb +5 -4
- data/lib/rhoconnect/utilities.rb +7 -5
- data/lib/rhoconnect/version.rb +2 -2
- data/lib/rhoconnect/web-console/server.rb +17 -16
- data/rhoconnect.gemspec +23 -24
- data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +4 -0
- data/spec/apps/rhotestapp/models/js/js_sample.js +36 -0
- data/spec/apps/rhotestapp/models/ruby/sample_adapter.rb +34 -19
- data/spec/async_spec.rb +1 -1
- data/spec/cli/cli_spec.rb +69 -31
- data/spec/client_sync_spec.rb +30 -13
- data/spec/controllers/js_base_spec.rb +10 -4
- data/spec/jobs/source_job_spec.rb +1 -1
- data/spec/models/{js_model_spec.rb → js_base_spec.rb} +63 -13
- data/spec/server/server_spec.rb +20 -0
- data/spec/server/stats_spec.rb +7 -17
- data/spec/source_adapter_spec.rb +6 -0
- data/spec/source_sync_spec.rb +219 -54
- data/spec/spec_helper.rb +8 -13
- data/spec/store_spec.rb +6 -4
- data/spec/test_methods_spec.rb +4 -4
- metadata +14 -27
- data/commands/execute.rb +0 -48
- data/commands/utilities/utilities.rb +0 -6
- data/generators/templates/application/controllers/application_controller.rb +0 -17
- data/lib/rhoconnect/js_adapter.rb +0 -79
data/lib/rhoconnect/store.rb
CHANGED
@@ -240,7 +240,7 @@ module Rhoconnect
|
|
240
240
|
end
|
241
241
|
|
242
242
|
|
243
|
-
def put_zdata(dockey,assoc_key,data=
|
243
|
+
def put_zdata(dockey,assoc_key,data=[],append=false)
|
244
244
|
get_store(0).put_zdata(dockey, assoc_key, data, append)
|
245
245
|
end
|
246
246
|
|
@@ -774,18 +774,25 @@ module Rhoconnect
|
|
774
774
|
end
|
775
775
|
end
|
776
776
|
|
777
|
-
def put_zdata(dockey,assoc_key,data=
|
777
|
+
def put_zdata(dockey,assoc_key,data=[],append=false)
|
778
778
|
return true unless (dockey and assoc_key and data)
|
779
779
|
flush_zdata(dockey) unless append
|
780
780
|
current_score = 0
|
781
781
|
current_score_data = @db.zrevrange(dockey,0,0,:with_scores => true)
|
782
782
|
current_score = current_score_data[-1][1].to_i if current_score_data and current_score_data[-1]
|
783
783
|
current_score += 1
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
784
|
+
|
785
|
+
data.each_with_index do |source_queue_entry, source_entry_index|
|
786
|
+
source_id = source_queue_entry[0]
|
787
|
+
source_id_with_index = "#{source_id}:#{source_entry_index}"
|
788
|
+
source_entry_data = source_queue_entry[1]
|
789
|
+
source_entry_docname = setelement(current_score,assoc_key, source_id_with_index)
|
790
|
+
source_entry_data.each_with_index do |obj_entry, obj_index|
|
791
|
+
obj_key_with_index = "#{obj_index}_#{obj_entry[0]}"
|
792
|
+
put_data("#{dockey}:#{source_entry_docname}",{obj_key_with_index => obj_entry[1]},true)
|
793
|
+
end if source_entry_data
|
794
|
+
@db.zadd(dockey, current_score, source_entry_docname)
|
795
|
+
end if data
|
789
796
|
true
|
790
797
|
end
|
791
798
|
|
@@ -793,29 +800,34 @@ module Rhoconnect
|
|
793
800
|
def get_zdata(dockey)
|
794
801
|
data = @db.zrange(dockey, 0, -1)
|
795
802
|
ret = []
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
keys << key
|
805
|
-
scores << score
|
806
|
-
else
|
807
|
-
ret[-1].merge!(obj_hash)
|
808
|
-
end
|
803
|
+
assoc_keys = []
|
804
|
+
scores = []
|
805
|
+
data.each do |zsetkey|
|
806
|
+
obj_entries = []
|
807
|
+
obj_hash = get_data "#{dockey}:#{zsetkey}"
|
808
|
+
obj_hash.each do |obj_key_with_index, objdata|
|
809
|
+
index,objkey = obj_key_with_index.split('_', 2)
|
810
|
+
obj_entries[index.to_i] = [objkey, objdata]
|
809
811
|
end
|
810
|
-
|
811
|
-
|
812
|
+
score,assoc_key,source_id_with_index = getelement(zsetkey)
|
813
|
+
source_id, source_index = source_id_with_index.split(':', 2)
|
814
|
+
|
815
|
+
if scores[-1] != score
|
816
|
+
ret << [[source_id, obj_entries]]
|
817
|
+
assoc_keys << assoc_key
|
818
|
+
scores << score
|
819
|
+
else
|
820
|
+
ret[-1] << [source_id, obj_entries]
|
821
|
+
end
|
822
|
+
end if data
|
823
|
+
[ret, assoc_keys]
|
812
824
|
end
|
813
825
|
|
814
826
|
# Deletes all keys and their hashes from the Redis DB
|
815
827
|
def flush_zdata(dockey)
|
816
828
|
data = @db.zrange(dockey, 0, -1)
|
817
|
-
data.each do |
|
818
|
-
_delete_doc("#{dockey}:#{
|
829
|
+
data.each do |zsetkey|
|
830
|
+
_delete_doc("#{dockey}:#{zsetkey}")
|
819
831
|
end
|
820
832
|
@db.zremrangebyrank(dockey, 0, -1)
|
821
833
|
end
|
@@ -859,7 +871,6 @@ module Rhoconnect
|
|
859
871
|
|
860
872
|
private
|
861
873
|
|
862
|
-
if RUBY_VERSION =~ /1.9/
|
863
874
|
def _get_redis(server=nil)
|
864
875
|
url = ENV[REDIS_URL] || ENV[REDISTOGO_URL] || nil
|
865
876
|
if url
|
@@ -882,23 +893,6 @@ if RUBY_VERSION =~ /1.9/
|
|
882
893
|
end
|
883
894
|
end
|
884
895
|
end
|
885
|
-
else # Ruby 1.8 does not support Connnection Pools
|
886
|
-
def _get_redis(server=nil)
|
887
|
-
url = ENV[REDIS_URL] || ENV[REDISTOGO_URL] || nil
|
888
|
-
if url
|
889
|
-
Redis.connect(:url => url, :timeout => Rhoconnect.redis_timeout, :thread_safe => true)
|
890
|
-
elsif server and server.is_a?(String)
|
891
|
-
host,port,db,password = server.split(':')
|
892
|
-
Redis.connect(:thread_safe => true, :host => host,
|
893
|
-
:port => port, :db => db, :password => password, :timeout => Rhoconnect.redis_timeout)
|
894
|
-
elsif server and (server.is_a?(Redis) or server.is_a?(ConnectionPool::Wrapper))
|
895
|
-
server
|
896
|
-
else
|
897
|
-
Redis.connect(:timeout => 30, :thread_safe => true)
|
898
|
-
end
|
899
|
-
end
|
900
|
-
end # end of if RUBY_VERSION
|
901
|
-
|
902
896
|
|
903
897
|
def _lock_key(dockey)
|
904
898
|
"lock:#{dockey}"
|
@@ -1063,22 +1057,8 @@ end # end of if RUBY_VERSION
|
|
1063
1057
|
end
|
1064
1058
|
|
1065
1059
|
# Set Obj Element MUST ensure the order of attribs
|
1066
|
-
# In 1.8.7 Hash keys are not-sorted - therefore
|
1067
|
-
# to ensure same order - we sort them before storing
|
1068
|
-
if RUBY_VERSION =~ /1.8/
|
1069
|
-
def set_obj_element(key, obj)
|
1070
|
-
return unless (key and key.size > 0 and obj and obj.size > 0)
|
1071
|
-
elem = "#{key}"
|
1072
|
-
obj.sort.each do |attrib, value|
|
1073
|
-
unless _is_reserved?(attrib,value)
|
1074
|
-
elem += ":^rho&:#{attrib}:#{value}"
|
1075
|
-
end
|
1076
|
-
end
|
1077
|
-
elem
|
1078
|
-
end
|
1079
1060
|
# in Ruby 1.9.x Hash keys are sorted (always in the same order), so
|
1080
1061
|
# we do not need to do redundant sorting
|
1081
|
-
else
|
1082
1062
|
def set_obj_element(key, obj)
|
1083
1063
|
return unless (key and key.size > 0 and obj and obj.size > 0)
|
1084
1064
|
elem = "#{key}"
|
@@ -1089,6 +1069,5 @@ else
|
|
1089
1069
|
end
|
1090
1070
|
elem
|
1091
1071
|
end
|
1092
|
-
end # if Ruby 1.8
|
1093
1072
|
end
|
1094
1073
|
end
|
@@ -29,9 +29,10 @@ module Rhoconnect
|
|
29
29
|
handler_sync = lambda { @model.query(params[:query])}
|
30
30
|
@query_engine = Rhoconnect::Handler::Query::Engine.new(@model, handler_sync, {})
|
31
31
|
handler_cud = lambda { @model.send params[:operation].to_sym, params["#{params[:operation]}_object".to_sym] }
|
32
|
-
@cud_engine = Rhoconnect::Handler::Changes::Engine.new(['create', 'update', 'delete'], @model, handler_cud, {})
|
32
|
+
@cud_engine = Rhoconnect::Handler::Changes::Engine.new(['create', 'update', 'delete'], @model, handler_cud, {:queue_key => 'post:/'})
|
33
33
|
handler_search = lambda { @model.search(params[:search]) }
|
34
34
|
@search_engine = Rhoconnect::Handler::Search::Engine.new(@model, @c, handler_search, {})
|
35
|
+
Source.define_valid_queues(["create:post:/", "update:post:/", "delete:post:/"])
|
35
36
|
end
|
36
37
|
|
37
38
|
# Executes the adapter's query method and returns
|
@@ -163,7 +164,7 @@ module Rhoconnect
|
|
163
164
|
@cud_engine.params = {'create'=> {'temp-id' => record}}
|
164
165
|
@cud_engine.do_pass_through_cud
|
165
166
|
else
|
166
|
-
@s.push_queue(:
|
167
|
+
@s.push_queue("create:post:/",@c.id,[[@s.name,[['temp-id', record]]]],true)
|
167
168
|
@cud_engine.do_cud
|
168
169
|
links = @c.get_data(:create_links)['temp-id']
|
169
170
|
links ? links['l'] : nil
|
@@ -193,7 +194,7 @@ module Rhoconnect
|
|
193
194
|
@cud_engine.params = {'update'=> record }
|
194
195
|
@cud_engine.do_pass_through_cud
|
195
196
|
else
|
196
|
-
@s.push_queue(:
|
197
|
+
@s.push_queue("update:post:/",@c.id,[[@s.name,record.to_a]],true)
|
197
198
|
@cud_engine.do_cud
|
198
199
|
end
|
199
200
|
end
|
@@ -227,7 +228,7 @@ module Rhoconnect
|
|
227
228
|
@cud_engine.params = {'delete'=> record }
|
228
229
|
@cud_engine.do_pass_through_cud
|
229
230
|
else
|
230
|
-
@s.push_queue(:
|
231
|
+
@s.push_queue("delete:post:/",@c.id,[[@s.name, record.to_a]],true)
|
231
232
|
@cud_engine.do_cud
|
232
233
|
end
|
233
234
|
end
|
data/lib/rhoconnect/utilities.rb
CHANGED
@@ -110,11 +110,13 @@ EOF
|
|
110
110
|
exit 1
|
111
111
|
end
|
112
112
|
|
113
|
-
# def jetty_rackup?
|
114
|
-
# 'jruby -S jetty-rackup'
|
115
|
-
# end
|
116
|
-
|
117
113
|
def trinidad?
|
118
114
|
'bundle exec jruby -S trinidad'
|
119
115
|
end
|
120
|
-
|
116
|
+
|
117
|
+
def dtach_installed?
|
118
|
+
return false if windows? # n/a on windows
|
119
|
+
`which dtach` != ''
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
data/lib/rhoconnect/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Rhoconnect
|
2
|
-
VERSION = '4.0.0.beta.
|
3
|
-
end
|
2
|
+
VERSION = '4.0.0.beta.24'
|
3
|
+
end
|
@@ -3,27 +3,28 @@ require 'erb'
|
|
3
3
|
require 'json'
|
4
4
|
require 'rhoconnect/graph_helper'
|
5
5
|
|
6
|
-
module RhoconnectConsole
|
6
|
+
module RhoconnectConsole
|
7
7
|
class << self
|
8
8
|
ROOT_DIR = File.dirname(File.expand_path(__FILE__)) unless defined? ROOT_DIR
|
9
9
|
def root_path(*args)
|
10
10
|
File.join(ROOT_DIR, *args)
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
13
13
|
|
14
14
|
class Server < Sinatra::Base
|
15
15
|
set :views, RhoconnectConsole.root_path('templates')
|
16
16
|
set :public_folder, RhoconnectConsole.root_path
|
17
|
-
set :static, true
|
18
|
-
use Rack::Session::Cookie
|
17
|
+
set :static, true
|
18
|
+
use Rack::Session::Cookie, :key => 'rhoconnect.console',
|
19
|
+
:secret => SecureRandom.hex(64)
|
19
20
|
HEROKU_NAV = ENV['INSTANCE_ID'] ? RestClient.get('http://nav.heroku.com/v1/providers/header') : nil
|
20
21
|
before do
|
21
22
|
headers['Expires'] = 'Sun, 19 Nov 1978 05:00:00 GMT'
|
22
|
-
headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'
|
23
|
+
headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'
|
23
24
|
headers['Pragma'] = 'no-cache'
|
24
25
|
end
|
25
26
|
include GraphHelper
|
26
|
-
|
27
|
+
|
27
28
|
get '/' do
|
28
29
|
#if heroku instance single sign will already have logged in a have token in session
|
29
30
|
@token = session[:token] if ENV['INSTANCE_ID']
|
@@ -33,17 +34,17 @@ module RhoconnectConsole
|
|
33
34
|
@domain += "/application" if @domain and !ENV['RHODES_URL']
|
34
35
|
erb :index
|
35
36
|
end
|
36
|
-
|
37
|
+
|
37
38
|
get "/heroku/resources/:id" do
|
38
39
|
begin
|
39
40
|
# check heroku addon started app
|
40
41
|
halt 403 unless ENV['INSTANCE_ID'] == params[:id] && params[:token] == ENV['API_TOKEN']
|
41
42
|
# rhoconnect authentication
|
42
|
-
session[:login] = 'rhoadmin'
|
43
|
+
session[:login] = 'rhoadmin'
|
43
44
|
session[:token] = User.load(session[:login]).token.value
|
44
45
|
rescue Exception => e
|
45
46
|
session[:token] = nil
|
46
|
-
halt 403
|
47
|
+
halt 403
|
47
48
|
end
|
48
49
|
response.set_cookie('heroku-nav-data', :value => params[:nav], :path => '/')
|
49
50
|
redirect '/'
|
@@ -60,7 +61,7 @@ module RhoconnectConsole
|
|
60
61
|
post '/http_timing' do
|
61
62
|
http_timing(params)
|
62
63
|
end
|
63
|
-
|
64
|
+
|
64
65
|
post '/http_timing_key' do
|
65
66
|
http_timing_key(params)
|
66
67
|
end
|
@@ -68,16 +69,16 @@ module RhoconnectConsole
|
|
68
69
|
post '/device_count' do
|
69
70
|
count_graph('timing/devicecount', "Device Count", "Devices", "clients")
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
get '/get_sources' do
|
73
74
|
sources = App.load(APP_NAME).sources
|
74
75
|
sources.to_json
|
75
76
|
end
|
76
|
-
|
77
|
+
|
77
78
|
get '/get_http_routes' do
|
78
79
|
# keys = get_user_count("http:*:*")
|
79
80
|
# sources = get_sources('all')
|
80
|
-
#
|
81
|
+
#
|
81
82
|
# #loop through arrays and remove any regex matches
|
82
83
|
# keysf = keys.inject([]) do |keys_final, element|
|
83
84
|
# found = true
|
@@ -87,11 +88,11 @@ module RhoconnectConsole
|
|
87
88
|
# keys_final << element.strip if found
|
88
89
|
# keys_final
|
89
90
|
# end
|
90
|
-
|
91
|
+
|
91
92
|
keysf = get_http_routes()
|
92
|
-
|
93
|
+
|
93
94
|
keysf.to_json
|
94
95
|
end
|
95
|
-
|
96
|
+
|
96
97
|
end
|
97
98
|
end
|
data/rhoconnect.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'rhoconnect/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'rhoconnect'
|
7
7
|
s.version = Rhoconnect::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = [
|
9
|
+
s.authors = ['Rhomobile']
|
10
10
|
s.date = Time.now.strftime('%Y-%m-%d')
|
11
11
|
s.email = %q{dev@rhomobile.com}
|
12
12
|
s.homepage = %q{http://rhomobile.com/products/rhoconnect}
|
@@ -18,30 +18,30 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.files = %w(
|
19
19
|
CHANGELOG.md CREDITS Gemfile Gemfile.lock install.sh README.md Rakefile LICENSE Rakefile rhoconnect.gemspec
|
20
20
|
)
|
21
|
-
s.files += Dir.glob(
|
22
|
-
s.files += Dir.glob(
|
23
|
-
s.files += Dir.glob(
|
24
|
-
s.files += Dir.glob(
|
25
|
-
s.files += Dir.glob(
|
26
|
-
s.files += Dir.glob(
|
27
|
-
s.files += Dir.glob(
|
28
|
-
s.files += Dir.glob(
|
29
|
-
s.files += Dir.glob(
|
30
|
-
s.files += Dir.glob(
|
31
|
-
s.test_files = Dir.glob(
|
32
|
-
s.executables = Dir.glob(
|
33
|
-
s.require_paths = [
|
21
|
+
s.files += Dir.glob('bench/**/*')
|
22
|
+
s.files += Dir.glob('commands/**/*')
|
23
|
+
s.files += Dir.glob('doc/**/*')
|
24
|
+
s.files += Dir.glob('examples/**/*')
|
25
|
+
s.files += Dir.glob('generators/**/*')
|
26
|
+
s.files += Dir.glob('generators/templates/application/.rcgemfile')
|
27
|
+
s.files += Dir.glob('installer/**/*')
|
28
|
+
s.files += Dir.glob('lib/**/*')
|
29
|
+
s.files += Dir.glob('js-adapters/**/*')
|
30
|
+
s.files += Dir.glob('tasks/**/*')
|
31
|
+
s.test_files = Dir.glob('spec/**/*')
|
32
|
+
s.executables = Dir.glob('bin/*').map{ |f| File.basename(f) }
|
33
|
+
s.require_paths = ['lib']
|
34
34
|
|
35
|
-
s.required_rubygems_version = Gem::Requirement.new(
|
35
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
36
36
|
s.rubygems_version = %q{1.5.0}
|
37
37
|
s.extra_rdoc_files = [
|
38
|
-
|
39
|
-
|
38
|
+
'LICENSE',
|
39
|
+
'README.md'
|
40
40
|
]
|
41
41
|
|
42
42
|
s.add_dependency('bundler', '~> 1.0')
|
43
|
-
s.add_dependency(
|
44
|
-
s.add_dependency(
|
43
|
+
s.add_dependency('rack', '~> 1.5.2')
|
44
|
+
s.add_dependency('sinatra', '~> 1.3')
|
45
45
|
s.add_dependency('rake', '~> 10.0.0')
|
46
46
|
s.add_dependency('json', '~> 1.7.7')
|
47
47
|
s.add_dependency('rubyzip', '~> 0.9.4')
|
@@ -51,6 +51,5 @@ Gem::Specification.new do |s|
|
|
51
51
|
s.add_dependency('resque', '>= 1.22.0')
|
52
52
|
s.add_dependency('rest-client', '~> 1.6.1')
|
53
53
|
s.add_dependency('templater', '~> 1.0.0')
|
54
|
-
s.add_dependency('thor', '~> 0.
|
55
|
-
s.add_dependency('ohm', '~> 0.1.3')
|
54
|
+
s.add_dependency('thor', '~> 0.18.0')
|
56
55
|
end
|
@@ -17,6 +17,10 @@ app.get('/custom_route3',{}, function(req,resp){
|
|
17
17
|
JsSample.get_stash_result(resp);
|
18
18
|
});
|
19
19
|
|
20
|
+
app.get('/no_client_route', {login_required: false, client_required: false}, function(req,resp){
|
21
|
+
resp.send('no client required!');
|
22
|
+
});
|
23
|
+
|
20
24
|
app.post('/',{"rc_handler":"query"}, function(req,resp){
|
21
25
|
var result = {'id':req.params};
|
22
26
|
resp.send(result);
|
@@ -5,6 +5,13 @@ var JsSample = function() {
|
|
5
5
|
|
6
6
|
this.query = function(resp){
|
7
7
|
var result = {'1': {'name': 'iPhone'}};
|
8
|
+
if(resp.params && resp.params.raise_an_error){
|
9
|
+
new rc.ServerErrorException(resp, 'query error occured');
|
10
|
+
}
|
11
|
+
|
12
|
+
if(resp.params && resp.params.test_non_hash){
|
13
|
+
result = true;
|
14
|
+
}
|
8
15
|
resp.send(result);
|
9
16
|
};
|
10
17
|
|
@@ -88,6 +95,35 @@ var JsSample = function() {
|
|
88
95
|
resp.send(true);
|
89
96
|
};
|
90
97
|
|
98
|
+
this.testRaiseException = function(resp){
|
99
|
+
new rc.Exception(resp, 'some custom message');
|
100
|
+
};
|
101
|
+
|
102
|
+
this.testRaiseLoginException = function(resp){
|
103
|
+
new rc.LoginException(resp, 'some login message');
|
104
|
+
};
|
105
|
+
|
106
|
+
this.testRaiseLogoffException = function(resp){
|
107
|
+
new rc.LogoffException(resp, 'some logoff message');
|
108
|
+
};
|
109
|
+
|
110
|
+
this.testRaiseTimeoutException = function(resp){
|
111
|
+
new rc.ServerTimeoutException(resp, 'some timeout message');
|
112
|
+
};
|
113
|
+
|
114
|
+
this.testRaiseErrorException = function(resp){
|
115
|
+
new rc.ServerErrorException(resp, 'some error message');
|
116
|
+
};
|
117
|
+
|
118
|
+
this.testRaiseConflictException = function(resp){
|
119
|
+
new rc.ObjectConflictErrorException(resp, 'some object conflict message');
|
120
|
+
};
|
121
|
+
|
122
|
+
this.partitionName = function(resp){
|
123
|
+
resp.send(resp.params.user_id + '_partition');
|
124
|
+
};
|
125
|
+
|
126
|
+
|
91
127
|
this.storeBlob = function(resp){
|
92
128
|
var fs = require('fs');
|
93
129
|
if(fs.existsSync(resp.params.path)){
|