setup_script_generator 0.2.8 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 601c0cdc2725d9bb4557d9ae22d51b8ecd3fd4fb3aa282ebfe7d42bea5d871db
4
- data.tar.gz: 3442120d303cdb1427df26b3d8cc48e993121695074f2ea650f0689fad3d248d
3
+ metadata.gz: 414b35d4fd8fcc955edbd48c07adf9cb6a58b1268ab535a4b19793efc95ddb6c
4
+ data.tar.gz: 6fb7d8ca9db2ccdeb09a977e8aaf29ff61621c60541ea50913511bd6cfcad3de
5
5
  SHA512:
6
- metadata.gz: e5539f8aa1b762dd23db56f0892bc9dae2c0fc70bb1361c4b85d06d1f88b7df971b8c72883ffc3730a27d9b4c0f5242369223ac2334e74175181d05e3bc1cccc
7
- data.tar.gz: d3b68a13f76ee2e214d7492aea1f807f9634146079c46f855aa5b0ee123c25a101b82392352877aaca3e0847c135c68687f2cfbd05e704dedc219e17136d753e
6
+ metadata.gz: '0962104490d7df6439779e62e9dd7e417d087d34ec4cd52857075bcfe6fd0ab0b337178e4354ae8c9fdad93fcdabcf7df999c676de6fe713728f499393034f21'
7
+ data.tar.gz: 9fde5cadf9262ff46f34e2a479d8a9e02106a0f857fb18c84f5046072da15bdd9c7d726a815be46e563a4cc29a8ef1473d9201b9efd035e4fecf939e8e0caa6e
data/bin/setup CHANGED
@@ -17,7 +17,7 @@ provision-project() {
17
17
 
18
18
  ### DON'T MODIFY ANYTHING BELOW THIS LINE! #####################################
19
19
 
20
- # This setup script was generated with setup_script_generator 0.2.3,
20
+ # This setup script was generated with setup_script_generator 0.4.1,
21
21
  # available on RubyGems.
22
22
  #
23
23
  # To regenerate this section, install the gem and run:
@@ -186,24 +186,31 @@ setup() {
186
186
 
187
187
  # --- RUBY ---------------------------------------------------------------------
188
188
 
189
+ REQUIRED_RUBY_VERSION=
190
+
189
191
  provision-ruby() {
190
192
  USE_BUNDLER_1=0
191
193
 
192
194
  if [[ -f .tool-versions ]]; then
193
- REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | sed -Ee 's/^ruby (.+)$/\1/')
195
+ REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | head -n 1 | sed -Ee 's/^ruby (.+)$/\1/')
194
196
  elif [[ -f .ruby-version ]]; then
195
- REQUIRED_RUBY_VERSION=$(cat .ruby-version)
196
- else
197
- error "You don't seem to have a Ruby version set in your project."
197
+ REQUIRED_RUBY_VERSION=$(cat .ruby-version | head -n 1 | sed -Ee 's/^ruby-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)$/\1/')
198
+ fi
199
+
200
+ if [[ -z $REQUIRED_RUBY_VERSION ]]; then
201
+ error "Could not determine required Ruby version for this project."
198
202
  print-wrapped "\
199
- You'll need to create either a .tool-versions file or .ruby-version file in your
200
- project before you can run this script."
203
+ Your project needs to include either a valid .tool-versions file with a 'ruby'
204
+ line or a valid .ruby-version file."
201
205
  exit 1
202
206
  fi
203
207
 
204
208
  ensure-ruby-development-libraries-installed
205
209
  ensure-ruby-installed
206
- ensure-project-ruby-dependencies-installed
210
+
211
+ if [[ -f Gemfile ]]; then
212
+ ensure-project-ruby-dependencies-installed
213
+ fi
207
214
  }
208
215
 
209
216
  ensure-ruby-development-libraries-installed() {
@@ -237,10 +244,9 @@ ensure-ruby-installed() {
237
244
  fi
238
245
  fi
239
246
  elif has-executable rvm; then
240
- if ! (rvm list | grep $required_ruby_version'\>' &>/dev/null); then
241
- banner "Installing Ruby $required_ruby_version with rvm"
242
- rvm install $required_ruby_version
243
- rvm use $required_ruby_version
247
+ if ! (rvm list | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
248
+ banner "Installing Ruby $REQUIRED_RUBY_VERSION with rvm"
249
+ rvm install $REQUIRED_RUBY_VERSION
244
250
  fi
245
251
  else
246
252
  error "You don't seem to have a Ruby manager installed."
@@ -261,8 +267,8 @@ has-bundler() {
261
267
  ensure-project-ruby-dependencies-installed() {
262
268
  banner 'Installing Ruby dependencies'
263
269
 
264
- if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || [[ $(bundle -v) =~ '^1\.' ]]); then
265
- gem install bundler -v '~> 1.0'
270
+ if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
271
+ gem install bundler:'~> 1.0'
266
272
  elif ! has-bundler; then
267
273
  gem install bundler
268
274
  fi
@@ -272,10 +278,6 @@ ensure-project-ruby-dependencies-installed() {
272
278
 
273
279
  run-provisions() {
274
280
  provision-ruby
275
-
276
- if type provision-project &>/dev/null; then
277
- provision-project
278
- fi
279
281
  }
280
282
 
281
283
  # --- FIN ----------------------------------------------------------------------
@@ -1,27 +1,19 @@
1
- read-required-node-version-for-asdf() {
2
- (cat .tool-versions | grep '^nodejs ' | sed -Ee 's/^nodejs (.+)$/\1/') || \
3
- echo ''
4
- }
1
+ REQUIRED_NODE_VERSION=
5
2
 
6
3
  provision-node() {
7
4
  if [[ -f .tool-versions ]]; then
8
- REQUIRED_NODE_VERSION=$(read-required-node-version-for-asdf)
9
-
10
- if [[ -z $REQUIRED_NODE_VERSION ]]; then
11
- error "Could not read required Node version."
12
- print-wrapped "\
13
- Please check that .tool-versions is correct before re-running this script."
14
- exit 1
15
- fi
5
+ REQUIRED_NODE_VERSION=$(cat .tool-versions | grep '^nodejs ' | sed -Ee 's/^nodejs (.+)$/\1/')
16
6
  elif [[ -f .node-version ]]; then
17
7
  REQUIRED_NODE_VERSION=$(cat .node-version)
18
8
  elif [[ -f .nvmrc ]]; then
19
9
  REQUIRED_NODE_VERSION=$(cat .nvmrc)
20
- else
21
- error "You don't seem to have a Node version set in your project."
10
+ fi
11
+
12
+ if [[ -z $REQUIRED_NODE_VERSION ]]; then
13
+ error "Could not determine required Node version for this project."
22
14
  print-wrapped "\
23
- You'll need to create either a .tool-versions file or .nvmrc file in your
24
- project before you can run this script."
15
+ Your project needs to include either a valid .tool-versions file with a 'nodejs'
16
+ line or a valid .node-version or .nvimrc file."
25
17
  exit 1
26
18
  fi
27
19
 
@@ -1,21 +1,28 @@
1
+ REQUIRED_RUBY_VERSION=
2
+
1
3
  provision-ruby() {
2
4
  USE_BUNDLER_1=0
3
5
 
4
6
  if [[ -f .tool-versions ]]; then
5
- REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | sed -Ee 's/^ruby (.+)$/\1/')
7
+ REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | head -n 1 | sed -Ee 's/^ruby (.+)$/\1/')
6
8
  elif [[ -f .ruby-version ]]; then
7
- REQUIRED_RUBY_VERSION=$(cat .ruby-version)
8
- else
9
- error "You don't seem to have a Ruby version set in your project."
9
+ REQUIRED_RUBY_VERSION=$(cat .ruby-version | head -n 1 | sed -Ee 's/^ruby-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)$/\1/')
10
+ fi
11
+
12
+ if [[ -z $REQUIRED_RUBY_VERSION ]]; then
13
+ error "Could not determine required Ruby version for this project."
10
14
  print-wrapped "\
11
- You'll need to create either a .tool-versions file or .ruby-version file in your
12
- project before you can run this script."
15
+ Your project needs to include either a valid .tool-versions file with a 'ruby'
16
+ line or a valid .ruby-version file."
13
17
  exit 1
14
18
  fi
15
19
 
16
20
  ensure-ruby-development-libraries-installed
17
21
  ensure-ruby-installed
18
- ensure-project-ruby-dependencies-installed
22
+
23
+ if [[ -f Gemfile ]]; then
24
+ ensure-project-ruby-dependencies-installed
25
+ fi
19
26
  }
20
27
 
21
28
  ensure-ruby-development-libraries-installed() {
@@ -49,10 +56,9 @@ ensure-ruby-installed() {
49
56
  fi
50
57
  fi
51
58
  elif has-executable rvm; then
52
- if ! (rvm list | grep $required_ruby_version'\>' &>/dev/null); then
53
- banner "Installing Ruby $required_ruby_version with rvm"
54
- rvm install $required_ruby_version
55
- rvm use $required_ruby_version
59
+ if ! (rvm list | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
60
+ banner "Installing Ruby $REQUIRED_RUBY_VERSION with rvm"
61
+ rvm install $REQUIRED_RUBY_VERSION
56
62
  fi
57
63
  else
58
64
  error "You don't seem to have a Ruby manager installed."
@@ -74,7 +80,7 @@ ensure-project-ruby-dependencies-installed() {
74
80
  banner 'Installing Ruby dependencies'
75
81
 
76
82
  if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
77
- gem install bundler -v '~> 1.0'
83
+ gem install bundler:'~> 1.0'
78
84
  elif ! has-bundler; then
79
85
  gem install bundler
80
86
  fi
@@ -1,3 +1,3 @@
1
1
  module SetupScriptGenerator
2
- VERSION = "0.2.8".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
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.8
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Winkler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2021-04-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: