ruboto 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99baa768052a043076db03f4d9598cf9d076bf2e
4
- data.tar.gz: 3bf07e86b7f41a0cbba8dd9d6f02e750f31ee9ab
3
+ metadata.gz: c968343b3a48179ec48fecd316b53fa63ad49e49
4
+ data.tar.gz: 2a00ac4f9378a4ea037519665d94dee920b0b076
5
5
  SHA512:
6
- metadata.gz: f7bd276940850a60b549e140bb7eec8b2e2932c20a31a318034d831e74a46ea50221fbdb133e924cdc1598d73fe670af0ed2ef86da30dc84bf0b3eebf13bc1f4
7
- data.tar.gz: 493aa40906f9100157163398355975c5570c3aa210eb7f6816c8413006bed929fca0fcf90841fde123643786d7d90a7d40b55a7b72134518c8a54fc9e913586f
6
+ metadata.gz: 7beb90cd29d1041a36f2d657023dafc8ac6869ab94532eef8123dddd00fac65f7695747914b0b1549b30284cc9036167545f35c428d3d21637c8bc7f00f52ca2
7
+ data.tar.gz: ca14e4d1b2bb0c2a49f809b5211e476deb03a4630d55b3aee0109afb2b19f2c2b8f008d63e10f4e760ef41fbca0f4d3aa205113dd4098c0ac3d195eeec356bab
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org/'
1
+ source 'http://rubygems.org/'
2
2
  gemspec
data/Gemfile.lock CHANGED
@@ -1,18 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (0.14.0.dev)
5
- jruby-jars
4
+ ruboto (0.15.0)
6
5
  main (>= 4.7.2)
7
6
  rake
8
7
 
9
8
  GEM
10
- remote: https://rubygems.org/
9
+ remote: http://rubygems.org/
11
10
  specs:
12
11
  arrayfields (4.9.0)
13
- chronic (0.9.1)
12
+ chronic (0.10.2)
14
13
  fattr (2.2.1)
15
- jruby-jars (1.7.4)
16
14
  main (5.2.0)
17
15
  arrayfields (>= 4.7.4)
18
16
  chronic (>= 0.6.2)
data/README.md CHANGED
@@ -199,17 +199,19 @@ your favorite text editor. If you want an activity that does nothing but Log
199
199
  when it gets launched and when it gets destroyed (in the onCreate and onPause
200
200
  methods). You want your script to look like this:
201
201
 
202
- class FooActivity
203
- def onCreate(bundle)
204
- super
205
- android.util.Log.v 'MYAPPNAME', 'onCreate got called!'
206
- end
207
-
208
- def onPause
209
- super
210
- android.util.Log.v 'MYAPPNAME', 'onPause got called!'
211
- end
212
- end
202
+ ```ruby
203
+ class FooActivity
204
+ def onCreate(bundle)
205
+ super
206
+ android.util.Log.v 'MYAPPNAME', 'onCreate got called!'
207
+ end
208
+
209
+ def onPause
210
+ super
211
+ android.util.Log.v 'MYAPPNAME', 'onPause got called!'
212
+ end
213
+ end
214
+ ```
213
215
 
214
216
  The arguments passed to the methods are the same as the arguments that the java
215
217
  methods take. Consult the Android documentation.
@@ -234,27 +236,29 @@ directory. For example if you generate a RubotoSampleAppActivity a file
234
236
  "test/src/ruboto_sample_app_activity_test.rb" file is created containing a
235
237
  sample test script:
236
238
 
237
- activity Java::org.ruboto.sample_app.RubotoSampleAppActivity
238
-
239
- setup do |activity|
240
- start = Time.now
241
- loop do
242
- @text_view = activity.findViewById(42)
243
- break if @text_view || (Time.now - start > 60)
244
- sleep 1
245
- end
246
- assert @text_view
247
- end
248
-
249
- test('initial setup') do |activity|
250
- assert_equal "What hath Matz wrought?", @text_view.text
251
- end
252
-
253
- test('button changes text') do |activity|
254
- button = activity.findViewById(43)
255
- button.performClick
256
- assert_equal "What hath Matz wrought!", @text_view.text
257
- end
239
+ ```ruby
240
+ activity Java::org.ruboto.sample_app.RubotoSampleAppActivity
241
+
242
+ setup do |activity|
243
+ start = Time.now
244
+ loop do
245
+ @text_view = activity.findViewById(42)
246
+ break if @text_view || (Time.now - start > 60)
247
+ sleep 1
248
+ end
249
+ assert @text_view
250
+ end
251
+
252
+ test('initial setup') do |activity|
253
+ assert_equal "What hath Matz wrought?", @text_view.text
254
+ end
255
+
256
+ test('button changes text') do |activity|
257
+ button = activity.findViewById(43)
258
+ button.performClick
259
+ assert_equal "What hath Matz wrought!", @text_view.text
260
+ end
261
+ ```
258
262
 
259
263
  You run the tests for your app using ant or rake
260
264
 
@@ -328,10 +332,11 @@ commands.
328
332
 
329
333
  For example, in your `~/.bashrc`, `~/.zshrc`, or similar file, you might put
330
334
 
331
- alias ics="ruboto emulator -t 15"
332
- alias jellyb="ruboto emulator -t 16"
333
- alias jb17="ruboto emulator -t 17"
334
-
335
+ ```sh
336
+ alias ics="ruboto emulator -t 15"
337
+ alias jellyb="ruboto emulator -t 16"
338
+ alias jb17="ruboto emulator -t 17"
339
+ ```
335
340
 
336
341
  Alternatives
337
342
  ------------
@@ -1,11 +1,18 @@
1
- Subject: [ANN] Ruboto 0.14.0 release candidate
1
+ Subject: [ANN] Ruboto 0.15.0 release candidate
2
2
 
3
3
  Hi all!
4
4
 
5
- The Ruboto 0.14.0 release candidate is now available.
6
-
7
- In this release we change the startup to use a separate SplashActivity.
8
- This simplifies the startup and makes it more robust.
5
+ The Ruboto 0.15.0 release candidate is now available.
6
+
7
+ In this release we stabilize the new SplashActivity feature and introduce
8
+ a new rapid development cycle.
9
+
10
+ Using "rake update_scripts:reload" changed Ruby scripts are pushed to the
11
+ device/emulator and an intent is broadcasted to reload the files inside
12
+ the running app, and the currently displayed activity is restarted.
13
+
14
+ The process should take just a few seconds and avoids the full
15
+ build->transfer->restart cycle.
9
16
 
10
17
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
11
18
 
data/RELEASE_DOC CHANGED
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 0.14.0 released!
1
+ Subject: [ANN] Ruboto 0.15.0 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 0.14.0.
3
+ The Ruboto team is pleased to announce the release of Ruboto 0.15.0.
4
4
 
5
5
  Ruboto (JRuby on Android) is a platform for developing full stand-alone
6
6
  apps for Android using the Ruby language and libraries. It includes
@@ -8,73 +8,52 @@ support libraries and generators for creating projects, classes, tests,
8
8
  and more. The complete APIs of Android, Java, and Ruby are available to
9
9
  you using the Ruby language.
10
10
 
11
- New in version 0.14.0:
11
+ New in version 0.15.0:
12
12
 
13
- In this release we change the startup to use a separate SplashActivity.
14
- This simplifies the startup and makes it more robust.
13
+ In this release we stabilize the new SplashActivity feature and introduce
14
+ a new rapid development cycle.
15
+
16
+ Using "rake update_scripts:reload" changed Ruby scripts are pushed to the
17
+ device/emulator and an intent is broadcasted to reload the files inside
18
+ the running app, and the currently displayed activity is restarted.
19
+
20
+ The process should take just a few seconds and avoids the full
21
+ build->transfer->restart cycle.
15
22
 
16
23
  Features:
17
24
 
18
- * Issue #433 Tests: add support for individual/matrix tests in Windows
19
- * Issue #460 New startup sequence with SplashActivity
20
- * Issue #471 Allow sending Intent extras with start_ruboto_activity
21
- * Issue #473 Modify EntryPointActivity to send an Intent to SplashActivity
25
+ * Issue #12 Fast development with "rake update_scripts:reload"
26
+ * Issue #461 Old API level files removed from repository as of 4.3
27
+ * Issue #475 Reuse the original Intent when relaunching the user activity
28
+ after the SplashActivity has completed.
29
+ * Issue #482 Better handling of "update_scripts" apk timestamp
30
+ * Issue #486 Let "ruboto setup" download the latest version of a tool if
31
+ multiple versions exist.
22
32
 
23
33
  Bugfixes:
24
34
 
25
- * Issue #428 Splash requests window feature too late
26
- * Issue #429 ruboto emulator -t android-17 fails
27
- * Issue #432 'ruboto update app' leaves some old files behind
28
- * Issue #434 After JRuby is loaded, check the activity state before
29
- calling onCreate
30
- * Issue #442 Adding splash.xml crashes app.
31
- * Issue #443 onCreateOptionsMenu (and other callbacks) not called on first
32
- time startup
33
- * Issue #449 Change ruboto setup to use /linux/ instead of /^linux(.*)/
34
- * Issue #451 Changing device orientation during splash causes exception
35
- * Issue #453 Builds but fails to load ruby scripts on uppercase package
36
- name
37
- * Issue #455 Rake install fails in ruboto-0.14.0-dev
38
- * Issue #468 Using the EntryPointActivity check in the RubotoActivity
39
- template doesn't work for other activities like PreferencesActivity
40
- * Issue #470 "ruboto update app" deletes "src/ruboto/.svn" subversion
41
- directory
35
+ * Issue #174 Ensure APK is not rebuilt if only Ruby source has changed
36
+ * Issue #452 Android SDK command dx Not found
37
+ * Issue #481 New Splash fails to start on Android 2.3
38
+ * Issue #490 ruboto setup
42
39
 
43
40
  Support:
44
41
 
45
- * Issue #446 Bad call from ruboto setup
46
- * Issue #450 Application aborts prematurely, when I add a Gemfile.apk
47
-
48
- Documentation:
49
-
50
- * Issue #225 Investigate AIDE
51
- * Issue #430 Add Downloads page to ruboto.org
42
+ * Issue #469 Missing step in "Getting started": 1'. install GEMS
52
43
 
53
44
  Pull requests:
54
45
 
55
- * Issue #439 Fixes #432
56
- * Issue #440 Added check for compatible APIs for update examples: re issue
57
- #437
58
- * Issue #444 Fix building on Windows caused by mixed file separators. Also
59
- pre-compressed the included PNGs with optipng, despite included pngcrush
60
- during rake for increased loseless file compression.
61
- * Issue #454 Fix android_package_directory for ones already installed
62
- android sdk
63
- * Issue #457 Allow uppercase package name
64
- * Issue #462 Add SplashActivity for new startup sequence
65
- * Issue #463 New APK size upper limit in test/ruboto_gen_test
66
- * Issue #464 Fix #451 by locking screen orientation of SplashActivity
46
+ * Issue #474 Longer 'Timeout' time of BOSS process
47
+ * Issue #477 Add readme.MD syntax highlight.
67
48
 
68
49
  Internal:
69
50
 
70
- * Issue #436 Use "ruboto emulator" instead of start_emulator.sh when
71
- running tests on travis-ci
72
- * Issue #437 test ruboto_update_test fails for old versions < 0.11.0
73
- * Issue #465 Adjust update scripts to the new JRuby mavenized packaging
51
+ * Issue #487 Start testing against JRuby 9000
52
+ * Issue #488 Start testing against JRuby 1.7.5
74
53
 
75
54
  You can find a complete list of issues here:
76
55
 
77
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=26
56
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=29
78
57
 
79
58
 
80
59
  Installation:
data/Rakefile CHANGED
@@ -21,6 +21,8 @@ README_FILE = 'README.md'
21
21
  BLOG_DIR = "#{File.dirname PROJECT_DIR}/ruboto.github.com/_posts"
22
22
  RELEASE_BLOG = "#{BLOG_DIR}/#{Date.today}-Ruboto-#{Ruboto::VERSION}-release-doc.md"
23
23
  RELEASE_BLOG_GLOB = "#{BLOG_DIR}/*-Ruboto-#{Ruboto::VERSION}-release-doc.md"
24
+ RELEASE_CANDIDATE_DOC = 'RELEASE_CANDICATE_DOC'
25
+ RELEASE_DOC = 'RELEASE_DOC'
24
26
 
25
27
  CLEAN.include('ruboto-*.gem', 'tmp')
26
28
 
@@ -35,10 +37,10 @@ file GEM_FILE => GEM_SPEC_FILE do
35
37
  end
36
38
 
37
39
  task :install => :gem do
38
- `gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
40
+ `RUBYOPT= gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
39
41
  if $? != 0
40
42
  puts 'Installing gem'
41
- cmd = "gem install ruboto-#{Ruboto::VERSION}.gem"
43
+ cmd = "RUBYOPT= gem install ruboto-#{Ruboto::VERSION}.gem"
42
44
  output = `#{cmd}`
43
45
  if $? == 0
44
46
  puts output
@@ -51,10 +53,10 @@ task :install => :gem do
51
53
  end
52
54
 
53
55
  task :uninstall do
54
- `gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
56
+ `RUBYOPT= gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
55
57
  if $? == 0
56
58
  puts 'Uninstalling gem'
57
- cmd = "gem uninstall -x ruboto -v #{Ruboto::VERSION}"
59
+ cmd = "RUBYOPT= gem uninstall -x ruboto -v #{Ruboto::VERSION}"
58
60
  output = `#{cmd}`
59
61
  if $? == 0
60
62
  puts output
@@ -204,7 +206,8 @@ http://ruboto.org/
204
206
  EOF
205
207
 
206
208
  puts release_candidate_doc
207
- File.write('RELEASE_CANDICATE_DOC', release_candidate_doc)
209
+ File.write(RELEASE_CANDIDATE_DOC, release_candidate_doc)
210
+ sh "git add -f #{RELEASE_CANDIDATE_DOC}"
208
211
 
209
212
  puts
210
213
  puts '=' * 80
@@ -278,7 +281,9 @@ title : Ruboto #{Ruboto::VERSION}
278
281
  layout: post
279
282
  ---
280
283
  EOF
281
- File.write('RELEASE_DOC', release_doc)
284
+ File.write(RELEASE_DOC, release_doc)
285
+ sh "git add -f #{RELEASE_DOC}"
286
+ `git commit -m "* Added release doc for Ruboto #{Ruboto::VERSION}"`
282
287
  Dir.chdir BLOG_DIR do
283
288
  output = `git status --porcelain`
284
289
  old_blog_posts = Dir[RELEASE_BLOG_GLOB] - [RELEASE_BLOG]
@@ -447,6 +452,7 @@ namespace :platform do
447
452
  content = http.request(Net::HTTP::Get.new(uri.request_uri)).body
448
453
  File.open(PLATFORM_CURRENT_RELEASE_APK, 'wb') { |f| f << content }
449
454
  rescue Exception, SystemExit
455
+ puts "Download failed: #{$!}"
450
456
  FileUtils.rm(PLATFORM_CURRENT_RELEASE_APK) if File.exists?(PLATFORM_CURRENT_RELEASE_APK)
451
457
  raise
452
458
  end
@@ -564,7 +570,7 @@ end
564
570
 
565
571
  desc 'Download the latest jruby-jars snapshot'
566
572
  task :get_jruby_jars_snapshot do
567
- current_gem = 'jruby-jars-1.7.5.dev.gem'
573
+ current_gem = 'jruby-jars-9000.dev.gem'
568
574
  `wget http://ci.jruby.org/snapshots/master/#{current_gem}`
569
575
  jars = Dir["#{current_gem}.*"]
570
576
  jars[0..-2].each { |j| FileUtils.rm_f j } if jars.size > 1
@@ -54,11 +54,25 @@ unless DX_FILENAME
54
54
  exit 1
55
55
  end
56
56
 
57
- def manifest; @manifest ||= REXML::Document.new(File.read(MANIFEST_FILE)) end
58
- def package; manifest.root.attribute('package') end
59
- def build_project_name; @build_project_name ||= REXML::Document.new(File.read('build.xml')).elements['project'].attribute(:name).value end
60
- def scripts_path; @sdcard_path ||= "/mnt/sdcard/Android/data/#{package}/files/scripts" end
61
- def app_files_path; @app_files_path ||= "/data/data/#{package}/files" end
57
+ def manifest;
58
+ @manifest ||= REXML::Document.new(File.read(MANIFEST_FILE))
59
+ end
60
+
61
+ def package;
62
+ manifest.root.attribute('package')
63
+ end
64
+
65
+ def build_project_name;
66
+ @build_project_name ||= REXML::Document.new(File.read('build.xml')).elements['project'].attribute(:name).value
67
+ end
68
+
69
+ def scripts_path;
70
+ @sdcard_path ||= "/mnt/sdcard/Android/data/#{package}/files/scripts"
71
+ end
72
+
73
+ def app_files_path;
74
+ @app_files_path ||= "/data/data/#{package}/files"
75
+ end
62
76
 
63
77
  PROJECT_DIR = File.expand_path('..', File.dirname(__FILE__))
64
78
  UPDATE_MARKER_FILE = File.join(PROJECT_DIR, 'bin', 'LAST_UPDATE')
@@ -224,7 +238,7 @@ file RUBOTO_CONFIG_FILE
224
238
  file JRUBY_ADAPTER_FILE => RUBOTO_CONFIG_FILE do
225
239
  require 'yaml'
226
240
  if (heap_alloc = YAML.load(File.read(RUBOTO_CONFIG_FILE))['heap_alloc'])
227
- config = <<EOF
241
+ config = <<EOF
228
242
  // BEGIN Ruboto HeapAlloc
229
243
  @SuppressWarnings("unused")
230
244
  byte[] arrayForHeapAllocation = new byte[#{heap_alloc} * 1024 * 1024];
@@ -242,7 +256,7 @@ EOF
242
256
  end
243
257
  source = File.read(JRUBY_ADAPTER_FILE)
244
258
  heap_alloc_pattern = %r{^\s*// BEGIN Ruboto HeapAlloc\n.*^\s*// END Ruboto HeapAlloc\n}m
245
- File.open(JRUBY_ADAPTER_FILE, 'w'){|f| f << source.sub(heap_alloc_pattern, config)}
259
+ File.open(JRUBY_ADAPTER_FILE, 'w') { |f| f << source.sub(heap_alloc_pattern, config) }
246
260
  end
247
261
 
248
262
  file APK_FILE => APK_DEPENDENCIES do |t|
@@ -269,7 +283,7 @@ end
269
283
 
270
284
  namespace :update_scripts do
271
285
  desc 'Copy scripts to emulator and restart the app'
272
- task :restart => APK_DEPENDENCIES do |t|
286
+ task :restart => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
273
287
  if build_apk(t, false) || !stop_app
274
288
  install_apk
275
289
  else
@@ -277,6 +291,27 @@ namespace :update_scripts do
277
291
  end
278
292
  start_app
279
293
  end
294
+
295
+ desc 'Copy scripts to emulator and restart the app'
296
+ task :start => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
297
+ if build_apk(t, false)
298
+ install_apk
299
+ else
300
+ update_scripts
301
+ end
302
+ start_app # FIXME(uwe): Should trigger reload of updated scripts
303
+ end
304
+
305
+ desc 'Copy scripts to emulator and reload'
306
+ task :reload => APK_DEPENDENCIES - RUBY_SOURCE_FILES do |t|
307
+ if build_apk(t, false)
308
+ install_apk
309
+ start_app
310
+ else
311
+ scripts = update_scripts
312
+ reload_scripts(scripts) if scripts
313
+ end
314
+ end
280
315
  end
281
316
 
282
317
  task :test => APK_DEPENDENCIES + [:uninstall] do
@@ -665,24 +700,36 @@ end
665
700
 
666
701
  def update_scripts
667
702
  `adb shell mkdir -p #{scripts_path}` if !device_path_exists?(scripts_path)
668
- puts 'Pushing files to apk public file area.'
669
703
  last_update = File.exists?(UPDATE_MARKER_FILE) ? Time.parse(File.read(UPDATE_MARKER_FILE)) : Time.parse('1970-01-01T00:00:00')
670
704
  Dir.chdir('src') do
671
- Dir['**/*.rb'].each do |script_file|
672
- next if File.directory? script_file
673
- next if File.mtime(script_file) < last_update
674
- next if script_file =~ /~$/
675
- print "#{script_file}: "; $stdout.flush
676
- `adb push #{script_file} #{scripts_path}/#{script_file}`
705
+ source_files = Dir['**/*.rb']
706
+ changed_files = source_files.select { |f| !File.directory?(f) && File.mtime(f) >= last_update && f !~ /~$/ }
707
+ unless changed_files.empty?
708
+ puts 'Pushing files to apk public file area.'
709
+ changed_files.each do |script_file|
710
+ print "#{script_file}: "; $stdout.flush
711
+ `adb push #{script_file} #{scripts_path}/#{script_file}`
712
+ end
713
+ mark_update
714
+ return changed_files
677
715
  end
678
716
  end
679
- mark_update
717
+ return nil
680
718
  end
681
719
 
682
720
  def start_app
683
721
  `adb shell am start -a android.intent.action.MAIN -n #{package}/.#{main_activity}`
684
722
  end
685
723
 
724
+ # Triggers reload of updated scripts and restart of the current activity
725
+ def reload_scripts(scripts)
726
+ scripts.each.with_index do |s, i|
727
+ cmd = "adb shell am broadcast -a android.intent.action.VIEW -e file #{s} #{'-e restart YES' if i == (scripts.size - 1)}"
728
+ puts cmd
729
+ system cmd
730
+ end
731
+ end
732
+
686
733
  def stop_app
687
734
  output = `adb shell ps | grep #{package} | awk '{print $2}' | xargs adb shell kill`
688
735
  output !~ /Operation not permitted/