setup_script_generator 0.2.7 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0ac6d154f9e8b45ac914372c53379e9c95397e931fe17a940b00e6a5b855196
4
- data.tar.gz: f09643e67bfe4caab8286c17b55681f80cf89e826af60278da268937965b883a
3
+ metadata.gz: 5fd5e83995916e6bf77222292688adcd991ad378dffe7fd9ec0e6a578239f03c
4
+ data.tar.gz: 0465dd858b92c3541770b3e2bf545be75d0fad94ba7edb31cce1884c4f04cbc9
5
5
  SHA512:
6
- metadata.gz: 30c6402cf80d7412d8089e24d0770644c4148698b590d9c7cab98c70bd8390adb8c474eb38f24efa82e56b16088232f91ce7ceaf9338ead30e72c6a0934e9aa1
7
- data.tar.gz: 3b33de5999e65b71ffe9e0ca6c8f82df4f03d035afc4a78b9744c4ec10a943ace2ae042f784bd3fb735f87022ed32e5009a8b2a4d8c587f6ad2be7bc6e21bf0e
6
+ metadata.gz: 3e61eab9c4e26823ce01571414712837241d3a7a81d0ff87bf456120b80545e131313597187325487336d5ea58b0e9c06a3d15164a627d18bcb8fd04e2737656
7
+ data.tar.gz: 9c567c47b33f8da7f7934a780a29efad0f03fc582609f86c06e8ff699a6d7d4e0a0e1a97411585b97ee3d4221b4345fa7be4fea03137dec84b41f44afea28ec0
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.0,
21
21
  # available on RubyGems.
22
22
  #
23
23
  # To regenerate this section, install the gem and run:
@@ -190,20 +190,25 @@ provision-ruby() {
190
190
  USE_BUNDLER_1=0
191
191
 
192
192
  if [[ -f .tool-versions ]]; then
193
- REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | sed -Ee 's/^ruby (.+)$/\1/')
193
+ REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | head -n 1 | sed -Ee 's/^ruby (.+)$/\1/')
194
194
  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."
195
+ REQUIRED_RUBY_VERSION=$(cat .ruby-version | head -n 1 | sed -Ee 's/^ruby-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)$/\1/')
196
+ fi
197
+
198
+ if [[ -z $REQUIRED_RUBY_VERSION ]]; then
199
+ error "Could not determine required Ruby version for this project."
198
200
  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."
201
+ Your project needs to include either a valid .tool-versions file with a 'ruby'
202
+ line or a valid .ruby-version file."
201
203
  exit 1
202
204
  fi
203
205
 
204
206
  ensure-ruby-development-libraries-installed
205
207
  ensure-ruby-installed
206
- ensure-project-ruby-dependencies-installed
208
+
209
+ if [[ -f Gemfile ]]; then
210
+ ensure-project-ruby-dependencies-installed
211
+ fi
207
212
  }
208
213
 
209
214
  ensure-ruby-development-libraries-installed() {
@@ -237,10 +242,9 @@ ensure-ruby-installed() {
237
242
  fi
238
243
  fi
239
244
  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
245
+ if ! (rvm list | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
246
+ banner "Installing Ruby $REQUIRED_RUBY_VERSION with rvm"
247
+ rvm install $REQUIRED_RUBY_VERSION
244
248
  fi
245
249
  else
246
250
  error "You don't seem to have a Ruby manager installed."
@@ -261,8 +265,8 @@ has-bundler() {
261
265
  ensure-project-ruby-dependencies-installed() {
262
266
  banner 'Installing Ruby dependencies'
263
267
 
264
- if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || [[ $(bundle -v) =~ '^1\.' ]]); then
265
- gem install bundler -v '~> 1.0'
268
+ if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
269
+ gem install bundler:'~> 1.0'
266
270
  elif ! has-bundler; then
267
271
  gem install bundler
268
272
  fi
@@ -272,10 +276,6 @@ ensure-project-ruby-dependencies-installed() {
272
276
 
273
277
  run-provisions() {
274
278
  provision-ruby
275
-
276
- if type provision-project &>/dev/null; then
277
- provision-project
278
- fi
279
279
  }
280
280
 
281
281
  # --- FIN ----------------------------------------------------------------------
@@ -5,11 +5,13 @@ provision-node() {
5
5
  REQUIRED_NODE_VERSION=$(cat .node-version)
6
6
  elif [[ -f .nvmrc ]]; then
7
7
  REQUIRED_NODE_VERSION=$(cat .nvmrc)
8
- else
9
- error "You don't seem to have a Node version set in your project."
8
+ fi
9
+
10
+ if [[ -z $REQUIRED_NODE_VERSION ]]; then
11
+ error "Could not determine required Node version for this project."
10
12
  print-wrapped "\
11
- You'll need to create either a .tool-versions file or .nvmrc file in your
12
- project before you can run this script."
13
+ Your project needs to include either a valid .tool-versions file with a 'nodejs'
14
+ line or a valid .node-version or .nvimrc file."
13
15
  exit 1
14
16
  fi
15
17
 
@@ -2,20 +2,25 @@ provision-ruby() {
2
2
  USE_BUNDLER_1=0
3
3
 
4
4
  if [[ -f .tool-versions ]]; then
5
- REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | sed -Ee 's/^ruby (.+)$/\1/')
5
+ REQUIRED_RUBY_VERSION=$(cat .tool-versions | grep '^ruby ' | head -n 1 | sed -Ee 's/^ruby (.+)$/\1/')
6
6
  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."
7
+ REQUIRED_RUBY_VERSION=$(cat .ruby-version | head -n 1 | sed -Ee 's/^ruby-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)$/\1/')
8
+ fi
9
+
10
+ if [[ -z $REQUIRED_RUBY_VERSION ]]; then
11
+ error "Could not determine required Ruby version for this project."
10
12
  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."
13
+ Your project needs to include either a valid .tool-versions file with a 'ruby'
14
+ line or a valid .ruby-version file."
13
15
  exit 1
14
16
  fi
15
17
 
16
18
  ensure-ruby-development-libraries-installed
17
19
  ensure-ruby-installed
18
- ensure-project-ruby-dependencies-installed
20
+
21
+ if [[ -f Gemfile ]]; then
22
+ ensure-project-ruby-dependencies-installed
23
+ fi
19
24
  }
20
25
 
21
26
  ensure-ruby-development-libraries-installed() {
@@ -49,10 +54,9 @@ ensure-ruby-installed() {
49
54
  fi
50
55
  fi
51
56
  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
57
+ if ! (rvm list | grep $REQUIRED_RUBY_VERSION'\>' &>/dev/null); then
58
+ banner "Installing Ruby $REQUIRED_RUBY_VERSION with rvm"
59
+ rvm install $REQUIRED_RUBY_VERSION
56
60
  fi
57
61
  else
58
62
  error "You don't seem to have a Ruby manager installed."
@@ -74,7 +78,7 @@ ensure-project-ruby-dependencies-installed() {
74
78
  banner 'Installing Ruby dependencies'
75
79
 
76
80
  if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
77
- gem install bundler -v '~> 1.0'
81
+ gem install bundler:'~> 1.0'
78
82
  elif ! has-bundler; then
79
83
  gem install bundler
80
84
  fi
@@ -1,3 +1,3 @@
1
1
  module SetupScriptGenerator
2
- VERSION = "0.2.7".freeze
2
+ VERSION = "0.4.0".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.7
4
+ version: 0.4.0
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-08-23 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: