Skip to content

Commit cf520a4

Browse files
[WIP] Enforce options
1 parent 20ee63b commit cf520a4

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

lib/install/web.rb

+16-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
def enforce_options!
2-
if incorrect_database? && default_test_suite?
1+
def apply_template!
2+
if options[:database] == "postgresql" && options[:skip_test]
3+
after_bundle do
4+
gem_group :development, :test do
5+
gem "suspenders", github: "thoughtbot/suspenders", branch: "suspenders-3-0-0-web-generator"
6+
end
7+
8+
run "bundle install"
9+
10+
generate "suspenders:install:web"
11+
rails_command "db:prepare"
12+
13+
say "\nCongratulations! You just pulled our suspenders."
14+
end
15+
else
316
message = <<~ERROR
417
518
@@ -15,25 +28,4 @@ def enforce_options!
1528
end
1629
end
1730

18-
def incorrect_database?
19-
options[:database] != "postgresql"
20-
end
21-
22-
def default_test_suite?
23-
options[:skip_test] != true
24-
end
25-
26-
enforce_options!
27-
28-
after_bundle do
29-
gem_group :development, :test do
30-
gem "suspenders", github: "thoughtbot/suspenders", branch: "suspenders-3-0-0-web-generator"
31-
end
32-
33-
run "bundle install"
34-
35-
generate "suspenders:install:web"
36-
rails_command "db:prepare"
37-
38-
say "\nCongratulations! You just pulled our suspenders."
39-
end
31+
apply_template!

0 commit comments

Comments
 (0)