rhodes 2.0.0.beta8 → 2.0.0.beta9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/rhodes-setup CHANGED
@@ -55,28 +55,37 @@ if ENV['ANDROID_HOME']
55
55
  android = ENV['ANDROID_HOME']
56
56
  end
57
57
 
58
- android = android.gsub(/\\/,"/")
59
- apilevel = -1
60
- android_platform_dir = "/platforms/android-1.5"
61
- Dir.glob(File.join(android, 'platforms', '*')).each do |dir|
62
- props = File.join(dir, 'source.properties')
63
- next unless File.file? props
64
- File.open(props, 'r') do |f|
65
- while line = f.gets
66
- next if line !~ /^\s*AndroidVersion\.ApiLevel\s*=\s*([0-9]+)\s*$/
67
- apilevel = $1.to_i
58
+ while true
59
+ android = prompt_for("Android SDK path", android, false)
60
+
61
+ android = android.gsub(/\\/,"/")
62
+ apilevel = -1
63
+ android_platform_dir = "/platforms/android-1.5"
64
+ Dir.glob(File.join(android, 'platforms', '*')).each do |dir|
65
+ props = File.join(dir, 'source.properties')
66
+ next unless File.file? props
67
+ File.open(props, 'r') do |f|
68
+ while line = f.gets
69
+ next if line !~ /^\s*AndroidVersion\.ApiLevel\s*=\s*([0-9]+)\s*$/
70
+ apilevel = $1.to_i
71
+ break
72
+ end
73
+ end
74
+
75
+ if apilevel == 3
76
+ android_platform_dir = dir[android.length..-1]
68
77
  break
69
78
  end
70
79
  end
80
+ android = "" if apilevel == -1
71
81
 
72
- if apilevel == 3
73
- android_platform_dir = dir[android.length..-1]
74
- break
82
+ unless File.directory? File.join(android, android_platform_dir)
83
+ puts "Invalid Android SDK path"
84
+ next
75
85
  end
76
- end
77
- android = "" if apilevel == -1
78
86
 
79
- android = prompt_for("Android SDK path", android, false, android_platform_dir)
87
+ break
88
+ end
80
89
 
81
90
  # try to detect android ndk
82
91
  ndks = Dir.glob(File.dirname(android) + "/android-ndk-*").sort
@@ -183,9 +183,11 @@ module Rho
183
183
 
184
184
  hashSrcs = Rhom::RhomSource::find_all_ashash
185
185
  puts "hashSrcs : #{hashSrcs}"
186
- arSrc.each do |src|
187
- oldSrc = hashSrcs[src['name']]
186
+ arSrc.each do |name, src|
187
+ oldSrc = hashSrcs[name]
188
188
  puts "oldSrc: #{oldSrc}"
189
+ #update schema_version
190
+ src['schema_version'] = src['schema']['version'] if src['schema'] && src['schema']['version']
189
191
  if oldSrc
190
192
  oldVer = oldSrc.schema_version
191
193
  newVer = src['schema_version']
@@ -194,14 +196,14 @@ module Rho
194
196
  end
195
197
  end
196
198
 
197
- Rho::RhoConfig::add_source(src['name'], src)
199
+ Rho::RhoConfig::add_source(name, src)
198
200
  end
199
201
 
200
202
  init_sources()
201
- rescue Exception => e
202
- puts "Error load_server_sources: #{e}"
203
- puts "Trace: #{e.backtrace}"
204
- end
203
+ rescue Exception => e
204
+ puts "Error load_server_sources: #{e}"
205
+ puts "Trace: #{e.backtrace}"
206
+ end
205
207
 
206
208
  end
207
209
 
@@ -282,6 +284,10 @@ module Rho
282
284
 
283
285
  index_param.each do |index_name, index_cols|
284
286
  strCols = ""
287
+ if index_cols.is_a?(String)
288
+ index_cols = index_cols.split(',')
289
+ end
290
+
285
291
  index_cols.each do |col|
286
292
  strCols += ',' if strCols.length() > 0
287
293
  strCols += "\"#{col}\""
@@ -350,14 +356,15 @@ module Rho
350
356
 
351
357
  if source['schema'] && source['schema']['property']
352
358
  str = ""
353
- source['schema']['property'].each do |name, type|
354
- if type && type.is_a?(Hash)
355
- next unless type[:blob] || type['blob']
356
- str += ',' if str.length()>0
357
- str += name.to_s() + ',' + (type[:server_overwrite]||type[:server_overwrite].to_i() ? '1' : '0')
358
- elsif type && type.to_s == 'blob'
359
+ source['schema']['property'].each do |name, ar_type|
360
+ if ar_type && ar_type.is_a?(String)
361
+ ar_type = ar_type.split(',')
362
+ end
363
+
364
+ if ar_type && ar_type[0].to_s == 'blob'
359
365
  str += ',' if str.length()>0
360
- str += name.to_s() + ',0'
366
+ str += name.to_s() + ','
367
+ str += (ar_type[1].to_s() == 'overwrite' ? '1' : '0')
361
368
  end
362
369
  end
363
370
 
@@ -54,7 +54,8 @@ module Rhom
54
54
  db.destroy_tables(:exclude => ['sources','client_info'])
55
55
  end
56
56
 
57
- ::Rho::RHO.init_schema_sources
57
+ hash_migrate = {}
58
+ ::Rho::RHO.init_schema_sources(hash_migrate)
58
59
  end
59
60
 
60
61
  def database_full_reset_and_logout
@@ -22,14 +22,14 @@ module Rhom
22
22
  false
23
23
  end
24
24
 
25
- def property(name,type=:string)
25
+ def property(name,type=:string,option=nil)
26
26
  fixed_schema?()
27
27
 
28
28
  BaseModel.model_params ||= {}
29
29
 
30
30
  BaseModel.model_params['schema'] ||= {}
31
31
  BaseModel.model_params['schema']['property'] ||= {}
32
- BaseModel.model_params['schema']['property'][name.to_s] = type
32
+ BaseModel.model_params['schema']['property'][name.to_s] = [type,option]
33
33
 
34
34
 
35
35
  end
@@ -77,6 +77,8 @@
77
77
  NSMutableArray *views = [NSMutableArray arrayWithCapacity:count];
78
78
  NSMutableArray *tabs = [[NSMutableArray alloc] initWithCapacity:count];
79
79
 
80
+ NSString *initUrl = nil;
81
+
80
82
  for (int i = 0; i < count; ++i) {
81
83
  int index = i*4 - 1;
82
84
  NSString *label = [items objectAtIndex:++index];
@@ -84,6 +86,9 @@
84
86
  NSString *icon = [items objectAtIndex:++index];
85
87
  NSString *reload = [items objectAtIndex:++index];
86
88
 
89
+ if (!initUrl)
90
+ initUrl = url;
91
+
87
92
  if (label && url && icon) {
88
93
  RhoTabBarData *td = [[RhoTabBarData alloc] init];
89
94
  td.url = url;
@@ -93,7 +98,7 @@
93
98
  subController.title = label;
94
99
  NSString *imagePath = [[AppManager getApplicationsRootPath] stringByAppendingPathComponent:icon];
95
100
  subController.tabBarItem.image = [UIImage imageWithContentsOfFile:imagePath];
96
- [subController navigateRedirect:url tab:0];
101
+ //[subController navigateRedirect:url tab:0];
97
102
 
98
103
  [tabs addObject:td];
99
104
  [views addObject:subController];
@@ -109,6 +114,9 @@
109
114
  self.tabbarData = tabs;
110
115
  [tabs release];
111
116
 
117
+ if (initUrl)
118
+ [self navigateRedirect:initUrl tab:0];
119
+
112
120
  return self;
113
121
  }
114
122
 
@@ -324,6 +324,11 @@ rb_thread_terminate_all(void)
324
324
  thread_debug("rb_thread_terminate_all (main thread: %p)\n", (void *)th);
325
325
  st_foreach(vm->living_threads, terminate_i, (st_data_t)th);
326
326
 
327
+ #if USE_NATIVE_THREAD_PRIORITY
328
+ th->priority -= 2;
329
+ native_thread_apply_priority(th);
330
+ #endif
331
+
327
332
  while (!rb_thread_alone()) {
328
333
  PUSH_TAG();
329
334
  if (EXEC_TAG() == 0) {
@@ -17,7 +17,7 @@
17
17
  #define WIN32_WAIT_TIMEOUT 10 /* 10 ms */
18
18
  #undef Sleep
19
19
 
20
- #define native_thread_yield() Sleep(0)
20
+ #define native_thread_yield() Sleep(10)
21
21
  #define remove_signal_thread_list(th)
22
22
 
23
23
  static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
@@ -723,6 +723,15 @@ public class SyncEngine implements NetRequest.IRhoSession
723
723
  void login(String name, String password, String callback)
724
724
  {
725
725
  try {
726
+ /*
727
+ processServerSources("{\"sources\":{ \"ProductEx\":{ "+
728
+ "\"sync_type\":\"incremental\", \"partition\":\"application\", \"source_id\":\"7\","+
729
+ " \"sync_priority\":\"0\", \"model_type\":\"fixed_schema\", "+
730
+ " \"schema\":{\"version\":\"1.1\", \"property\":{\"brand\":\"string\", \"price\":\"string\", \"quantity\":\"string\", \"name\":\"string\", "+
731
+ " \"image_url\":\"blob\", \"image_url_ex\":\"blob,overwrite\"}, "+
732
+ " \"index\":[{\"by_brand_price1\":\"brand,price\"}, {\"by_quantity1\":\"quantity\"}], \"unique_index\":[{\"by_name1\":\"name\"}]}, "+
733
+ " \"belongs_to\":{\"brand\":\"Customer\"}}}}");//, \"schema_version\":\"1.0\"
734
+ */
726
735
  NetResponse resp = null;
727
736
 
728
737
  try{
@@ -364,7 +364,7 @@ void CSyncEngine::processServerSources(String strSources)
364
364
  /*NetResponse(resp,getNet().pushData( getNet().resolveUrl("/system/loadserversources"), strSources, null ));
365
365
  loadAllSources();
366
366
 
367
- rho_db_init_attr_manager(); */
367
+ rho_db_init_attr_manager();*/
368
368
  }
369
369
  }
370
370
 
@@ -626,14 +626,13 @@ void CSyncEngine::login(String name, String password, String callback)
626
626
  {
627
627
  /*
628
628
  processServerSources(
629
- "{\"sources\":[{ \"name\":\"ProductEx\", "
629
+ "{\"sources\":{ \"ProductEx\":{ "
630
630
  "\"sync_type\":\"incremental\", \"partition\":\"application\", \"source_id\":\"7\","
631
631
  " \"sync_priority\":\"0\", \"model_type\":\"fixed_schema\", "
632
- " \"schema\":{\"property\":{\"brand\":\"string\", \"price\":\"string\", \"quantity\":\"string\", \"name\":\"string\", "
633
- " \"image_url\":\"blob\", \"image_url_ex\":{\"blob\":\"1\", \"server_overwrite\":\"1\"}}, "
634
- " \"index\":[{\"by_brand_price1\":[\"brand\", \"price\"]}, {\"by_quantity1\":[\"quantity\"]}], \"unique_index\":[{\"by_name1\":[\"name\"]}]}, "
635
- " \"belongs_to\":{\"brand\":\"Customer\"}, "
636
- " \"schema_version\":\"1.0\"}]}");
632
+ " \"schema\":{\"version\":\"1.1\", \"property\":{\"brand\":\"string\", \"price\":\"string\", \"quantity\":\"string\", \"name\":\"string\", "
633
+ " \"image_url\":\"blob\", \"image_url_ex\":\"blob,overwrite\"}, "
634
+ " \"index\":[{\"by_brand_price1\":\"brand,price\"}, {\"by_quantity1\":\"quantity\"}], \"unique_index\":[{\"by_name1\":\"name\"}]}, "
635
+ " \"belongs_to\":{\"brand\":\"Customer\"}}}}");//, \"schema_version\":\"1.0\"
637
636
  */
638
637
  PROF_START("Login");
639
638
  //try {
@@ -191,7 +191,7 @@ CNetResponseImpl* CNetRequestImpl::sendString(const String& strBody)
191
191
 
192
192
  if ( !HttpSendRequest( m_hRequest, NULL, 0, const_cast<char*>(strBody.c_str()), strBody.length() ) )
193
193
  {
194
- if (checkSslCertError())
194
+ if (!m_bCancel && checkSslCertError())
195
195
  {
196
196
  if ( !HttpSendRequest( m_hRequest, NULL, 0, const_cast<char*>(strBody.c_str()), strBody.length() ) )
197
197
  {
@@ -319,6 +319,9 @@ void CNetRequestImpl::readResponse(CNetResponseImpl* pNetResp)
319
319
  wchar_t szHttpRes[10];
320
320
  DWORD nIndex = 0;
321
321
 
322
+ if ( m_bCancel )
323
+ return;
324
+
322
325
  if( !HttpQueryInfo( m_hRequest, HTTP_QUERY_STATUS_CODE, szHttpRes, &dwLen, &nIndex) )
323
326
  {
324
327
  m_pszErrFunction = L"HttpQueryInfo";
@@ -379,7 +382,7 @@ CNetResponseImpl* CNetRequestImpl::downloadFile(common::CRhoFile& oFile)
379
382
 
380
383
  if ( !HttpSendRequest( m_hRequest, NULL, 0, NULL, 0 ) )
381
384
  {
382
- if (checkSslCertError())
385
+ if (!m_bCancel && checkSslCertError())
383
386
  {
384
387
  if ( !HttpSendRequest( m_hRequest, NULL, 0, NULL, 0 ) )
385
388
  {
@@ -617,9 +620,9 @@ void CNetRequestImpl::cancel()
617
620
 
618
621
  if ( m_hRequest )
619
622
  InternetCloseHandle(m_hRequest);
620
- /* if ( hConnection )
621
- InternetCloseHandle(hConnection);
622
- if ( hInet )
623
+ if ( m_hConnection )
624
+ InternetCloseHandle(m_hConnection);
625
+ /* if ( hInet )
623
626
  InternetCloseHandle(hInet); */
624
627
  /*
625
628
  hRequest = 0;
@@ -657,6 +660,9 @@ CNetRequestImpl::~CNetRequestImpl()
657
660
  void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetResp, common::CRhoFile* pFile /*=NULL*/,
658
661
  char* pBuf, DWORD dwBufSize )
659
662
  {
663
+ if (m_bCancel)
664
+ return;
665
+
660
666
  //if ( pNetResp->getRespCode() == 500 || pNetResp->getRespCode() == 422 )
661
667
  // return;
662
668
  char* pBufToFree = 0;
@@ -694,7 +700,7 @@ void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetRe
694
700
 
695
701
  pNetResp->setValid(true);
696
702
 
697
- }while(bRead && dwBytesRead > 0);
703
+ }while(bRead && dwBytesRead > 0 && !m_bCancel );
698
704
 
699
705
  if ( !pNetResp->isOK() )
700
706
  LOG(TRACE) + "Server response: " + pNetResp->getCharData();
data/rhodes.gemspec CHANGED
@@ -3,7 +3,7 @@ require "lib/rhodes.rb"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{rhodes}
6
- s.version = '2.0.0.beta8'
6
+ s.version = '2.0.0.beta9'
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Rhomobile"]
@@ -14,7 +14,8 @@ Gem::Specification.new do |s|
14
14
  files = Array.new
15
15
  IO.read("Manifest.txt").each_line {|x| files << x.chomp}
16
16
  s.files = files
17
- s.has_rdoc = true
17
+ # disable rdoc until we fix the docs
18
+ s.has_rdoc = false
18
19
  s.homepage = %q{http://www.rhomobile.com}
19
20
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
20
21
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhodes
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230044
4
+ hash: -1848230043
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
- - beta8
11
- version: 2.0.0.beta8
10
+ - beta9
11
+ version: 2.0.0.beta9
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rhomobile