Sha256: 73ad48ac9ff567c60c2ec25be056452fcb3a07f195c4d9b886870fedef63ab22

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'clamp'

module Unwrappr
  # Entry point for the app
  class CLI < Clamp::Command
    self.default_subcommand = 'all'

    option ['--version', '-v'], :flag, 'Show version' do
      puts "unwrappr v#{Unwrappr::VERSION}"
      exit(0)
    end

    subcommand 'all', 'run bundle update, push to github, '\
                      'create a pr and annotate changes' do
      def execute
        puts 'Doing the unwrappr thing...'
        GitCommandRunner.create_branch!
        BundlerCommandRunner.bundle_update!
        GitCommandRunner.commit_and_push_changes!
        GitHub::Client.make_pull_request!
      end
    end

    subcommand 'annotate-pull-request',
               'Annotate Gemfile.lock changes in a Github pull request' do

      option '--repo', 'REPO',
             'The repo in github <owner/project>',
             required: true

      option '--pr', 'PR',
             'The github PR number',
             required: true

      def execute
        LockFileAnnotator.annotate_github_pull_request(
          repo: repo,
          pr_number: pr.to_i
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unwrappr-0.3.1 lib/unwrappr/cli.rb
unwrappr-0.3.0 lib/unwrappr/cli.rb