rhoconnect 3.0.0.beta1 → 3.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/CHANGELOG +16 -2
  2. data/Gemfile +14 -5
  3. data/Gemfile.lock +13 -23
  4. data/Rakefile +86 -0
  5. data/bench/bench_runner.rb +5 -4
  6. data/bench/benchapp/Gemfile +17 -8
  7. data/bench/blobapp/Gemfile +13 -14
  8. data/doc/adapters-crm.txt +226 -0
  9. data/doc/adapters-intro.txt +18 -0
  10. data/doc/client.txt +29 -2
  11. data/doc/heroku-addon.txt +54 -0
  12. data/doc/install.txt +1 -2
  13. data/doc/migration.txt +18 -6
  14. data/doc/net-plugin.txt +276 -0
  15. data/doc/plugin-intro.txt +6 -0
  16. data/doc/push.txt +1 -1
  17. data/doc/rails-plugin.txt +116 -0
  18. data/doc/rest-api.txt +2 -2
  19. data/doc/settings.txt +59 -0
  20. data/doc/tutorial.txt +8 -5
  21. data/generators/rhoconnect.rb +30 -0
  22. data/generators/templates/application/Gemfile +16 -7
  23. data/generators/templates/application/gitignore +4 -0
  24. data/install.sh +74 -106
  25. data/installer/deb-scripts/LICENSE +75 -0
  26. data/installer/deb-scripts/install.sh +300 -0
  27. data/installer/deb-scripts/scripts/rho_connect_install_constants.rb +32 -0
  28. data/installer/deb-scripts/scripts/rho_connect_install_installers.rb +103 -0
  29. data/installer/deb-scripts/scripts/rho_connect_install_utilities.rb +110 -0
  30. data/installer/deb-scripts/scripts/rhoinstaller.rb +55 -0
  31. data/installer/deb-scripts/utils/README +67 -0
  32. data/installer/deb-scripts/utils/create_texts.rb +76 -0
  33. data/installer/deb-scripts/utils/redis_init_script +124 -0
  34. data/installer/deb-scripts/utils/redis_log_rotate +8 -0
  35. data/installer/unix-like/install.sh +361 -0
  36. data/installer/unix-like/post-install.sh +8 -0
  37. data/installer/unix-like/pre-install.sh +8 -0
  38. data/installer/unix-like/rho_connect_install_constants.rb +9 -14
  39. data/installer/unix-like/rho_connect_install_debian.rb +7 -5
  40. data/installer/unix-like/rho_connect_install_dnd.rb +6 -6
  41. data/installer/unix-like/rho_connect_install_get_params.rb +1 -1
  42. data/installer/unix-like/rho_connect_install_installers.rb +39 -38
  43. data/installer/unix-like/rho_connect_install_utilities.rb +9 -10
  44. data/installer/unix-like/rho_connect_install_yum.rb +6 -5
  45. data/installer/unix-like/rhoinstaller.rb +8 -3
  46. data/installer/utils/create_texts.rb +313 -85
  47. data/installer/windows/rhosync.nsi +5 -5
  48. data/lib/rhoconnect/api/application/clientcreate.rb +1 -1
  49. data/lib/rhoconnect/api/application/clientregister.rb +1 -1
  50. data/lib/rhoconnect/api/application/clientreset.rb +1 -1
  51. data/lib/rhoconnect/client.rb +0 -1
  52. data/lib/rhoconnect/client_sync.rb +1 -0
  53. data/lib/rhoconnect/console/app/routes/home.rb +1 -1
  54. data/lib/rhoconnect/console/app/routes/user.rb +8 -3
  55. data/lib/rhoconnect/console/app/views/adapter.erb +2 -2
  56. data/lib/rhoconnect/console/app/views/ping.erb +14 -2
  57. data/lib/rhoconnect/console/app/views/users.erb +8 -1
  58. data/lib/rhoconnect/jobs/ping_job.rb +11 -3
  59. data/lib/rhoconnect/model.rb +2 -2
  60. data/lib/rhoconnect/read_state.rb +2 -0
  61. data/lib/rhoconnect/server.rb +4 -3
  62. data/lib/rhoconnect/source.rb +33 -6
  63. data/lib/rhoconnect/source_adapter.rb +5 -9
  64. data/lib/rhoconnect/source_sync.rb +11 -5
  65. data/lib/rhoconnect/store.rb +7 -4
  66. data/lib/rhoconnect/tasks.rb +3 -3
  67. data/lib/rhoconnect/version.rb +1 -1
  68. data/lib/rhoconnect.rb +22 -8
  69. data/rhoconnect.gemspec +4 -22
  70. data/spec/api/application/rhoconnect_api_spec.rb +54 -8
  71. data/spec/api/source/get_source_params_spec.rb +2 -1
  72. data/spec/api/source/list_sources_spec.rb +3 -3
  73. data/spec/app_spec.rb +8 -1
  74. data/spec/apps/rhotestapp/settings/settings.yml +10 -5
  75. data/spec/apps/rhotestapp/sources/other_adapter.rb +7 -0
  76. data/spec/client_sync_spec.rb +5 -8
  77. data/spec/dynamic_adapter_spec.rb +8 -8
  78. data/spec/generator/generator_spec.rb +4 -2
  79. data/spec/jobs/ping_job_spec.rb +53 -0
  80. data/spec/model_spec.rb +2 -2
  81. data/spec/rhosync_spec.rb +1 -1
  82. data/spec/server/server_spec.rb +3 -14
  83. data/spec/source_sync_spec.rb +84 -2
  84. data/spec/support/shared_examples.rb +2 -2
  85. data/tasks/redis.rake +2 -2
  86. metadata +30 -41
  87. data/spec/api/rhosync_api_spec.rb.orig +0 -606
@@ -1,6 +1,8 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__))
1
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','unix-like'))
2
2
 
3
3
  require 'optparse'
4
+ require 'rho_connect_install_constants'
5
+ require 'fileutils'
4
6
 
5
7
  options = {}
6
8
 
@@ -10,7 +12,7 @@ optparse = OptionParser.new do |opts|
10
12
  options[:dist] = dist
11
13
  end #do
12
14
 
13
- options[:prefix] = '/opt/rhoconnect/'
15
+ options[:prefix] = '/opt/rhoconnect'
14
16
  opts.on( '-p', '--prefix RHODIR', 'Specify RHODIR as the prefix directory.' ) do |dir|
15
17
  options[:prefix] = dir
16
18
  end #do
@@ -24,6 +26,12 @@ optparse = OptionParser.new do |opts|
24
26
  opts.on( '-r', '--rubyVer VERSION', 'Specify VERSION as the verion of ruby that is installed.' ) do |rubyVer|
25
27
  options[:rubyVersion] = rubyVer
26
28
  end #do
29
+
30
+ options[:web_server] = "nginx"
31
+ opts.on('-w', '--web-server Server', ' Specify that you are using web server SERVER') do |server|
32
+ options[:web_server] = server
33
+ end #do
34
+
27
35
  end #do
28
36
 
29
37
  optparse.parse!
@@ -33,12 +41,15 @@ optparse.parse!
33
41
  @redis = options[:redis]
34
42
  @ruby_version = options[:rubyVersion]
35
43
  @profile = (@dist == 'debian') ? '~/.profile' : '~/.bash_profile'
44
+ @server = options[:web_server]
45
+
46
+ def passenger_version
47
+ (`#{@prefix}/bin/passenger --version`.match /\d+\.\d+\.\d+/)[0]
48
+ end
36
49
 
37
50
  # create_redis_init
38
51
  # Creates the redis initialization file and places it into the correct directory
39
52
  def create_redis_init
40
- redisInit="/etc/init.d/redis"
41
-
42
53
  redis_init_script = <<'_REDIS_INIT_SCRIPT_'
43
54
  #!/usr/bin/env bash
44
55
  ### BEGIN INIT INFO
@@ -66,8 +77,8 @@ fi
66
77
  # Default config variables that have not been set.
67
78
  port="${port:-6379}"
68
79
  prefix="${prefix:-/opt/rhoconnect}"
69
- redis="${prefix}bin/redis-server"
70
- redis_cli="${prefix}bin/redis-cli"
80
+ redis="${prefix}/bin/redis-server"
81
+ redis_cli="${prefix}/bin/redis-cli"
71
82
  pidfile="${pidfile:-/var/run/redis.pid}"
72
83
  config="${config:-/opt/rhoconnect/etc/redis.conf}"
73
84
  user="${user:-root}"
@@ -166,10 +177,11 @@ case "$1" in
166
177
  esac
167
178
  _REDIS_INIT_SCRIPT_
168
179
 
180
+ redisInit="/etc/init.d/redis"
169
181
  File.open(redisInit, 'w') { |f| f << redis_init_script }
182
+
170
183
  # Make the init script executable
171
184
  `chmod +x #{redisInit}`
172
-
173
185
  # Set run levels
174
186
  if @dist == 'debian'
175
187
  `update-rc.d -f redis defaults`
@@ -196,6 +208,167 @@ _REDIS_LOGRORATE_CONF_
196
208
  File.open('/etc/logrotate.d/redis', 'w') { |f| f << redis_logrotate_conf }
197
209
  end
198
210
 
211
+ #
212
+ # Nginx stuff ...
213
+
214
+ def create_nginx_init
215
+ nginx_init_script = <<'_NGINX_INIT_SCRIPT_'
216
+ #!/bin/sh
217
+ # Author: Ryan Norbauer http://norbauerinc.com
218
+ # Modified: Geoffrey Grosenbach http://topfunky.com
219
+ # Modified: Clement NEDELCU
220
+ # Modified: Alexander Babichev
221
+ # Reproduced with express authorization from its contributors
222
+
223
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
224
+ DESC="nginx daemon"
225
+ NAME=nginx
226
+ DAEMON=/opt/nginx/sbin/$NAME
227
+ SCRIPTNAME=/etc/init.d/$NAME
228
+
229
+ # If the daemon file is not found, terminate the script.
230
+ test -x $DAEMON || exit 0
231
+
232
+ d_start() {
233
+ $DAEMON || echo -n " already running"
234
+ }
235
+
236
+ d_stop() {
237
+ $DAEMON -s quit || echo -n " not running"
238
+ }
239
+
240
+ d_reload() {
241
+ $DAEMON -s reload || echo -n " could not reload"
242
+ }
243
+
244
+ case "$1" in
245
+ start)
246
+ echo -n "Starting $DESC: $NAME"
247
+ d_start
248
+ echo "."
249
+ ;;
250
+ stop)
251
+ echo -n "Stopping $DESC: $NAME"
252
+ d_stop
253
+ echo "."
254
+ ;;
255
+ reload)
256
+ echo -n "Reloading $DESC configuration ... "
257
+ d_reload
258
+ echo "reloaded."
259
+ ;;
260
+ restart)
261
+ echo -n "Restarting $DESC: $NAME"
262
+ d_stop
263
+ # Sleep for two seconds before starting again, this should give the
264
+ # Nginx daemon some time to perform a graceful stop.
265
+ sleep 2
266
+ d_start
267
+ echo "."
268
+ ;;
269
+ *)
270
+ echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
271
+ exit 3
272
+ ;;
273
+ esac
274
+
275
+ exit 0
276
+ _NGINX_INIT_SCRIPT_
277
+
278
+ nginx_script = '/etc/init.d/nginx'
279
+ File.open(nginx_script, 'w') { |f| f << nginx_init_script }
280
+ # Make the init script executable
281
+ `chmod +x #{nginx_script}`
282
+
283
+ # Set run levels
284
+ # if @dist == 'debian'
285
+ # #`update-rc.d -f nginx defaults`
286
+ # else
287
+ # #`/sbin/chkconfig nginx on`
288
+ # end
289
+
290
+ end
291
+
292
+ def create_nginx_logrotate
293
+ nginx_logrorate_conf = <<'_NGINX_LOGRORATE_CONF_'
294
+ /opt/nginx/logs/*log {
295
+ missingok
296
+ notifempty
297
+ rotate 4
298
+ size 100k
299
+ delaycompress
300
+ sharedscripts
301
+ postrotate
302
+ test ! -f /opt/nginx/logs/nginx.pid || kill -USR1 `cat /opt/nginx/logs/nginx.pid`
303
+ endscript
304
+ }
305
+ _NGINX_LOGRORATE_CONF_
306
+
307
+ File.open('/etc/logrotate.d/nginx', 'w') { |f| f << nginx_logrorate_conf }
308
+ end
309
+
310
+ def create_nginx_conf_files
311
+ nginx_server_conf = <<'_NGINX_CONF_'
312
+ user nginx;
313
+
314
+ worker_processes 4;
315
+
316
+ error_log logs/error.log;
317
+ pid logs/nginx.pid;
318
+
319
+ events {
320
+ worker_connections 1024;
321
+ }
322
+
323
+ http {
324
+ include mime.types;
325
+ default_type application/octet-stream;
326
+
327
+ sendfile on;
328
+ keepalive_timeout 65;
329
+ #gzip on;
330
+
331
+ include /opt/nginx/conf/conf.d/*.conf;
332
+ }
333
+ _NGINX_CONF_
334
+
335
+ # create 'nginx' user if it does not exist
336
+ user_nginx = `cat /etc/passwd | cut -d: -f1 | grep nginx`
337
+ if user_nginx.empty?
338
+ puts "Creating 'nginx' user ..."
339
+ if @dist == 'debian'
340
+ `adduser --system --home /opt/nginx/html --no-create-home --disabled-login --disabled-password --group nginx`
341
+ else
342
+ `/usr/sbin/useradd -M -r -s /sbin/nologin -d /opt/nginx/html nginx`
343
+ end
344
+ end
345
+
346
+ FileUtils.mv("/opt/nginx/conf/nginx.conf", "/opt/nginx/conf/nginx.conf.bak") unless File.exist? "/opt/nginx/conf/nginx.conf.bak"
347
+ File.open('/opt/nginx/conf/nginx.conf', 'w' ) { |f| f << nginx_server_conf }
348
+
349
+ Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
350
+ rho_vhost_conf = <<'_VHOST_CONF_'
351
+ server {
352
+ listen 80;
353
+ server_name www.yourhost.com; # <-- your server domain name!
354
+ root /opt/nginx/html/rhoapp/public; # <--- be sure to point to 'public' folder of your application!
355
+ passenger_enabled on;
356
+ }
357
+ _VHOST_CONF_
358
+ File.open('/opt/nginx/conf/conf.d/rhoconnect.conf', 'w' ) { |f| f << rho_vhost_conf }
359
+
360
+ passenger_conf = <<_PASSENGER_CONF_
361
+ passenger_root /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version};
362
+ passenger_ruby /opt/rhoconnect/bin/ruby;
363
+ passenger_max_pool_size 20;
364
+ passenger_min_instances 6;
365
+ _PASSENGER_CONF_
366
+ File.open('/opt/nginx/conf/conf.d/passenger.conf', 'w' ) { |f| f << passenger_conf }
367
+ end
368
+
369
+ # End of nginx stuff ...
370
+
371
+
199
372
  # generate_common_info
200
373
  # Generates the readme info that is common across all distributions
201
374
  def generate_common_info
@@ -207,62 +380,57 @@ To finish this setup, please complete the following...
207
380
  1) Add necessary bins to the path(s) of the users who will
208
381
  be using this software. You may also wish to add these items
209
382
  to your #{@profile} to automatically add them upon login.
210
- Ex:
211
-
212
- A) All bins in the main bin deposit:
213
- export PATH=#{@prefix}bin:$PATH
383
+ export PATH=#{@prefix}/bin:$PATH
214
384
 
215
- B) Bins specifically placed in the ruby/bin directory
216
- export PATH=#{@prefix}ruby/1.8/bin:$PATH
217
-
218
- Or if you had other versions of ruby installed previously to running
385
+ If you had other versions of ruby installed previously to running
219
386
  this installation, you may instead wish to simply create an alias
220
- for the newly installed ruby.
221
-
222
- Ex:
223
-
224
- alias #{@ruby_version}=#{@prefix}bin/ruby
387
+ for the newly installed ruby:
388
+ alias #{@ruby_version}=#{@prefix}/bin/ruby
225
389
 
226
- B) Add the export line to #{@profile}:
390
+ _README_
227
391
 
228
- export PATH=#{@prefix}bin:#{@prefix}ruby/bin:$PATH
392
+ if @dist == "yum"
393
+ rpm_lib = <<_RPM_LIB_
394
+ Add #{@prefix}/lib to your library path like so:
395
+ export LD_LIBRARY_PATH=#{@prefix}/lib:$LD_LIBRARY_PATH
229
396
 
230
- C) Add #{@prefix}lib to your library path like so:
397
+ Note: You may also want to add this line to #{@profile}
231
398
 
232
- export LD_LIBRARY_PATH=#{@prefix}lib:$LD_LIBRARY_PATH
233
- Note: You may also want to add this line to #{@profile}
399
+ _RPM_LIB_
400
+ # concatenate _RPM_LIB_ onto _README_
401
+ readme = readme + rpm_lib
402
+ end #if
234
403
 
404
+ readme_2 = <<_README2_
235
405
  2) Rhoconnect installer configured redis server with the following settings:
236
406
 
237
- A) redis.conf file is located in #{@prefix}etc/ directory with properties:
238
- daemonize yes
239
- pidfile /var/run/redis.pid
240
- logfile /var/log/redis.log
407
+ A) redis.conf file is located in #{@prefix}/etc/ directory with properties:
408
+ daemonize yes
409
+ pidfile /var/run/redis.pid
410
+ logfile /var/log/redis.log
241
411
 
242
- B) Redis logrotate settings for /var/log/redis.log files defined in '/etc/logrotate.d/redis':
412
+ B) Redis logrotate settings for /var/log/redis.log files defined in '/etc/logrotate.d/redis':
243
413
 
244
- /var/log/redis.log {
414
+ /var/log/redis.log {
245
415
  rotate 3
246
416
  missingok
247
417
  notifempty
248
418
  size 250k
249
419
  create 0644 root root
250
420
  compress
251
- }
421
+ }
252
422
 
253
- C) Redis start-up script '/etc/init.d/redis'.
254
- You can start/stop redis server by running the following commands:
255
- /etc/init.d/redis {start|stop}
423
+ C) Redis start-up script '/etc/init.d/redis'.
424
+ You can start/stop redis server by running the following commands:
425
+ /etc/init.d/redis {start|stop}
256
426
 
257
427
  3) Setup rhoconnect application directory
258
-    
259
- A) Put your application code in a directory called /var/www/rhoconnect
260
- (make sure this is the root of your applictaion directory, i.e. /var/www/rhoconnect/config.ru should exist).
261
-
262
- B) Make an empty public folder in the directory
263
- $ mkdir /var/www/rhoconnect/public
264
-
265
- _README_
428
+
429
+ Put your application code in a directory called /var/www/rhoconnect
430
+ (make sure this is the root of your application directory, i.e. /var/www/rhoconnect/config.ru should exist).
431
+
432
+ _README2_
433
+ readme = readme + readme_2
266
434
 
267
435
  readme
268
436
  end #generate_common_info
@@ -275,8 +443,8 @@ def create_passenger_load
275
443
  end # if
276
444
 
277
445
  passenger_load = <<_PASSENGER_LOAD_
278
- LoadModule passenger_module /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
279
- PassengerRoot /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-3.0.8
446
+ LoadModule passenger_module /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}/ext/apache2/mod_passenger.so
447
+ PassengerRoot /opt/rhoconnect/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}
280
448
  PassengerRuby /opt/rhoconnect/bin/ruby
281
449
  _PASSENGER_LOAD_
282
450
 
@@ -291,12 +459,12 @@ def create_apache_vhost
291
459
  end
292
460
  vhost = <<_VHOST_
293
461
  <VirtualHost *:80>
294
- ServerName your.server.name.goes.here.com
295
- DocumentRoot /var/www/rhoconnect/public
462
+ ServerName www.yourhost.com
463
+ DocumentRoot /var/www/rhoapp/public
296
464
  PassengerMaxPoolSize 20
297
465
  PassengerMinInstances 6
298
466
  #...
299
- <Directory /var/www/rhoconnect/public
467
+ <Directory /var/www/rhoconnect/public>
300
468
  AllowOverride all
301
469
  Options -MultiViews
302
470
  </Directory>
@@ -306,43 +474,66 @@ _VHOST_
306
474
  File.open( vhost_file, 'w' ) { |f| f << vhost }
307
475
  end #create_apache_vhost
308
476
 
309
- # create_debian_readme
310
- # Creates the debian specific part of the readme and places it in options[:prefix]
311
- def create_debian_readme
477
+ # The debian Apache2 specific part of the readme and places it in options[:prefix]
478
+ def debian_apache_readme
312
479
  readme = <<_README_
313
- 4) Configure Apache2
314
- A) Configure virtual host for rhoconnect application:
315
- Edit the file /etc/apache2/sites-available/rhoconnect so that it
316
- reflects your specifications.
317
-
318
- B) Enable the virtual host:
319
- $ sudo a2ensite rhoconnect
320
-
321
- C) Load the passenger.load module
322
- $ sudo a2enmod passenger.load
323
-
324
- D) Restart apache to pick up the changes:
325
- $ sudo /etc/init.d/apache2 restart
480
+ 4) Installer created the following Apache2 configuration files:
481
+ - rhoconnect application template (/etc/apache2/sites-available/rhoconnect)
482
+ - passenger module (/etc/apache2/mods-available/passenger.load)
483
+
484
+ To complete setup of web server
485
+ A) Configure virtual host for rhoconnect application:
486
+ Edit the file /etc/apache2/sites-available/rhoconnect so that it reflects your specifications.
487
+
488
+ B) Enable the virtual host:
489
+ sudo a2ensite rhoconnect
490
+
491
+ C) Load the passenger.load module
492
+ sudo a2enmod passenger
493
+
494
+ D) Start server to pick up the changes:
495
+ sudo /etc/init.d/apache2 start
326
496
  _README_
327
497
 
328
498
  readme
329
- end #create_debian_readme
330
-
331
- # create_yum_readme
332
- # Creates the non-debian specific part of the readme file and places it in options[:prefix]
333
- def create_yum_readme
499
+ end
500
+
501
+ # The non-debian Apache2 specific part of the readme file and places it in options[:prefix]
502
+ def yum_apache_readme
334
503
  readme = <<_README_
335
- 4) Configure Apache2
336
- A) Configure virtual host for rhoconnect application:
337
- Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it
338
- reflects your specifications.
504
+ 4) Installer created the following Apache2 configuration files:
505
+ - rhoconnect application template (/etc/httpd/conf.d/rhoconnect.conf)
506
+ - passenger module (/etc/httpd/conf.d/passenger.conf)
507
+
508
+ To complete setup of web server
509
+ A) Configure virtual host for rhoconnect application:
510
+ Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it reflects your specifications.
339
511
 
340
- B) Restart apache to pick up the changes:
341
- $ sudo /sbin/service httpd restart
512
+ B) As root user start server to pick up the changes:
513
+ /sbin/service httpd start
342
514
  _README_
343
515
 
344
516
  readme
345
- end #create_yum_readme
517
+ end
518
+
519
+ def nginx_readme
520
+ readme = <<_NGINX_README_
521
+ 4) Installer compiled Nginx web server (/opt/nginx) with the following configuration files:
522
+ - Nginx start-up script (/etc/init.d/nginx)
523
+ - Nginx logrotate settings (/etc/logrotate.d/nginx)
524
+ - Nginx configuration file (/opt/nginx/conf/nginx.conf)
525
+ - passenger configuration file and virtual host template for rhoconnect application
526
+ (/opt/nginx/conf/conf.d/passenger.conf and /opt/nginx/conf/conf.d/rhoconnect.conf)
527
+
528
+ To complete setup of web server
529
+ A) Configure virtual host for rhoconnect application:
530
+ Edit the file /opt/nginx/conf/conf.d/rhoconnect.conf so that it reflects your specifications.
531
+
532
+ B) As root user start server to pick up the changes:
533
+ /etc/init.d/nginx start
534
+ _NGINX_README_
535
+ readme
536
+ end
346
537
 
347
538
  def create_texts
348
539
  if @redis
@@ -350,17 +541,54 @@ def create_texts
350
541
  create_redis_logrotate
351
542
  end
352
543
 
353
- create_passenger_load
354
- create_apache_vhost
544
+ if @server == 'nginx'
545
+ create_nginx_init
546
+ create_nginx_logrotate
547
+ create_nginx_conf_files
548
+ distro_info = nginx_readme
549
+ else
550
+ create_passenger_load
551
+ create_apache_vhost
552
+ distro_info = (@dist == 'debian') ? debian_apache_readme : yum_apache_readme
553
+ end
355
554
 
356
- puts generate_common_info
357
- distro_info = (@dist == 'debian') ? create_debian_readme : create_yum_readme
358
- puts distro_info
555
+ common_info = generate_common_info
556
+ readme = common_info + distro_info
557
+ File.open("#{@prefix}/README", 'w') { |f| f << readme }
558
+
559
+ afterwords = <<_IT_SHOULD_BE_DONE_
560
+
561
+ Thank you for choosing Rhomobile for your cross-platform app needs!
562
+ To finish this setup, please complete the following...
563
+
564
+ 1) Add necessary bins to the path(s) of the users who will
565
+ be using this software. You may also wish to add these items
566
+ to your #{@profile} to automatically add them upon login.
567
+ export PATH=#{@prefix}/bin:$PATH
568
+
569
+ _IT_SHOULD_BE_DONE_
570
+
571
+ puts afterwords +
572
+ if @server == 'nginx'
573
+ server_todo_list = <<_NGINX_TO_DO_
574
+ 2) Complete setup Nginx web server
575
+ A) Configure virtual host for your rhoconnect application:
576
+ Edit the file /opt/nginx/conf/conf.d/rhoconnect.conf so that it reflects your specifications.
577
+ B) As root user start server to pick up the changes:
578
+ /etc/init.d/nginx start
579
+
580
+ _NGINX_TO_DO_
581
+ else
582
+ server_todo_list = <<_APACHE2_TO_DO_
583
+ 2) Complete setup of Apache2 web server
584
+ A) Configure virtual host for your rhoconnect application:
585
+ Edit the file /etc/httpd/conf.d/rhoconnect.conf so that it reflects your specifications.
586
+ B) As root user start server to pick up the changes:
587
+ /sbin/service httpd start
588
+
589
+ _APACHE2_TO_DO_
590
+ end + "For more details see #{@prefix}/README file."
359
591
 
360
- File.open("#{@prefix}README", 'w') do |f|
361
- f << generate_common_info
362
- f << distro_info
363
- end
364
592
  end #create_texts
365
593
 
366
594
  create_texts
@@ -99,7 +99,7 @@ section "uninstall"
99
99
  Push "PATH"
100
100
  Push "R"
101
101
  Push "HKLM"
102
- Push "$INSTDIR\redis-2.2.12"
102
+ Push "$INSTDIR\redis-2.2.13"
103
103
  Call un.EnvVarUpdate
104
104
  Pop $R0
105
105
 
@@ -170,25 +170,25 @@ Section "Redis" redisSection
170
170
 
171
171
  SetOutPath $INSTDIR
172
172
 
173
- File /r "redis-2.2.12"
173
+ File /r "redis-2.2.13"
174
174
 
175
175
  ;add to path here
176
176
 
177
177
  Push "PATH"
178
178
  Push "P"
179
179
  Push "HKLM"
180
- Push "$INSTDIR\redis-2.2.12"
180
+ Push "$INSTDIR\redis-2.2.13"
181
181
  Call EnvVarUpdate
182
182
  Pop $R0
183
183
 
184
184
  Push "REDIS_HOME"
185
185
  Push "P"
186
186
  Push "HKLM"
187
- Push "$INSTDIR\redis-2.2.12"
187
+ Push "$INSTDIR\redis-2.2.13"
188
188
  Call EnvVarUpdate
189
189
  Pop $R0
190
190
 
191
- ExecWait '$INSTDIR\redis-2.2.12\redis-service.exe install' $0
191
+ ExecWait '$INSTDIR\redis-2.2.13\redis-service.exe install' $0
192
192
  StrCmp $0 "0" continue wrong
193
193
 
194
194
  wrong:
@@ -3,6 +3,6 @@ Server.api :clientcreate, :application, :get do |params,user,server|
3
3
  server.content_type :json
4
4
  client = Client.create(:user_id => server.current_user.id,:app_id => server.current_app.id)
5
5
  client.update_fields(params)
6
- { "client" => { "client_id" => client.id.to_s } }.merge!(server.source_config).to_json
6
+ { "client" => { "client_id" => client.id.to_s } }.to_json
7
7
  end
8
8
  end
@@ -1,6 +1,6 @@
1
1
  Server.api :clientregister, :application, :post do |params,user,server|
2
2
  server.catch_all do
3
3
  server.current_client.update_fields(params)
4
- server.source_config.to_json
4
+ server.status 200
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  Server.api :clientreset, :application, :get do |params,user,server|
2
2
  server.catch_all do
3
3
  ClientSync.reset(server.current_client, params)
4
- server.source_config.to_json
4
+ server.status 200
5
5
  end
6
6
  end
@@ -30,7 +30,6 @@ module Rhoconnect
30
30
  end
31
31
 
32
32
  def self.load(id,params)
33
- params.merge!(:last_sync => Time.now)
34
33
  validate_attributes(params)
35
34
  super(id,params)
36
35
  end
@@ -11,6 +11,7 @@ module Rhoconnect
11
11
  raise ArgumentError.new(UNKNOWN_CLIENT) unless client
12
12
  raise ArgumentError.new(UNKNOWN_SOURCE) unless source
13
13
  @source,@client,@p_size = source,client,p_size ? p_size.to_i : 500
14
+ @client.last_sync = Time.now if @client
14
15
  @source_sync = SourceSync.new(@source)
15
16
  end
16
17
 
@@ -28,7 +28,7 @@ class RhoconnectConsole::Server
28
28
  :links => [
29
29
  { :url => url_path('/homepage'), :selected => true, :title => 'Info' },
30
30
  { :url => url_path('/doc/select'), :title => 'Server Document' },
31
- { :url => url_path('/adapter'), :title => 'Adapter URL' },
31
+ { :url => url_path('/adapter'), :title => 'Backend App URL' },
32
32
  { :url => url_path('/users'), :title => 'Users' }
33
33
  ]
34
34
  }
@@ -8,7 +8,7 @@ class RhoconnectConsole::Server
8
8
  :links => [
9
9
  { :url => url_path('/homepage'), :title => 'Info' },
10
10
  { :url => url_path('/doc/select'), :title => 'Server Document' },
11
- { :url => url_path('/adapter'), :title => 'Adapter URL' },
11
+ { :url => url_path('/adapter'), :title => 'Backend App URL' },
12
12
  { :url => url_path('/users'), :selected => true, :title => 'Users' }
13
13
  ]
14
14
  }
@@ -108,10 +108,15 @@ class RhoconnectConsole::Server
108
108
 
109
109
  post '/user/ping' do
110
110
  params['sources'] = params['sources'].split(',')
111
+ params[:user_id] = params[:user_id].split(',')
111
112
  handle_api_error("Error while pinging") do
112
113
  RhoconnectApi::ping(session[:server],session[:token],params[:user_id],params)
113
114
  end
114
- user = CGI.escape(params[:user_id])
115
- redirect url_path(session[:errors] ? "/user/ping?user_id=#{user}" : "/user?user_id=#{user}"), 303
115
+ users = CGI.escape(params[:user_id].join(','))
116
+ if params[:user_id].size == 1
117
+ redirect url_path(session[:errors] ? "/user/ping?user_id=#{users}" : "/user?user_id=#{users}"), 303
118
+ else
119
+ redirect url_path(session[:errors] ? "/user/ping?user_id=#{users}" : "/users"), 303
120
+ end
116
121
  end
117
122
  end
@@ -1,9 +1,9 @@
1
- <h1>Set Adapter URL</h1>
1
+ <h1>Set Backend App URL</h1>
2
2
  <%=show_errors%>
3
3
  <form action="<%=url_path('/adapter/create')%>" method='POST'>
4
4
  <table>
5
5
  <tr>
6
- <td>adapter url:&nbsp;</td>
6
+ <td>backend app url:&nbsp;</td>
7
7
  <td><input style='padding-left:5px;width:300px' name='adapter_url' value='<%=@adapter%>'/></td>
8
8
  </tr>
9
9
  <tr>
@@ -1,8 +1,20 @@
1
- <h1>Ping <%=params[:user_id]%></h1>
1
+ <%users = params[:user_id].split(',')%>
2
+ <%if users.size == 1%>
3
+ <h1>Ping <%=users[0]%></h1>
4
+ <%else%>
5
+ <h1>Ping Users</h1>
6
+ <%end%>
2
7
  <%=show_errors%>
3
8
  <form method="POST" action="<%=url_path('user/ping')%>">
4
- <input type="hidden" name="user_id" value="<%=params[:user_id]%>">
5
9
  <table>
10
+ <%if users.size == 1%>
11
+ <input type="hidden" name="user_id" value="<%=params[:user_id]%>">
12
+ <%else%>
13
+ <tr>
14
+ <td>Users:</td>
15
+ <td><input type="text" name="user_id" value="<%=params[:user_id]%>" size=64/></td>
16
+ </tr>
17
+ <%end%>
6
18
  <tr>
7
19
  <td>Message:</td>
8
20
  <td><input type="text" name="message" value="push message" size=64/></td>