Skip to content

Instantly share code, notes, and snippets.

@suhanlee
Created February 17, 2016 07:38
Show Gist options
  • Save suhanlee/11a2a8fbdbfd9d2624c8 to your computer and use it in GitHub Desktop.
Save suhanlee/11a2a8fbdbfd9d2624c8 to your computer and use it in GitHub Desktop.
get version-code and version-name in android's build.grade
#!/usr/bin/env ruby
filename = ARGV[0]
File.open(filename, 'r').each do |line|
versionCode = line.match(/versionCode\s(\d*)/)
if versionCode != nil
v = versionCode.captures
puts v
end
end
#!/usr/bin/env ruby
filename = ARGV[0]
File.open(filename, 'r').each do |line|
versionCode = line.match(/versionName\s"(\S*)"/)
if versionCode != nil
v = versionCode.captures
puts v
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment