setup_script_generator 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4379891f48bbc0eb854a07195331ea38069bf8757808cf07882aff97c419a29c
4
- data.tar.gz: 355658991af90bc45354433fe5c0b4afb32b15cbc0db6916ec54515d8d94f4e6
3
+ metadata.gz: 5fd5e83995916e6bf77222292688adcd991ad378dffe7fd9ec0e6a578239f03c
4
+ data.tar.gz: 0465dd858b92c3541770b3e2bf545be75d0fad94ba7edb31cce1884c4f04cbc9
5
5
  SHA512:
6
- metadata.gz: 396e36d2da122281011f4a12ad962f97d01f5bcff85598ca00f74a89c01f81a839d1eeb4a5491f5d5827078767ec7a0bbdab84e4ba8b264088aed8b338405c20
7
- data.tar.gz: c0da9ecdb57e0292bf4c6cbd08f13820eabba6acf1e8774b04ec75322d346ae0adcf753bc72c585f5756ea4678bd09462faaa6a045604e9a8ca70f87ea0afcd9
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 ----------------------------------------------------------------------
@@ -53,6 +53,11 @@ ensure-ruby-installed() {
53
53
  error "Please use chruby to install Ruby $REQUIRED_RUBY_VERSION!"
54
54
  fi
55
55
  fi
56
+ elif has-executable rvm; then
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
60
+ fi
56
61
  else
57
62
  error "You don't seem to have a Ruby manager installed."
58
63
  print-wrapped "\
@@ -1,3 +1,3 @@
1
1
  module SetupScriptGenerator
2
- VERSION = "0.3.1".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.3.1
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-11-08 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: