rhoconnect 3.2.0.beta5 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (3.2.0.beta5)
4
+ rhoconnect (3.2.0)
5
5
  bundler (~> 1.0)
6
6
  json (~> 1.6.0)
7
7
  rake (~> 0.9.2)
@@ -23,7 +23,7 @@ GEM
23
23
  cabin (> 0)
24
24
  async-rack (0.5.1)
25
25
  rack (~> 1.1)
26
- aws-s3 (0.6.2)
26
+ aws-s3 (0.6.3)
27
27
  builder
28
28
  mime-types
29
29
  xml-simple
@@ -37,13 +37,13 @@ GEM
37
37
  coffee-script (2.2.0)
38
38
  coffee-script-source
39
39
  execjs
40
- coffee-script-source (1.3.2)
40
+ coffee-script-source (1.3.3)
41
41
  crack (0.3.1)
42
42
  daemons (1.1.8)
43
43
  diff-lcs (1.1.3)
44
44
  eventmachine (1.0.0.beta.4)
45
45
  excon (0.13.4)
46
- execjs (1.3.2)
46
+ execjs (1.4.0)
47
47
  multi_json (~> 1.0)
48
48
  extlib (0.9.15)
49
49
  ffaker (1.14.0)
@@ -58,8 +58,8 @@ GEM
58
58
  net-ssh (>= 2.1.3)
59
59
  nokogiri (~> 1.5.0)
60
60
  ruby-hmac
61
- formatador (0.2.1)
62
- fpm (0.4.9)
61
+ formatador (0.2.3)
62
+ fpm (0.4.10)
63
63
  arr-pm (~> 0.0.7)
64
64
  backports (= 2.3.0)
65
65
  cabin (~> 0.4.3)
@@ -83,10 +83,10 @@ GEM
83
83
  libwebsocket (0.1.3)
84
84
  addressable
85
85
  mime-types (1.18)
86
- multi_json (1.3.5)
86
+ multi_json (1.3.6)
87
87
  net-scp (1.0.4)
88
88
  net-ssh (>= 1.99.1)
89
- net-ssh (2.3.0)
89
+ net-ssh (2.5.2)
90
90
  nokogiri (1.5.2)
91
91
  rack (1.4.1)
92
92
  rack-fiber_pool (0.9.2)
@@ -117,7 +117,7 @@ GEM
117
117
  rspec-mocks (2.9.0)
118
118
  ruby-hmac (0.4.0)
119
119
  rubyzip (0.9.8)
120
- selenium-webdriver (2.21.2)
120
+ selenium-webdriver (2.22.0)
121
121
  childprocess (>= 0.2.5)
122
122
  ffi (~> 1.0)
123
123
  libwebsocket (~> 0.1.3)
@@ -131,7 +131,7 @@ GEM
131
131
  rack (~> 1.3, >= 1.3.6)
132
132
  rack-protection (~> 1.2)
133
133
  tilt (~> 1.3, >= 1.3.3)
134
- sprockets (2.4.2)
134
+ sprockets (2.4.3)
135
135
  hike (~> 1.2)
136
136
  multi_json (~> 1.0)
137
137
  rack (~> 1.0)
@@ -150,7 +150,7 @@ GEM
150
150
  uuidtools (2.1.2)
151
151
  vegas (0.1.11)
152
152
  rack (>= 1.0.0)
153
- webmock (1.8.7)
153
+ webmock (1.8.6)
154
154
  addressable (>= 2.2.7)
155
155
  crack (>= 0.1.7)
156
156
  xml-simple (1.1.1)
data/doc/deploying.txt CHANGED
@@ -93,7 +93,7 @@ To test it you need to as a root user start redis, nginx, and thin servers:
93
93
  :::term
94
94
  $ sudo /etc/init.d/redis start
95
95
  $ sudo /etc/init.d/nginx start
96
- $ sudo /etc/init.d/thin start
96
+ $ sudo /etc/init.d/thin start
97
97
 
98
98
  And verify that it's up and running by visiting application web console in your browser:
99
99
 
@@ -169,3 +169,64 @@ to place the WAR file into the server's deploy directory.
169
169
 
170
170
 
171
171
 
172
+ * Rhoconnect gem version >= 3.2.0
173
+
174
+ #### Create Rhoconnect application
175
+ Create your Rhoconnect app and make sure that it's up and running in your development environment using thin:
176
+
177
+ :::term
178
+ $ cd your_rhoconnect_app
179
+ $ bundle exec thin start
180
+
181
+ #### Declare `Procfile`
182
+ This step is optional, but it will give you more control and flexibility when application deployed on Heroku.
183
+ Create in your rhoconnect project file named `Procfile`:
184
+
185
+ :::term
186
+ web: bundle exec thin start -p $PORT
187
+
188
+ If your application is using resque worker, then you should specify it in the `Procfile` as well:
189
+
190
+ :::term
191
+ web: bundle exec thin start -p $PORT
192
+ worker: bundle exec rake resque:work
193
+
194
+ Now you can run your app locally
195
+
196
+ :::term
197
+ $ gem install foreman
198
+ $ foreman start
199
+
200
+
201
+ #### Deploy to Heroku
202
+ Before moving your code to Git you need comment in your project's `Gemfile` declaration of `sqlite3` gem, because target
203
+ Heroku server has no devel libraries required to build that gem.
204
+
205
+ :::term
206
+ $ git init
207
+ $ git add .
208
+ $ git commit -m ' ... '
209
+ $ heroku create --stack cedar
210
+ $ heroku addons:add redistogo:nano
211
+ $ git push heroku master
212
+ $ heroku open
213
+
214
+ #### Monitoring app on Heroku
215
+ Use `heroku ps` to determine the number of processes that are executing.
216
+ Use `heroku logs` to view an aggregated list of log messages from all process types.
217
+
218
+ :::term
219
+ $ heroku ps
220
+ $ heroku logs
221
+
222
+ #### Get connected with Rhodes client
223
+ If you have rhodes client and wanted to sync it with rhoconnect app on Heroku, then set proper sync server URL in `rhoconfig.txt` file
224
+
225
+ :::term
226
+ syncserver = 'http://<your-app-here>.herokuapp.com/application'
227
+
228
+
229
+
230
+
231
+
232
+
data/doc/install.txt CHANGED
@@ -8,17 +8,19 @@ On Linux, you install the RhoConnect gem from the command line; you can also do
8
8
 
9
9
  ## Mac OS
10
10
 
11
- If you're running Mac OS, download the latest [Motorola RhoMobile Suite Installer for Macintosh](http://rhomobile.com/rhostudio-mac). This contains [Redis](http://redis.io/), [RhoConnect](/rhoconnect/introduction) and [Rhodes](/rhodes/introduction).
11
+ If you're running Mac OS, download the latest [MotorolaRhoMobileSuite Installer for Macintosh](http://rhomobile.com/rhostudio-mac). This contains [Redis](http://redis.io/), [RhoConnect](/rhoconnect/introduction) and [Rhodes](/rhodes/introduction).
12
12
 
13
- Mac OS has [Ruby](http://www.ruby-lang.org/en/) installed. It is recommended that you install [Ruby Version Manager](https://rvm.io//) and install Ruby version 1.9.3, latest patch.
13
+ Although Mac OS has [Ruby](http://www.ruby-lang.org/en/) installed, the official way to install Ruby for RhoStudio is to install [Ruby Version Manager](https://rvm.io//) and then install Ruby version 1.9.3.
14
14
 
15
- Click on the RhoStudioInstaller for Mac download file to open it. You will get a window similar to this:
15
+ Click on the MotorolaRhoMobileSuite Installer for Mac download file to open it. You will get a window similar to this:
16
16
 
17
17
  <img src="http://rhodocs.s3.amazonaws.com/rhodes-devel/rhostudio-mac-install.png" alt="RhoStudioInstaller Mac" />
18
18
 
19
- Run the install gems script appropriate for you. If you have Ruby Version Manager, you can run "Install gems on rvm." A terminal window will open; wait for the gems install process to complete.
19
+ Run "Install gems on rvm" (this requires that you have installed Ruby Version Manager). A terminal window will open; wait for the gems install process to complete.
20
20
 
21
- Then drag RhoStudio to the Applications folder.
21
+ Then drag Motorola RhoStudio to the Applications folder.
22
+
23
+ **NOTE: Installing Ruby into the System folder is not supported by RhoMobile; the official RhoMobile way to install and use Ruby on the Macintosh is with Ruby Version Manager. If you do not use Ruby Version Manager and instead install Ruby into the System folder, you will need to start and run RhoStudio from the command line using sudo.**
22
24
 
23
25
  ## Windows
24
26
 
@@ -40,7 +42,7 @@ For Mac OS 10.6 and earlier, the JDK is already installed. For Mac OS 10.7, Java
40
42
 
41
43
  ### Setting the JDK Path
42
44
 
43
- On Windows installs for RhoMobile, go to RhoStudio Preferences (Windows -> Preferences) and set the JDK path in the rhobuild.yml file. On Windows 64-bit installations, you must set this path to the 32-bit version of the JDK, such as `C:/Program Files (x86)/Java/jdk1.7.0_01/bin`.
45
+ On Windows installs for RhoMobile, go to RhoStudio Preferences (Windows -> Preferences) and set the JDK path in the rhobuild.yml file. On Windows 64-bit installations, you must set this path to the 32-bit version of the JDK, such as `C:/Program Files (x86)/Java/jdk<version number>/bin`.
44
46
 
45
47
  On Mac OS, the path to the JDK is automatically set once Java is installed.
46
48
 
@@ -56,7 +58,9 @@ To install RhoConnect on Linux, and to install RhoConnect on Windows or Mac OS u
56
58
 
57
59
  3. [Redis](http://redis.io/) - RhoConnect includes a simple [rake task](/rhoconnect/command-line#rake-tasks) `redis:install` to install redis, covered in the [Rake Tasks section](rhoconnect/command-line#rake-tasks). Alternatively, you can [install redis directly](http://redis.io/download).
58
60
 
59
- 4. Install the RhoConnect Gem. Run this command to install.
61
+ 4. Install the RhoConnect Gem.
62
+
63
+ Run this command to install the RhoConnect Gem.
60
64
 
61
65
  :::term
62
66
  $ [sudo] gem install rhoconnect
@@ -67,4 +71,12 @@ NOTE: Windows doesn't come with the necessary build tools to install gems ('make
67
71
 
68
72
  You can [install RhoStudio as a plugin for Eclipse](rhostudio-eclipse).
69
73
 
70
- RhoSimulator, which comes with RhoStudio for Mac and Windows, does not work with Linux.
74
+ RhoSimulator, which comes with RhoStudio for Mac and Windows, does not work with Linux.
75
+
76
+ ## Setting the Location of the RhoStudio Workspace Directory
77
+
78
+ When you start RhoStudio, you can set the location of the workspace directory. The path to the workspace directory should not contain space symbols: if the path has spaces, a RhoConnect application created with RhoStudio will not work properly.
79
+
80
+ ## Standalone Ruby Installation and Ruby Version Manager
81
+
82
+ Do not install Ruby as a standalone if you also use Ruby Version Manager (rvm) to install Ruby. If you need only one version of Ruby, you can install Ruby as a standalone. If you need more than one version of Ruby, you should uninstall standalone Ruby and then install Ruby with Ruby Version Manager. Mixed standalone Ruby and rvm-controlled Ruby installations can conflict and cause runtime issues in Rhodes applications.
data/doc/rest-api.txt CHANGED
@@ -35,6 +35,19 @@ All API calls will return http 200 and requested data (if applied). Otherwise, A
35
35
 
36
36
  ## API Methods
37
37
 
38
+ ### `login`
39
+ Login to the RhoConnect server.
40
+
41
+ :::ruby
42
+ require 'rest_client'
43
+ require 'json'
44
+
45
+ server = "http://localhost:9292"
46
+ login = "rhoadmin"
47
+ password = ""
48
+
49
+ res = RestClient.post("#{server}/login", { :login => login, :password => password }.to_json, :content_type => :json)
50
+
38
51
  ### `get_api_token`
39
52
  Before you can use RhoConnect API you should get API token:
40
53
 
@@ -117,7 +130,7 @@ Push new objects or object updates to RhoConnect. These changes will be sent to
117
130
  **NOTE: Normally, `push_objects` method will refresh the whole :md document in Redis. However, in case of large-size
118
131
  documents, `push_objects` method can be optimized by invoking only the necessary updates. This can help reducing
119
132
  the number of transactions with Redis. To force the optimization, user can use the `:rebuild_md => false` flag
120
- in the `push_objects` parameters hash.
133
+ in the `push_objects` parameters hash.**
121
134
 
122
135
  ### `push_deletes`
123
136
  Delete objects from RhoConnect. These objects will be deleted from the device the next time it synchronizes.
@@ -223,6 +236,44 @@ Push object deletes to RhoConnect. This method doesn't involve pulling the exist
223
236
  :content_type => :json
224
237
  )
225
238
 
239
+ ### `get_adapter`
240
+ Returns the url of the source adapter from the RhoConnect server.
241
+
242
+ :::ruby
243
+ adapter_url = RestClient.post(
244
+ "#{server}/api/get_adapter",
245
+ {
246
+ :api_token => token
247
+ }.to_json,
248
+ :content_type => :json
249
+ ).body
250
+
251
+ ### `save_adapter`
252
+ Saves the url of the source adapter to the RhoConnect server.
253
+
254
+ :::ruby
255
+ RestClient.post(
256
+ "#{server}/api/save_adapter",
257
+ {
258
+ :api_token => token,
259
+ :adapter_url => url
260
+ }.to_json,
261
+ :content_type => :json
262
+ )
263
+
264
+ ### `upload_file`
265
+ Upload a file to the RhoConnect server.
266
+
267
+ :::ruby
268
+ RestClient.post(
269
+ "#{server}/api/upload_file",
270
+ {
271
+ :api_token => token,
272
+ :upload_file => path_to_file
273
+ }.to_json,
274
+ :content_type => :json
275
+ )
276
+
226
277
  ### `list_users`
227
278
  List users registered with this RhoConnect application.
228
279
 
@@ -261,6 +312,22 @@ Delete User and all associated devices from the RhoConnect application.
261
312
  :content_type => :json
262
313
  )
263
314
 
315
+ ### `update_user`
316
+ Update attributes for a user on this RhoConnect application.
317
+
318
+ :::ruby
319
+ RestClient.post(
320
+ "#{server}/api/update_user",
321
+ {
322
+ :api_token => token,
323
+ :user_id => user_id
324
+ :attributes => {
325
+ :a_user_specific_attribute => a_user_specific_attribute_value
326
+ }
327
+ }.to_json,
328
+ :content_type => :json
329
+ )
330
+
264
331
  ### `list_clients`
265
332
  List clients (devices) associated with given user.
266
333
 
@@ -367,7 +434,7 @@ Return attributes associated with a given source:
367
434
  ### `update_source_params`
368
435
  Updates attributes associated with a given source:
369
436
 
370
- * `poll_interval` - query poll interval; defines how often RhoConnect will call source adapter to query for new data, set to -1 to disable polling, 0 to always poll
437
+ `poll_interval` - query poll interval; defines how often RhoConnect will call source adapter to query for new data, set to -1 to disable polling, 0 to always poll.
371
438
 
372
439
  :::ruby
373
440
  attributes = RestClient.post("#{server}/api/update_source_params",
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ rhoconnect (3.2.0.beta1)
5
+ bundler (~> 1.0)
6
+ json (~> 1.6.0)
7
+ rake (~> 0.9.2)
8
+ redis (>= 2.2.0)
9
+ resque (~> 1.20.0)
10
+ rest-client (~> 1.6.1)
11
+ rubyzip (~> 0.9.4)
12
+ sinatra (~> 1.3)
13
+ templater (~> 1.0.0)
14
+ thor (~> 0.14.6)
15
+ uuidtools (>= 2.1.1)
16
+
17
+ GEM
18
+ remote: http://rubygems.org/
19
+ specs:
20
+ SystemTimer (1.2.3)
21
+ async-rack (0.5.1)
22
+ rack (~> 1.1)
23
+ daemons (1.1.8)
24
+ diff-lcs (1.1.3)
25
+ eventmachine (0.12.10)
26
+ extlib (0.9.15)
27
+ highline (1.6.11)
28
+ json (1.6.6)
29
+ mime-types (1.18)
30
+ multi_json (1.3.2)
31
+ rack (1.4.1)
32
+ rack-fiber_pool (0.9.2)
33
+ rack-protection (1.2.0)
34
+ rack
35
+ rack-test (0.6.1)
36
+ rack (>= 1.0)
37
+ rake (0.9.2.2)
38
+ redis (2.2.2)
39
+ redis-namespace (1.0.3)
40
+ redis (< 3.0.0)
41
+ resque (1.20.0)
42
+ multi_json (~> 1.0)
43
+ redis-namespace (~> 1.0.2)
44
+ sinatra (>= 0.9.2)
45
+ vegas (~> 0.1.2)
46
+ rest-client (1.6.7)
47
+ mime-types (>= 1.16)
48
+ rhomobile-debug (1.0.6)
49
+ rspec (2.6.0)
50
+ rspec-core (~> 2.6.0)
51
+ rspec-expectations (~> 2.6.0)
52
+ rspec-mocks (~> 2.6.0)
53
+ rspec-core (2.6.4)
54
+ rspec-expectations (2.6.0)
55
+ diff-lcs (~> 1.1.2)
56
+ rspec-mocks (2.6.0)
57
+ rubyzip (0.9.7)
58
+ sinatra (1.3.2)
59
+ rack (~> 1.3, >= 1.3.6)
60
+ rack-protection (~> 1.2)
61
+ tilt (~> 1.3, >= 1.3.3)
62
+ sqlite3 (1.3.5)
63
+ templater (1.0.0)
64
+ diff-lcs (>= 1.1.2)
65
+ extlib (>= 0.9.5)
66
+ highline (>= 1.4.0)
67
+ thin (1.3.1)
68
+ daemons (>= 1.0.9)
69
+ eventmachine (>= 0.12.6)
70
+ rack (>= 1.0.0)
71
+ thor (0.14.6)
72
+ tilt (1.3.3)
73
+ uuidtools (2.1.2)
74
+ vegas (0.1.11)
75
+ rack (>= 1.0.0)
76
+
77
+ PLATFORMS
78
+ ruby
79
+
80
+ DEPENDENCIES
81
+ SystemTimer (~> 1.2.3)
82
+ async-rack
83
+ dbd-jdbc (>= 0.1.4)
84
+ dbi (>= 0.4.5)
85
+ eventmachine (~> 1.0.0.beta)
86
+ jdbc-sqlite3 (>= 3.7.2)
87
+ jruby-openssl (>= 0.7.4)
88
+ rack-fiber_pool
89
+ rack-test (>= 0.5.3)
90
+ rhoconnect!
91
+ rhomobile-debug (>= 1.0.2)
92
+ rspec (~> 2.6.0)
93
+ sqlite3 (>= 1.3.3)
94
+ thin
95
+ trinidad
96
+ warbler
97
+ win32-process
Binary file
@@ -373,6 +373,7 @@ _NGINX_CONF_
373
373
  Dir.mkdir "/opt/nginx/conf/conf.d" unless File.exist? "/opt/nginx/conf/conf.d"
374
374
  rho_vhost_conf = <<_VHOST_CONF_
375
375
  upstream thin_cluster {
376
+ ip_hash;
376
377
  server unix:/tmp/thin.0.sock;
377
378
  server unix:/tmp/thin.1.sock;
378
379
  # server unix:/tmp/thin.2.sock;
@@ -25,9 +25,11 @@ cmd "ruby ./installer/utils/create_sha1.rb #{dir_to_compare} ."
25
25
  old_sha1 = File.open(checksum_file) { |f| f.readline }
26
26
  new_sha1 = File.open('./checksum') { |f| f.readline }
27
27
 
28
+ puts Dir.ls_la dir_to_compare
29
+
28
30
  if !new_sha1.eql?(old_sha1)
29
31
  puts "Checksums do not match!"
30
32
  exit 2
31
33
  else
32
34
  puts "Checksums match!"
33
- end #if
35
+ end #if
@@ -332,8 +332,9 @@ module Rhoconnect
332
332
 
333
333
  private
334
334
  def _get_redis(server=nil)
335
- if ENV[REDIS_URL]
336
- Redis.connect(:url => ENV[REDIS_URL])
335
+ url = ENV[REDIS_URL] || ENV[REDISTOGO_URL] || nil
336
+ if url
337
+ Redis.connect(:url => url)
337
338
  elsif server and server.is_a?(String)
338
339
  host,port,db,password = server.split(':')
339
340
  Redis.new(:thread_safe => true, :host => host,
@@ -1,3 +1,3 @@
1
1
  module Rhoconnect
2
- VERSION = '3.2.0.beta5'
2
+ VERSION = '3.2.0'
3
3
  end
data/lib/rhoconnect.rb CHANGED
@@ -29,6 +29,7 @@ require 'rhoconnect/db_adapter'
29
29
  require 'rhoconnect/dynamic_adapter'
30
30
 
31
31
  REDIS_URL = 'REDIS' unless defined? REDIS_URL
32
+ REDISTOGO_URL = 'REDISTOGO_URL' unless defined? REDISTOGO_URL
32
33
 
33
34
  # Various module utilities for the store
34
35
  module Rhoconnect
data/spec/store_spec.rb CHANGED
@@ -32,6 +32,14 @@ describe "Store" do
32
32
  ENV.delete(REDIS_URL)
33
33
  end
34
34
 
35
+ it "should create redis connection based on REDISTOGO_URL ENV" do
36
+ ENV[REDISTOGO_URL] = 'redis://localhost:6379'
37
+ Redis.should_receive(:connect).with(:url => 'redis://localhost:6379').and_return { Redis.new }
38
+ Store.db = nil
39
+ Store.db.should_not == nil
40
+ ENV.delete(REDISTOGO_URL)
41
+ end
42
+
35
43
  it "should add simple data to new set" do
36
44
  Store.put_data(@s.docname(:md),@data).should == true
37
45
  Store.get_data(@s.docname(:md)).should == @data