droiuby 0.2.9 → 0.3.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: e18345aa04cb95e4b637645460c23caaa436bf05
4
- data.tar.gz: 9d06d878aaf9d0e7792d55c0ef1b006cd0b57420
3
+ metadata.gz: bab67e67fe3e51fa4f03a12293bb911ac0dd4280
4
+ data.tar.gz: 4418988873fea81764e4aa2c53d3cb78f4061fc8
5
5
  SHA512:
6
- metadata.gz: 39dea7d3bd65ecac0cf8e76d1dc3e60b0691097ff3e773cc8ff3e55e46f1b54304315160293b22893fbee6bbc088124a67333fbe2e6b99b56a8938e185c2ea02
7
- data.tar.gz: 9f67339a8b060c0158570056cab9929ed8256c997b073d414f40bd04ef0d366b830e04dc96c8ac451c6b91bab9bac623877903343d2088d731ff0ed669895afd
6
+ metadata.gz: 6d470183f2a1ae762b1fdc99ec2585433c75980616f14e38b16322ad9d49d83a00469e69a9a847b7006ad7d92f76b71b6306c13c31c8cd660d9f061016ec3d94
7
+ data.tar.gz: 56466890df504619298624b92b0afb7da6a518eafd9fc349cc952cfed6e70b3bf94510534d2d9a79b1bf099323df2a9ec3eb5855c55293e3f3b41ab16ff9af5a
data/bin/drby CHANGED
@@ -57,7 +57,14 @@ case command
57
57
  puts "Usage: drby new PROJECT_NAME [options]"
58
58
  exit(1)
59
59
  end
60
- project.create(project_name,'')
60
+
61
+ app_name = if $app_name.nil?
62
+ :prompt
63
+ else
64
+ $app_name
65
+ end
66
+
67
+ project.create(project_name, app_name, '')
61
68
  when 'reload'
62
69
  project_name = ARGV[1]
63
70
  project.package(project_name, nil, 'true')
@@ -27,6 +27,26 @@ class Project < Thor
27
27
  end
28
28
  device_ip
29
29
  end
30
+
31
+ def ignore_path?(fpath)
32
+ [/^build/, /^project/, /^vendor\/cache/, /^vendor\/(.*)\/tasks/,
33
+ /^vendor\/(.*)\/ext/, /^vendor\/(.*)\/test/, /^vendor\/(.*)\/port/,
34
+ /^vendor\/(.*)\/bin/].each do |r|
35
+ return true if fpath.match(r)
36
+ end
37
+ return false
38
+ end
39
+
40
+ def get_connected_devices
41
+ begin
42
+ output = `adb devices`
43
+ lines = output.split("\n")
44
+ lines.shift 1
45
+ lines.reject { |line| line.strip.empty? }.collect { |line| line.split(' ').first }
46
+ rescue Errno::ENOENT => e
47
+ []
48
+ end
49
+ end
30
50
  }
31
51
 
32
52
 
@@ -171,10 +191,17 @@ class Project < Thor
171
191
  end
172
192
 
173
193
 
174
- desc "create NAME [WORKSPACE_DIR]","create a new droiuby project with NAME"
194
+ desc "create PROJECT_NAME [APP_NAME] [WORKSPACE_DIR]","create a new droiuby project with NAME"
175
195
 
176
- def create(name, output_dir = 'projects')
196
+ def create(name, app_name = :prompt, output_dir = 'projects')
177
197
  @name = name
198
+ if app_name.nil?
199
+ @app_name = app_name
200
+ elsif app_name == :prompt
201
+ say("Please enter the display name for your app (Used for app launcher and Title):")
202
+ @app_name = ask("Display Name: ")
203
+ end
204
+
178
205
  @description = name
179
206
  @launcher_icon = ''
180
207
  @base_url = ''
@@ -356,11 +383,15 @@ class Project < Thor
356
383
  package_name = element['package']
357
384
  end
358
385
 
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`
386
+ say "running ant debug install"
387
+ if !get_connected_devices.empty?
388
+ puts `ant debug install`
389
+ say "Starting activity #{package_name}"
390
+ `adb shell am start -S --activity-clear-top --activity-brought-to-front -n #{package_name}/.StartupActivity`
391
+ else
392
+ say "No device connected. will just build the project"
393
+ puts `ant debug`
394
+ end
364
395
  else
365
396
  upload name, device_ip, source_dir
366
397
  end
@@ -408,8 +439,7 @@ class Project < Thor
408
439
  FileUtils.rm archive, :force=>true
409
440
 
410
441
  Zip::File.open(archive, Zip::File::CREATE) do |zipfile|
411
- Dir.glob("**{,/*/**}/*.*").reject{ |f| f==archive ||
412
- f.match(/^build/) || f.match(/^project/) }.uniq.each do |file|
442
+ Dir.glob("**{,/*/**}/*.*").reject{ |f| f==archive || ignore_path?(f) }.uniq.each do |file|
413
443
  say_status 'adding', file
414
444
  begin
415
445
  zipfile.add(file, file)
@@ -1,5 +1,5 @@
1
1
  <app_descriptor>
2
- <name><%= @name %></name>
2
+ <name><%= @app_name %></name>
3
3
  <description><%= @description %></description>
4
4
  <launcher_icon><%= @launcher_icon %></launcher_icon>
5
5
  <base_url><%= @base_url%></base_url>
@@ -9,4 +9,4 @@
9
9
  <resource name="lib" type="lib"/>
10
10
  <resource name="vendor" type="vendor"/>
11
11
  </assets>
12
- </app_descriptor>
12
+ </app_descriptor>
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.9
4
+ version: 0.3.0
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-03-26 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake