droiuby 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/drby +6 -2
- data/lib/droiuby/bootstrap.rb +7 -3
- data/lib/droiuby/scripts/project.rb +47 -5
- data/lib/droiuby/wrappers/listeners/auto_wrap.rb +10 -4
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e18345aa04cb95e4b637645460c23caaa436bf05
|
4
|
+
data.tar.gz: 9d06d878aaf9d0e7792d55c0ef1b006cd0b57420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39dea7d3bd65ecac0cf8e76d1dc3e60b0691097ff3e773cc8ff3e55e46f1b54304315160293b22893fbee6bbc088124a67333fbe2e6b99b56a8938e185c2ea02
|
7
|
+
data.tar.gz: 9f67339a8b060c0158570056cab9929ed8256c997b073d414f40bd04ef0d366b830e04dc96c8ac451c6b91bab9bac623877903343d2088d731ff0ed669895afd
|
data/bin/drby
CHANGED
@@ -116,8 +116,7 @@ case command
|
|
116
116
|
puts '--package [JAVA_PACKAGE] is required.'
|
117
117
|
exit(1)
|
118
118
|
end
|
119
|
-
project.standalone(project_name, $java_package, $app_name
|
120
|
-
: $app_name,'')
|
119
|
+
project.standalone(project_name, $java_package, $app_name,'')
|
121
120
|
when 'switch'
|
122
121
|
instance_name = nil
|
123
122
|
unless ARGV[1].blank?
|
@@ -160,6 +159,11 @@ case command
|
|
160
159
|
|
161
160
|
unless ARGV[1].blank?
|
162
161
|
project_name = ARGV[1]
|
162
|
+
else
|
163
|
+
if !File.exists?('config.droiuby')
|
164
|
+
puts 'current directory is not a valid droiuby project'
|
165
|
+
exit(1)
|
166
|
+
end
|
163
167
|
end
|
164
168
|
|
165
169
|
project.execute(project_name, $device_ip, $droiuby_host)
|
data/lib/droiuby/bootstrap.rb
CHANGED
@@ -57,7 +57,12 @@ def _active_bundles
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def _errors
|
60
|
-
_execution_bundle.getScriptErrors.collect { |
|
60
|
+
_execution_bundle.getScriptErrors.collect { |e| e.to_s }
|
61
|
+
end
|
62
|
+
|
63
|
+
def _add_error(error_message)
|
64
|
+
_execution_bundle.addError(error_message)
|
65
|
+
error_message
|
61
66
|
end
|
62
67
|
|
63
68
|
def _R(attr)
|
@@ -96,7 +101,7 @@ def render(url, params = {})
|
|
96
101
|
end
|
97
102
|
|
98
103
|
new_activity = params[:activity] ? true : false;
|
99
|
-
|
104
|
+
|
100
105
|
async.perform {
|
101
106
|
Java::com.droiuby.client.core.DroiubyLauncher.loadPage(_current_activity, _execution_bundle, url, http_method)
|
102
107
|
}.done { |result|
|
@@ -264,4 +269,3 @@ def http_get(url, params = {}, options = {})
|
|
264
269
|
|
265
270
|
Java::com.droiuby.client.core.utils.Utils.load(_current_activity, url_string, _execution_bundle);
|
266
271
|
end
|
267
|
-
|
@@ -5,6 +5,7 @@ require 'zip'
|
|
5
5
|
require 'thor'
|
6
6
|
require "uri"
|
7
7
|
require 'cgi'
|
8
|
+
require 'nokogiri'
|
8
9
|
require 'droiuby/support/object'
|
9
10
|
require 'droiuby/support/string'
|
10
11
|
|
@@ -119,7 +120,7 @@ class Project < Thor
|
|
119
120
|
end
|
120
121
|
|
121
122
|
desc "standalone NAME [PACKAGE_NAME]", "create an android project for this app with the specified java package name"
|
122
|
-
def standalone(name, package_name, title =
|
123
|
+
def standalone(name, package_name, title = nil, output_dir = 'projects')
|
123
124
|
|
124
125
|
if output_dir.blank?
|
125
126
|
output_dir = Dir.pwd
|
@@ -127,6 +128,18 @@ class Project < Thor
|
|
127
128
|
|
128
129
|
dest_folder = File.join(output_dir,"#{name}")
|
129
130
|
|
131
|
+
Dir.chdir dest_folder
|
132
|
+
|
133
|
+
if title.nil?
|
134
|
+
|
135
|
+
doc = Nokogiri.XML(File.read('config.droiuby'))
|
136
|
+
|
137
|
+
doc.css('app_descriptor name').each do |element|
|
138
|
+
title = element.content
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
130
143
|
template_repository = ENV['droiuby_template'] || 'https://github.com/jedld/droiuby-template.git'
|
131
144
|
template_directory = File.expand_path('~/.droiuby/android_project_templates')
|
132
145
|
|
@@ -198,10 +211,10 @@ class Project < Thor
|
|
198
211
|
archive = compress(src_folder, force)
|
199
212
|
|
200
213
|
project_directory = File.join(src_folder,'project')
|
201
|
-
say "
|
214
|
+
say "exsits? #{project_directory}"
|
202
215
|
if File.exists? project_directory
|
203
216
|
say "Android Project exists. Updating build inside assets ..."
|
204
|
-
copy_file archive, File.join(project_directory,'assets',File.basename(archive))
|
217
|
+
copy_file archive, File.join(project_directory,'assets',File.basename(archive)), force: true
|
205
218
|
end
|
206
219
|
end
|
207
220
|
|
@@ -313,7 +326,6 @@ class Project < Thor
|
|
313
326
|
end
|
314
327
|
|
315
328
|
desc "framework DEVICE_IP","updates the droiuby framework using code from framework_src"
|
316
|
-
|
317
329
|
def framework(device_ip = nil, source_dir = 'framework_src')
|
318
330
|
compress(source_dir, "true", "framework")
|
319
331
|
upload 'framework', device_ip, File.join(Dir.pwd,"framework_src"), true
|
@@ -321,8 +333,38 @@ class Project < Thor
|
|
321
333
|
|
322
334
|
desc "execute NAME DEVICE_IP [WORKSPACE_DIR]","package and execute a droiuby application to target device running droiuby client"
|
323
335
|
def execute(name, device_ip, source_dir = 'projects')
|
336
|
+
|
324
337
|
package name, source_dir, "true"
|
325
|
-
|
338
|
+
|
339
|
+
source_dir_args = source_dir ? source_dir : 'projects'
|
340
|
+
src_dir = if name.blank?
|
341
|
+
Dir.pwd
|
342
|
+
else
|
343
|
+
File.join(source_dir_args, name)
|
344
|
+
end
|
345
|
+
|
346
|
+
project_directory = File.join(src_dir,'project')
|
347
|
+
|
348
|
+
say "exsits? #{project_directory}"
|
349
|
+
if File.exists? project_directory
|
350
|
+
say "Android Project exists. Building debug project instead ..."
|
351
|
+
Dir.chdir(project_directory)
|
352
|
+
doc = Nokogiri.XML(File.read('AndroidManifest.xml'))
|
353
|
+
|
354
|
+
package_name = nil
|
355
|
+
doc.css('manifest').each do |element|
|
356
|
+
package_name = element['package']
|
357
|
+
end
|
358
|
+
|
359
|
+
`ant debug install`
|
360
|
+
|
361
|
+
say "Starting activity #{package_name}"
|
362
|
+
|
363
|
+
`adb shell am start -W -S --activity-clear-top --activity-brought-to-front -n #{package_name}/.StartupActivity`
|
364
|
+
else
|
365
|
+
upload name, device_ip, source_dir
|
366
|
+
end
|
367
|
+
|
326
368
|
end
|
327
369
|
|
328
370
|
desc "bundle", "unpack all cached gems"
|
@@ -73,10 +73,16 @@ module Droiuby
|
|
73
73
|
def _listener(java_class, package = 'android.view.View' , &block)
|
74
74
|
puts "using dexmaker auto wrapper"
|
75
75
|
Proc.new { |*args|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
begin
|
77
|
+
wrapped_args = args.collect { |a|
|
78
|
+
wrap_native_view(a)
|
79
|
+
}
|
80
|
+
block.call(*wrapped_args)
|
81
|
+
rescue Exception => e
|
82
|
+
error_message_str = "#{e.inspect}\n#{e.backtrace.join("\n")}"
|
83
|
+
puts error_message_str
|
84
|
+
_add_error(error_message_str)
|
85
|
+
end
|
80
86
|
}
|
81
87
|
end
|
82
88
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: droiuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Emmanuel Dayo
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: nokogiri
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Android app development and rapid prototyping using Ruby
|
84
98
|
email: joseph.dayo@gmail.com
|
85
99
|
executables:
|