lib/gonative/commands/android/publish.rb in gonative-cli-1.3.8 vs lib/gonative/commands/android/publish.rb in gonative-cli-1.3.9

- old
+ new

@@ -3,46 +3,30 @@ module GoNative module Commands module Android class Publish < Base desc 'Used to update one of the android internal dependencies' + include Helpers::GradleVersionReader def call assert_build_file_exists! create_and_push_tag! end def assert_build_file_exists! - return unless gradle_files.empty? + return unless gradle_file.empty? - raise Error, "No build.gradle file exists" + raise Error, 'No build.gradle file exists' end private - def gradle_files - @gradle_files ||= `find . -maxdepth 2 -iname build.gradle`.split("\n") - end - - def version - return @version if @version - - gradle_files.each do |gradle_file| - str = IO.read(gradle_file) - @version = str.match(/versionName\s+\"(?<version>.+)\"/)[:version] - - break if @version - end - - @version - end - def create_and_push_tag! - unless system("git tag | grep #{version} > /dev/null") - system "git add -A && git commit -m \"Releases #{version}.\"" - system "git tag #{version}" - system "git push && git push --tags" - end + return if system("git tag | grep #{version} > /dev/null") + + system "git add -A && git commit -m \"Releases #{version}.\"" + system "git tag #{version}" + system 'git push && git push --tags' end end end end end