rhoconnect 3.2.0.beta1 → 3.2.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/CHANGELOG.md +14 -0
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +33 -7
  4. data/README.md +4 -0
  5. data/Rakefile +13 -11
  6. data/commands/commands/rhoconnect/create_user.rb +1 -1
  7. data/commands/commands/rhoconnect/delete_device.rb +1 -1
  8. data/commands/commands/rhoconnect/delete_user.rb +1 -1
  9. data/commands/commands/rhoconnect/get_token.rb +1 -1
  10. data/commands/commands/rhoconnect/reset.rb +1 -1
  11. data/commands/execute.rb +0 -1
  12. data/doc/bulk-sync.txt +35 -1
  13. data/doc/install.txt +7 -3
  14. data/examples/simple/config.ru +1 -1
  15. data/generators/templates/application/Gemfile +1 -1
  16. data/install.sh +4 -4
  17. data/installer/unix-like/create_texts.rb +31 -31
  18. data/installer/unix-like/pre_uninstall.sh +2 -3
  19. data/installer/unix-like/rho_connect_install_constants.rb +3 -3
  20. data/installer/unix-like/rho_connect_install_debian.rb +0 -5
  21. data/installer/unix-like/rho_connect_install_yum.rb +1 -3
  22. data/installer/utils/constants.rb +4 -4
  23. data/installer/utils/nix_install_test.rb +20 -20
  24. data/installer/utils/package_upload/repos.rake +2 -2
  25. data/installer/utils/package_upload/s3_single_file.rb +57 -0
  26. data/lib/rhoconnect/client_sync.rb +1 -1
  27. data/lib/rhoconnect/jobs/bulk_data_job.rb +30 -32
  28. data/lib/rhoconnect/jobs/ping_job.rb +15 -2
  29. data/lib/rhoconnect/server.rb +3 -0
  30. data/lib/rhoconnect/tasks.rb +5 -7
  31. data/lib/rhoconnect/user.rb +1 -0
  32. data/lib/rhoconnect/version.rb +1 -1
  33. data/lib/rhoconnect/web-console/models/adapter.js +2 -0
  34. data/lib/rhoconnect/web-console/models/client.js +0 -22
  35. data/lib/rhoconnect/web-console/models/source.js +1 -1
  36. data/lib/rhoconnect/web-console/templates/index.erb +2 -1
  37. data/lib/rhoconnect/web-console/views/home.js +22 -1
  38. data/lib/rhoconnect/web-console/views/set_adapter.js +5 -6
  39. data/rhoconnect.gemspec +2 -1
  40. data/spec/api/source/fast_insert_spec.rb +1 -1
  41. data/spec/api/user/create_user_spec.rb +11 -1
  42. data/spec/client_sync_spec.rb +32 -25
  43. data/spec/javascripts/admins_routes_spec.js +108 -103
  44. data/spec/javascripts/doc_view_spec.js +2 -3
  45. data/spec/javascripts/edit_user_view_spec.js +1 -1
  46. data/spec/javascripts/home_view_spec.js +6 -6
  47. data/spec/javascripts/server_doc_view_spec.js +4 -0
  48. data/spec/javascripts/session_spec.js +15 -0
  49. data/spec/javascripts/set_adapter_view_spec.js +2 -6
  50. data/spec/javascripts/show_device_view_spec.js +4 -1
  51. data/spec/javascripts/show_user_view_spec.js +4 -0
  52. data/spec/javascripts/source_docs_view_spec.js +2 -2
  53. data/spec/jobs/bulk_data_job_spec.rb +8 -12
  54. data/spec/jobs/ping_job_spec.rb +21 -0
  55. data/spec/perf/bulk_data_perf_spec.rb +1 -2
  56. data/spec/server/server_spec.rb +2 -4
  57. data/spec/spec_helper.rb +13 -3
  58. data/tasks/jasmine.rake +7 -0
  59. metadata +24 -7
  60. data/lib/rhoconnect/console/rhoconnect_api.rb +0 -245
  61. data/spec/api/application/rhoconnect_api_spec.rb +0 -592
@@ -60,27 +60,27 @@ def compile_stack_info
60
60
  # Append the rest of the file name according to distribution
61
61
  if @user == 'ubuntu'
62
62
 
63
- @dist = { :flavor => "ubuntu",
64
- :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
65
- :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
66
- :pkg_mgr => 'dpkg',
67
- :pkg_type => 'DEB',
68
- :pkg_repo => 'apt-get',
69
- :deps => Constants::DEB_DEPS,
63
+ @dist = { :flavor => "ubuntu",
64
+ :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
65
+ :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
66
+ :pkg_mgr => 'dpkg',
67
+ :pkg_type => 'DEB',
68
+ :pkg_repo => 'apt-get',
69
+ :deps => Constants::DEB_DEPS,
70
70
  :repo_src_file => '/etc/apt/sources.list',
71
- :repo_str => '\n' +
71
+ :repo_str => '\n' +
72
72
  '# This is the repository for rhoconnect packages\n' +
73
73
  "deb http://#{BUCKET}.s3.amazonaws.com/#{channel}/deb rhoconnect main" }
74
74
  elsif @user == 'root'
75
- @dist = { :flavor => "centos",
76
- :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
77
- :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
78
- :pkg_mgr => 'rpm',
79
- :pkg_type => 'RPM',
80
- :pkg_repo => 'yum',
81
- :deps => Constants::RPM_DEPS,
75
+ @dist = { :flavor => "centos",
76
+ :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
77
+ :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
78
+ :pkg_mgr => 'rpm',
79
+ :pkg_type => 'RPM',
80
+ :pkg_repo => 'yum',
81
+ :deps => Constants::RPM_DEPS,
82
82
  :repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
83
- :repo_str => '[rhoconnect]\n' +
83
+ :repo_str => '[rhoconnect]\n' +
84
84
  'name=Rhoconnect\n' +
85
85
  "baseurl=http://#{BUCKET}.s3.amazonaws.com/#{channel}/rpm" +
86
86
  '\nenabled=1\n' +
@@ -103,7 +103,8 @@ end #create_ec2_instance
103
103
  # Retrieves the access key and secret access key from the above specified file.
104
104
  def get_access_keys
105
105
  lines = IO.readlines Constants::ACCESS_KEY_FILE
106
- @access_key = lines.first.strip.split("=")[1]
106
+
107
+ @access_key = lines.first.strip.split("=")[1]
107
108
  @secret_access_key = lines.last.strip.split("=")[1]
108
109
  end #get_access_keys
109
110
 
@@ -223,13 +224,12 @@ def check_rc_service
223
224
  puts "Checking RC service."
224
225
  request = nil #Defined outside block as to not limit the scope of request to the do block.
225
226
  2.times do
226
- request = Net::HTTP.get_response(@host, '/')
227
+ request = Net::HTTP.get_response(@host, '/console/')
227
228
  end #do
228
229
 
229
230
  puts "Code: #{request.code} Message: #{request.message}"
230
231
 
231
- if request.code == '200' or
232
- request.code == '302'
232
+ if request.code.to_s < '400'
233
233
  puts "Rhoconnect service up!"
234
234
  else
235
235
  puts "Failed to connect to rhoconnect service."
@@ -18,7 +18,7 @@ task "build:repos", :build_type, :build_number do |t, args|
18
18
 
19
19
  # CONSTANTS
20
20
 
21
- RHOCONNECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..'))
21
+ RHOCONNECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))
22
22
 
23
23
  PKG_DIR = case build_type
24
24
  when 'release'
@@ -125,4 +125,4 @@ task "build:repos", :build_type, :build_number do |t, args|
125
125
  cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/#{dir} #{BUCKET}"
126
126
  end #do
127
127
  cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/SHA1 #{BUCKET}"
128
- end #build:repos
128
+ end #build:repos
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'aws/s3'
5
+
6
+ # Constants
7
+
8
+ FILE = File.expand_path(ARGV[0])
9
+ BUCKET = ARGV[1]
10
+ USER_DATA = `wget -q -O - http://169.254.169.254/latest/user-data`.split("\n")
11
+
12
+ # Methods
13
+
14
+ # Retrieves S3 credential information
15
+ def get_keys
16
+ access_key = USER_DATA[0].to_s.strip
17
+ secret_access_key = USER_DATA[1].to_s.strip
18
+ keys = { :access_key_id => access_key,
19
+ :secret_access_key => secret_access_key}
20
+ end #get_keys
21
+
22
+ # Establishes S3 connection
23
+ def establish_s3_connection
24
+ @s3_connection = AWS::S3::Base.establish_connection!(get_keys)
25
+ end #establish_s3_connection
26
+
27
+ # Uploads given file to the specified S3 bucket
28
+ def upload
29
+ # Upload the given file
30
+ AWS::S3::S3Object.store( FILE,
31
+ open( FILE ),
32
+ BUCKET,
33
+ :access => :public_read )
34
+
35
+ # display the URL of the file just uploaded
36
+ puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]
37
+ end #upload
38
+
39
+ # Script
40
+
41
+ begin
42
+ establish_s3_connection
43
+ rescue => e
44
+ puts "Error Connecting to S3!!"
45
+ puts e.inspect
46
+ puts e.backtrace
47
+ exit 1
48
+ end #begin
49
+
50
+ begin
51
+ upload
52
+ rescue => e
53
+ puts "Error Uploading files!!"
54
+ puts e.inspect
55
+ puts e.backtrace
56
+ exit 3
57
+ end #begin
@@ -25,7 +25,7 @@ module Rhoconnect
25
25
  key,value = op,cud_params[op]
26
26
  processed += _receive_cud(key,value) if value
27
27
  end
28
- @source_sync.process_cud if processed > 0
28
+ @source_sync.process_cud
29
29
  end
30
30
  end
31
31
 
@@ -6,48 +6,42 @@ module Rhoconnect
6
6
  @queue = :bulk_data
7
7
 
8
8
  def self.perform(params)
9
- bulk_data = nil
10
- begin
11
- bulk_data = BulkData.load(params["data_name"]) if BulkData.is_exist?(params["data_name"])
12
- if bulk_data
13
- timer = start_timer('starting bulk data process')
14
- bulk_data.process_sources
15
- timer = lap_timer('process_sources',timer)
16
- ts = Time.now.to_i.to_s
17
- create_sqlite_data_file(bulk_data,ts)
18
- timer = lap_timer('create_sqlite_data_file',timer)
19
- log "bulk_data.dbfile: #{bulk_data.dbfile}"
20
- create_hsql_data_file(bulk_data,ts) if Rhoconnect.blackberry_bulk_sync
21
- lap_timer('create_hsql_data_file',timer)
22
- log "finished bulk data process"
23
- #bulk_data.state = :completed
24
- #bulk_data.refresh_time = Time.now.to_i + Rhoconnect.bulk_sync_poll_interval
25
- else
26
- raise Exception.new("No bulk data found for #{params["data_name"]}")
27
- end
28
- rescue Exception => e
29
- bulk_data.delete if bulk_data
30
- log "Bulk data job raised: #{e.message}"
31
- log e.backtrace.join("\n")
32
- raise e
9
+ do_bulk_job(params) do |bulk_data|
10
+ timer = start_timer('starting bulk data process')
11
+ bulk_data.process_sources
12
+ timer = lap_timer('process_sources',timer)
13
+ ts = Time.now.to_i.to_s
14
+ create_sqlite_data_file(bulk_data,ts)
15
+ timer = lap_timer('create_sqlite_data_file',timer)
16
+ log "bulk_data.dbfile: #{bulk_data.dbfile}"
17
+ create_hsql_data_file(bulk_data,ts) if Rhoconnect.blackberry_bulk_sync
18
+ lap_timer('create_hsql_data_file',timer)
19
+ log "finished bulk data process"
33
20
  end
34
21
  end
35
22
 
36
23
  def self.after_perform_x(*args)
37
24
  log "BulkDataJob.after_perform_x hook called ..."
38
25
  params = args[0] # 1st parameter is bulk data
26
+ do_bulk_job(params) do |bulk_data|
27
+ bulk_data.state = :completed
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
+ end
31
+ end
32
+
33
+ def self.do_bulk_job(params)
34
+ bulk_data = nil
39
35
  begin
40
36
  bulk_data = BulkData.load(params["data_name"]) if BulkData.is_exist?(params["data_name"])
41
37
  if bulk_data
42
- bulk_data.state = :completed
43
- bulk_data.refresh_time = Time.now.to_i + Rhoconnect.bulk_sync_poll_interval
44
- log "BulkDataJob.after_perform_x hook set data state to complete."
38
+ yield bulk_data
45
39
  else
46
40
  raise Exception.new("No bulk data found for #{params["data_name"]}")
47
41
  end
48
42
  rescue Exception => e
49
43
  bulk_data.delete if bulk_data
50
- log "Bulk data after_perform_x raised: #{e.message}"
44
+ log "Bulk data job raised: #{e.message}"
51
45
  log e.backtrace.join("\n")
52
46
  raise e
53
47
  end
@@ -131,19 +125,23 @@ module Rhoconnect
131
125
  str[0..-2]
132
126
  end
133
127
 
128
+ # #2354: Bulk sync not updating sources table
129
+ # last_inserted_size +
130
+ # last_deleted_size
131
+ # backend_refresh_time +
134
132
  def self.populate_sources_table(db,sources_refs)
135
133
  db.transaction do |database|
136
134
  database.prepare("insert into sources
137
- (source_id,name,sync_priority,partition,sync_type,source_attribs,metadata,schema,blob_attribs,associations)
138
- values (?,?,?,?,?,?,?,?,?,?)") do |stmt|
135
+ (source_id,name,sync_priority,partition,sync_type,source_attribs,metadata,schema,blob_attribs,associations,last_inserted_size,backend_refresh_time)
136
+ values (?,?,?,?,?,?,?,?,?,?,?,?)") do |stmt|
139
137
  sources_refs.each do |source_name,ref|
140
138
  s = ref[:source]
141
139
  stmt.execute(s.source_id,s.name,s.priority,s.partition_type.to_s,
142
- s.sync_type.to_s,refs_to_s(ref[:refs]),s.get_value(:metadata),s.schema,s.blob_attribs,s.has_many)
140
+ s.sync_type.to_s,refs_to_s(ref[:refs]),s.get_value(:metadata),s.schema,s.blob_attribs,s.has_many,s.get_value(:md_size),s.read_state.refresh_time)
143
141
  end
144
142
  end
145
143
  end
146
- end
144
+ end
147
145
 
148
146
  def self.create_sqlite_data_file(bulk_data,ts)
149
147
  sources_refs = {}
@@ -10,12 +10,20 @@ module Rhoconnect
10
10
  phone_ids = []
11
11
  user_ids = params['user_id']
12
12
  user_ids = [user_ids] unless user_ids.is_a? Array
13
+ errors = []
13
14
  user_ids.each do |user|
14
- ping_by_user user, params, device_pins, phone_ids
15
+ user_errors = ping_by_user user, params, device_pins, phone_ids
16
+ errors = errors + user_errors if user_errors
17
+ end
18
+ if errors.size != 0
19
+ joined_err = errors.join '\n'
20
+ raise joined_err
15
21
  end
16
22
  end
17
23
 
18
24
  def self.ping_by_user(user_id, params, device_pins, phone_ids)
25
+ # all errors are recorded here
26
+ errors = []
19
27
  user = User.load(user_id)
20
28
  user.clients.members.each do |client_id|
21
29
  client = Client.load(client_id,{:source_name => '*'})
@@ -40,7 +48,11 @@ module Rhoconnect
40
48
  klass = Object.const_get(camelize(client.device_type.downcase))
41
49
  if klass
42
50
  params['vibrate'] = params['vibrate'].to_s
43
- klass.ping(params)
51
+ begin
52
+ klass.ping(params)
53
+ rescue Exception => e
54
+ errors << e
55
+ end
44
56
  end
45
57
  else
46
58
  log "Dropping ping request for client_id '#{client_id}' because it's already in user's device pin or phone_id list."
@@ -49,6 +61,7 @@ module Rhoconnect
49
61
  log "Skipping ping for non-registered client_id '#{client_id}'..."
50
62
  end
51
63
  end
64
+ errors
52
65
  end
53
66
  end
54
67
  end
@@ -79,6 +79,9 @@ module Rhoconnect
79
79
  end
80
80
 
81
81
  def login
82
+ if params[:login].nil? or params[:login].empty?
83
+ return false
84
+ end
82
85
  if params[:login] == 'rhoadmin'
83
86
  user = User.authenticate(params[:login], params[:password])
84
87
  elsif current_app and current_app.can_authenticate? and params[:login]
@@ -1,7 +1,6 @@
1
1
  require 'zip/zip'
2
2
  require 'uri'
3
3
  $:.unshift File.dirname(__FILE__)
4
- require 'console/rhoconnect_api'
5
4
  require 'utilities'
6
5
 
7
6
  DEPRECATION_MSG = "\n" +
@@ -14,7 +13,6 @@ puts DEPRECATION_MSG if $0.include? 'rake'
14
13
 
15
14
  namespace :rhoconnect do
16
15
  include Utilities
17
- include RhoconnectApi
18
16
 
19
17
  task :config do
20
18
  $settings = load_settings(File.join('settings','settings.yml'))
@@ -41,7 +39,7 @@ namespace :rhoconnect do
41
39
  task :reset => :config do
42
40
  confirm = ask " Are you sure? Resetting will remove all data!\n It will also return an error code to all\n existing devices when they connect! (yes/no): "
43
41
  if confirm == 'yes'
44
- RhoconnectApi.reset($url,$token)
42
+ RestClient.post("#{$url}/api/admin/reset", { :api_token => $token })
45
43
  puts "Database reset."
46
44
  else
47
45
  puts "Cancelling."
@@ -62,7 +60,7 @@ namespace :rhoconnect do
62
60
  end
63
61
  puts ''
64
62
  begin
65
- $token = RhoconnectApi.get_token($url,login,password)
63
+ $token = RestClient.post("#{$url}/api/admin/login", { :login => login, :password => password})
66
64
  rescue
67
65
  puts "Login failed."
68
66
  exit
@@ -90,20 +88,20 @@ namespace :rhoconnect do
90
88
  exit
91
89
  end
92
90
  puts ''
93
- RhoconnectApi.create_user($url,$token,login,password)
91
+ RestClient.post("#{$url}/api/user/create_user", { :api_token => $token, :attributes => {:login => login, :password => password}})
94
92
  end
95
93
 
96
94
  desc "Deletes a user from rhoconnect"
97
95
  task :delete_user => :config do
98
96
  login = ask "user to delete: "
99
- RhoconnectApi.delete_user($url,$token,login)
97
+ RestClient.post("#{$url}/api/user/delete_user", { :api_token => $token, :user_id => login })
100
98
  end
101
99
 
102
100
  desc "Deletes a device from rhoconnect"
103
101
  task :delete_device => :config do
104
102
  user_id = ask "device's user_id: "
105
103
  device_id = ask "device to delete: "
106
- RhoconnectApi.delete_client($url,$token,user_id,device_id)
104
+ RestClient.post("#{$url}/api/client/delete_client", { :api_token => $token, :user_id => user_id, :client_id => device_id})
107
105
  end
108
106
 
109
107
  desc "Sets the admin password"
@@ -14,6 +14,7 @@ module Rhoconnect
14
14
 
15
15
  class << self
16
16
  def create(fields={})
17
+ raise ArgumentError.new("Empty login") if (fields[:login].nil? or fields[:login].empty?)
17
18
  raise ArgumentError.new("Reserved user id #{fields[:login]}") if fields[:login] && fields[:login] == '__shared__'
18
19
  fields[:id] = fields[:login]
19
20
  user = super(fields)
@@ -1,3 +1,3 @@
1
1
  module Rhoconnect
2
- VERSION = '3.2.0.beta1'
2
+ VERSION = '3.2.0.beta2'
3
3
  end
@@ -12,6 +12,7 @@ var Adapter = Backbone.Model.extend({
12
12
  },
13
13
 
14
14
  set_adapter: function(adapter_url){
15
+ var adapter_url = adapter_url;
15
16
  $.ajax({
16
17
  type: 'POST',
17
18
  url: '/api/source/save_adapter',
@@ -19,6 +20,7 @@ var Adapter = Backbone.Model.extend({
19
20
  success: function(model, resp){
20
21
  $(".setadapter-status")[0].firstChild.className = "label label-success";
21
22
  $(".setadapter-status")[0].firstChild.innerHTML = "success";
23
+ $('#input_adapter').val(adapter_url);
22
24
  },
23
25
  error: function(resp){
24
26
  if(resp.status == 422){
@@ -80,26 +80,4 @@ var Client = Backbone.Model.extend({
80
80
  }
81
81
  })
82
82
  }
83
-
84
- // get_device: function(device_id){
85
- // $.ajax({
86
- // type: 'POST',
87
- // url: '/api/client/get_client_params',
88
- // data: {api_token : this.get('api_token'), client_id : device_id},
89
- // success: function(resp){
90
- // var r = JSON.parse(resp)
91
- // data = "";
92
- // $.each(r, function(index,value){
93
- // if(value.value != null && value.value != "")
94
- // data += "<tr><td>" + value.name + "</td><td>" + value.value + "</td></tr>"
95
- // })
96
- //
97
- // $('#device-table tr:last').after(data);
98
- // },
99
- // error: function(resp){
100
- // $('#showdevice-alert')[0].innerHTML = resp.responseText;
101
- // $('#showdevice-alert').css('display','block');
102
- // }
103
- // })
104
- // }
105
83
  })
@@ -53,7 +53,7 @@ var Source = Backbone.Model.extend({
53
53
  $('#source-table tr:last').after(adapters);
54
54
  }
55
55
  else{
56
- var license_text = "License to &nbsp;" + resp["licensee"] +
56
+ var license_text = "Licensed to &nbsp;" + resp["licensee"] +
57
57
  "&nbsp;on&nbsp;" + resp["issued"] + ", available&nbsp;" +
58
58
  resp["available"] + "&nbsp;out of&nbsp;" +
59
59
  resp['seats'] + "&nbsp;devices"
@@ -4,7 +4,8 @@
4
4
  <title>RhoConnect Console</title>
5
5
 
6
6
  <link rel="stylesheet" href='public/bootstrap.css' type="text/css" media="screen" />
7
- <script language="javascript" type="text/javascript" src='public/jquery-1.7.1.min.js'></script>
7
+ <!-- <script language="javascript" type="text/javascript" src='application.js'></script> -->
8
+ <script language="javascript" type="text/javascript" src='public/jquery-1.7.1.min.js'></script>
8
9
  <script language="javascript" type="text/javascript" src='public/underscore.js'></script>
9
10
  <script language="javascript" type="text/javascript" src='public/backbone.js'></script>
10
11
  <script language="javascript" type="text/javascript" src='public/rhoconnect-web.js'></script>
@@ -48,7 +48,28 @@ App.Views.Home = Backbone.View.extend({
48
48
  out += "<table id='source-table' class='table table-bordered'><thead><tr><th><h3>App partition sources</h3></th></tr></thead>"
49
49
  out += "</table></div>"
50
50
  out += "<div class='span4 pull-right'><h3>Sync Server URL</h3><code style='margin:0'>http://"+domain+"</code></br>";
51
- out += "<em style='margin-top:5px'>Paste this url into your client app configuration to sync with this RhoConnect instance.</em></div>"
51
+ out += "<em style='margin-top:5px'>Paste this url into your client app configuration to sync with this RhoConnect instance.</em></div>";
52
+ out += "<div class='span12' style='margin-top:20px'><h2>Getting Started with RhoConnect</h2>";
53
+ out += "<ol style='font-size:18px;margin-top:20px'><li>The Home Screen</li>";
54
+ out += "<ul style='margin:20px'>"
55
+ out += "<li>Sync Server URL<p style='margin-top:5px'> This url is the domain of this page appended with 'application'. This is a convenience function as you will need to paste this url into your rhodes app to sync with rhoconnect</p></li>"
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
+ 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 reseting the db as you will lose all your user information and document data.</em></b></p>"
59
+ out += "</ul>"
60
+ out += "<li>Server Doc</li>";
61
+ out += "<p style='margin:10px'>Enter a dbkey to view the stored value in redis. You can also set and delete doc values here.</p>"
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 apdapters partitioned by user as well as that users registered devices."
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
+ 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
+ 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
+ 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
+ out += "<li>Statistics</li>"
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 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
+ out += "</ol></div>"
72
+
52
73
  $(this.el).html(out);
53
74
  $('#main_content').html(this.el);
54
75
  return this
@@ -5,27 +5,26 @@ App.Views.SetAdapter = Backbone.View.extend({
5
5
  },
6
6
 
7
7
  initialize: function() {
8
- this.render("",domain);
8
+ this.render()
9
9
  this.model.get_adapter();
10
10
  },
11
11
 
12
12
  set_adapter: function(e){
13
13
  e.preventDefault();
14
14
  var adapter_url = $('#input_adapter').val();
15
- var domain = $('input#domain').val();
16
- this.render(adapter_url,domain);
15
+ this.render(adapter_url);
17
16
  $(".setadapter-status")[0].firstChild.className = "label label-warning";
18
17
  $(".setadapter-status")[0].firstChild.innerHTML = "loading...";
19
18
  $(".setadapter-status").css("visibility","visible");
20
19
  this.delegateEvents();
21
- this.model.set_adapter(adapter_url, self);
20
+ this.model.set_adapter(adapter_url);
22
21
  },
23
22
 
24
- render: function(adapter_url,domain) {
23
+ render: function() {
25
24
  $('#secondary-nav').css('display','block');
26
25
  out = "<h3>Backend App URL</h3>";
27
26
  out += "<form style='margin:0'>";
28
- out += "<input id='input_adapter' type='text' name='adapter_url' value='"+adapter_url+"' class='input-xlarge' placeholder='Enter Adapter URL' style='margin:0'/>";
27
+ out += "<input id='input_adapter' type='text' name='adapter_url' value='' class='input-xlarge' placeholder='Enter Adapter URL' style='margin:0'/>";
29
28
  out += "<input type='submit' value='Submit' class='btn btn-primary' style='margin-left:10px'/><div class='setadapter-status' style='display:inline;margin-left:10px;visibility:hidden'><span class=''></span></div>";
30
29
  out += "</form>";
31
30
 
data/rhoconnect.gemspec CHANGED
@@ -48,5 +48,6 @@ Gem::Specification.new do |s|
48
48
  s.add_dependency('resque', '~> 1.20.0')
49
49
  s.add_dependency('rest-client', '~> 1.6.1')
50
50
  s.add_dependency('templater', '~> 1.0.0')
51
- s.add_dependency('thor', '~> 0.14.6')
51
+ s.add_dependency('thor', '~> 0.14.6')
52
+ s.add_dependency('thin', '~> 1.3.1')
52
53
  end
@@ -22,7 +22,7 @@ describe "RhoconnectApiFastInsert" do
22
22
  :user_id => @u.id, :source_id => @s_fields[:name], :data => incorrect_insert
23
23
  last_response.should be_ok
24
24
  data['3'].merge!(incorrect_insert['3'])
25
- verify_result(@s.docname(:md) => data,@s.docname(:md_size)=>'4')
25
+ verify_result(@s.docname(:md_size)=>'4')
26
26
  end
27
27
  end
28
28
  end
@@ -12,5 +12,15 @@ describe "RhoconnectApiCreateUser" do
12
12
  params[:attributes][:password]).login.should == params[:attributes][:login]
13
13
  @a.users.members.sort.should == [@u.login, params[:attributes][:login]]
14
14
  end
15
- end
15
+ end
16
+
17
+ it_should_behave_like "ApiHelper" do
18
+ it "should not create user with empty login" do
19
+ params = {:api_token => @api_token,
20
+ :attributes => {:login => '', :password => ''}}
21
+ post "/api/user/create_user", params
22
+ last_response.should_not be_ok
23
+ User.is_exist?('').should == false
24
+ end
25
+ end
16
26
  end