Sha256: 2402b7d1997d477747fd4db692908c1e770b70da7b4617cf6f373cfa25eb2b87

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

require 'travis/cli'

module Travis
  module CLI
    class Enable < RepoCommand
      description 'enables a project'
      on('-s', '--skip-sync', "don't trigger a sync if the repo is unknown")

      def run
        authenticate
        error "not allowed to update service hook for #{color(repository.slug, :bold)}" unless repository.admin?
        repository.enable
        say 'enabled', color("#{slug}: %s :)", :success)
      end

      private

      def repository
        repo(slug)
      rescue Travis::Client::NotFound
        unless skip_sync?
          say 'repository not known to Travis CI (or no access?)'
          say 'triggering sync: '
          sync
          say ' done'
        end
        super
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 lib/travis/cli/enable.rb
travis-1.13.3 lib/travis/cli/enable.rb
travis-1.13.2 lib/travis/cli/enable.rb
travis-1.13.1 lib/travis/cli/enable.rb
travis-1.13.0 lib/travis/cli/enable.rb
travis-1.12.0 lib/travis/cli/enable.rb