-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·89 lines (79 loc) · 3.48 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·89 lines (79 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -euo pipefail
# -----------------------------------------------------------------------------
# Setup Ruby Virtual Environment
# Installs the project Ruby version via rbenv and activates it locally.
# -----------------------------------------------------------------------------
setup_ruby() {
echo -e
echo "INFO: Install Project Version of Ruby with Rbenv"
project_ruby_version="$(cat .ruby-version)"
echo "INFO: Project Ruby Version: $project_ruby_version"
rbenv versions | grep -q "$project_ruby_version" || rbenv install "$project_ruby_version" || exit 1
echo -e
echo "INFO: Activating Virtual Environment"
rbenv local "$project_ruby_version" || exit 1
export PATH="$PWD/.bin:$PATH"
}
# -----------------------------------------------------------------------------
# Install Tools (Homebrew)
# Installs required CLI tools via Homebrew, skipping any already present.
# -----------------------------------------------------------------------------
install_tools() {
echo -e
echo "INFO: Installing Tools (Homebrew)"
if command -v actionlint &>/dev/null; then
echo "INFO: actionlint already installed ($(actionlint --version 2>/dev/null || echo 'version unknown'))"
else
brew install actionlint
fi
if command -v shellcheck &>/dev/null; then
echo "INFO: shellcheck already installed ($(shellcheck --version | grep version: || echo 'version unknown'))"
else
brew install shellcheck
fi
}
# -----------------------------------------------------------------------------
# Install Ruby Libraries (Gemfile)
# Configures bundler and installs all project gems into .vendor/bundle.
# -----------------------------------------------------------------------------
install_libraries() {
echo -e
echo "INFO: Installing Libraries (Gemfile)"
bundle config set --local path '.vendor/bundle' # stores gems in ./vendor
bundle config set --local bin '.bin' # set binstubs directory
bundle install # install gems
bundle binstubs --all # generate binstubs for all gems
export PATH="$PWD/.bin:$PATH"
echo "INFO: Ruby Version: $(ruby -v)"
echo "INFO: Bundler Version: $(bundle -v)"
echo 'RUN: export PATH="$PWD/.bin:$PATH"'
}
# -----------------------------------------------------------------------------
# Shopify CLI Environment Setup
# Prompts for store domain and theme access token, exports them for the session.
# -----------------------------------------------------------------------------
setup_shopify_env() {
echo -e
echo "INFO: Shopify CLI Environment Setup"
echo "These values are used by 'shopify theme pull/push' and rake shopify tasks."
echo "Values are exported for this session only — not written to any file."
echo -e
read -rp "Enter your Shopify store domain (e.g. mystore.myshopify.com): " shopify_store
read -rsp "Enter your Shopify Theme Access token (from Shopify Admin > Apps > Theme Access): " shopify_token
echo -e
if [[ -n "$shopify_store" && -n "$shopify_token" ]]; then
export SHOPIFY_FLAG_STORE="$shopify_store"
export SHOPIFY_CLI_THEME_TOKEN="$shopify_token"
echo "INFO: Shopify env vars exported for this session."
else
echo "WARN: Skipping Shopify env setup — one or both values were blank."
fi
}
# -----------------------------------------------------------------------------
# Run
# -----------------------------------------------------------------------------
setup_ruby
install_tools
install_libraries
# setup_shopify_env