droiuby 0.2.2 → 0.2.3

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: a20c92e4f7910149a0baf89de5c4b3fa65923a54
4
- data.tar.gz: ce2e50f8c9686819398224b543862c20f86e07b7
3
+ metadata.gz: 921db7f8b7c41deedd0cfeb464aa1c6e57daf543
4
+ data.tar.gz: cdfdce5bcc529ddf3a683c17e4bba254a5236646
5
5
  SHA512:
6
- metadata.gz: c55561deb9cfd6ed18cc2edf12470f3e26da53bd0be282fd32b49d1f971ef1f949cba1cb0fa4fca9231f984134849a3bf7bde4b77c9fcbb0a739692d170f5114
7
- data.tar.gz: 0ddf758c421e1a00fc76ee81ed494c14b5c857d98c41137350546b442acccb7812fd221a3c77d202a76536918ed5fea031a48e3040955e337617c05417421f86
6
+ metadata.gz: 18b98c0a830f51c63f85be967c8d90b1abff4bd2abcd510155cec093dcef3d676aeb106083bfa4106e5976a151509782104785bc87f49b915e96733853640b22
7
+ data.tar.gz: fb7e8d554b2fe4500111e325c2fa285b16615a95be4b3fc09283fd7e5845c7dc8ffc0697e5000083fea54e2c9de33d53b51701556fbec9cc9854373e4ab037f9
data/bin/drby CHANGED
@@ -10,21 +10,23 @@ $droiuby_host = ENV['DROIUBY_HOST'] || '10.0.2.2'
10
10
  $device_ip = ENV['DROIUBY_DEVICE'] || nil
11
11
 
12
12
  options = OptionParser.new do |o|
13
- o.banner =
13
+ o.banner =
14
14
  "Usage: drby autostart true|false INSTANCE_NAME [options] # Set specified instance to start on droiuby launch
15
- drby console [options] # Launch an interactive console to the target Android Device running Droiuby
16
- drby framework update [FOLDER] [options] # updates the droiuby framework from folder (default src_framework)
17
- drby go [PROJECT_NAME] [options] # packages an app and uploads to an Android Device running Droiuby
18
- drby list [options] # Lists the app instances running on the phone
19
- drby live [PROJECT_NAME] [options] # runs a web instance of the app and tells Droiuby to load it.
20
- drby new PROJECT_NAME [options] # Create a new project
21
- drby pack [PROJECT_NAME] [options] # zips and packages an app
22
- drby reload # uploads and then reload the current app
23
- drby switch INSTANCE_NAME [options] # Switch to the specified instance
24
- drby bundle # unzips all gems in vendor/cache for deployment to droiuby\n"
15
+ drby console [options] # Launch an interactive console to the target Android Device running Droiuby
16
+ drby framework update [FOLDER] [options] # updates the droiuby framework from folder (default src_framework)
17
+ drby go [PROJECT_NAME] [options] # packages an app and uploads to an Android Device running Droiuby
18
+ drby list [options] # Lists the app instances running on the phone
19
+ drby live [PROJECT_NAME] [options] # runs a web instance of the app and tells Droiuby to load it.
20
+ drby new PROJECT_NAME [options] # Create a new project
21
+ drby pack [PROJECT_NAME] [options] # zips and packages an app
22
+ drby standalone [PROJECT_NAME] --package [JAVA_PACKAGE] # creates a standalone android project for the current app
23
+ drby reload # uploads and then reload the current app
24
+ drby switch INSTANCE_NAME [options] # Switch to the specified instance
25
+ drby bundle # unzips all gems in vendor/cache for deployment to droiuby\n"
25
26
 
26
27
  o.separator ""
27
28
  o.separator "options:"
29
+ o.on('-p','--package java_package','The java package name to use') {|b| $java_package = b}
28
30
  o.on('-h','--host HOST_IP','The IP Address of the host computer (for droiuby live mode)') { |b| $droiuby_host = b }
29
31
  o.on('-d','--device DEVICE_IP','The IP Address of the Android Device') { |b| $device_ip = b }
30
32
  o.parse!
@@ -92,10 +94,26 @@ case command
92
94
  rescue EOFError=>e
93
95
  puts 'cannot communicate with the device. make sure it is connected and the WebConsole is started'
94
96
  end
95
-
97
+
96
98
  end
97
99
  when 'list'
98
100
  project.list($device_ip)
101
+ when 'standalone'
102
+ project_name = nil
103
+ unless ARGV[1].blank?
104
+ project_name = ARGV[1]
105
+ else
106
+ if !File.exists?('config.droiuby')
107
+ puts 'current directory is not a valid droiuby project'
108
+ exit(1)
109
+ end
110
+ end
111
+
112
+ if $java_package.nil?
113
+ puts '--package [JAVA_PACKAGE] is required.'
114
+ exit(1)
115
+ end
116
+ project.standalone(project_name, $java_package, '')
99
117
  when 'switch'
100
118
  instance_name = nil
101
119
  unless ARGV[1].blank?
@@ -109,13 +127,13 @@ case command
109
127
  exit(1)
110
128
  end
111
129
  project.switch(instance_name, $device_ip)
112
- when 'autostart'
130
+ when 'autostart'
113
131
  switch = ARGV[1]
114
132
  if switch.blank?
115
133
  puts "Usage: drby autostart on|off [NAMESPACE] [options]"
116
134
  exit(1)
117
135
  end
118
- project.autostart(switch, ARGV[2], $device_ip)
136
+ project.autostart(switch, ARGV[2], $device_ip)
119
137
  when 'pack'
120
138
  project_name = nil
121
139
  unless ARGV[1].blank?
@@ -126,7 +144,7 @@ case command
126
144
  exit(1)
127
145
  end
128
146
  end
129
- project.package(project_name)
147
+ project.package(project_name)
130
148
  when 'framework'
131
149
  if ARGV[1] == 'update'
132
150
  project = Project.new
@@ -139,8 +157,8 @@ case command
139
157
  unless ARGV[1].blank?
140
158
  project_name = ARGV[1]
141
159
  end
142
-
143
- project.execute(project_name, $device_ip, $droiuby_host)
160
+
161
+ project.execute(project_name, $device_ip, $droiuby_host)
144
162
  when 'bundle'
145
163
  project.bundle
146
164
  when 'live'
@@ -2,7 +2,6 @@ require 'java'
2
2
  require 'droiuby/support/utils'
3
3
  require 'droiuby/support/fixnum'
4
4
  require 'droiuby/support/autoload'
5
- require 'droiuby/support/java'
6
5
  require 'droiuby/wrappers/collection/view_array'
7
6
  require 'droiuby/wrappers/proxy_builder/interface_builder'
8
7
  require 'droiuby/wrappers/listeners/auto_wrap'
@@ -118,6 +118,47 @@ class Project < Thor
118
118
 
119
119
  end
120
120
 
121
+ desc "standalone NAME [PACKAGE_NAME]", "create an android project for this app with the specified java package name"
122
+ def standalone(name, package_name, output_dir = 'projects')
123
+
124
+ if output_dir.blank?
125
+ output_dir = Dir.pwd
126
+ end
127
+
128
+ dest_folder = File.join(output_dir,"#{name}")
129
+
130
+ template_repository = ENV['droiuby_template'] || 'git@github.com:jedld/droiuby-template.git'
131
+ template_directory = File.expand_path('~/.droiuby/android_project_templates')
132
+
133
+ unless File.exists?(template_directory)
134
+ say "no cached copy yet. obtaining template project from repository"
135
+ `git clone --depth 1 #{template_repository} #{template_directory}`
136
+ else
137
+ say "checking for template updates..."
138
+ Dir.chdir template_directory
139
+ `git pull`
140
+ end
141
+
142
+ #prepare
143
+ directory template_directory, File.join(dest_folder,'project')
144
+ remove_dir "#{File.join(dest_folder,'project')}/.git"
145
+
146
+ Dir.chdir File.join(dest_folder,'project')
147
+
148
+ require "#{File.join(dest_folder,'project','init.rb')}"
149
+
150
+ archive_name = File.basename(dest_folder.sub!(%r[/$],'')) if archive_name.nil?
151
+
152
+ init = Init.new
153
+ init.init(package_name, "#{archive_name}.zip")
154
+ Dir.chdir dest_folder
155
+ bundle
156
+ package(name, '', "true")
157
+ copy_file File.join(dest_folder, 'build',"#{archive_name}.zip"), File.join(dest_folder,'project','assets',"#{archive_name}.zip")
158
+ say "Your android project is located at #{dest_folder}/project."
159
+ end
160
+
161
+
121
162
  desc "create NAME [WORKSPACE_DIR]","create a new droiuby project with NAME"
122
163
 
123
164
  def create(name, output_dir = 'projects')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droiuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Emmanuel Dayo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: Android development and rapid prototyping using ruby
97
+ description: Android app development and rapid prototyping using Ruby
98
98
  email: joseph.dayo@gmail.com
99
99
  executables:
100
100
  - drby