deploio-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/setup ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ APP_NAME=${APP_NAME:-deploio}
4
+ INSTALL_DIR=${INSTALL_DIR:-"${HOME}/.local/bin"}
5
+ RAW_BASE=${RAW_BASE:-"https://raw.githubusercontent.com/CuddlyBunion341/deploio-cli/main"}
6
+ CLI_URL="${RAW_BASE}/deploio"
7
+ MAN_URL="${RAW_BASE}/deploio.1"
8
+ COMPLETION_URL="${RAW_BASE}/_deploio"
9
+ COLOR_RESET='\033[0m'
10
+ COLOR_GREEN='\033[0;32m'
11
+ COLOR_YELLOW='\033[0;33m'
12
+ COLOR_CYAN='\033[0;36m'
13
+ COLOR_RED='\033[0;31m'
14
+ print() { printf "%b\n" "$*"; }
15
+ info() { print "${COLOR_CYAN}$*${COLOR_RESET}"; }
16
+ success() { print "${COLOR_GREEN}$*${COLOR_RESET}"; }
17
+ warn() { print "${COLOR_YELLOW}$*${COLOR_RESET}"; }
18
+ err() { print "${COLOR_RED}$*${COLOR_RESET}" 1>&2; }
19
+ have_cmd() { command -v "$1" >/dev/null 2>&1; }
20
+ fetch() {
21
+ local url="$1" dest="$2"
22
+ if have_cmd curl; then
23
+ curl -fsSL "$url" -o "$dest"
24
+ elif have_cmd wget; then
25
+ wget -qO "$dest" "$url"
26
+ else
27
+ err "Need curl or wget to download: $url"
28
+ return 1
29
+ fi
30
+ }
31
+ main() {
32
+ info "Installing ${APP_NAME} (deplo.io app CLI)"
33
+ mkdir -p "$INSTALL_DIR"
34
+ tmp_file="$(mktemp -t ${APP_NAME}.XXXXXX)"
35
+ tmp_man="$(mktemp -t ${APP_NAME}-man.XXXXXX)"
36
+ tmp_completion="$(mktemp -t ${APP_NAME}-completion.XXXXXX)"
37
+ trap 'rm -f "$tmp_file" "$tmp_man" "$tmp_completion"' EXIT
38
+
39
+ info "Downloading CLI from: $CLI_URL"
40
+ if ! fetch "$CLI_URL" "$tmp_file"; then
41
+ err "Failed to download ${APP_NAME} from $CLI_URL"
42
+ exit 1
43
+ fi
44
+
45
+ info "Downloading man page from: $MAN_URL"
46
+ if ! fetch "$MAN_URL" "$tmp_man"; then
47
+ warn "Failed to download man page from $MAN_URL (continuing without man page)"
48
+ fi
49
+
50
+ info "Downloading zsh completion from: $COMPLETION_URL"
51
+ if ! fetch "$COMPLETION_URL" "$tmp_completion"; then
52
+ warn "Failed to download completion script from $COMPLETION_URL (continuing without completions)"
53
+ fi
54
+
55
+ install_path="${INSTALL_DIR}/${APP_NAME}"
56
+ mv "$tmp_file" "$install_path"
57
+ chmod +x "$install_path"
58
+
59
+ # Install man page if download succeeded
60
+ if [[ -s "$tmp_man" ]]; then
61
+ man_dir="${HOME}/.local/share/man/man1"
62
+ mkdir -p "$man_dir"
63
+ mv "$tmp_man" "${man_dir}/${APP_NAME}.1"
64
+ success "Installed man page to ${man_dir}/${APP_NAME}.1"
65
+ fi
66
+
67
+ # Install zsh completion if download succeeded
68
+ if [[ -s "$tmp_completion" ]]; then
69
+ completion_dir="${HOME}/.local/share/zsh/site-functions"
70
+ mkdir -p "$completion_dir"
71
+ mv "$tmp_completion" "${completion_dir}/_${APP_NAME}"
72
+ success "Installed zsh completion to ${completion_dir}/_${APP_NAME}"
73
+ fi
74
+
75
+ # Create shorthand symlink 'depl'
76
+ (cd "$INSTALL_DIR" && ln -sf "$APP_NAME" depl)
77
+ success "Installed ${APP_NAME} to ${install_path}"
78
+ case ":${PATH}:" in
79
+ *":${INSTALL_DIR}:"*) ;;
80
+ *)
81
+ warn "${INSTALL_DIR} is not on your PATH. Add this to your ~/.zshrc:"
82
+ echo ""
83
+ echo " export PATH=\"$INSTALL_DIR:\$PATH\""
84
+ echo ""
85
+ echo "Then reload your shell:"
86
+ echo " source ~/.zshrc"
87
+ ;;
88
+ esac
89
+
90
+ # Check if man page directory is in MANPATH
91
+ man_dir="${HOME}/.local/share/man"
92
+ if [[ -f "${man_dir}/man1/${APP_NAME}.1" ]] && [[ ":${MANPATH}:" != *":${man_dir}:"* ]]; then
93
+ warn "Man page installed but ${man_dir} is not in MANPATH."
94
+ echo "Add this to your ~/.zshrc to access man pages:"
95
+ echo ""
96
+ echo " export MANPATH=\"${man_dir}:\$MANPATH\""
97
+ echo ""
98
+ fi
99
+
100
+ # Check if completion directory is in fpath
101
+ completion_dir="${HOME}/.local/share/zsh/site-functions"
102
+ if [[ -f "${completion_dir}/_${APP_NAME}" ]]; then
103
+ echo "Zsh completion installed. To enable it, add this to your ~/.zshrc:"
104
+ echo ""
105
+ echo " fpath=(\"${completion_dir}\" \$fpath)"
106
+ echo " autoload -Uz compinit && compinit"
107
+ echo ""
108
+ echo "Then restart your shell or run: source ~/.zshrc"
109
+ fi
110
+ echo ""
111
+ info "Test the installation:"
112
+ echo " ${APP_NAME} --dry-run list"
113
+ echo " man ${APP_NAME}"
114
+ }
115
+ main "$@"
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deploio-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Renuo AG
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: thor
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.3'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.3'
26
+ - !ruby/object:Gem::Dependency
27
+ name: tty-table
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.12'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.12'
40
+ description: A Ruby CLI that provides an interface for managing Deploio applications.
41
+ email:
42
+ - info@renuo.ch
43
+ executables:
44
+ - deploio
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".ruby-version"
49
+ - README.md
50
+ - Rakefile
51
+ - bin/deploio
52
+ - deploio-cli.gemspec
53
+ - lib/deploio.rb
54
+ - lib/deploio/app_ref.rb
55
+ - lib/deploio/app_resolver.rb
56
+ - lib/deploio/cli.rb
57
+ - lib/deploio/commands/apps.rb
58
+ - lib/deploio/commands/auth.rb
59
+ - lib/deploio/commands/orgs.rb
60
+ - lib/deploio/completion_generator.rb
61
+ - lib/deploio/nctl_client.rb
62
+ - lib/deploio/output.rb
63
+ - lib/deploio/shared_options.rb
64
+ - lib/deploio/templates/completion.zsh.erb
65
+ - lib/deploio/utils.rb
66
+ - lib/deploio/version.rb
67
+ - setup
68
+ homepage: https://github.com/renuo/deploio-cli
69
+ licenses:
70
+ - MIT
71
+ metadata:
72
+ homepage_uri: https://github.com/renuo/deploio-cli
73
+ source_code_uri: https://github.com/renuo/deploio-cli
74
+ changelog_uri: https://github.com/renuo/deploio-cli/blob/main/CHANGELOG.md
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 4.0.3
90
+ specification_version: 4
91
+ summary: CLI for Deploio
92
+ test_files: []