shoulda-context 1.2.2 → 2.0.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.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +190 -0
  5. data/.ruby-version +1 -1
  6. data/.travis.yml +36 -2
  7. data/Appraisals +100 -29
  8. data/CHANGELOG.md +29 -0
  9. data/Gemfile +15 -1
  10. data/Gemfile.lock +70 -0
  11. data/MIT-LICENSE +1 -1
  12. data/README.md +140 -29
  13. data/Rakefile +20 -15
  14. data/bin/install_gems_in_all_appraisals +16 -0
  15. data/bin/run_all_tests +16 -0
  16. data/bin/setup +190 -0
  17. data/bin/supported_ruby_versions +7 -0
  18. data/bin/update_gem_in_all_appraisals +17 -0
  19. data/bin/update_gems_in_all_appraisals +16 -0
  20. data/{bin → exe}/convert_to_should_syntax +0 -0
  21. data/gemfiles/rails_4_2.gemfile +35 -0
  22. data/gemfiles/rails_4_2.gemfile.lock +234 -0
  23. data/gemfiles/rails_5_0.gemfile +33 -0
  24. data/gemfiles/rails_5_0.gemfile.lock +226 -0
  25. data/gemfiles/rails_5_1.gemfile +34 -0
  26. data/gemfiles/rails_5_1.gemfile.lock +242 -0
  27. data/gemfiles/rails_5_2.gemfile +36 -0
  28. data/gemfiles/rails_5_2.gemfile.lock +261 -0
  29. data/gemfiles/rails_6_0.gemfile +38 -0
  30. data/gemfiles/rails_6_0.gemfile.lock +286 -0
  31. data/lib/shoulda/context.rb +13 -16
  32. data/lib/shoulda/context/assertions.rb +16 -13
  33. data/lib/shoulda/context/configuration.rb +19 -0
  34. data/lib/shoulda/context/context.rb +33 -307
  35. data/lib/shoulda/context/dsl.rb +279 -0
  36. data/lib/shoulda/context/rails_test_unit_reporter_patch.rb +21 -0
  37. data/lib/shoulda/context/railtie.rb +14 -0
  38. data/lib/shoulda/context/test_framework_detection.rb +4 -5
  39. data/lib/shoulda/context/version.rb +1 -1
  40. data/lib/shoulda/context/world.rb +22 -0
  41. data/shoulda-context.gemspec +11 -18
  42. data/test/fake_rails_root/test/shoulda_macros/custom_macro.rb +1 -1
  43. data/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +1 -2
  44. data/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +1 -2
  45. data/test/shoulda/autoload_macro_test.rb +1 -1
  46. data/test/shoulda/context_test.rb +92 -53
  47. data/test/shoulda/convert_to_should_syntax_test.rb +5 -7
  48. data/test/shoulda/helpers_test.rb +24 -59
  49. data/test/shoulda/railtie_test.rb +43 -0
  50. data/test/shoulda/rerun_snippet_test.rb +45 -0
  51. data/test/shoulda/should_test.rb +163 -24
  52. data/test/shoulda/test_framework_detection_test.rb +64 -71
  53. data/test/support/current_bundle.rb +61 -0
  54. data/test/support/rails_application_with_shoulda_context.rb +46 -0
  55. data/test/support/snowglobe.rb +5 -0
  56. data/test/test_helper.rb +43 -11
  57. metadata +46 -142
  58. data/gemfiles/minitest_4_x.gemfile +0 -7
  59. data/gemfiles/minitest_4_x.gemfile.lock +0 -96
  60. data/gemfiles/minitest_5_x.gemfile +0 -7
  61. data/gemfiles/minitest_5_x.gemfile.lock +0 -102
  62. data/gemfiles/rails_3_0.gemfile +0 -8
  63. data/gemfiles/rails_3_0.gemfile.lock +0 -93
  64. data/gemfiles/rails_3_1.gemfile +0 -10
  65. data/gemfiles/rails_3_1.gemfile.lock +0 -114
  66. data/gemfiles/rails_3_2.gemfile +0 -10
  67. data/gemfiles/rails_3_2.gemfile.lock +0 -112
  68. data/gemfiles/rails_4_0.gemfile +0 -10
  69. data/gemfiles/rails_4_0.gemfile.lock +0 -107
  70. data/gemfiles/rails_4_1.gemfile +0 -10
  71. data/gemfiles/rails_4_1.gemfile.lock +0 -119
  72. data/gemfiles/test_unit.gemfile +0 -7
  73. data/gemfiles/test_unit.gemfile.lock +0 -95
  74. data/init.rb +0 -1
  75. data/rails/init.rb +0 -4
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shoulda-context (2.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ appraisal (2.2.0)
10
+ bundler
11
+ rake
12
+ thor (>= 0.14.0)
13
+ ast (2.4.0)
14
+ byebug (10.0.2)
15
+ coderay (1.1.2)
16
+ jaro_winkler (1.5.4)
17
+ m (1.5.1)
18
+ method_source (>= 0.6.7)
19
+ rake (>= 0.9.2.2)
20
+ method_source (0.9.2)
21
+ minitest (5.14.0)
22
+ mocha (1.11.2)
23
+ parallel (1.19.1)
24
+ parser (2.7.1.0)
25
+ ast (~> 2.4.0)
26
+ power_assert (1.1.7)
27
+ pry (0.12.2)
28
+ coderay (~> 1.1.0)
29
+ method_source (~> 0.9.0)
30
+ pry-byebug (3.6.0)
31
+ byebug (~> 10.0)
32
+ pry (~> 0.10)
33
+ rainbow (3.0.0)
34
+ rake (13.0.1)
35
+ rubocop (0.71.0)
36
+ jaro_winkler (~> 1.5.1)
37
+ parallel (~> 1.10)
38
+ parser (>= 2.6)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 1.7)
42
+ ruby-progressbar (1.10.1)
43
+ snowglobe (0.3.0)
44
+ test-unit (3.3.5)
45
+ power_assert
46
+ thor (1.0.1)
47
+ unicode-display_width (1.6.1)
48
+ warnings_logger (0.1.0)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ appraisal
55
+ bundler (~> 1.0)
56
+ byebug
57
+ m
58
+ minitest
59
+ mocha
60
+ pry (~> 0.12.0)
61
+ pry-byebug (~> 3.6.0)
62
+ rake
63
+ rubocop (= 0.71.0)
64
+ shoulda-context!
65
+ snowglobe (>= 0.3.0)
66
+ test-unit
67
+ warnings_logger
68
+
69
+ BUNDLED WITH
70
+ 1.17.3
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2013, Tammer Saleh, thoughtbot, inc.
1
+ Copyright (c) 2006-2020, Tammer Saleh and thoughtbot, inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.md CHANGED
@@ -1,22 +1,35 @@
1
- # shoulda-context [![Gem Version](https://badge.fury.io/rb/shoulda-context.png)](http://badge.fury.io/rb/shoulda-context) [![Build Status](https://travis-ci.org/thoughtbot/shoulda-context.png?branch=master)](https://travis-ci.org/thoughtbot/shoulda-context)
1
+ # Shoulda Context [![Gem Version][version-badge]][rubygems] [![Build Status][travis-badge]][travis] ![Downloads][downloads-badge] [![Hound][hound-badge]][hound]
2
2
 
3
- [Official Documentation](http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames)
3
+ [version-badge]: https://img.shields.io/gem/v/shoulda-context.svg
4
+ [rubygems]: https://rubygems.org/gems/shoulda-matchers
5
+ [travis-badge]: https://img.shields.io/travis/thoughtbot/shoulda-context/master.svg
6
+ [travis]: https://travis-ci.org/thoughtbot/shoulda-context
7
+ [downloads-badge]: https://img.shields.io/gem/dtv/shoulda-context.svg
8
+ [hound-badge]: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
9
+ [hound]: https://houndci.com
4
10
 
5
- Shoulda's contexts make it easy to write understandable and maintainable tests for Test::Unit.
6
- It's fully compatible with your existing tests in Test::Unit, and requires no retooling to use.
11
+ Shoulda Context makes it easy to write understandable and maintainable tests
12
+ under Minitest and Test::Unit within Rails projects or plain Ruby projects. It's
13
+ fully compatible with your existing tests and requires no retooling to use.
7
14
 
8
- Refer to the [shoulda](https://github.com/thoughtbot/shoulda) gem if you want to know more
9
- about using shoulda with Rails or RSpec.
15
+ ## Quick links
10
16
 
11
- ## Contexts
17
+ 📖 **[Read the documentation for the latest version.][rubydocs]**
18
+ 📢 **[See what's changed in recent versions.][changelog]**
12
19
 
13
- Instead of writing Ruby methods with `lots_of_underscores`, shoulda-context adds
14
- context, setup, and should blocks...
20
+ [rubydocs]: http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames
21
+ [changelog]: CHANGELOG.md
15
22
 
16
- ```ruby
17
- require "test/unit"
23
+ ## Usage
24
+
25
+ Instead of writing Ruby methods with `lots_of_underscores`, Shoulda Context lets
26
+ you name your tests and group them together using English.
27
+
28
+ At a minimum, the gem provides some convenience layers around core Minitest /
29
+ Test::Unit functionality. For instance, this test case:
18
30
 
19
- class CalculatorTest < Test::Unit::TestCase
31
+ ```ruby
32
+ class CalculatorTest < Minitest::Test
20
33
  context "a calculator" do
21
34
  setup do
22
35
  @calculator = Calculator.new
@@ -33,35 +46,133 @@ class CalculatorTest < Test::Unit::TestCase
33
46
  end
34
47
  ```
35
48
 
36
- ... which combine to produce the following test methods:
49
+ turns into:
50
+
51
+ ```ruby
52
+ class CalculatorTest < Minitest::Test
53
+ def setup
54
+ @calculator = Calculator.new
55
+ end
56
+
57
+ define_method "test_: a calculator should add two numbers for the sum" do
58
+ assert_equal 4, @calculator.sum(2, 2)
59
+ end
60
+
61
+ define_method "test_: a calculator should multiply two numbers for the product" do
62
+ assert_equal 10, @calculator.product(2, 5)
63
+ end
64
+ end
65
+ ```
66
+
67
+ However, Shoulda Context also provides functionality apart from Minitest /
68
+ Test::Unit that allows you to shorten tests drastically by making use of
69
+ RSpec-compatible matchers. For instance, with [Shoulda
70
+ Matchers][shoulda-matchers] you can write such tests as:
37
71
 
38
- "test: a calculator should add two numbers for the sum."
39
- "test: a calculator should multiply two numbers for the product."
72
+ ```ruby
73
+ class User < ActiveSupport::TestCase
74
+ context "validations" do
75
+ subject { FactoryBot.build(:user) }
76
+
77
+ should validate_presence_of(:first_name)
78
+ should validate_presence_of(:last_name)
79
+ should validate_uniqueness_of(:email)
80
+ should_not allow_value('weird').for(:email)
81
+ end
82
+ end
83
+ ```
40
84
 
41
- When running a single test method via (example from a Rails context):
85
+ [shoulda-matchers]: https://github.com/thoughtbot/shoulda-matchers
42
86
 
43
- ruby -I"lib:test" path_to_test_file -n name_of_the_test_method
87
+ ## API
44
88
 
45
- you should include a trailing space(!), e.g.,
89
+ ### DSL
46
90
 
47
- ruby -I"lib:test" path_to_test_file -n "test: a calculator should add two numbers for the sum. "
91
+ The primary method in Shoulda Context's API is `context`, which declares a group
92
+ of a tests.
48
93
 
94
+ These methods are available inside of a `context`:
49
95
 
50
- ## Assertions
96
+ * `setup` — a DSL-y alternative to defining a `setup` method
97
+ * `teardown` — a DSL-y alternative to defining a `teardown` method
98
+ * `should` — There are two forms:
99
+ 1. when passed a name + block, creates a test equivalent to defining a
100
+ `test_` method
101
+ 2. when passed a matcher, creates a test that will run the matcher, asserting
102
+ that it passes
103
+ * `should_not` — like the matcher version of `should`, but creates a test that
104
+ asserts that the matcher fails
105
+ * `should_eventually` — allows you to temporarily skip tests
106
+ * `context` — creates a subcontext
51
107
 
52
- It also has two additional Test::Unit assertions for working with Ruby's Array:
108
+ These methods are available within a test case class, but outside of a
109
+ `context`:
53
110
 
54
- assert_same_elements([:a, :b, :c], [:c, :a, :b])
55
- assert_contains(['a', '1'], /\d/)
56
- assert_contains(['a', '1'], 'a')
111
+ * `should` same as above
112
+ * `should_not` — same as above
113
+ * `should_eventually` — same as above
114
+ * `described_type` — returns the class being tested, as determined by the class
115
+ name of the outermost class
116
+ * `subject` — lets you define an object that is the primary focus of the tests
117
+ within a context; this is most useful when using a matcher as the matcher will
118
+ make use of this as _its_ subject
119
+
120
+ And these methods are available inside of a test (whether defined via a method
121
+ or via `should`):
122
+
123
+ * `subject` — an instance of the class under test, which is derived
124
+ automatically from the name of the test case class but is overridable via the
125
+ class method version of `subject` above
126
+
127
+ ### Assertions
128
+
129
+ In addition to the main API, the gem also provides some extra assertions that
130
+ may be of use:
131
+
132
+ * `assert_same_elements` — compares two arrays for equality, but ignoring
133
+ ordering
134
+ * `assert_contains` — asserts that an array has an item
135
+ * `assert_does_not_contain` — the opposite of `assert_contains`
136
+ * `assert_accepts` — what `should` uses internally; asserts that a matcher
137
+ object matches against a value
138
+ * `assert_reject` — what `should_not` uses internally; asserts that a matcher
139
+ object does not match against a value
140
+
141
+ ## Note on running tests
142
+
143
+ Normally, you will run a single test like this:
144
+
145
+ ruby -I lib -I test path_to_test.rb -n name_of_test_method
146
+
147
+ When using Shoulda Context, however, you'll need to put a space after the test
148
+ name:
149
+
150
+ ruby -I lib -I test path_to_test.rb -n "test_: a calculator should add two numbers for the sum. "
151
+
152
+ If this is too cumbersome, consider using the [m] gem to run tests instead:
153
+
154
+ m path_to_test.rb:39
155
+
156
+ [m]: https://github.com/qrush/m
157
+
158
+ ## Compatibility
159
+
160
+ Shoulda Context is tested and supported against Rails 4.x+, Minitest 4.x,
161
+ Test::Unit 3.x, and Ruby 2.4+.
57
162
 
58
163
  ## Credits
59
164
 
60
- Shoulda is maintained and funded by [thoughtbot](http://thoughtbot.com/community).
61
- shoulda-context is maintained by [Travis Jeffery](https://github.com/travisjeffery).
62
- Thank you to all the [contributors](https://github.com/thoughtbot/shoulda-context/contributors).
165
+ Shoulda Context is maintained by [Elliot Winkler][elliot-winkler], [Travis
166
+ Jeffery][travis-jeffery], and thoughtbot. Thank you to all the [contributors].
167
+
168
+ [elliot-winkler]: https://github.com/mcmire
169
+ [travis-jeffery]: https://github.com/travisjeffery
170
+ [contributors]: https://github.com/thoughtbot/shoulda-context/contributors
63
171
 
64
172
  ## License
65
173
 
66
- Shoulda is Copyright © 2006-2016 thoughtbot, inc.
67
- It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
174
+ Shoulda Context is copyright © 2006-2020 [thoughtbot, inc][thoughtbot-website].
175
+ It is free software, and may be redistributed under the terms specified in the
176
+ [MIT-LICENSE](MIT-LICENSE) file.
177
+
178
+ [thoughtbot-website]: https://thoughtbot.com
data/Rakefile CHANGED
@@ -1,21 +1,26 @@
1
- require 'bundler/setup'
2
- require 'bundler/gem_tasks'
3
- require 'rake/testtask'
4
- require 'appraisal'
1
+ require "bundler/setup"
2
+ require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+ require "pry-byebug"
5
5
 
6
- $LOAD_PATH.unshift("lib")
7
- load 'tasks/shoulda.rake'
6
+ require_relative "test/support/current_bundle"
7
+
8
+ load "tasks/shoulda.rake"
8
9
 
9
10
  Rake::TestTask.new do |t|
10
- t.libs << 'lib' << 'test'
11
- t.pattern = 'test/**/*_test.rb'
12
- t.verbose = false
11
+ t.libs << "test"
12
+ t.ruby_opts += ["-w"]
13
+ t.pattern = "test/**/*_test.rb"
14
+ t.verbose = true
13
15
  end
14
16
 
15
- desc 'Test the plugin under all supported Rails versions.'
16
- task :all => ['appraisal:cleanup', 'appraisal:install'] do
17
- exec('rake appraisal test')
17
+ task :default do
18
+ if Tests::CurrentBundle.instance.appraisal_in_use?
19
+ Rake::Task["test"].invoke
20
+ elsif ENV["CI"]
21
+ exec "appraisal install && appraisal rake --trace"
22
+ else
23
+ appraisal = Tests::CurrentBundle.instance.latest_appraisal
24
+ exec "appraisal install && appraisal #{appraisal} rake --trace"
25
+ end
18
26
  end
19
-
20
- desc 'Default: run tests'
21
- task :default => [:all]
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ SUPPORTED_VERSIONS=$(bin/supported_ruby_versions)
6
+
7
+ install-gems-for-version() {
8
+ local version="$1"
9
+ (export RBENV_VERSION=$version; bundle && bundle exec appraisal install)
10
+ }
11
+
12
+ for version in $SUPPORTED_VERSIONS; do
13
+ echo
14
+ echo "*** Installing gems for $version ***"
15
+ install-gems-for-version $version
16
+ done
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ SUPPORTED_VERSIONS=$(bin/supported_ruby_versions)
6
+
7
+ run-tests-for-version() {
8
+ local version="$1"
9
+ (export RBENV_VERSION=$version; bundle exec rake)
10
+ }
11
+
12
+ for version in $SUPPORTED_VERSIONS; do
13
+ echo
14
+ echo "*** Running tests for $version ***"
15
+ run-tests-for-version $version
16
+ done
@@ -0,0 +1,190 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ RUBY_VERSION=$(bin/supported_ruby_versions | xargs -n 1 echo | sort -V | tail -n 1)
6
+
7
+ cd "$(dirname "$(dirname "$0")")"
8
+
9
+ uname=$(uname)
10
+
11
+ if [[ $uname == 'Darwin' ]]; then
12
+ platform='mac'
13
+ else
14
+ platform='linux'
15
+ fi
16
+
17
+ banner() {
18
+ echo -e "\033[34m== $@ ==\033[0m"
19
+ }
20
+
21
+ success() {
22
+ echo -e "\033[32m$@\033[0m"
23
+ }
24
+
25
+ warning() {
26
+ echo -e "\033[33m$@\033[0m"
27
+ }
28
+
29
+ error() {
30
+ echo -e "\033[31m$@\033[0m"
31
+ }
32
+
33
+ has-executable() {
34
+ type "$1" &>/dev/null
35
+ }
36
+
37
+ is-running() {
38
+ pgrep "$1" >/dev/null
39
+ }
40
+
41
+ install() {
42
+ local apt_package=""
43
+ local rpm_package=""
44
+ local brew_package=""
45
+ local default_package=""
46
+ local package=""
47
+
48
+ for arg in "$@"; do
49
+ case $arg in
50
+ apt=*)
51
+ apt_package="$arg"
52
+ ;;
53
+ rpm=*)
54
+ rpm_package="$arg"
55
+ ;;
56
+ brew=*)
57
+ brew_package="$arg"
58
+ ;;
59
+ *)
60
+ default_package="$arg"
61
+ ;;
62
+ esac
63
+ done
64
+
65
+ if has-executable brew; then
66
+ package="${brew_package:-$default_package}"
67
+
68
+ if [[ -n $package ]]; then
69
+ brew install "$package"
70
+ fi
71
+ elif has-executable apt-get; then
72
+ package="${apt_package:-$default_package}"
73
+
74
+ if [[ -n $package ]]; then
75
+ sudo apt-get install -y "$package"
76
+ fi
77
+ elif has-executable yum; then
78
+ package="${yum_package:-$default_package}"
79
+
80
+ if [[ -n $package ]]; then
81
+ sudo yum install -y "$package"
82
+ fi
83
+ else
84
+ error "Sorry, I'm not sure how to install $default_package."
85
+ exit 1
86
+ fi
87
+ }
88
+
89
+ check-for-build-tools() {
90
+ if [[ $platform == "linux" ]]; then
91
+ if ! has-executable apt-get; then
92
+ error "You don't seem to have a package manager installed."
93
+ echo "The setup script assumes you're using Debian or a Debian-derived flavor of Linux"
94
+ echo "(i.e. something with Apt). If this is not the case, then we would gladly take a"
95
+ echo "PR fixing this!"
96
+ exit 1
97
+ fi
98
+
99
+ # TODO: Check if build-essential is installed on Debian?
100
+ else
101
+ if ! has-executable brew; then
102
+ error "You don't seem to have Homebrew installed."
103
+ echo
104
+ echo "Follow the instructions here to do this:"
105
+ echo
106
+ echo "http://brew.sh"
107
+ exit 1
108
+ fi
109
+
110
+ # TODO: Check that OS X Command Line Tools are installed?
111
+ fi
112
+ }
113
+
114
+ install-development-libraries() {
115
+ install apt=ruby-dev rpm=ruby-devel
116
+ install rpm=zlib-devel
117
+ }
118
+
119
+ install-dependencies() {
120
+ if ! has-executable sqlite3; then
121
+ banner 'Installing SQLite 3'
122
+ install sqlite3
123
+ install apt=libsqlite3-dev rpm=sqlite-devel
124
+ fi
125
+
126
+ if ! has-executable psql; then
127
+ banner 'Installing PostgreSQL'
128
+ install postgresql
129
+ install apt=libpq-dev rpm=postgresql-devel
130
+ fi
131
+
132
+ if ! is-running postgres; then
133
+ banner 'Starting PostgreSQL'
134
+ start postgresql
135
+ fi
136
+
137
+ if ! has-executable heroku; then
138
+ banner 'Installing Heroku'
139
+ install heroku/brew/heroku heroku
140
+ fi
141
+
142
+ if has-executable rbenv; then
143
+ if ! (rbenv versions | grep $RUBY_VERSION'\>' &>/dev/null); then
144
+ banner "Installing Ruby $RUBY_VERSION with rbenv"
145
+ rbenv install --skip-existing "$RUBY_VERSION"
146
+ fi
147
+ elif has-executable rvm; then
148
+ if ! (rvm ls | grep $RUBY_VERSION'\>' &>/dev/null); then
149
+ banner "Installing Ruby $RUBY_VERSION with rvm"
150
+ error "You don't seem to have Ruby $RUBY_VERSION installed."
151
+ echo
152
+ echo "Use RVM to do so, and then re-run this command."
153
+ echo
154
+ fi
155
+ else
156
+ error "You don't seem to have a Ruby manager installed."
157
+ echo
158
+ echo 'We recommend using rbenv. You can find installation instructions here:'
159
+ echo
160
+ echo 'http://github.com/rbenv/rbenv'
161
+ echo
162
+ echo "When you're done, simply re-run this script!"
163
+ exit 1
164
+ fi
165
+
166
+ banner 'Installing Ruby dependencies'
167
+ gem install bundler -v '~> 1.0' --conservative
168
+ bundle check || bundle install
169
+ bundle exec appraisal install
170
+
171
+ if ! has-executable node; then
172
+ banner 'Installing Node'
173
+
174
+ if [[ $platform == 'linux' ]]; then
175
+ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
176
+
177
+ install nodejs
178
+
179
+ if ! has-executable npm; then
180
+ install npm
181
+ fi
182
+ else
183
+ install nodejs
184
+ fi
185
+ fi
186
+ }
187
+
188
+ check-for-build-tools
189
+ install-development-libraries
190
+ install-dependencies