Class: CodeshipMigrateToGithubApp::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/codeship_migrate_to_github_app/cli.rb

Constant Summary collapse

CODESHIP_JSON_HEADER =
"application/json"
GITHUB_JSON_HEADER =
"application/vnd.github.v3+json"
GITHUB_INSTALLATIONS_PREVIEW_HEADER =
"application/vnd.github.v3+json, application/vnd.github.machine-man-preview+json"
CODESHIP_AUTH_URL =
"https://api.codeship.com/v2/auth"
GITHUB_ORGS_URL =
"https://api.github.com/user/orgs"
CODESHIP_MIGRATION_INFO_URL =
"https://api.codeship.com/v2/internal/github_app_migration"
GITHUB_INSTALL_URL =
"https://api.github.com/user/installations/{installation_id}/repositories/{repository_id}"
GITHUB_LIST_HOOKS_URL =
"https://api.github.com/repos/{owner}/{repo}/hooks"
GITHUB_DELETE_HOOK_URL =
"https://api.github.com/repos/{owner}/{repo}/hooks/{hook_id}"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeship_migration_infoObject

Returns the value of attribute codeship_migration_info.



20
21
22
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 20

def codeship_migration_info
  @codeship_migration_info
end

#codeship_tokenObject

Returns the value of attribute codeship_token.



20
21
22
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 20

def codeship_token
  @codeship_token
end

#errorsObject

Returns the value of attribute errors.



20
21
22
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 20

def errors
  @errors
end

#github_orgObject

Returns the value of attribute github_org.



20
21
22
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 20

def github_org
  @github_org
end

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 22

def self.exit_on_failure?
  true
end

Instance Method Details

#startObject



34
35
36
37
38
39
40
41
# File 'lib/codeship_migrate_to_github_app/cli.rb', line 34

def start
  setup
  validate_github_credentials(options[:github_token])
  fetch_codeship_token(options[:codeship_user], options[:codeship_pass])
  fetch_migration_info
  migrate
  report
end