Class: Renuo::Cli::Commands::CreateDeploioApp

Inherits:
Object
  • Object
show all
Defined in:
lib/renuo/cli/commands/create_deploio_app.rb

Overview

rubocop:disable Metrics/ClassLength

Constant Summary collapse

GITHUB_SSH_KEY_FILE_NAME =
"temporary_repository_ssh_key"
GITHUB_DEPLOY_KEY_TITLE =
"deploio-deploy-key"
SSH_ALGORITHM =
"Ed25519"
PROJECT_NAME_PREFIX =
"renuo-"

Instance Method Summary collapse

Instance Method Details

#git_url_valid?(git_url) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 37

def git_url_valid?(git_url)
  http_git_url?(git_url) || ssh_git_url?(git_url)
end

#http_git_url?(git_url) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 41

def http_git_url?(git_url)
  http_git_url_regex = %r{^https?://[\w.-]+/[\w.-]+/[\w.-]+(?:\.git)?/?$}
  git_url.match?(http_git_url_regex)
end

#runObject



29
30
31
32
33
34
35
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 29

def run
  parse_arguments
  setup_commands
  setup_environments
ensure
  cleanup
end

#ssh_git_url?(git_url) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 46

def ssh_git_url?(git_url)
  ssh_git_url_regex = %r{^(git@[\w.-]+[:|/][\w.-]+/[\w.-]+\.git)$}
  git_url.match?(ssh_git_url_regex)
end