lib/gonative/commands/android/publish.rb in gonative-cli-1.0.0 vs lib/gonative/commands/android/publish.rb in gonative-cli-1.0.1
- old
+ new
@@ -18,14 +18,17 @@
end
private
def gradle_file
- Dir.entries(".").select { |s| s == "build.gradle" }.first
+ @gradle_file ||= Dir.entries(".").select { |s| s == "build.gradle" }.first
end
def version
- @version ||= `grep -o "versionName\s.*\d.\d.\d" build.gradle | awk '{ print $2 }' | tr -d \''"\'`
+ str = IO.read(gradle_file)
+ str.match(/versionName\s+\"(?<version>.+)\"/)
+
+ str.match(/versionName\s+\"(?<version>.+)\"/)[:version]
end
def create_and_push_tag!
unless system("git tag | grep #{version} > /dev/null")
system "git add -A && git commit -m \"Releases #{version}.\""