rhoconnect 3.2.0.beta2 → 3.2.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/Gemfile +11 -4
- data/Gemfile.lock +10 -5
- data/commands/commands/rhoconnect/startbg.rb +4 -9
- data/commands/commands/rhoconnect/startdebug.rb +4 -9
- data/doc/adapters-crm.txt +6 -1
- data/doc/deploying.txt +90 -9
- data/doc/heroku-addon.txt +2 -2
- data/doc/install.txt +12 -12
- data/doc/stats-middleware.txt +2 -2
- data/doc/supported-platforms.txt +10 -12
- data/doc/web-console.txt +1 -1
- data/examples/simple/Gemfile.lock +97 -0
- data/examples/simple/dump.rdb +0 -0
- data/generators/rhoconnect.rb +14 -6
- data/generators/templates/application/Gemfile +9 -5
- data/installer/unix-like/create_texts.rb +8 -2
- data/installer/unix-like/rho_connect_install_constants.rb +1 -1
- data/installer/unix-like/rho_connect_install_installers.rb +10 -1
- data/installer/utils/package_upload/repos.rake +15 -18
- data/installer/utils/package_upload/s3_single_file.rb +1 -1
- data/lib/rhoconnect/cors.rb +0 -21
- data/lib/rhoconnect/jobs/bulk_data_job.rb +1 -1
- data/lib/rhoconnect/server.rb +27 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/models/client.js +3 -1
- data/lib/rhoconnect/web-console/models/doc.js +2 -1
- data/lib/rhoconnect/web-console/models/source.js +3 -0
- data/lib/rhoconnect/web-console/models/user.js +1 -0
- data/lib/rhoconnect/web-console/views/doc.js +3 -1
- data/lib/rhoconnect/web-console/views/home.js +5 -5
- data/lib/rhoconnect/web-console/views/show_device.js +3 -1
- data/lib/rhoconnect/web-console/views/show_user.js +2 -0
- data/lib/rhoconnect/web-console/views/source_docs.js +2 -0
- data/lib/rhoconnect/web-console/views/users.js +1 -1
- data/rhoconnect.gemspec +0 -1
- data/spec/generator/generator_spec.rb +3 -0
- data/spec/spec_helper.rb +2 -5
- metadata +616 -643
@@ -29,8 +29,17 @@ module Installers
|
|
29
29
|
@gem_path = "#{@options[:prefix]}/bin/gem"
|
30
30
|
|
31
31
|
# Update the RubyGems system software
|
32
|
-
cmd "#{@gem_path} update --system"
|
32
|
+
cmd "#{@gem_path} update --system"
|
33
33
|
|
34
|
+
# FIXME:
|
35
|
+
#install eventmachine 1.0.0.0.beta4
|
36
|
+
`wget https://github.com/rhomobile/eventmachine/tarball/master`
|
37
|
+
`tar xzfv master`
|
38
|
+
`cd rhomobile-eventmachine-6858b3b`
|
39
|
+
`/opt/rhoconnect/bin/gem build eventmachine.gemspec`
|
40
|
+
`/opt/rhoconnect/bin/gem install eventmachine-1.0.0.beta.4.gem --no-ri --no-rdoc`
|
41
|
+
`cd ../;rm -rf master rhomobile-eventmachine-6858b3b`
|
42
|
+
|
34
43
|
Constants::GEMS.each do |gem|
|
35
44
|
install_gem gem
|
36
45
|
end
|
@@ -78,7 +78,7 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
78
78
|
Find.find('./pkg') do |file|
|
79
79
|
if !FileTest.directory?(file)
|
80
80
|
dest_dir = File.extname(file)
|
81
|
-
#
|
81
|
+
# Get rid of '.' before extension name
|
82
82
|
dest_dir[0] = ''
|
83
83
|
if dest_dir == 'deb' || dest_dir == 'rpm'
|
84
84
|
if dest_dir == 'deb'
|
@@ -95,22 +95,19 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
95
95
|
|
96
96
|
copy_files
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
|
111
|
-
# end #do
|
112
|
-
# end #do
|
113
|
-
# end #if
|
98
|
+
if !build_number.empty?
|
99
|
+
# Change name of packages to include build number
|
100
|
+
['deb', 'rpm'].each do |arch|
|
101
|
+
Find.find("#{PKG_DIR}") do |file|
|
102
|
+
if !File.directory?(file) and file =~ /#{arch}$/
|
103
|
+
file_to_rename = File.open(file, 'r')
|
104
|
+
old_name = File.expand_path(file)
|
105
|
+
new_name = old_name.gsub(/(#{arch})$/, "#{build_number}.\\1" )
|
106
|
+
File.rename(old_name, new_name)
|
107
|
+
end #if
|
108
|
+
end #do
|
109
|
+
end #do
|
110
|
+
end #if
|
114
111
|
|
115
112
|
# REPOIFY!
|
116
113
|
cmd "sudo reprepro -b #{PKG_DIR}/deb includedeb rhoconnect #{PKG_DIR}/deb/#{@deb_pkg}"
|
@@ -125,4 +122,4 @@ task "build:repos", :build_type, :build_number do |t, args|
|
|
125
122
|
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/#{dir} #{BUCKET}"
|
126
123
|
end #do
|
127
124
|
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/SHA1 #{BUCKET}"
|
128
|
-
end #build:repos
|
125
|
+
end #build:repos
|
data/lib/rhoconnect/cors.rb
CHANGED
@@ -23,19 +23,8 @@ module Rack
|
|
23
23
|
end
|
24
24
|
cors_headers = nil
|
25
25
|
if env['HTTP_ORIGIN']
|
26
|
-
debug(env) do
|
27
|
-
[ 'Incoming Headers:',
|
28
|
-
" Origin: #{env['HTTP_ORIGIN']}",
|
29
|
-
" Access-Control-Request-Method: #{env['HTTP_ACCESS_CONTROL_REQUEST_METHOD']}",
|
30
|
-
" Access-Control-Request-Headers: #{env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"
|
31
|
-
].join("\n")
|
32
|
-
end
|
33
26
|
if env['REQUEST_METHOD'] == 'OPTIONS'
|
34
27
|
if headers = process_preflight(env)
|
35
|
-
debug(env) do
|
36
|
-
"Preflight Headers:\n" +
|
37
|
-
headers.collect{|kv| " #{kv.join(': ')}"}.join("\n")
|
38
|
-
end
|
39
28
|
return [200, headers, ['']]
|
40
29
|
end
|
41
30
|
else
|
@@ -48,16 +37,6 @@ module Rack
|
|
48
37
|
end
|
49
38
|
|
50
39
|
protected
|
51
|
-
def debug(env, message = nil, &block)
|
52
|
-
logger = @logger || env['rack.logger'] || begin
|
53
|
-
@logger = ::Logger.new(STDOUT).tap {|logger| logger.level = ::Logger::Severity::INFO}
|
54
|
-
end
|
55
|
-
logger.debug(message, &block)
|
56
|
-
#TODO: remove debug output from code!
|
57
|
-
message = yield
|
58
|
-
puts message
|
59
|
-
end
|
60
|
-
|
61
40
|
def all_resources
|
62
41
|
@all_resources ||= []
|
63
42
|
end
|
@@ -26,8 +26,8 @@ module Rhoconnect
|
|
26
26
|
do_bulk_job(params) do |bulk_data|
|
27
27
|
bulk_data.state = :completed
|
28
28
|
bulk_data.refresh_time = Time.now.to_i + Rhoconnect.bulk_sync_poll_interval
|
29
|
-
log "BulkDataJob.after_perform_x hook set data state to complete."
|
30
29
|
end
|
30
|
+
log "BulkDataJob.after_perform_x hook set data state to complete."
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.do_bulk_job(params)
|
data/lib/rhoconnect/server.rb
CHANGED
@@ -206,9 +206,33 @@ module Rhoconnect
|
|
206
206
|
|
207
207
|
@dispatch_framework_initialized ||=true
|
208
208
|
if RUBY_VERSION =~ /1.9/ and not defined?(JRUBY_VERSION)
|
209
|
-
|
210
|
-
|
211
|
-
|
209
|
+
begin
|
210
|
+
require 'rhoconnect/async'
|
211
|
+
register Rhoconnect::Synchrony
|
212
|
+
helpers Rhoconnect::AsyncHelpers
|
213
|
+
rescue LoadError => e
|
214
|
+
# if it fails here - Async can not be used
|
215
|
+
settings.use_async_model = false
|
216
|
+
warning_for_async_gems = <<_INSTALL_ASYNC_GEMS
|
217
|
+
|
218
|
+
***** WARNING *****
|
219
|
+
Rhoconnect has detected that Ruby 1.9.x is used and tried to initialize Async Framework, but failed:
|
220
|
+
|
221
|
+
#{e.inspect}
|
222
|
+
|
223
|
+
Make sure to include the following dependencies into your application's Gemfile:
|
224
|
+
|
225
|
+
platforms :ruby_19, :mingw_19 do
|
226
|
+
gem 'rack-fiber_pool'
|
227
|
+
gem 'async-rack'
|
228
|
+
end
|
229
|
+
|
230
|
+
After that, run 'bundle install' to install the necassary dependency gems.
|
231
|
+
***** WARNING *****
|
232
|
+
|
233
|
+
_INSTALL_ASYNC_GEMS
|
234
|
+
puts warning_for_async_gems
|
235
|
+
end
|
212
236
|
else
|
213
237
|
settings.use_async_model = false
|
214
238
|
end
|
data/lib/rhoconnect/version.rb
CHANGED
@@ -21,6 +21,7 @@ var Client = Backbone.Model.extend({
|
|
21
21
|
$.each(r,function(index,value){
|
22
22
|
data += "<tr><td><a href='#device/"+value+"/"+user_id+"'>"+value+"</a></td></tr>";
|
23
23
|
})
|
24
|
+
$('tr.remove-tr-device').remove();
|
24
25
|
$('#device-table tr:last').after(data);
|
25
26
|
},
|
26
27
|
error: function(resp){
|
@@ -44,6 +45,7 @@ var Client = Backbone.Model.extend({
|
|
44
45
|
$.each(r,function(index,value){
|
45
46
|
data += "<tr><td><a href='#doc/"+value+"/source_id="+source_id+"'>"+value+"</a></td></tr>";
|
46
47
|
})
|
48
|
+
$('tr.remove-tr-docs').remove();
|
47
49
|
$('#sourcedocs-table tr:last').after(data);
|
48
50
|
},
|
49
51
|
error: function(resp){
|
@@ -68,7 +70,7 @@ var Client = Backbone.Model.extend({
|
|
68
70
|
if(value.value != null && value.value != "")
|
69
71
|
data += "<tr><td width='25%'>" + value.name + "</td><td>" + value.value + "</td></tr>"
|
70
72
|
})
|
71
|
-
|
73
|
+
$('tr.remove-tr-client').remove();
|
72
74
|
$('#deviceattr-table tr:last').after(data);
|
73
75
|
},
|
74
76
|
error: function(resp){
|
@@ -44,11 +44,12 @@ var Doc = Backbone.Model.extend({
|
|
44
44
|
if(resp != ''){
|
45
45
|
data += "<tr><th colspan=3><h3 style='display:inline'>Data</h3><span class='pull-right'>" +
|
46
46
|
"<a id='clear' class='btn btn-danger'>clear document</a></span></th></tr>" +
|
47
|
-
"<tr><td id='doc_data'>" + r+ "</td></tr>";
|
47
|
+
"<tr><td id='doc_data'><pre>" + r+ "</pre></td></tr>";
|
48
48
|
}
|
49
49
|
else{
|
50
50
|
data += "<tr><th>Document is Empty</th></tr>";
|
51
51
|
}
|
52
|
+
$('tr.remove-tr-doc').remove();
|
52
53
|
$('#docdata-table tr:last').after(data);
|
53
54
|
$(".query-status")[0].firstChild.className = "label label-success";
|
54
55
|
$(".query-status")[0].firstChild.innerHTML = "success";
|
@@ -50,6 +50,7 @@ var Source = Backbone.Model.extend({
|
|
50
50
|
adapters += "<tr><td colspan='2'><a href='#sources/"+value+"/"+user+"/"+doctype+"/"+client_id+"'>"+ value + "</a></td></tr>"
|
51
51
|
}
|
52
52
|
})
|
53
|
+
$('tr.remove-tr-user').remove();
|
53
54
|
$('#source-table tr:last').after(adapters);
|
54
55
|
}
|
55
56
|
else{
|
@@ -75,6 +76,7 @@ var Source = Backbone.Model.extend({
|
|
75
76
|
$.each(r, function(index,value){
|
76
77
|
docs += "<tr><td width='25%'>" + index + "</td><td><a href='#doc/"+value+"/source_id="+source_id+"'>" + value + "</a></td></tr>"
|
77
78
|
})
|
79
|
+
$('tr.remove-tr-docs').remove();
|
78
80
|
$('#sourcedocs-table tr:last').after(docs);
|
79
81
|
},
|
80
82
|
error: function(resp){
|
@@ -100,6 +102,7 @@ var Source = Backbone.Model.extend({
|
|
100
102
|
if(value.value != null && value.value != "")
|
101
103
|
params += "<tr><td width='25%'>" + value.name + "</td><td>" + value.value + "</td></tr>"
|
102
104
|
})
|
105
|
+
$('tr.remove-tr-src').remove();
|
103
106
|
$('#sourceparams-table tr:last').after(params);
|
104
107
|
},
|
105
108
|
error: function(resp){
|
@@ -55,7 +55,9 @@ App.Views.Doc = Backbone.View.extend({
|
|
55
55
|
out += "<input type='text' name='data' value='' class='input-xlarge' placeholder='Upload string'/>";
|
56
56
|
out += "<input type='submit' value='Submit' class='btn btn-primary' style='margin-left:10px'>";
|
57
57
|
out += "</form>";
|
58
|
-
out += "<table id='docdata-table' class='table table-bordered'><tr></tr
|
58
|
+
out += "<table id='docdata-table' class='table table-bordered'><tr></tr>";
|
59
|
+
out += "<tr class='remove-tr-doc'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
60
|
+
out += "</table>"
|
59
61
|
|
60
62
|
$(this.el).html(out);
|
61
63
|
$('#main_content').html(this.el);
|
@@ -52,22 +52,22 @@ App.Views.Home = Backbone.View.extend({
|
|
52
52
|
out += "<div class='span12' style='margin-top:20px'><h2>Getting Started with RhoConnect</h2>";
|
53
53
|
out += "<ol style='font-size:18px;margin-top:20px'><li>The Home Screen</li>";
|
54
54
|
out += "<ul style='margin:20px'>"
|
55
|
-
out += "<li>Sync Server URL<p style='margin-top:5px'>
|
55
|
+
out += "<li>Sync Server URL<p style='margin-top:5px'>Use this url in your client application to sync with RhoConnect</p></li>"
|
56
56
|
out += "<li>App partition sources</li><p style='margin-top:5px'>This is a list of all your source adapters partitioned by :app. Click on the source links to view the attributes and document key/values stored in redis</p>"
|
57
57
|
out += "<li><a class='btn btn-danger'>Reset</a> button</li>"
|
58
|
-
out += "<p style='margin-top:5px'>The reset button will clear the redis db of all data. <b><em>Be careful when
|
58
|
+
out += "<p style='margin-top:5px'>The reset button will clear the redis db of all data. <b><em>Be careful when resetting the db as you will lose all your user information and document data!</em></b></p>"
|
59
59
|
out += "</ul>"
|
60
60
|
out += "<li>Server Doc</li>";
|
61
|
-
out += "<p style='margin:10px'>Enter a
|
61
|
+
out += "<p style='margin:10px'>Enter a key to view the stored value in the database. You can also set and delete keys here.</p>"
|
62
62
|
out += "<li>Users</li>"
|
63
|
-
out += "<p style='margin:10px'>View a list of registered users here. You can also create,delete and ping users. Viewing a particular user will allow you to view source
|
63
|
+
out += "<p style='margin:10px'>View a list of registered users here. You can also create,delete, and ping users. Viewing a particular user will allow you to view source adapters partitioned by user as well as that user's registered devices."
|
64
64
|
out += "<li>Settings</li><ul style='margin:20px'><li>Change Admin Password</li><p style='margin-top:10px'>By default the admin password is blank. Here you can change the admin password.</p>"
|
65
65
|
out += "<li>API Token</li><p>View your RhoConnect API Token. This token needs to be included in all API calls made to RhoConnect</p>"
|
66
66
|
out += "<li>Plugin Settings</li><p style='margin-top:10px'>If you are using Dynamic Adapters (opposed to source adapters) with <a href='http://docs.rhomobile.com/rhoconnect/plugin-intro' target='_blank'>RhoConnect Plugins</a>, you will need to "
|
67
67
|
out += "define your backend app URL here. For example, if I am using the plugin rhoconnect-rb with my rails app, I would put the URL http://myrailsapp.com here. <em><b>This value needs to be set in order to use RhoConnect Plugins.</b></em></p></ul>"
|
68
68
|
out += "<li>Statistics</li>"
|
69
69
|
out += "<p style='margin-top:10px'>If you do not see a link to Statistics, it is not enabled in your config.ru file. By default Rhoconnect apps will have this line <code>Rhoconnect::Server.enable :stats</code> commented out. "
|
70
|
-
out += "Older versions of
|
70
|
+
out += "Older versions of RhoConnect will not have this line in the config.ru file at all. Uncomment or add the line above to enable Statistics. The Statistics tab will have different graphs to measure metrics/performance for RhoConnect.</p>"
|
71
71
|
out += "</ol></div>"
|
72
72
|
|
73
73
|
$(this.el).html(out);
|
@@ -10,7 +10,7 @@ App.Views.ShowDevice = Backbone.View.extend({
|
|
10
10
|
this.model.get_client_params(device_id);
|
11
11
|
//this.model.list_client_docs(device_id,'Product');
|
12
12
|
source = new Source();
|
13
|
-
source.set('partition_type','
|
13
|
+
source.set('partition_type','all');
|
14
14
|
source.set('user_id',this.model.get('user_id'));
|
15
15
|
source.set('client_id',device_id);
|
16
16
|
source.set('doctype','client');
|
@@ -46,8 +46,10 @@ App.Views.ShowDevice = Backbone.View.extend({
|
|
46
46
|
out += "<div id='showdevice-alert' class='alert alert-error' style='display:none'></div>";
|
47
47
|
out += "<table id='deviceattr-table' class='table table-bordered'>";
|
48
48
|
out += "<tr><th><h3>Attributes</h3></th></tr>";
|
49
|
+
out += "<tr class='remove-tr-client'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
49
50
|
out += "</table>";
|
50
51
|
out += "<table id='source-table' class='table table-bordered'><tr><th><h3>Sources for device</h3></th></tr>";
|
52
|
+
out += "<tr class='remove-tr-user'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
51
53
|
out += "</table>"
|
52
54
|
|
53
55
|
$(this.el).html(out);
|
@@ -28,8 +28,10 @@ App.Views.ShowUser = Backbone.View.extend({
|
|
28
28
|
out += "<div id='showuser-alert' class='alert alert-error' style='display:none'></div>";
|
29
29
|
out += "<table id='source-table' class='table table-bordered'>";
|
30
30
|
out += "<tr><th><h3>Sources</h3></th></tr>";
|
31
|
+
out += "<tr class='remove-tr-user'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
31
32
|
out += "</table>";
|
32
33
|
out += "<table id='device-table' class='table table-bordered'><tr><th><h3>Registered Devices</h3></th></tr>";
|
34
|
+
out += "<tr class='remove-tr-device'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
33
35
|
out += "</table>"
|
34
36
|
|
35
37
|
$(this.el).html(out);
|
@@ -21,8 +21,10 @@ App.Views.SourceDocs = Backbone.View.extend({
|
|
21
21
|
out = "<div class='page-header well'><h1>"+source_id+"</h1></div>";
|
22
22
|
out += "<div class='docalert alert-error' style='display:none'></div>";
|
23
23
|
out += "<table id='sourceparams-table' class='table table-bordered'><thead><tr><th><h3>Attributes</h3></th></tr></thead>";
|
24
|
+
out += "<tr class='remove-tr-src'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
24
25
|
out += "</table>";
|
25
26
|
out += "<table id='sourcedocs-table' class='table table-bordered'><tr><th class='span5'><h3>Documents</h3></th></tr>";
|
27
|
+
out += "<tr class='remove-tr-docs'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
26
28
|
out += "</table>";
|
27
29
|
$(this.el).html(out);
|
28
30
|
$('#main_content').html(this.el);
|
@@ -1,6 +1,5 @@
|
|
1
1
|
App.Views.Users = Backbone.View.extend({
|
2
2
|
|
3
|
-
|
4
3
|
initialize: function() {
|
5
4
|
this.render();
|
6
5
|
this.model.get_users('user_table');
|
@@ -12,6 +11,7 @@ App.Views.Users = Backbone.View.extend({
|
|
12
11
|
out += "<table id='users_table' class='table table-bordered'>";
|
13
12
|
out += "<tr><th><div style='display:inline;font-size:18px'>Registered Users<div class='pull-right'><a href='#users/new' class='btn btn-primary'>Create User</a>";
|
14
13
|
out += "<a href='#users/newping' class='btn btn-primary' style='margin-left:10px'>Ping Users</a></div></th></tr>";
|
14
|
+
out += "<tr class='remove-tr-users'><td colspan='2' style='text-align:center'>Loading...</td></tr>"
|
15
15
|
out += "</table></form>";
|
16
16
|
|
17
17
|
$(this.el).html(out);
|
data/rhoconnect.gemspec
CHANGED
@@ -48,6 +48,9 @@ describe "Generator" do
|
|
48
48
|
FileUtils.rm_rf "/tmp/#{appname}"
|
49
49
|
@app_generator = Rhoconnect::AppGenerator.new('/tmp',{},appname)
|
50
50
|
@app_generator.invoke!
|
51
|
+
Bundler.with_clean_env do
|
52
|
+
@app_generator.after_run
|
53
|
+
end
|
51
54
|
@generator = Rhoconnect::SourceGenerator.new("/tmp/#{appname}",{},source)
|
52
55
|
end
|
53
56
|
|
data/spec/spec_helper.rb
CHANGED
@@ -298,11 +298,8 @@ module TestHelpers
|
|
298
298
|
end
|
299
299
|
|
300
300
|
def do_bulk_data_job(params)
|
301
|
-
|
302
|
-
|
303
|
-
ensure
|
304
|
-
BulkDataJob.after_perform_x(params)
|
305
|
-
end
|
301
|
+
BulkDataJob.perform(params)
|
302
|
+
BulkDataJob.after_perform_x(params) if BulkData.is_exist?(params["data_name"])
|
306
303
|
end
|
307
304
|
|
308
305
|
end #TestHelpers
|