Sha256: dc2c2fa966bcbe623207e113cfd0c63042e74e81b15db776b527f4a0ae3b2f70

Contents?: true

Size: 718 Bytes

Versions: 11

Compression:

Stored size: 718 Bytes

Contents

module SafePusher
  module Client
    class Github
      def push
        system('git push origin')

        exit_status = $CHILD_STATUS.exitstatus

        if exit_status == 128
          puts 'Syncing with github...'.green

          push_and_set_upstream

          exit_status = $CHILD_STATUS.exitstatus
        end

        exit_status
      end

      def open
        system(
          "open '#{SafePusher.configuration.repo_url}/pull/new/#{branch}'",
        )
      end

      private

      def push_and_set_upstream
        system("git push --set-upstream origin #{branch}")
      end

      def branch
        `git rev-parse --symbolic-full-name --abbrev-ref HEAD`.delete("\n")
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
safe_pusher-0.5.7 lib/safe_pusher/client/github.rb
safe_pusher-0.5.6 lib/safe_pusher/client/github.rb
safe_pusher-0.5.5 lib/safe_pusher/client/github.rb
safe_pusher-0.5.4 lib/safe_pusher/client/github.rb
safe_pusher-0.5.3 lib/safe_pusher/client/github.rb
safe_pusher-0.5.2 lib/safe_pusher/client/github.rb
safe_pusher-0.5.1 lib/safe_pusher/client/github.rb
safe_pusher-0.5.0 lib/safe_pusher/client/github.rb
safe_pusher-0.4.3 lib/safe_pusher/client/github.rb
safe_pusher-0.4.2 lib/safe_pusher/client/github.rb
safe_pusher-0.4.1 lib/safe_pusher/client/github.rb