setup_script_generator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/setup +46 -91
- data/lib/setup_script_generator/templates/non-customizable-section.sh.erb +24 -26
- data/lib/setup_script_generator/templates/provisions/node.sh +18 -16
- data/lib/setup_script_generator/templates/provisions/ruby.sh +31 -19
- data/lib/setup_script_generator/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed17c40212f0857cadb91986f31f099511dd1cf6245db95581948ce267be3a6c
|
4
|
+
data.tar.gz: f867c2449067ceed2434b85214f038bc4b037a2fa351daf66917f7302ed408ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a44e7899c89b1dd04b8f1892b0593f97614d550bb34e2e6ee6b62cabca6e97b36e3013c9aec203e0c1794bf4b6679aa26279c45502b24cd7c1b68a02bd097bf
|
7
|
+
data.tar.gz: 602dedb74fb0fe247409905463325823e2b4f4bfc3d2898acf1a4d85abe7e7450844d6931eda9b19685a95d6683c176c57bdc81a6640cf0c2cc378a0d7f7e9d8
|
data/Gemfile.lock
CHANGED
data/bin/setup
CHANGED
@@ -2,9 +2,32 @@
|
|
2
2
|
|
3
3
|
set -euo pipefail
|
4
4
|
|
5
|
-
|
5
|
+
### PROJECT SETUP ##############################################################
|
6
|
+
|
7
|
+
# Feel free to add whatever functions or variables you want to add in this
|
8
|
+
# section. You may also delete this section altogether if your project doesn't
|
9
|
+
# need a custom setup.
|
10
|
+
|
11
|
+
provision-project() {
|
12
|
+
# This function gets called automatically below.
|
13
|
+
# Feel free to remove these comments.
|
14
|
+
# If your project needs custom setup, then place that here.
|
15
|
+
true
|
16
|
+
}
|
17
|
+
|
18
|
+
### DON'T MODIFY ANYTHING BELOW THIS LINE! #####################################
|
19
|
+
|
20
|
+
# This setup script was generated with setup_script_generator 0.2.1,
|
21
|
+
# available on RubyGems.
|
22
|
+
#
|
23
|
+
# To regenerate this section, install the gem and run:
|
24
|
+
#
|
25
|
+
# generate-setup
|
26
|
+
#
|
6
27
|
|
7
|
-
|
28
|
+
# --- SETUP --------------------------------------------------------------------
|
29
|
+
|
30
|
+
something_already_printed=0
|
8
31
|
|
9
32
|
determine-platform() {
|
10
33
|
local uname=$(uname)
|
@@ -111,7 +134,7 @@ install() {
|
|
111
134
|
sudo apt-get install -y "$package"
|
112
135
|
fi
|
113
136
|
elif has-executable yum; then
|
114
|
-
package="${
|
137
|
+
package="${rpm_package:-$default_package}"
|
115
138
|
|
116
139
|
if [[ -n $package ]]; then
|
117
140
|
sudo yum install -y "$package"
|
@@ -125,108 +148,40 @@ install() {
|
|
125
148
|
check-for-package-manager() {
|
126
149
|
local platform=$(determine-platform)
|
127
150
|
|
128
|
-
if [[ $platform == "linux" ]]; then
|
129
|
-
|
130
|
-
|
131
|
-
print-wrapped "\
|
132
|
-
The setup script assumes you're using Debian or a Debian-derived flavor of
|
133
|
-
Linux (i.e. something with Apt). If this is not the case, then we would
|
134
|
-
gladly take a PR fixing this!"
|
135
|
-
exit 1
|
136
|
-
fi
|
137
|
-
else
|
138
|
-
if ! has-executable brew; then
|
139
|
-
error "You don't seem to have Homebrew installed."
|
140
|
-
print-wrapped "\
|
141
|
-
Follow the instructions here to do this:
|
142
|
-
|
143
|
-
http://brew.sh
|
144
|
-
|
145
|
-
Then re-run this script."
|
146
|
-
exit 1
|
147
|
-
fi
|
148
|
-
|
149
|
-
# TODO: Check that OS X Command Line Tools are installed?
|
150
|
-
fi
|
151
|
-
}
|
152
|
-
|
153
|
-
install-development-libraries() {
|
154
|
-
install rpm=zlib-devel
|
155
|
-
}
|
151
|
+
if [[ $platform == "linux" ]] && ! has-executable apt-get && ! has-executable yum; then
|
152
|
+
# TODO: Check if build-essential is installed on Debian?
|
153
|
+
# TODO: Check if 'Development Tools' group is installed on RedHat?
|
156
154
|
|
157
|
-
|
158
|
-
if [[ -f .ruby-version ]]; then
|
159
|
-
REQUIRED_RUBY_VERSION=$(cat .ruby-version)
|
160
|
-
else
|
161
|
-
error "You don't seem to have a Ruby version set in your project."
|
155
|
+
error "You don't seem to have a package manager installed."
|
162
156
|
print-wrapped "\
|
163
|
-
|
164
|
-
this
|
165
|
-
|
157
|
+
This setup script assumes you're using a flavor of Linux derived from Debian or
|
158
|
+
RedHat (i.e. something with Apt or Yum). If this is not the case, then we would
|
159
|
+
gladly take a PR fixing this!"
|
166
160
|
exit 1
|
167
|
-
|
168
|
-
|
169
|
-
install-ruby-development-library
|
170
|
-
ensure-ruby-installed
|
171
|
-
install-ruby-dependencies
|
172
|
-
}
|
173
|
-
|
174
|
-
install-ruby-development-library() {
|
175
|
-
install apt=ruby-dev rpm=ruby-devel
|
176
|
-
}
|
161
|
+
elif [[ $platform == "mac" ]] && ! has-executable brew; then
|
162
|
+
# TODO: Check that OS X Command Line Tools are installed?
|
177
163
|
|
178
|
-
|
179
|
-
if has-executable rbenv; then
|
180
|
-
if ! (rbenv versions | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
|
181
|
-
banner "Installing Ruby $REQUIRED_RUBY_VERSION with rbenv"
|
182
|
-
rbenv install --skip-existing "$REQUIRED_RUBY_VERSION"
|
183
|
-
fi
|
184
|
-
elif has-executable chruby-exec; then
|
185
|
-
PREFIX='' source /usr/local/share/chruby/chruby.sh
|
186
|
-
if ! (chruby '' | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
|
187
|
-
if has-executable install-ruby; then
|
188
|
-
banner "Installing Ruby $REQUIRED_RUBY_VERSION with install-ruby"
|
189
|
-
install-ruby "$REQUIRED_RUBY_VERSION"
|
190
|
-
else
|
191
|
-
error "Please install Ruby $REQUIRED_RUBY_VERSION"
|
192
|
-
fi
|
193
|
-
fi
|
194
|
-
elif has-executable rvm; then
|
195
|
-
if ! (rvm list | grep $required_ruby_version'\>' &>/dev/null); then
|
196
|
-
banner "Installing Ruby $required_ruby_version with rvm"
|
197
|
-
rvm install $required_ruby_version
|
198
|
-
rvm use $required_ruby_version
|
199
|
-
fi
|
200
|
-
else
|
201
|
-
error "You don't seem to have a Ruby manager installed."
|
164
|
+
error "You don't seem to have Homebrew installed."
|
202
165
|
print-wrapped "\
|
203
|
-
|
204
|
-
|
205
|
-
https://github.com/rbenv/rbenv#installation
|
206
|
-
|
207
|
-
Make sure to follow the instructions to configure your shell so that rbenv is
|
208
|
-
automatically loaded.
|
209
|
-
|
210
|
-
When you're done, open up a new terminal tab and re-run this script."
|
166
|
+
Visit <https://brew.sh> and follow the instructions there, then re-run this
|
167
|
+
script."
|
211
168
|
exit 1
|
212
169
|
fi
|
213
170
|
}
|
214
171
|
|
215
|
-
install-
|
216
|
-
|
217
|
-
gem install bundler -v '~> 1.0' --conservative
|
218
|
-
bundle check || bundle install
|
219
|
-
}
|
220
|
-
|
221
|
-
run-provisions() {
|
222
|
-
provision-ruby
|
172
|
+
install-development-libraries() {
|
173
|
+
install rpm=zlib-devel
|
223
174
|
}
|
224
175
|
|
225
176
|
setup() {
|
177
|
+
cd "$(dirname "$(dirname "$0")")"
|
226
178
|
check-for-package-manager
|
227
179
|
install-development-libraries
|
228
|
-
|
229
|
-
success "
|
180
|
+
provision-project
|
181
|
+
success "Setup complete!"
|
230
182
|
}
|
231
183
|
|
184
|
+
|
185
|
+
# --- FIN ----------------------------------------------------------------------
|
186
|
+
|
232
187
|
setup
|
@@ -6,10 +6,10 @@
|
|
6
6
|
# To regenerate this section, install the gem and run:
|
7
7
|
#
|
8
8
|
<% if provisions.any? -%>
|
9
|
-
# generate-setup <%= provisions.map { |p| "-p #{p.name}" }.join(" ")
|
10
|
-
<% else
|
9
|
+
# generate-setup <%= provisions.map { |p| "-p #{p.name}" }.join(" ") %>
|
10
|
+
<% else -%>
|
11
11
|
# generate-setup
|
12
|
-
<% end
|
12
|
+
<% end -%>
|
13
13
|
#
|
14
14
|
|
15
15
|
# --- SETUP --------------------------------------------------------------------
|
@@ -121,7 +121,7 @@ install() {
|
|
121
121
|
sudo apt-get install -y "$package"
|
122
122
|
fi
|
123
123
|
elif has-executable yum; then
|
124
|
-
package="${
|
124
|
+
package="${rpm_package:-$default_package}"
|
125
125
|
|
126
126
|
if [[ -n $package ]]; then
|
127
127
|
sudo yum install -y "$package"
|
@@ -135,28 +135,24 @@ install() {
|
|
135
135
|
check-for-package-manager() {
|
136
136
|
local platform=$(determine-platform)
|
137
137
|
|
138
|
-
if [[ $platform == "linux" ]]; then
|
139
|
-
|
140
|
-
|
141
|
-
print-wrapped "\
|
142
|
-
The setup script assumes you're using Debian or a Debian-derived flavor of
|
143
|
-
Linux (i.e. something with Apt). If this is not the case, then we would
|
144
|
-
gladly take a PR fixing this!"
|
145
|
-
exit 1
|
146
|
-
fi
|
147
|
-
else
|
148
|
-
if ! has-executable brew; then
|
149
|
-
error "You don't seem to have Homebrew installed."
|
150
|
-
print-wrapped "\
|
151
|
-
Follow the instructions here to do this:
|
152
|
-
|
153
|
-
http://brew.sh
|
154
|
-
|
155
|
-
Then re-run this script."
|
156
|
-
exit 1
|
157
|
-
fi
|
138
|
+
if [[ $platform == "linux" ]] && ! has-executable apt-get && ! has-executable yum; then
|
139
|
+
# TODO: Check if build-essential is installed on Debian?
|
140
|
+
# TODO: Check if 'Development Tools' group is installed on RedHat?
|
158
141
|
|
142
|
+
error "You don't seem to have a package manager installed."
|
143
|
+
print-wrapped "\
|
144
|
+
This setup script assumes you're using a flavor of Linux derived from Debian or
|
145
|
+
RedHat (i.e. something with Apt or Yum). If this is not the case, then we would
|
146
|
+
gladly take a PR fixing this!"
|
147
|
+
exit 1
|
148
|
+
elif [[ $platform == "mac" ]] && ! has-executable brew; then
|
159
149
|
# TODO: Check that OS X Command Line Tools are installed?
|
150
|
+
|
151
|
+
error "You don't seem to have Homebrew installed."
|
152
|
+
print-wrapped "\
|
153
|
+
Visit <https://brew.sh> and follow the instructions there, then re-run this
|
154
|
+
script."
|
155
|
+
exit 1
|
160
156
|
fi
|
161
157
|
}
|
162
158
|
|
@@ -172,8 +168,10 @@ setup() {
|
|
172
168
|
<% if provisions.any? -%>
|
173
169
|
run-provisions
|
174
170
|
<% end -%>
|
175
|
-
provision-project
|
176
|
-
|
171
|
+
if type provision-project &>/dev/null; then
|
172
|
+
provision-project
|
173
|
+
fi
|
174
|
+
success "Setup complete!"
|
177
175
|
}
|
178
176
|
|
179
177
|
<% provisions.each do |provision| -%>
|
@@ -1,23 +1,29 @@
|
|
1
1
|
provision-node() {
|
2
|
-
if [[ -f .
|
2
|
+
if [[ -f .tool-versions ]]; then
|
3
|
+
REQUIRED_NODE_VERSION=$(cat .tool-versions | grep '^nodejs ' | sed -Ee 's/^nodejs (.+)$/\1/')
|
4
|
+
elif [[ -f .node-version ]]; then
|
3
5
|
REQUIRED_NODE_VERSION=$(cat .node-version)
|
4
6
|
elif [[ -f .nvmrc ]]; then
|
5
7
|
REQUIRED_NODE_VERSION=$(cat .nvmrc)
|
6
8
|
else
|
7
9
|
error "You don't seem to have a Node version set in your project."
|
8
10
|
print-wrapped "\
|
9
|
-
You'll need to create a .
|
10
|
-
can run this script.
|
11
|
-
"
|
11
|
+
You'll need to create either a .tool-versions file or .nvmrc file in your
|
12
|
+
project before you can run this script."
|
12
13
|
exit 1
|
13
14
|
fi
|
14
15
|
|
15
16
|
ensure-node-installed
|
16
|
-
|
17
|
+
ensure-project-node-dependencies-installed
|
17
18
|
}
|
18
19
|
|
19
20
|
ensure-node-installed() {
|
20
|
-
if has-executable
|
21
|
+
if has-executable asdf; then
|
22
|
+
if ! (asdf current nodejs | grep $REQUIRED_NODE_VERSION'\>' &>/dev/null); then
|
23
|
+
banner "Installing Node $REQUIRED_NODE_VERSION with asdf"
|
24
|
+
asdf install nodejs $REQUIRED_NODE_VERSION
|
25
|
+
fi
|
26
|
+
elif has-executable nodenv; then
|
21
27
|
if ! (nodenv versions | grep $REQUIRED_NODE_VERSION'\>' &>/dev/null); then
|
22
28
|
banner "Installing Node $REQUIRED_NODE_VERSION with nodenv"
|
23
29
|
nodenv install --skip-existing "$REQUIRED_NODE_VERSION"
|
@@ -31,19 +37,16 @@ ensure-node-installed() {
|
|
31
37
|
else
|
32
38
|
error "You don't seem to have a Node manager installed."
|
33
39
|
print-wrapped "\
|
34
|
-
We recommend using
|
35
|
-
|
36
|
-
https://github.com/nodenv/nodenv#installation
|
40
|
+
We recommend using asdf. You can find instructions to install it here:
|
37
41
|
|
38
|
-
|
39
|
-
automatically loaded.
|
42
|
+
https://asdf-vm.com
|
40
43
|
|
41
|
-
When you're done,
|
44
|
+
When you're done, close and re-open this terminal tab and re-run this script."
|
42
45
|
exit 1
|
43
46
|
fi
|
44
47
|
}
|
45
48
|
|
46
|
-
|
49
|
+
ensure-project-node-dependencies-installed() {
|
47
50
|
banner 'Installing Node dependencies'
|
48
51
|
|
49
52
|
if [[ -f package-lock.json ]]; then
|
@@ -53,9 +56,8 @@ install-node-dependencies() {
|
|
53
56
|
else
|
54
57
|
error "Sorry, I'm not sure how to install your dependencies."
|
55
58
|
print-wrapped "\
|
56
|
-
|
57
|
-
|
58
|
-
"
|
59
|
+
Are you missing a package.json? Have you run 'npm install' or 'yarn install'
|
60
|
+
yet?"
|
59
61
|
exit 1
|
60
62
|
fi
|
61
63
|
}
|
@@ -1,26 +1,37 @@
|
|
1
1
|
provision-ruby() {
|
2
|
-
if [[ -f .
|
2
|
+
if [[ -f .tool-versions ]]; then
|
3
|
+
REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | sed -Ee 's/^ruby (.+)$/\1/')
|
4
|
+
elif [[ -f .ruby-version ]]; then
|
3
5
|
REQUIRED_RUBY_VERSION=$(cat .ruby-version)
|
4
6
|
else
|
5
7
|
error "You don't seem to have a Ruby version set in your project."
|
6
8
|
print-wrapped "\
|
7
|
-
You'll need to create a .ruby-version file in your
|
8
|
-
this script.
|
9
|
-
"
|
9
|
+
You'll need to create either a .tool-versions file or .ruby-version file in your
|
10
|
+
project before you can run this script."
|
10
11
|
exit 1
|
11
12
|
fi
|
12
13
|
|
13
|
-
|
14
|
+
ensure-ruby-development-libraries-installed
|
14
15
|
ensure-ruby-installed
|
15
|
-
|
16
|
+
ensure-project-ruby-dependencies-installed
|
16
17
|
}
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
ensure-ruby-development-libraries-installed() {
|
20
|
+
local platform=$(determine-platform)
|
21
|
+
|
22
|
+
if [[ $platform == "linux" ]]; then
|
23
|
+
banner "Installing Ruby development libraries"
|
24
|
+
install apt=ruby-dev rpm=ruby-devel
|
25
|
+
fi
|
20
26
|
}
|
21
27
|
|
22
28
|
ensure-ruby-installed() {
|
23
|
-
if has-executable
|
29
|
+
if has-executable asdf; then
|
30
|
+
if ! (asdf current ruby | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
|
31
|
+
banner "Installing Ruby $REQUIRED_RUBY_VERSION with asdf"
|
32
|
+
asdf install ruby $REQUIRED_RUBY_VERSION
|
33
|
+
fi
|
34
|
+
elif has-executable rbenv; then
|
24
35
|
if ! (rbenv versions | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
|
25
36
|
banner "Installing Ruby $REQUIRED_RUBY_VERSION with rbenv"
|
26
37
|
rbenv install --skip-existing "$REQUIRED_RUBY_VERSION"
|
@@ -29,10 +40,10 @@ ensure-ruby-installed() {
|
|
29
40
|
PREFIX='' source /usr/local/share/chruby/chruby.sh
|
30
41
|
if ! (chruby '' | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
|
31
42
|
if has-executable install-ruby; then
|
32
|
-
|
43
|
+
banner "Installing Ruby $REQUIRED_RUBY_VERSION with install-ruby"
|
33
44
|
install-ruby "$REQUIRED_RUBY_VERSION"
|
34
45
|
else
|
35
|
-
error "Please install Ruby $REQUIRED_RUBY_VERSION"
|
46
|
+
error "Please use chruby to install Ruby $REQUIRED_RUBY_VERSION!"
|
36
47
|
fi
|
37
48
|
fi
|
38
49
|
elif has-executable rvm; then
|
@@ -44,20 +55,21 @@ ensure-ruby-installed() {
|
|
44
55
|
else
|
45
56
|
error "You don't seem to have a Ruby manager installed."
|
46
57
|
print-wrapped "\
|
47
|
-
We recommend using
|
48
|
-
|
49
|
-
https://github.com/rbenv/rbenv#installation
|
58
|
+
We recommend using asdf. You can find instructions to install it here:
|
50
59
|
|
51
|
-
|
52
|
-
automatically loaded.
|
60
|
+
https://asdf-vm.com
|
53
61
|
|
54
|
-
When you're done,
|
62
|
+
When you're done, close and re-open this terminal tab and re-run this script."
|
55
63
|
exit 1
|
56
64
|
fi
|
57
65
|
}
|
58
66
|
|
59
|
-
|
67
|
+
ensure-project-ruby-dependencies-installed() {
|
60
68
|
banner 'Installing Ruby dependencies'
|
61
|
-
|
69
|
+
|
70
|
+
if [[ $USE_BUNDLER_1 ]]; then
|
71
|
+
gem install bundler -v '~> 1.0' --conservative
|
72
|
+
fi
|
73
|
+
|
62
74
|
bundle check || bundle install
|
63
75
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: setup_script_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elliot Winkler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- elliot.winkler@gmail.com
|
44
44
|
executables:
|
@@ -76,7 +76,7 @@ metadata:
|
|
76
76
|
homepage_uri: https://github.com/mcmire/setup_script_generator
|
77
77
|
source_code_uri: https://github.com/mcmire/setup_script_generator
|
78
78
|
changelog_uri: https://github.com/mcmire/setup_script_generator/tree/master/CHANGELOG.md
|
79
|
-
post_install_message:
|
79
|
+
post_install_message:
|
80
80
|
rdoc_options: []
|
81
81
|
require_paths:
|
82
82
|
- lib
|
@@ -91,8 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
95
|
-
signing_key:
|
94
|
+
rubygems_version: 3.1.2
|
95
|
+
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Generate setup scripts for your projects.
|
98
98
|
test_files: []
|