ruboto 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -1
  3. data/README.md +44 -43
  4. data/RELEASE_CANDICATE_DOC +10 -12
  5. data/RELEASE_DOC +69 -37
  6. data/Rakefile +47 -27
  7. data/assets/rakelib/ruboto.rake +69 -26
  8. data/assets/src/RubotoActivity.java +17 -4
  9. data/assets/src/RubotoService.java +18 -0
  10. data/assets/src/org/ruboto/EntryPointActivity.java +1 -1
  11. data/assets/src/org/ruboto/JRubyAdapter.java +3 -1
  12. data/assets/src/org/ruboto/ScriptLoader.java +27 -4
  13. data/assets/src/ruboto/activity.rb +4 -3
  14. data/assets/src/ruboto/activity/reload.rb +17 -12
  15. data/assets/src/ruboto/widget.rb +18 -18
  16. data/bin/elevate.exe +0 -0
  17. data/bin/elevate_32.exe +0 -0
  18. data/lib/java_class_gen/android_api.xml +1 -1
  19. data/lib/ruboto/commands/base.rb +3 -5
  20. data/lib/ruboto/util/build.rb +1 -1
  21. data/lib/ruboto/util/emulator.rb +31 -5
  22. data/lib/ruboto/util/setup.rb +183 -68
  23. data/lib/ruboto/util/update.rb +35 -42
  24. data/lib/ruboto/util/xml_element.rb +45 -33
  25. data/lib/ruboto/version.rb +1 -1
  26. data/test/activity/call_super_activity.rb +1 -1
  27. data/test/activity/dialog_fragment_activity.rb +37 -0
  28. data/test/activity/dialog_fragment_activity_test.rb +19 -0
  29. data/test/activity/image_button_activity.rb +2 -1
  30. data/test/activity/navigation_activity_test.rb +2 -1
  31. data/test/activity/no_on_create_activity.rb +17 -0
  32. data/test/activity/no_on_create_activity_test.rb +15 -0
  33. data/test/activity/spinner_activity.rb +51 -0
  34. data/test/activity/spinner_activity_test.rb +65 -0
  35. data/test/activity/stack_activity_test.rb +14 -7
  36. data/test/activity/startup_exception_activity.rb +7 -5
  37. data/test/activity/startup_exception_activity_test.rb +2 -2
  38. data/test/app_test_methods.rb +4 -0
  39. data/test/git_based_gem_test.rb +64 -0
  40. data/test/minimal_app_test.rb +12 -13
  41. data/test/rake_test.rb +1 -0
  42. data/test/ruboto_gen_test.rb +21 -15
  43. data/test/ruboto_update_test.rb +23 -6
  44. data/test/sqldroid_test.rb +0 -1
  45. data/test/test_helper.rb +37 -19
  46. metadata +25 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c968343b3a48179ec48fecd316b53fa63ad49e49
4
- data.tar.gz: 2a00ac4f9378a4ea037519665d94dee920b0b076
3
+ metadata.gz: 4fb13ffa79e6bb330307b86180514990fcef5fc8
4
+ data.tar.gz: f1f984e01bbc611d45edfbc6405bd160c6f80631
5
5
  SHA512:
6
- metadata.gz: 7beb90cd29d1041a36f2d657023dafc8ac6869ab94532eef8123dddd00fac65f7695747914b0b1549b30284cc9036167545f35c428d3d21637c8bc7f00f52ca2
7
- data.tar.gz: ca14e4d1b2bb0c2a49f809b5211e476deb03a4630d55b3aee0109afb2b19f2c2b8f008d63e10f4e760ef41fbca0f4d3aa205113dd4098c0ac3d195eeec356bab
6
+ metadata.gz: ab88a4c19b913cc21b5f8c71960c331ffcee29f329a50b5107b5003cb9ba69ca219a3692267fa2b8a92d4fe22bfb42d04353a1bbdb0ae6c98436dbbd79086721
7
+ data.tar.gz: 54e0b680d1f1d6fa9ab05803dcc620d73bd766c84d01061a18eca543e7f0baf3befb19496c9cda49287ea535191d635517bfef351bc0dbbf1a828c9dd2c6734e
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboto (0.15.0)
4
+ ruboto (0.16.0)
5
5
  main (>= 4.7.2)
6
6
  rake
7
+ rubyzip (>= 1.0.0)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
@@ -18,8 +19,10 @@ GEM
18
19
  map (>= 5.1.0)
19
20
  map (6.5.1)
20
21
  rake (10.1.0)
22
+ rubyzip (1.0.0)
21
23
 
22
24
  PLATFORMS
25
+ java
23
26
  ruby
24
27
 
25
28
  DEPENDENCIES
data/README.md CHANGED
@@ -56,10 +56,10 @@ version (api-level) of Android.
56
56
  Command-line Tools
57
57
  -------
58
58
 
59
- * [Application generator](#application_generator) (like the rails application generator)
59
+ * [Application generator](#application_generator) (like the Rails application generator)
60
60
  * [Class generator](#class_generator) to generate additional Activities, BroadcastReceivers, Services, etc.
61
- * [Callback generator](#class_generator) to generate specific subclasses to open up access (callbacks) for various portions of the Android API.
62
- * [Packaging task](#packaging_task) to generate an apk file
61
+ * [Callback generator](#class_generator) to generate specific subclasses to open up access (callbacks) for various portions of the Android API
62
+ * [Packaging task](#packaging_task) to generate an .apk file
63
63
  * [Release task](#release_task) to deploy a generated package to an emulator or connected device
64
64
  * [Develop without having to compile to try every change](#update_scripts)
65
65
 
@@ -68,38 +68,39 @@ Command-line Tools
68
68
  ### Application generator
69
69
 
70
70
  $ ruboto gen app --package com.yourdomain.whatever --path path/to/where/you/want/the/app --name NameOfApp --target android-version --min-sdk another-android-version --activity MainActivityName
71
- Version values must be specified using'android-' and the sdk level number (e.g., android-10 is gingerbread).
71
+ Version values must be specified using `android-` and the sdk level number (e.g., android-10 is Gingerbread.)
72
72
 
73
73
  <a name="class_generator"></a>
74
74
  ### Class generator
75
75
 
76
- Generates a Java class (Activity, Service, or BroadcastReceiver) associated with a specific ruboto script. The generator also generates a corresponding test script.
76
+ Generates a Java class (Activity, Service, or BroadcastReceiver) associated with a specific Ruboto script. The generator also generates a corresponding test script.
77
77
 
78
78
  $ ruboto gen class ClassName --name YourObjectName
79
- Ex:
79
+ For example:
80
+
80
81
  $ ruboto gen class BroadcastReceiver --name AwesomenessReceiver
81
82
 
82
83
  <a name="callback_generator"></a>
83
84
  ### Callback generator
84
85
 
85
- You can subclass any part of the Android API to pass control over to a script when the specified methods are called. You can also create classes that implement a single Android interface to pass control over to ruboto.
86
+ You can subclass any part of the Android API to pass control over to a script when the specified methods are called. You can also create classes that implement a single Android interface to pass control over to Ruboto.
86
87
 
87
88
  Starting with Ruboto 0.6.0 there are easy ways to do this within your scripts.
88
- The new way of generating interfaces and subclasses is described in the wiki
89
+ The new way of generating interfaces and subclasses is described in the wiki page
89
90
  [Generating classes for callbacks](https://github.com/ruboto/ruboto/wiki/Generating-classes-for-callbacks).
90
91
 
91
92
  <a name="packaging_task"></a>
92
93
  ### Packaging task
93
94
 
94
- This will generate an apk file.
95
+ This will generate an .apk file:
95
96
 
96
97
  $ rake debug
97
98
 
98
- To generate an apk and install it to a connected device (or emulator) all in one go, run
99
+ To generate an .apk and install it to a connected device (or emulator) all in one go, run:
99
100
 
100
101
  $ rake install
101
102
 
102
- To start the installed app, run
103
+ To start the installed app, run:
103
104
 
104
105
  $ rake start
105
106
 
@@ -122,7 +123,7 @@ Also make sure to keep your key backed up (if you lose it, you won't be able to
122
123
  release updates to your app that can install right over the old versions), but
123
124
  secure.
124
125
 
125
- Now get that `.apk` to the market!
126
+ Now get that .apk to the market!
126
127
 
127
128
  <a name="update_scripts"></a>
128
129
  ### Updating Your Scripts on a Device
@@ -137,7 +138,7 @@ compiled Java files. So if your changes are Ruby-only, you can just run
137
138
  $ rake update_scripts
138
139
 
139
140
  to have it copy the current version of your scripts to your device.
140
- To update the scripts and restart the app in one go, run
141
+ To update the scripts and restart the app in one go, run:
141
142
 
142
143
  $ rake update_scripts:restart
143
144
 
@@ -150,16 +151,16 @@ Caveats:
150
151
  This only works if your changes are all Ruby. If you have Java changes (which
151
152
  would generally just mean generating new classes) or changes to the xml, you
152
153
  will need to recompile your app. The `update_scripts` task will revert to
153
- build the complete apk and install it if it detects non-Ruby source changes.
154
+ build the complete .apk and install it if it detects non-Ruby source changes.
154
155
 
155
- On an actual device, you need to give the WRITE_EXTERNAL_STORAGE permission to
156
+ On an actual device, you need to give the `WRITE_EXTERNAL_STORAGE` permission to
156
157
  your app, and scripts will be updated using the SDCARD on the device/emulator.
157
158
 
158
159
  Alternatively, you can also root your phone.
159
160
 
160
161
  ### Updating Ruboto's Files
161
162
 
162
- You can update various portions of your generated Ruboto app through the ruboto command:
163
+ You can update various portions of your generated Ruboto app through the `ruboto` command:
163
164
 
164
165
  * JRuby:
165
166
 
@@ -180,24 +181,24 @@ Scripts
180
181
  -------
181
182
 
182
183
  The main thing Ruboto offers you is the ability to write Ruby scripts to define
183
- the behavior of Activities, BroadcastReceievers, and Services. (Eventually it'll
184
- be every class. It's setup such that adding in more classes should be trivial.)
184
+ the behavior of Activities, BroadcastReceivers, and Services. (Eventually, it'll
185
+ be every class. It's set up such that adding in more classes should be trivial.)
185
186
 
186
187
  Here's how it works:
187
188
 
188
189
  First of all, your scripts are found in the `src/` directory, and the script
189
190
  name is the same as the name of your class, only under_scored instead of
190
- CamelCased. Android classes have all of these methods that get called in certain
191
+ CamelCased. Android classes have some standard methods that get called in certain
191
192
  situations. `Activity.onDestroy()` gets called when the activity gets killed,
192
- for example. Save weird cases (like the "launching" methods that need to setup
193
- JRuby), to script the method onFooBar, you call the Ruby method onFooBar on the
194
- Android object. That was really abstract, so here's an example.
193
+ for example. Save weird cases (like the "launching" methods that are needed to set up
194
+ JRuby), to call the method `onFooBar()`, you call the Ruby method `onFooBar` on the
195
+ Android object.
195
196
 
196
- You generate an app with the option `--activity FooActivity`, which means that
197
+ That was really abstract, so here's an example. You generate an app with the option `--activity FooActivity`, which means that
197
198
  Ruboto will generate a FooActivity for you. So you open `src/foo_activity.rb` in
198
199
  your favorite text editor. If you want an activity that does nothing but Log
199
- when it gets launched and when it gets destroyed (in the onCreate and onPause
200
- methods). You want your script to look like this:
200
+ when it gets launched and when it gets destroyed (in the `onCreate` and `onPause`
201
+ methods,) you want your script to look like this:
201
202
 
202
203
  ```ruby
203
204
  class FooActivity
@@ -213,8 +214,8 @@ class FooActivity
213
214
  end
214
215
  ```
215
216
 
216
- The arguments passed to the methods are the same as the arguments that the java
217
- methods take. Consult the Android documentation.
217
+ The arguments passed to the methods are the same as the arguments that the Java
218
+ methods take. Consult the Android documentation for more information.
218
219
 
219
220
  Activities also have some special methods defined to make things easier. The
220
221
  easiest way to get an idea of what they are is looking over the
@@ -222,18 +223,18 @@ easiest way to get an idea of what they are is looking over the
222
223
  and the
223
224
  [tests](http://github.com/ruboto/ruboto/tree/master/test/activity/).
224
225
  You can also read the
225
- [ruboto source](http://github.com/ruboto/ruboto/blob/master/assets/src/ruboto)
226
+ [Ruboto source](http://github.com/ruboto/ruboto/blob/master/assets/src/ruboto)
226
227
  where everything is defined.
227
228
 
228
229
  We also have many fine examples on the
229
- [WIKI](https://github.com/ruboto/ruboto/wiki).
230
+ [Wiki](https://github.com/ruboto/ruboto/wiki).
230
231
 
231
232
  Testing
232
233
  -------
233
234
 
234
- For each generated class, a Ruby test script is created in the test/src
235
- directory. For example if you generate a RubotoSampleAppActivity a file
236
- "test/src/ruboto_sample_app_activity_test.rb" file is created containing a
235
+ For each generated class, a Ruby test script is created in the `test/src`
236
+ directory. For example, if you generate a RubotoSampleAppActivity, the file
237
+ `test/src/ruboto_sample_app_activity_test.rb` is created containing a
237
238
  sample test script:
238
239
 
239
240
  ```ruby
@@ -260,7 +261,7 @@ test('button changes text') do |activity|
260
261
  end
261
262
  ```
262
263
 
263
- You run the tests for your app using ant or rake
264
+ You can run the tests for your app using ant or rake:
264
265
 
265
266
  $ rake test
266
267
 
@@ -283,7 +284,7 @@ That's fine. Equally helpful:
283
284
  * When you gain enough wisdom, reconsider whether you could fork the project.
284
285
 
285
286
  If contributing code to the project, please run the existing tests and add tests
286
- for your changes. You run the tests using rake
287
+ for your changes. You run the tests using rake:
287
288
 
288
289
  $ rake test
289
290
 
@@ -291,8 +292,8 @@ We have set up a matrix test that tests multiple configuations on the emulator:
291
292
 
292
293
  $ ./matrix_tests.sh
293
294
 
294
- All branches and pull requests on GitHub are also testd on
295
- https://travis-ci.org/ruboto/ruboto
295
+ All branches and pull requests on GitHub are also tested on
296
+ [https://travis-ci.org/ruboto/ruboto](https://travis-ci.org/ruboto/ruboto).
296
297
 
297
298
  Getting Help
298
299
  ------------
@@ -315,14 +316,14 @@ Tips & Tricks
315
316
 
316
317
  ### Emulators
317
318
 
318
- You can start an emulator corresponding to the api level of your project with
319
+ You can start an emulator corresponding to the api level of your project with:
319
320
 
320
321
  $ ruboto emulator
321
322
 
322
- The emulator will be created for you and will be named after the android version
323
+ The emulator will be created for you and will be named after the Android version
323
324
  of your project, like "Android_4.0.3".
324
325
 
325
- If you want to start an emulator for a specific API level use the "-t" option:
326
+ If you want to start an emulator for a specific API level use the `-t` option:
326
327
 
327
328
  $ ruboto emulator -t 17
328
329
 
@@ -344,9 +345,9 @@ Alternatives
344
345
  If Ruboto's performance is a problem for you, check out
345
346
  [Mirah](http://mirah.org/) and [Garrett](http://github.com/technomancy/Garrett).
346
347
 
347
- Mirah is a language with Ruby-like syntax that compiles to java files. This
348
+ Mirah is a language with Ruby-like syntax that compiles to Java files. This
348
349
  means that it adds no big runtime dependencies and has essentially the same
349
- performance as writing Java code because it essentially generates the same Java
350
+ performance as writing Java code, as it essentially generates the same Java
350
351
  code that you would write. This makes it extremely well-suited for mobile
351
352
  devices where performance is a much bigger consideration.
352
353
 
@@ -360,8 +361,8 @@ Thanks go to:
360
361
 
361
362
  * Charles Nutter, a member of the JRuby core team, for mentoring this RSoC
362
363
  project and starting the Ruboto project in the first place with an
363
- [irb](http://github.com/ruboto/ruboto-irb)
364
- * All of Ruby Summer of Code's [sponsors](http://rubysoc.org/sponsors)
364
+ [irb](http://github.com/ruboto/ruboto-irb).
365
+ * All of Ruby Summer of Code's [sponsors](http://rubysoc.org/sponsors).
365
366
  * [Engine Yard](http://engineyard.com/) in particular for sponsoring RSoC and
366
367
  heavily sponsoring JRuby, which is obviously critical to the project.
367
368
  * All [contributors](http://github.com/ruboto/ruboto/contributors) and
@@ -1,18 +1,16 @@
1
- Subject: [ANN] Ruboto 0.15.0 release candidate
1
+ Subject: [ANN] Ruboto 0.16.0 release candidate
2
2
 
3
3
  Hi all!
4
4
 
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.
5
+ The Ruboto 0.16.0 release candidate is now available.
6
+
7
+ In this release we add support for Android 4.4 KitKat! You can also use
8
+ git-based gems in your Gemfile.apk, and implement framework methods like
9
+ onCreate in a Ruby Module and share them across Ruby classes. We have
10
+ expanded the Android Fragment support to allow the use of the Ruboto
11
+ Widget DSL. On the testing side, "ruboto setup" now downloads and
12
+ installs HAXM which gives a 10 times speedup of the emulator! For early
13
+ adopters we now support Ruby 2.1 when using JRuby 9000 builds.
16
14
 
17
15
  As always we need your help and feedback to ensure the quality of the release. Please install the release candidate using
18
16
 
data/RELEASE_DOC CHANGED
@@ -1,6 +1,6 @@
1
- Subject: [ANN] Ruboto 0.15.0 released!
1
+ Subject: [ANN] Ruboto 0.16.0 released!
2
2
 
3
- The Ruboto team is pleased to announce the release of Ruboto 0.15.0.
3
+ The Ruboto team is pleased to announce the release of Ruboto 0.16.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,52 +8,84 @@ 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.15.0:
12
-
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.
22
-
23
- Features:
24
-
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.
32
-
11
+ New in version 0.16.0:
12
+
13
+ In this release we add support for Android 4.4 KitKat! You can also use
14
+ git-based gems in your Gemfile.apk, and implement framework methods like
15
+ onCreate in a Ruby Module and share them across Ruby classes. We have
16
+ expanded the Android Fragment support to allow the use of the Ruboto
17
+ Widget DSL. On the testing side, "ruboto setup" now downloads and
18
+ installs HAXM which gives a 10 times speedup of the emulator! For early
19
+ adopters we now support Ruby 2.1 when using JRuby 9000 builds.
20
+
21
+ Features:
22
+
23
+ * Issue #479 rake log
24
+ * Issue #491 Add support for git-based gems
25
+ * Issue #495 Send all script names to be reloaded in one intent to speed
26
+ up reload
27
+ * Issue #497 Allow implementing framework methods like onCreate and
28
+ onResume in a Ruby module only.
29
+ * Issue #498 Allow use of Ruboto Widget in fragments
30
+ * Issue #499 Add shortcut "-t" for the "--target" option for "ruboto gen
31
+ app"
32
+ * Issue #502 Use "ruboto emulator" to set up HAXM
33
+ * Issue #503 Add "rake boing" as alias for "rake update_scripts:reload"
34
+ * Issue #512 Ruby 2.1 support
35
+ * Issue #517 Generate AVD with new format when running "ruboto emulator"
36
+ * Issue #521 Add support for running emulator with Android 4.4 api level
37
+ 19
38
+ * Issue #526 Add KitKat (4.4) support
39
+
33
40
  Bugfixes:
34
41
 
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
39
-
42
+ * Issue #438 Updating android_api.xml breaks test ruboto_gen_test
43
+ * Issue #448 Gems added from git repositories with the Gemfile.apk go
44
+ unrecognized.
45
+ * Issue #484 "ruboto setup" doesn't work on mac
46
+ * Issue #494 Ensure that the app is running before triggering reload of
47
+ scripts on device/emulator
48
+ * Issue #496 require 'ruboto/activity' from 'ruboto/activity/reload' since
49
+ we depend on it.
50
+ * Issue #504 Sporadically missing instance variable
51
+ * Issue #509 Ruboto setup fails on windows with -y option
52
+ * Issue #511 "ruboto update app" should rebuild JRubyAdapter.java based on
53
+ "ruboto.yml"
54
+ * Issue #516 Spinner#adapter returns nil when used with the :adapter
55
+ option
56
+ * Issue #519 Spinner should have prettier layout
57
+
40
58
  Support:
41
59
 
42
- * Issue #469 Missing step in "Getting started": 1'. install GEMS
43
-
60
+ * Issue #522 rake BUILD FAILED - Windows and Linux
61
+
62
+ Documentation:
63
+
64
+ * Issue #492 Add tutorial for using fragments
65
+ * Issue #493 README proofreading changes
66
+ * Issue #508 Add AppSurfer as a sponsor.
67
+ * Issue #514 Remove the 'ruboto update ruboto' command. Use 'ruboto
68
+ update app' instead.
69
+ * Issue #515 Add a "Contributors Wanted!" banner to the home page.
70
+ * Issue #518 Sqlite_ar tutorial no longer works?
71
+
44
72
  Pull requests:
45
73
 
46
- * Issue #474 Longer 'Timeout' time of BOSS process
47
- * Issue #477 Add readme.MD syntax highlight.
48
-
74
+ * Issue #458 Changed gem_paths to work with a gem pointing to repository
75
+ git in Gemfile.apk
76
+
49
77
  Internal:
50
78
 
51
- * Issue #487 Start testing against JRuby 9000
52
- * Issue #488 Start testing against JRuby 1.7.5
79
+ * Issue #466 Need faster tests for Travis-CI
80
+
81
+ Other:
53
82
 
83
+ * Issue #478 rake debug problem on Windows
84
+ * Issue #510 Ruboto setup on Windows fails to set path to dx
85
+
54
86
  You can find a complete list of issues here:
55
87
 
56
- * https://github.com/ruboto/ruboto/issues?state=closed&milestone=29
88
+ * https://github.com/ruboto/ruboto/issues?state=closed&milestone=30
57
89
 
58
90
 
59
91
  Installation:
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  $:.unshift('lib') unless $:.include?('lib')
2
+ require 'time'
2
3
  require 'date'
3
4
  require 'rake/clean'
4
5
  require 'rexml/document'
@@ -6,7 +7,10 @@ require 'ruboto/version'
6
7
  require 'ruboto/description'
7
8
  require 'ruboto/sdk_versions'
8
9
  require 'uri'
10
+ require 'net/http'
9
11
  require 'net/https'
12
+ require 'openssl'
13
+ require 'yaml'
10
14
 
11
15
  PROJECT_DIR = File.expand_path(File.dirname(__FILE__))
12
16
  PLATFORM_PROJECT = File.expand_path('tmp/RubotoCore', File.dirname(__FILE__))
@@ -37,10 +41,12 @@ file GEM_FILE => GEM_SPEC_FILE do
37
41
  end
38
42
 
39
43
  task :install => :gem do
40
- `RUBYOPT= gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
44
+ old_rubyopt = ENV['RUBYOPT']
45
+ ENV['RUBYOPT'] = nil
46
+ `gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
41
47
  if $? != 0
42
48
  puts 'Installing gem'
43
- cmd = "RUBYOPT= gem install ruboto-#{Ruboto::VERSION}.gem"
49
+ cmd = "gem install ruboto-#{Ruboto::VERSION}.gem"
44
50
  output = `#{cmd}`
45
51
  if $? == 0
46
52
  puts output
@@ -50,13 +56,16 @@ task :install => :gem do
50
56
  else
51
57
  puts "ruboto-#{Ruboto::VERSION} is already installed."
52
58
  end
59
+ ENV['RUBYOPT'] = old_rubyopt
53
60
  end
54
61
 
55
62
  task :uninstall do
56
- `RUBYOPT= gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
63
+ old_rubyopt = ENV['RUBYOPT']
64
+ ENV['RUBYOPT'] = nil
65
+ `gem query -i -n ^ruboto$ -v #{Ruboto::VERSION}`
57
66
  if $? == 0
58
67
  puts 'Uninstalling gem'
59
- cmd = "RUBYOPT= gem uninstall -x ruboto -v #{Ruboto::VERSION}"
68
+ cmd = "gem uninstall -x ruboto -v #{Ruboto::VERSION}"
60
69
  output = `#{cmd}`
61
70
  if $? == 0
62
71
  puts output
@@ -66,6 +75,7 @@ task :uninstall do
66
75
  else
67
76
  puts "ruboto-#{Ruboto::VERSION} is not installed."
68
77
  end
78
+ ENV['RUBYOPT'] = old_rubyopt
69
79
  end
70
80
 
71
81
  task :reinstall => [:uninstall, :clean, :install]
@@ -116,11 +126,6 @@ def get_github_issues
116
126
  print 'user name: '; user = STDIN.gets.chomp
117
127
  print ' password: '; pass = STDIN.gets.chomp
118
128
  end
119
- require 'uri'
120
- require 'net/http'
121
- require 'net/https'
122
- require 'openssl'
123
- require 'yaml'
124
129
  host = 'api.github.com'
125
130
  base_uri = "https://#{host}/repos/ruboto/ruboto"
126
131
  https = Net::HTTP.new(host, 443)
@@ -132,7 +137,7 @@ def get_github_issues
132
137
  req.basic_auth(user, pass)
133
138
  res = https.start { |http| http.request(req) }
134
139
  milestones = YAML.load(res.body).sort_by { |i| Date.parse(i['due_on']) }
135
- milestone_entry = milestones.find{|m| m['title'] == Ruboto::VERSION}
140
+ milestone_entry = milestones.find { |m| m['title'] == Ruboto::VERSION }
136
141
  raise "Milestone for version #{} not found." unless milestone_entry
137
142
  milestone = milestone_entry['number']
138
143
 
@@ -223,11 +228,11 @@ New in version #{milestone_name}:
223
228
 
224
229
  #{milestone_description}
225
230
 
226
- #{(categories.keys & grouped_issues.keys).map do |cat|
231
+ #{(categories.keys & grouped_issues.keys).map do |cat|
227
232
  "#{cat}:\n
228
- #{grouped_issues[cat].map { |i| %Q{* Issue ##{i['number']} #{i['title']}}.wrap(2) }.join("\n")}
229
- "
230
- end.join("\n")}
233
+ #{grouped_issues[cat].map { |i| %Q{* Issue ##{i['number']} #{i['title']}}.wrap(2) }.join("\n")}
234
+ "
235
+ end.join("\n")}
231
236
  You can find a complete list of issues here:
232
237
 
233
238
  * https://github.com/ruboto/ruboto/issues?state=closed&milestone=#{milestone}
@@ -302,14 +307,6 @@ end
302
307
 
303
308
  desc 'Fetch download stats form rubygems.org'
304
309
  task :stats do
305
- require 'time'
306
- require 'date'
307
- require 'rubygems'
308
- require 'uri'
309
- require 'net/http'
310
- require 'net/https'
311
- require 'openssl'
312
- require 'yaml'
313
310
  host = 'rubygems.org'
314
311
  base_uri = "https://#{host}/api/v1"
315
312
  https = Net::HTTP.new(host, 443)
@@ -397,7 +394,19 @@ task :test do
397
394
  ARGV.delete_if { |a| test_pattern.include? a }
398
395
  test_pattern.map! { |t| t[5..-1] }
399
396
  $: << File.expand_path('test', File.dirname(__FILE__))
400
- (test_pattern.any? ? test_pattern : %w(test/*_test.rb)).map { |d| Dir[d] }.flatten.each do |f|
397
+ test_files = (test_pattern.any? ? test_pattern : %w(test/*_test.rb)).
398
+ map { |d| Dir[d] }.flatten.sort
399
+ if /(\d+)OF(\d+)/i =~ ENV['TEST_PART']
400
+ part_index = $1.to_i - 1
401
+ parts = $2.to_i
402
+ total_tests = test_files.size
403
+ files_in_part = total_tests.to_f / parts
404
+ start_index = (files_in_part * part_index).round
405
+ end_index = (files_in_part * (part_index + 1)).round - 1
406
+ test_files = test_files[start_index..end_index]
407
+ puts "Running tests #{start_index + 1}-#{end_index + 1} of #{total_tests}"
408
+ end
409
+ test_files.each do |f|
401
410
  require f.chomp('.rb')[5..-1]
402
411
  end
403
412
  end
@@ -571,8 +580,19 @@ end
571
580
  desc 'Download the latest jruby-jars snapshot'
572
581
  task :get_jruby_jars_snapshot do
573
582
  current_gem = 'jruby-jars-9000.dev.gem'
574
- `wget http://ci.jruby.org/snapshots/master/#{current_gem}`
575
- jars = Dir["#{current_gem}.*"]
576
- jars[0..-2].each { |j| FileUtils.rm_f j } if jars.size > 1
577
- FileUtils.mv(jars[-1], current_gem) if jars[-1]
583
+ print "Downloading #{current_gem}: \r"
584
+ uri = URI("http://ci.jruby.org/snapshots/master/#{current_gem}")
585
+ done = 0
586
+ body = ''
587
+ Net::HTTP.new(uri.host, uri.port).request_get(uri.path) do |response|
588
+ length = response['Content-Length'].to_i
589
+ response.read_body do |fragment|
590
+ body << fragment
591
+ done += fragment.length
592
+ progress = (done * 100) / length
593
+ print "Downloading #{current_gem}: #{done / 1024}/#{length / 1024}KB #{progress}%\r"
594
+ end
595
+ puts
596
+ end
597
+ File.open(current_gem, 'wb') { |f| f << body }
578
598
  end