rhodes 2.0.0.rc2 → 2.0.0

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.
Files changed (29) hide show
  1. data/CHANGELOG +5 -0
  2. data/Manifest.txt +5331 -0
  3. data/README.textile +3 -3
  4. data/lib/build/jake.rb +63 -3
  5. data/lib/framework/rho/rhofsconnector.rb +6 -1
  6. data/lib/framework/rhom/rhom.rb +8 -2
  7. data/platform/android/Rhodes/jni/include/rhodes.h +2 -0
  8. data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_Rhodes.h +8 -0
  9. data/platform/android/Rhodes/jni/src/rhodes.cpp +19 -0
  10. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +4 -0
  11. data/platform/android/build/android.rake +56 -3
  12. data/platform/bb/build/bb.rake +43 -1
  13. data/platform/iphone/Classes/RhoAlert.m +1 -1
  14. data/platform/shared/rubyJVM/src/com/rho/file/RandomAccessFile.java +6 -1
  15. data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +1 -1
  16. data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubyIO_Methods.java +5 -0
  17. data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/InputStreamExecutor.java +1 -1
  18. data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyFile.java +20 -0
  19. data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyIO.java +41 -8
  20. data/platform/wm/build/wm.rake +19 -0
  21. data/res/generators/templates/application/public/css/android.css +22 -13
  22. data/res/generators/templates/application/public/images/android/disclosure.png +0 -0
  23. data/rhobuild.yml +39 -0
  24. data/rhodes.gemspec +1 -1
  25. data/spec/phone_spec/app/Data/test.png +0 -0
  26. data/spec/phone_spec/app/Spec/controller.rb +3 -0
  27. data/spec/phone_spec/app/Spec/index.erb +2 -0
  28. data/spec/phone_spec/app/Spec/rhofile_spec.rb +17 -0
  29. metadata +7 -4
@@ -26,7 +26,8 @@ import com.xruby.runtime.lang.RubyValue;
26
26
 
27
27
  import java.io.InputStream;
28
28
  //import java.io.ByteArrayOutputStream;
29
- import javolution.io.UTF8StreamReader;
29
+ //import javolution.io.UTF8StreamReader;
30
+ import com.rho.net.NetRequest;
30
31
 
31
32
  ////@RubyLevelClass(name="IO")
32
33
  public class RubyIO extends RubyBasic {
@@ -296,9 +297,10 @@ public class RubyIO extends RubyBasic {
296
297
  }*/
297
298
 
298
299
  //RHO_COMMENT
300
+ /*
299
301
  private static char[] buffer = new char[1024];
300
- public static final RubyValue readFully(InputStream in) throws IOException {
301
- RubyString str = ObjectFactory.createString();
302
+ public static final RubyValue readFully(InputStream in, boolean bText) throws IOException {
303
+ RubyString str = ObjectFactory.createString();
302
304
  UTF8StreamReader reader = new UTF8StreamReader();
303
305
  reader.setInput(in);
304
306
  while (true) {
@@ -311,9 +313,9 @@ public class RubyIO extends RubyBasic {
311
313
  }
312
314
  }
313
315
  return str;
314
- }
316
+ }*/
315
317
 
316
- static RubyValue loadFromResources(String fileName){
318
+ static RubyValue loadFromResources(String fileName, boolean bText){
317
319
  InputStream stream = null;
318
320
  try {
319
321
  //stream = RhoClassFactory.createFile().getResourceAsStream(fileName.getClass(), "/"+fileName);
@@ -326,8 +328,10 @@ public class RubyIO extends RubyBasic {
326
328
  return null;
327
329
 
328
330
  try{
329
- return readFully(stream);
330
- }catch( IOException exc ){
331
+ String res = NetRequest.readFully(stream, bText ? "=UTF-8" : "");
332
+
333
+ return ObjectFactory.createString(res);
334
+ }catch( Exception exc ){
331
335
  throw new RubyException(RubyRuntime.RuntimeErrorClass,exc.getMessage());
332
336
  }
333
337
  }
@@ -336,7 +340,35 @@ public class RubyIO extends RubyBasic {
336
340
  public static RubyValue read(RubyValue receiver, RubyArray args, RubyBlock block) {
337
341
  String fileName = ((RubyString) args.get(0)).toStr();
338
342
  //RHO_COMMENT
339
- RubyValue r = loadFromResources(fileName);
343
+ RubyValue r = loadFromResources(fileName, true);
344
+ if ( r != null )
345
+ return r;
346
+
347
+ RubyIO io = ObjectFactory.createFile(fileName, "r");
348
+ int offset;
349
+ int length;
350
+
351
+ if (args.size() == 1) {
352
+ r = buildResult(io.read(), null);
353
+ } else {
354
+ length = ((RubyFixnum) args.get(1)).toInt();
355
+ if (args.size() == 2) {
356
+ r = buildResult(io.read(length), null);
357
+ } else {
358
+ offset = ((RubyFixnum) args.get(2)).toInt();
359
+ r = buildResult(io.read(length, offset), null);
360
+ }
361
+ }
362
+
363
+ io.close();
364
+ return r;
365
+ }
366
+
367
+ //@RubyLevelMethod(name="read")
368
+ public static RubyValue binread(RubyValue receiver, RubyArray args, RubyBlock block) {
369
+ String fileName = ((RubyString) args.get(0)).toStr();
370
+ //RHO_COMMENT
371
+ RubyValue r = loadFromResources(fileName, false);
340
372
  if ( r != null )
341
373
  return r;
342
374
 
@@ -359,4 +391,5 @@ public class RubyIO extends RubyBasic {
359
391
  io.close();
360
392
  return r;
361
393
  }
394
+
362
395
  }
@@ -254,4 +254,23 @@ namespace "run" do
254
254
  exit 1
255
255
  end
256
256
  end
257
+
258
+ namespace "win32" do
259
+
260
+ task :spec => ["build:win32"] do
261
+ Jake.before_run_spec
262
+ start = Time.now
263
+
264
+ args = [' ']
265
+ Jake.run2( "bin\\win32\\rhodes\\Debug\\rhodes.exe", args, {:directory => $config["build"]["wmpath"], :nowait => false}) do |line|
266
+ Jake.process_spec_output(line)
267
+ end
268
+ Jake.process_spec_results(start)
269
+
270
+ $stdout.flush
271
+ chdir $startdir
272
+ end
273
+
274
+ end
275
+
257
276
  end
@@ -5,15 +5,15 @@ body {
5
5
  height: 100%;
6
6
  width: inherit;
7
7
  font-family: "Droid",sans-serif;
8
- background: white;
9
- color: black;
8
+ background: black;
9
+ color: white;
10
10
  }
11
11
  h1 {
12
12
  font-size: 1em;
13
13
  }
14
14
 
15
15
  div#content {
16
- background-color:#ffffff;
16
+ background-color:black;
17
17
  width: 100%;
18
18
  padding:0;
19
19
  margin:0;
@@ -47,7 +47,7 @@ div#toolbar .regularButton,
47
47
  div#toolbar .blueButton,
48
48
  div#toolbar .backButton {
49
49
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, white),color-stop(0.5, #ccc), color-stop(1.0, #bdbebd));
50
- -webkit-border-radius: 1px;
50
+ -webkit-border-radius: 5px;
51
51
  font-size: .9em;
52
52
  border: 1px solid white;
53
53
  }
@@ -57,7 +57,7 @@ div#toolbar .backButton {
57
57
 
58
58
  div#pageTitle {
59
59
  height: 25px;
60
- margin:0;
60
+ margin:0;
61
61
  width: 100%;
62
62
  display:none;
63
63
  }
@@ -79,24 +79,28 @@ div#pageTitle h1 {
79
79
  /* lists */
80
80
 
81
81
  div#content ul {
82
- background: white;
82
+ background: black;
83
83
  }
84
84
 
85
85
  div#content ul li {
86
- border-bottom: 1px solid #000;
86
+ border-bottom: 1px solid #666;
87
87
  font-size: 20px;
88
88
  }
89
89
 
90
90
  div#content ul li a {
91
91
  display: block;
92
92
  text-decoration: none;
93
- color: black;
93
+ color: white;
94
94
  font-size: 20px;
95
95
  height: 100%;
96
96
  width: 100%;
97
97
  padding: 15px 0 15px 0;
98
+ background:url("../images/android/disclosure.png") no-repeat center right;
98
99
  }
99
100
 
101
+ div#content ul li a:hover {
102
+ background-color:#3399cc;
103
+ }
100
104
  div#content ul li a img {
101
105
  float: left;
102
106
  height: 100%;
@@ -104,7 +108,7 @@ div#content ul li a img {
104
108
  }
105
109
 
106
110
  div#content ul li span.title {
107
- padding: 0 10px 0 10px;
111
+ padding: 0 50px 0 10px;
108
112
  }
109
113
 
110
114
  div#content ul li span.disclosure_indicator {
@@ -141,7 +145,7 @@ div#content form ul {
141
145
  }
142
146
 
143
147
  div#content form ul li {
144
- border-bottom: 1px solid black;
148
+ border-bottom: 1px solid #666;
145
149
  display: block;
146
150
  list-style-type: none;
147
151
  }
@@ -149,7 +153,7 @@ div#content form ul li {
149
153
  div#content form label {
150
154
  float: left;
151
155
  display:block;
152
- color: black;
156
+ color: white;
153
157
  line-height: 64px;
154
158
  padding: 0 10px 0 5px;
155
159
  margin: 0;
@@ -169,9 +173,11 @@ div#content h2.groupTitle{
169
173
  padding: 8px 0 8px 8px;
170
174
  font-size:10px;
171
175
  color:white;
172
- background-color:black;
176
+ background-color:#666;
173
177
  }
174
-
178
+ div#content form {
179
+ background-color: black;
180
+ }
175
181
  div#content form input[type="checkbox"] {
176
182
  -webkit-appearance: none;
177
183
  background: url(/public/images/android/btn_check_off.png) no-repeat;
@@ -214,6 +220,7 @@ div#content form select {
214
220
  width: 100%;
215
221
  padding-left: 20px;
216
222
  height: 60px;
223
+ color:white;
217
224
  background: url('/public/images/android/ic_menu_more.png') no-repeat center right;
218
225
  }
219
226
 
@@ -257,8 +264,10 @@ div#content ul#settings {
257
264
  margin: 0;
258
265
  }
259
266
 
267
+
260
268
  div#content div#reset h4 {
261
269
  margin:20px;
270
+ color:white;
262
271
  }
263
272
 
264
273
  div#content div.standardButton {
data/rhobuild.yml ADDED
@@ -0,0 +1,39 @@
1
+ ---
2
+ excludedirs:
3
+ bb:
4
+ - public/js/iui
5
+ - public/js/jquery*
6
+ - public/jqtouch*
7
+ - public/js/prototype*
8
+ - public/css/iphone*
9
+ - public/iwebkit
10
+ - public/themes
11
+ - "**/*.db"
12
+ - "**/.*.swo"
13
+ - "**/.*.swn"
14
+ - "**/jquery*.js"
15
+ - "**/.DS_Store"
16
+ env:
17
+ app: /Users/lars/Dev/code/rhomobile/store
18
+ paths:
19
+ android-ndk: /Users/lars/Dev/android-ndk-r4
20
+ android: /Users/lars/Dev/android-sdk-mac_86
21
+ java: /Library/Java/Home/bin
22
+ 4.6:
23
+ jde:
24
+ sim: 9000
25
+ mds:
26
+ 4.2:
27
+ jde:
28
+ sim: 8100
29
+ mds:
30
+ cabwiz:
31
+ android:
32
+ build:
33
+ bbsignpwd: somepasswordhere
34
+ bb:
35
+ symbianpath: platform/symbian
36
+ bbpath: platform/bb
37
+ androidpath: platform/android
38
+ wmpath: platform/wm
39
+ iphonepath: platform/iphone
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.rc2'
6
+ s.version = '2.0.0'
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Rhomobile"]
Binary file
@@ -15,6 +15,7 @@ class SpecController < Rho::RhoController
15
15
  def index
16
16
  @exc_count = 0
17
17
  @count = 0
18
+ @errorMessages = ""
18
19
  $is_network_available = System.get_property('has_network')
19
20
 
20
21
  run_all_tests()
@@ -44,6 +45,8 @@ class SpecController < Rho::RhoController
44
45
  testObj.send meth
45
46
  rescue Exception => e
46
47
  @exc_count += 1
48
+ @errorMessages += "<br/>FAIL: '#{name}:#{meth}' failed: Error: #{e}\n" +
49
+ "#{e.backtrace[1]}" if e.backtrace && e.backtrace.length > 0
47
50
  puts "FAIL: '#{name}:#{meth}' failed: Error: #{e}\n" +
48
51
  "#{e.backtrace[1]}" if e.backtrace && e.backtrace.length > 0
49
52
  #e.backtrace.each do |item|
@@ -12,4 +12,6 @@
12
12
  <li style="color:<%=@color%>">Total: <%=@count%></li>
13
13
  <li style="color:<%=@color%>">Passed: <%=@count - @exc_count%></li>
14
14
  <li style="color:<%=@color%>">Failed: <%=@exc_count%></li>
15
+ <li style="color:<%=@color%>">Errors: <%=@errorMessages%></li>
16
+
15
17
  </ul>
@@ -29,6 +29,23 @@ class RhoFileTest
29
29
 
30
30
  end
31
31
 
32
+ def binary_readwrite_test
33
+ file_testname = File.join(Rho::RhoApplication::get_model_path('app','Data'), 'test.png')
34
+ test_content = File.binread(file_testname)
35
+ Test_equal(File.size(file_testname), test_content.length)
36
+
37
+ file_name = File.join(Rho::RhoApplication::get_model_path('app','Data'), 'temp.png')
38
+ File.delete(file_name) if File.exists?(file_name)
39
+ Test_equal(File.exists?(file_name), false)
40
+
41
+ f = File.new(file_name, "wb")
42
+ f.write(test_content)
43
+ f.close
44
+
45
+ content = File.binread(file_name)
46
+ Test_equal( content, test_content )
47
+ end
48
+
32
49
  def create_file_in_cache(dir_name, file, ext)
33
50
  # get full file path
34
51
  f = File.join(dir_name, "#{file}"+ "#{ext}")
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhodes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940591
5
- prerelease: true
4
+ hash: 15
5
+ prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
- - rc2
11
- version: 2.0.0.rc2
10
+ version: 2.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Rhomobile
@@ -350,6 +349,7 @@ files:
350
349
  - lib/test/rho_stubs.rb
351
350
  - lib/test/syncdb.sqlite
352
351
  - LICENSE
352
+ - Manifest.txt
353
353
  - platform/android/build/android.rake
354
354
  - platform/android/build/androidcommon.rb
355
355
  - platform/android/build/libcurl_build.files
@@ -3500,6 +3500,7 @@ files:
3500
3500
  - res/generators/templates/application/public/images/android/btn_check_on.png
3501
3501
  - res/generators/templates/application/public/images/android/btn_radio_off.png
3502
3502
  - res/generators/templates/application/public/images/android/btn_radio_on.png
3503
+ - res/generators/templates/application/public/images/android/disclosure.png
3503
3504
  - res/generators/templates/application/public/images/android/ic_menu_more.png
3504
3505
  - res/generators/templates/application/public/images/backButton.png
3505
3506
  - res/generators/templates/application/public/images/blueButton.png
@@ -3662,6 +3663,7 @@ files:
3662
3663
  - res/generators/templates/spec/app/spec_runner.rb
3663
3664
  - res/generators/templates/spec/app/SpecRunner/controller.rb
3664
3665
  - res/generators/templates/spec/app/SpecRunner/index.erb
3666
+ - rhobuild.yml
3665
3667
  - rhobuild.yml.example
3666
3668
  - rhodes.gemspec
3667
3669
  - spec/framework_spec/app/Account/account.rb
@@ -5417,6 +5419,7 @@ files:
5417
5419
  - spec/phone_spec/app/Data/circtest.json
5418
5420
  - spec/phone_spec/app/Data/septest.json
5419
5421
  - spec/phone_spec/app/Data/test.json
5422
+ - spec/phone_spec/app/Data/test.png
5420
5423
  - spec/phone_spec/app/Data/test.xml
5421
5424
  - spec/phone_spec/app/Data/test_log.txt
5422
5425
  - spec/phone_spec/app/index.erb