setup_script_generator 0.3.0 → 0.5.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: 9fa313219d3d72070f83b76129dfa4d88b201e6711c7bf4da9ee88743a2e73f0
4
- data.tar.gz: f71b035c63680fca762ad81752bf711b239d71f5c4211983a13368e4c5471e6e
3
+ metadata.gz: 8e4802f8dbb397d7c66f030b2228f5aa3b91fc1b7cf1a7a9ef494a776bb95fb0
4
+ data.tar.gz: 0ce91133243bf727d1d44a0fd9a946c164880f96f694904201254112a0e3a90c
5
5
  SHA512:
6
- metadata.gz: 05f56f7fab52cb6925f0fe26ab6aa865a7b9e8eb1bffdc9bcc0f9c22730d5edbff03268f77e2401915ac0248265d4895c43f73e25cf98f34e867187de733ca5d
7
- data.tar.gz: 36579d3cd1018b4d740d845b8ecdee0b4f2441c12fab9105f3303e15949fb891da913175f3c0fbe461c61402f34cb28ff6306b867aa6cff054e31ab64110ee87
6
+ metadata.gz: 2527b8c517f829b9840d74d62878f200338492579607b59e0409de5ced554f93580db629be9e2f0399b268ba72dfc1628b5f145eec96de3c3534cfe0adec53bd
7
+ data.tar.gz: c8ad9aaaaecc49b60839c348d85fe724a86c8197675d4b48b1b4fd8ff577f4cf50d0c3bddbe8fe23308fcc2b207523c63c927f5f1ef1e60b053c658af11b613f
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.1
1
+ ruby 3.0.2
data/README.md CHANGED
@@ -91,6 +91,6 @@ bin/setup
91
91
 
92
92
  ## Author/License
93
93
 
94
- Setup Script Generator is copyright © 2019-2020 Elliot Winkler
94
+ Setup Script Generator is copyright © 2019-2021 Elliot Winkler
95
95
  (<elliot.winkler@gmail.com>)
96
96
  and is released under the [MIT license](LICENSE.txt).
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,3 +1,5 @@
1
+ REQUIRED_NODE_VERSION=
2
+
1
3
  provision-node() {
2
4
  if [[ -f .tool-versions ]]; then
3
5
  REQUIRED_NODE_VERSION=$(cat .tool-versions | grep '^nodejs ' | sed -Ee 's/^nodejs (.+)$/\1/')
@@ -8,7 +10,7 @@ provision-node() {
8
10
  fi
9
11
 
10
12
  if [[ -z $REQUIRED_NODE_VERSION ]]; then
11
- error "Could not determine required Node version for this project."
13
+ error 'Could not determine required Node version for this project.'
12
14
  print-wrapped "\
13
15
  Your project needs to include either a valid .tool-versions file with a 'nodejs'
14
16
  line or a valid .node-version or .nvimrc file."
@@ -49,17 +51,24 @@ When you're done, close and re-open this terminal tab and re-run this script."
49
51
  }
50
52
 
51
53
  ensure-project-node-dependencies-installed() {
52
- banner 'Installing Node dependencies'
53
-
54
54
  if [[ -f package-lock.json ]]; then
55
+ banner 'Installing Node dependencies'
55
56
  npm install
56
57
  elif [[ -f yarn.lock ]]; then
58
+ if ! type yarn &>/dev/null; then
59
+ banner 'Installing Yarn 1'
60
+ npm install -g yarn
61
+ fi
62
+ banner 'Installing Node dependencies'
57
63
  yarn install
58
64
  else
59
65
  error "Sorry, I'm not sure how to install your dependencies."
60
66
  print-wrapped "\
61
- Are you missing a package.json? Have you run 'npm install' or 'yarn install'
62
- yet?"
67
+ It doesn't look like you have a package-lock.json or yarn.lock in your project
68
+ yet. I'm not sure which package manager you plan on using, so you'll need to run
69
+ either \`npm install\` or \`yarn install\` once first. Additionally, if you want
70
+ to use Yarn 2, then now is the time to switch to that. Then you can re-run this
71
+ script."
63
72
  exit 1
64
73
  fi
65
74
  }
@@ -0,0 +1,6 @@
1
+ provision-overmind() {
2
+ if ! has-executable overmind; then
3
+ banner "Installing Overmind"
4
+ install tmux overmind
5
+ fi
6
+ }
@@ -0,0 +1,7 @@
1
+ provision-rails() {
2
+ banner "Preparing database; removing old logs and tempfiles"
3
+ bin/rails db:prepare log:clear tmp:clear
4
+
5
+ banner "Restarting application server"
6
+ bin/rails restart
7
+ }
@@ -1,3 +1,5 @@
1
+ REQUIRED_RUBY_VERSION=
2
+
1
3
  provision-ruby() {
2
4
  USE_BUNDLER_1=0
3
5
 
@@ -53,6 +55,11 @@ ensure-ruby-installed() {
53
55
  error "Please use chruby to install Ruby $REQUIRED_RUBY_VERSION!"
54
56
  fi
55
57
  fi
58
+ elif has-executable rvm; then
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
62
+ fi
56
63
  else
57
64
  error "You don't seem to have a Ruby manager installed."
58
65
  print-wrapped "\
@@ -73,7 +80,7 @@ ensure-project-ruby-dependencies-installed() {
73
80
  banner 'Installing Ruby dependencies'
74
81
 
75
82
  if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
76
- gem install bundler -v '~> 1.0'
83
+ gem install bundler:'~> 1.0'
77
84
  elif ! has-bundler; then
78
85
  gem install bundler
79
86
  fi
@@ -1,3 +1,3 @@
1
1
  module SetupScriptGenerator
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.5.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.0
4
+ version: 0.5.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-07-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -34,7 +34,9 @@ files:
34
34
  - lib/setup_script_generator/templates/provisions/elm.sh
35
35
  - lib/setup_script_generator/templates/provisions/heroku.sh
36
36
  - lib/setup_script_generator/templates/provisions/node.sh
37
+ - lib/setup_script_generator/templates/provisions/overmind.sh
37
38
  - lib/setup_script_generator/templates/provisions/postgresql.sh
39
+ - lib/setup_script_generator/templates/provisions/rails.sh
38
40
  - lib/setup_script_generator/templates/provisions/ruby.sh
39
41
  - lib/setup_script_generator/templates/provisions/sqlite3.sh
40
42
  - lib/setup_script_generator/templates/skeleton.sh.erb
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
65
  - !ruby/object:Gem::Version
64
66
  version: '0'
65
67
  requirements: []
66
- rubygems_version: 3.1.2
68
+ rubygems_version: 3.2.22
67
69
  signing_key:
68
70
  specification_version: 4
69
71
  summary: Generate setup scripts for your projects.