module Ruboto::Util::Verify
Constants
- ON_TRAVIS
Public Instance Methods
project_api_level()
click to toggle source
# File lib/ruboto/util/verify.rb, line 105 def project_api_level begin return $1 if project_properties =~ /^target=(.*)$/ rescue # ignored end end
project_properties()
click to toggle source
# File lib/ruboto/util/verify.rb, line 98 def project_properties return @project_properties if @project_properties properties_file_name = 'project.properties' return nil unless File.exists? properties_file_name @project_properties = File.read(properties_file_name) end
save_manifest()
click to toggle source
# File lib/ruboto/util/verify.rb, line 22 def save_manifest File.open('AndroidManifest.xml', 'w') do |f| REXML::Formatters::OrderedAttributes.new(4).write(verify_manifest.document, f) f.puts end end
save_ruboto_config()
click to toggle source
# File lib/ruboto/util/verify.rb, line 89 def save_ruboto_config File.open('ruboto.yml', 'w') {|f| f << YAML.dump(verify_ruboto_config)} end
save_test_manifest()
click to toggle source
# File lib/ruboto/util/verify.rb, line 35 def save_test_manifest File.open('test/AndroidManifest.xml', 'w') {|f| verify_test_manifest.document.write(f, 4)} end
verify_activity()
click to toggle source
# File lib/ruboto/util/verify.rb, line 44 def verify_activity verify_manifest @activity ||= @manifest.elements['application/activity'].attribute('android:name').value end
verify_api()
click to toggle source
# File lib/ruboto/util/verify.rb, line 77 def verify_api Ruboto::API.api end
verify_manifest(reload: false)
click to toggle source
Verify
the presence of important components
# File lib/ruboto/util/verify.rb, line 14 def verify_manifest(reload: false) return @manifest if @manifest && !reload unless File.exists? 'AndroidManifest.xml' abort "cannot find your AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app" end @manifest = REXML::Document.new(File.read('AndroidManifest.xml')).root end
verify_min_sdk()
click to toggle source
# File lib/ruboto/util/verify.rb, line 56 def verify_min_sdk return @min_sdk if @min_sdk verify_sdk_versions min_sdk_attr = @uses_sdk.attribute('android:minSdkVersion').value abort "you must specify a minimum sdk level in the manifest (e.g., <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='8' />)" unless min_sdk_attr @min_sdk = min_sdk_attr.to_i end
verify_package()
click to toggle source
# File lib/ruboto/util/verify.rb, line 39 def verify_package verify_manifest @package ||= @manifest.attribute('package').value end
verify_project_properties()
click to toggle source
# File lib/ruboto/util/verify.rb, line 93 def verify_project_properties return @project_properties if project_properties abort "cannot find your #{properties_file_name} to extract info from it. Make sure you're in the root directory of your app." unless File.exists? properties_file_name end
verify_ruboto_config()
click to toggle source
# File lib/ruboto/util/verify.rb, line 81 def verify_ruboto_config if File.exists? 'ruboto.yml' @ruboto_config ||= (YAML::load_file('ruboto.yml') || {}) else @ruboto_config = {} end end
verify_sdk_versions()
click to toggle source
# File lib/ruboto/util/verify.rb, line 49 def verify_sdk_versions verify_manifest @uses_sdk ||= @manifest.elements['uses-sdk'] abort "you must specify your sdk level in the manifest (e.g., <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='8' />)" unless @uses_sdk @uses_sdk end
verify_strings()
click to toggle source
# File lib/ruboto/util/verify.rb, line 72 def verify_strings abort "cannot find your strings.xml to extract info from it. Make sure you're in the root directory of your app" unless File.exists? 'res/values/strings.xml' @strings ||= REXML::Document.new(File.read('res/values/strings.xml')) end
verify_target_sdk()
click to toggle source
# File lib/ruboto/util/verify.rb, line 64 def verify_target_sdk return @target_sdk if @target_sdk verify_sdk_versions target_sdk_attr = @uses_sdk.attribute('android:targetSdkVersion').value abort "you must specify a target sdk level in the manifest (e.g., <uses-sdk android:minSdkVersion='3' android:targetSdkVersion='8' />)" unless target_sdk_attr @target_sdk = target_sdk_attr.to_i end
verify_test_manifest()
click to toggle source
# File lib/ruboto/util/verify.rb, line 29 def verify_test_manifest abort "cannot find your test AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app" \ unless File.exists? 'test/AndroidManifest.xml' @manifest ||= REXML::Document.new(File.read('test/AndroidManifest.xml')).root end