Class: Thrust::Android::Tools

Inherits:
Object
  • Object
show all
Defined in:
lib/thrust/android/tools.rb

Instance Method Summary collapse

Constructor Details

#initialize(thrust_executor, out) ⇒ Tools

Returns a new instance of Tools.



4
5
6
7
# File 'lib/thrust/android/tools.rb', line 4

def initialize(thrust_executor, out)
  @thrust_executor = thrust_executor
  @out = out
end

Instance Method Details

#build_signed_releaseObject



21
22
23
24
25
# File 'lib/thrust/android/tools.rb', line 21

def build_signed_release
  verify_android_installed!
  @thrust_executor.system_or_exit('mvn clean package -Prelease')
  Dir.glob('target/*-signed-aligned.apk').first or raise 'Signed APK was not generated'
end

#change_build_number(version_code, version_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/thrust/android/tools.rb', line 9

def change_build_number(version_code, version_name)
  @thrust_executor.system_or_exit(
      "sed -i ''" +
          " -e 's/android:versionCode=\"[0-9]*\"/android:versionCode=\"#{version_code}\"/'" +
          " -e 's/android:versionName=\"\\([^ \"]*\\)[^\"]*\"/android:versionName=\"\\1 (#{version_name})\"/'" +
          " AndroidManifest.xml")
  @thrust_executor.system_or_exit(
      "sed -i ''" +
          " '1,/<version>/s/<version>\\([^- <]*\\)[^<]*<\\/version>/<version>\\1 (#{version_name})<\\/version>/'" +
          " pom.xml")
end