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)


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

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)


44
45
46
47
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 44

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

#run(args, options = {}) ⇒ Object



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

def run(args, options = {})
  @project_name, @git_url = args
  @options = options
  parse_arguments
  setup_commands
  setup_environments
ensure
  cleanup
end

#ssh_git_url?(git_url) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/renuo/cli/commands/create_deploio_app.rb', line 49

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