rhodes 3.2.0.beta.7 → 3.2.0.beta.8

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -970,6 +970,7 @@ namespace "rhomobile-debug" do
970
970
  chdir 'rhomobile-debug'
971
971
 
972
972
  puts "Loading gemspec"
973
+ require 'rubygems'
973
974
  spec = Gem::Specification.load('rhomobile-debug.gemspec')
974
975
 
975
976
  puts "Building gem"
data/bin/set-rhodes-sdk CHANGED
@@ -15,7 +15,8 @@ if File.exists? "build.yml"
15
15
  YAML.dump( $app_config, out )
16
16
  end
17
17
 
18
- rakefilepath = File.join( File.dirname(`get-rhodes-info --rhodes-path`), 'res/generators/templates/application/Rakefile' )
18
+ rakefilepath = File.join( `get-rhodes-info --rhodes-path`.chomp(), 'res/generators/templates/application/Rakefile' )
19
+ puts "Application Rakefile has been updated to use latest Rhodes gem."
19
20
  cp rakefilepath, '.'
20
21
  end
21
22
  end
data/doc/device-caps.txt CHANGED
@@ -299,6 +299,8 @@ Remove contact identified by the provided id from the phonebook. (delete)
299
299
 
300
300
  On all devices, properties currently supported are: "id","first_name","last_name","mobile_number","home_number","business_number","email_address","company_name"
301
301
 
302
+ ### iPhone
303
+
302
304
  On iPhone, additional contact properties are supported.
303
305
 
304
306
  General:
@@ -326,6 +328,38 @@ Phone numbers:
326
328
  Home pages:
327
329
  "home_page"
328
330
 
331
+ ### Android
332
+
333
+ On Android extended RhoContact::find functionality is implemented.
334
+ In addition to common usage described above it is allowed to pass additional parameter values:
335
+
336
+ * :all - get all contacts as usual
337
+ * :first - find first contact from list
338
+ * :count - returns count of contacts
339
+
340
+ For these selectors an additional params hash may be used. The next keys and values are recognized in additional params:
341
+
342
+ * :per_page - max count if contacts returned by find
343
+ * :offset - offset from begin of contacts' list
344
+ These two parameters are used to paginate contacts list. If used with :count exact number of returned contacts can be determined (for example for last page).
345
+ * :select - list of contact properties have to be selected from phonebook (Use it to enchance query performance)
346
+
347
+ On Android the nexts contact properties are supported (every of them may be used in :select list):
348
+
349
+ General:
350
+ "id", "display_name", "first_name", "last_name"
351
+
352
+ Phone numbers:
353
+ "mobile_number", "home_number", "business_number"
354
+
355
+ E-mails:
356
+ "email_address"
357
+
358
+ Company:
359
+ "company_name"
360
+
361
+ **NOTE: In most cases the result of RhoContact::find query may return more contact properties the defined in :select**
362
+
329
363
  ### Sample
330
364
  For examples on how to use the API provided by this class, see the view and controller in the /app/Contacts folder in the [System API Samples application](http://github.com/rhomobile/rhodes-system-api-samples/tree/master/app/Contacts/controller.rb).
331
365
 
@@ -1,3 +1,6 @@
1
+ ## 1.0.3
2
+ * Fix working with Ruby 1.9.2
3
+
1
4
  ## 1.0.2
2
5
  * Change debug port parameter name
3
6
  * Fix issue with run from Rhosync
@@ -21,12 +21,13 @@ def debug_read_cmd(io,wait)
21
21
  end
22
22
 
23
23
  def execute_cmd(cmd, advanced)
24
+ #$_s.write("execute_cmd start\n")
24
25
  cmd = URI.unescape(cmd.gsub(/\+/,' ')) if advanced
25
26
  puts "[Debugger] Executing: #{cmd.inspect}"
26
27
  result = ""
27
28
  error = '0';
28
29
  begin
29
- result = eval(cmd, $_binding).inspect
30
+ result = eval(cmd.to_s, $_binding).inspect
30
31
  rescue Exception => exc
31
32
  error = '1';
32
33
  result = "#{$!}".inspect
@@ -34,6 +35,7 @@ def execute_cmd(cmd, advanced)
34
35
 
35
36
  cmd = URI.escape(cmd.sub(/[\n\r]+$/, ''), Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) if advanced
36
37
  $_s.write("EV" + (advanced ? "L:#{error}:#{cmd}:" : ':'+(error.to_i != 0 ? 'ERROR: ':'')) + result + "\n")
38
+ #$_s.write("execute_cmd end\n")
37
39
  end
38
40
 
39
41
  def get_variables(scope)
@@ -68,9 +70,9 @@ def get_variables(scope)
68
70
  vars.each do |v|
69
71
  if v !~ /^\$(=|KCODE)$/
70
72
  begin
71
- result = eval(v,$_binding).inspect
73
+ result = eval(v.to_s, $_binding).inspect
72
74
  rescue Exception => exc
73
- #$_s.write("get var exception\n")
75
+ $_s.write("get var exception\n")
74
76
  result = "#{$!}".inspect
75
77
  end
76
78
  $_s.write("V:#{vartype}:#{v}:#{result}\n")
@@ -162,7 +162,7 @@ public class XMLParser extends RubyBasic {
162
162
 
163
163
  private void parse(String strXML)throws Exception
164
164
  {
165
- InputStream in = new ByteArrayInputStream(strXML.getBytes());
165
+ InputStream in = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
166
166
 
167
167
  parse(in);
168
168
  }
@@ -215,6 +215,16 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
215
215
  //#endif
216
216
  BOOL nameChanged = ![self isContentsEqual:fileManager first:filePathNew second:filePathOld];
217
217
 
218
+ BOOL restoreSymLinks_only = NO;
219
+
220
+ {
221
+ NSString* testName = [rhoRoot stringByAppendingPathComponent:@"lib"];
222
+ if (![fileManager fileExistsAtPath:testName]) {
223
+ restoreSymLinks_only = YES;
224
+ }
225
+ restoreSymLinks_only = NO;
226
+ }
227
+
218
228
  BOOL contentChanged;
219
229
  if (nameChanged)
220
230
  contentChanged = YES;
@@ -223,26 +233,43 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
223
233
  filePathOld = [rhoRoot stringByAppendingPathComponent:@"hash"];
224
234
 
225
235
  contentChanged = ![self isContentsEqual:fileManager first:filePathNew second:filePathOld];
236
+
237
+ // check for lost sym-links (upgrade OS or reinstall application without change version)
238
+ if (!contentChanged) {
239
+ // check exist of sym-link
240
+ NSString* testName = [rhoRoot stringByAppendingPathComponent:@"lib"];
241
+ if (![fileManager fileExistsAtPath:testName]) {
242
+ NSLog(@" Can not found main Sym-Link - we should restore all sym-links !");
243
+ contentChanged = YES;
244
+ restoreSymLinks_only = YES;
245
+ }
246
+ else {
247
+ NSLog(@" Main Sym-Link founded - disable restoring !");
248
+ }
249
+ }
250
+
226
251
  }
252
+
253
+ NSString* testName = [rhoRoot stringByAppendingPathComponent:@"lib"];
254
+ BOOL libExist = [fileManager fileExistsAtPath:testName];
255
+ if (libExist) {
256
+ NSLog(@" Lib File is Exist: %@", testName);
257
+ }
258
+ else {
259
+ NSLog(@" Lib File is NOT Exist: %@", testName);
260
+ }
227
261
 
262
+
228
263
  if (contentChanged) {
229
264
  #ifdef RHO_DONT_COPY_ON_START
230
265
  // we have next situations when we should remove old content:
231
266
  // 1. we upgrade old version (where we copy all files)
232
267
  // we should remove all files
233
268
  // 2. we upgrade version with symlinks
234
- // we should remove only symlinks
269
+ // we should remove only symlinks
270
+ // 3. we should only restore sym-lins after that was cleared - OS upgrade/reinstall app with the same version/restore from bakup etc.
235
271
  // we check old "lib" file - if it is SymLink then we have new version of Rhodes (with SymLinks instead of files)
236
272
 
237
- NSString* testName = [rhoRoot stringByAppendingPathComponent:@"lib"];
238
- //BOOL libExist = [fileManager fileExistsAtPath:testName];
239
- //if (libExist) {
240
- // NSLog(@" Lib File is Exist: %@", testName);
241
- //}
242
- //else {
243
- // NSLog(@" Lib File is NOT Exist: %@", testName);
244
- //}
245
-
246
273
  BOOL isNewVersion = isPathIsSymLink(fileManager, testName);
247
274
 
248
275
  RhoFileManagerDelegate_RemoveOnly_SymLinks* myDelegate = nil;
@@ -296,26 +323,28 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
296
323
  [myDelegate release];
297
324
  }
298
325
  // copy "db"
299
- NSString *copy_dirs[] = {@"db"};
300
- for (int i = 0, lim = sizeof(copy_dirs)/sizeof(copy_dirs[0]); i < lim; ++i) {
301
- BOOL remove = nameChanged;
302
- if ([copy_dirs[i] isEqualToString:@"db"] && !hasOldName)
303
- remove = NO;
304
- NSString *src = [bundleRoot stringByAppendingPathComponent:copy_dirs[i]];
305
- NSLog(@"copy src: %@", src);
306
- NSString *dst = [rhoRoot stringByAppendingPathComponent:copy_dirs[i]];
307
- NSLog(@"copy dst: %@", dst);
308
- [self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:remove];
309
- }
310
- // Finally, copy "hash" and "name" files
311
- NSString *items[] = {@"hash", @"name"};
312
- for (int i = 0, lim = sizeof(items)/sizeof(items[0]); i < lim; ++i) {
313
- NSString *src = [bundleRoot stringByAppendingPathComponent:items[i]];
314
- NSLog(@"copy src: %@", src);
315
- NSString *dst = [rhoRoot stringByAppendingPathComponent:items[i]];
316
- NSLog(@"copy dst: %@", dst);
317
- [fileManager removeItemAtPath:dst error:&error];
318
- [fileManager copyItemAtPath:src toPath:dst error:&error];
326
+ if (!restoreSymLinks_only) {
327
+ NSString *copy_dirs[] = {@"db"};
328
+ for (int i = 0, lim = sizeof(copy_dirs)/sizeof(copy_dirs[0]); i < lim; ++i) {
329
+ BOOL remove = nameChanged;
330
+ if ([copy_dirs[i] isEqualToString:@"db"] && !hasOldName)
331
+ remove = NO;
332
+ NSString *src = [bundleRoot stringByAppendingPathComponent:copy_dirs[i]];
333
+ NSLog(@"copy src: %@", src);
334
+ NSString *dst = [rhoRoot stringByAppendingPathComponent:copy_dirs[i]];
335
+ NSLog(@"copy dst: %@", dst);
336
+ [self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:remove];
337
+ }
338
+ // Finally, copy "hash" and "name" files
339
+ NSString *items[] = {@"hash", @"name"};
340
+ for (int i = 0, lim = sizeof(items)/sizeof(items[0]); i < lim; ++i) {
341
+ NSString *src = [bundleRoot stringByAppendingPathComponent:items[i]];
342
+ NSLog(@"copy src: %@", src);
343
+ NSString *dst = [rhoRoot stringByAppendingPathComponent:items[i]];
344
+ NSLog(@"copy dst: %@", dst);
345
+ [fileManager removeItemAtPath:dst error:&error];
346
+ [fileManager copyItemAtPath:src toPath:dst error:&error];
347
+ }
319
348
  }
320
349
  #else
321
350
  NSString *dirs[] = {@"apps", @"lib", @"db", @"hash", @"name"};
@@ -123,13 +123,16 @@ void rho_connectclient_processmodels(RHOM_MODEL* pModels, int nModels)
123
123
  oUserDB.executeSQL("UPDATE sources SET sync_priority=?, sync_type=?, partition=?, schema=?, schema_version=?, associations=?, blob_attribs=? WHERE name=?",
124
124
  model.sync_priority, getSyncTypeName(model.sync_type), model.partition,
125
125
  (model.type == RMT_PROPERTY_FIXEDSCHEMA ? "schema_model" : ""), "", strAssoc.c_str(), model.blob_attribs, model.name );
126
-
126
+
127
+ model.source_id = res.getIntByIdx(1);
128
+
127
129
  }else //new model
128
130
  {
129
131
  oUserDB.executeSQL("INSERT INTO sources (source_id,name,sync_priority, sync_type, partition, schema,schema_version, associations, blob_attribs) values (?,?,?,?,?,?,?,?,?) ",
130
132
  nStartModelID, model.name, model.sync_priority, getSyncTypeName(model.sync_type), model.partition,
131
133
  (model.type == RMT_PROPERTY_FIXEDSCHEMA ? "schema_model" : ""), "", strAssoc.c_str(), model.blob_attribs );
132
134
 
135
+ model.source_id = nStartModelID;
133
136
  nStartModelID++;
134
137
  }
135
138
  }
@@ -922,7 +925,7 @@ void rho_connectclient_free_sync_objectnotify(RHO_CONNECT_OBJECT_NOTIFY* pNotify
922
925
  free(pNotify->created_objects);
923
926
  }
924
927
 
925
- memset( pNotify, 0, sizeof(RHO_CONNECT_NOTIFY) );
928
+ memset( pNotify, 0, sizeof(RHO_CONNECT_OBJECT_NOTIFY) );
926
929
  }
927
930
 
928
931
  unsigned long rho_connectclient_strarray_create()
@@ -38,7 +38,8 @@ typedef struct _RHOM_MODEL
38
38
  {
39
39
  const char* name;
40
40
  RHOM_MODEL_TYPE type;
41
-
41
+ int source_id; //generated when insert to database
42
+
42
43
  RHOM_SYNC_TYPE sync_type;
43
44
  int sync_priority;
44
45
 
data/rakefile.rb CHANGED
@@ -970,6 +970,7 @@ namespace "rhomobile-debug" do
970
970
  chdir 'rhomobile-debug'
971
971
 
972
972
  puts "Loading gemspec"
973
+ require 'rubygems'
973
974
  spec = Gem::Specification.load('rhomobile-debug.gemspec')
974
975
 
975
976
  puts "Building gem"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rhomobile-debug"
5
- s.version = "1.0.2"
5
+ s.version = "1.0.3"
6
6
  s.authors = ["Rhomobile"]
7
7
  s.date = Time.now.strftime('%Y-%m-%d')
8
8
  s.description = %q{Rhomobile debugger extension}
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: framework_spec
3
3
  bbver: 4.6
4
- sdk: /Users/brian/work/rhodes
4
+ sdk: ../../
5
5
  applog: rholog.txt
6
6
  version: 1.0.0
7
7
  vendor: rhomobile
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: perfomance_spec
3
3
  bbver: 5.0
4
- sdk: /Users/crystax/work/rhomobile/rhodes
4
+ sdk: ../../
5
5
  applog: rholog.txt
6
6
  version: 1.0.0
7
7
  vendor: rhomobile
@@ -66,7 +66,10 @@ describe "url_for and link_to" do
66
66
 
67
67
  it "should generate urls for create or index actions" do
68
68
  @c.url_for(:action => :index, :id => '{12}').should == '/application/model'
69
- if !defined?(RHO_WP7)
69
+
70
+ is_bb6 = System::get_property('platform') == 'Blackberry' && (System::get_property('os_version').split('.')[0].to_i >= 6)
71
+
72
+ if !defined?(RHO_WP7) && !is_bb6
70
73
  @c.url_for(:action => :create).should == '/application/model'
71
74
  else
72
75
  @c.url_for(:action => :create).should == '/application/model/create'
@@ -90,7 +93,8 @@ end
90
93
  end
91
94
 
92
95
  it "should generate urls with a query" do
93
- if !defined?(RHO_WP7)
96
+ is_bb6 = System::get_property('platform') == 'Blackberry' && (System::get_property('os_version').split('.')[0].to_i >= 6)
97
+ if !defined?(RHO_WP7) && !is_bb6
94
98
  @c.url_for(:action => :create, :query => {:name => 'John Smith',
95
99
  'address' => "http://john.smith.com"}).should == '/application/model?name=John%20Smith&address=http%3A%2F%2Fjohn.smith.com'
96
100
  else
@@ -94,7 +94,7 @@ describe "RhoFile" do
94
94
  it "should isfileexist" do
95
95
  File.exist?(Rho::RhoApplication::get_model_path('app', 'spec')).should == true if System.get_property('platform') != 'Blackberry'
96
96
  File.exist?(Rho::RhoApplication::get_blob_folder()).should == true
97
- File.exist?( File.join( __rhoGetCurrentDir(), 'RhoLog.txt')).should == true
97
+ File.exist?( File.join( __rhoGetCurrentDir(), 'rholog.txt')).should == true
98
98
 
99
99
  bExc = false
100
100
  begin
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: phone_spec
3
3
  bbver: 6.0
4
- sdk: /Users/crystax/work/rhomobile/rhodes
4
+ sdk: ../../
5
5
  #applog: rholog.txt
6
6
  version: 1.0.0
7
7
  vendor: rhomobile
data/version CHANGED
@@ -1 +1 @@
1
- 3.2.0.beta.7
1
+ 3.2.0.beta.8
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhodes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196461
4
+ hash: 62196467
5
5
  prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - beta
11
- - 7
12
- version: 3.2.0.beta.7
11
+ - 8
12
+ version: 3.2.0.beta.8
13
13
  platform: ruby
14
14
  authors:
15
15
  - Rhomobile
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-10-18 00:00:00 -07:00
20
+ date: 2011-10-19 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency