Sha256: 0f341013ac32bc3d95a04bdf811c0f24938e768f903781230dc63ab24f681a64

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module GoNative
  module Commands
    module Android
      class  Publish < Base
        desc 'Used to update one of the android internal dependencies'
        
        def call
          assert_build_file_exists!
          create_and_push_tag!
        end
        
        def assert_build_file_exists!
          return if gradle_file

          raise Error, "No build.gradle file exists"
        end
        
        private
        
        def 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 \''"\'`
        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
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gonative-cli-1.0.0 lib/gonative/commands/android/publish.rb