• R/O
  • HTTP
  • SSH
  • HTTPS

CUTEn: Commit

CUTEn


Commit MetaInfo

Revision6423ad8a3b929dc250ab3e3a7774e61be2fe4286 (tree)
Time2013-01-10 13:54:14
Authoreagletmt <eagletmt@gmai...>
Commitereagletmt

Log Message

Skip apk check if dexdump is not available

Change Summary

Incremental Difference

--- a/CutenServer/app/models/apk.rb
+++ b/CutenServer/app/models/apk.rb
@@ -45,6 +45,9 @@ class Apk < ActiveRecord::Base
4545 end
4646 return if not apk_updated_at_changed?
4747
48+ # Skip apk check if dexdump is not available
49+ return unless Rails.configuration.dexdump_path
50+
4851 path = apk.queued_for_write[:original].instance_variable_get(:@tempfile).to_path
4952 buf = ''
5053 status = Open4.popen4(Rails.configuration.dexdump_path.to_s, '-lxml', path) do |pid, stdin, stdout, stderr|
--- a/CutenServer/config/environment.rb
+++ b/CutenServer/config/environment.rb
@@ -10,5 +10,11 @@ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
1010 end
1111
1212 CutenServer::Application.configure do
13- config.dexdump_path = Pathname.new(ENV['ANDROID_HOME']).join('platform-tools', 'dexdump')
13+ config.dexdump_path =
14+ if ENV['ANDROID_HOME']
15+ path = Pathname.new(ENV['ANDROID_HOME']).join('platform-tools', 'dexdump')
16+ if path.file? and path.executable?
17+ path
18+ end
19+ end
1420 end
--- a/CutenServer/test/unit/apk_test.rb
+++ b/CutenServer/test/unit/apk_test.rb
@@ -7,12 +7,18 @@ class ApkTest < ActiveSupport::TestCase
77 end
88
99 test 'reject wrong class name' do
10+ if not Rails.configuration.dexdump_path
11+ skip 'dexdump is not available'
12+ end
1013 apk = FactoryGirl.build :apk, :name => 'does.not.exist'
1114 assert !apk.save
1215 assert_not_empty apk.errors[:apk]
1316 end
1417
1518 test 'reject invalid apk file' do
19+ if not Rails.configuration.dexdump_path
20+ skip 'dexdump is not available'
21+ end
1622 file = fixture_file_upload 'dummy.apk'
1723 apk = FactoryGirl.build :apk, :apk => file
1824 assert !apk.save
Show on old repository browser