File tree Expand file tree Collapse file tree 4 files changed +47
-12
lines changed
Expand file tree Collapse file tree 4 files changed +47
-12
lines changed Original file line number Diff line number Diff line change 11GIT
22 remote: https://github.com/basecamp/fizzy-saas
3- revision: f251028405bd0ba586fe836d1a8c56428b8abff0
3+ revision: 720bedaf37faf8dff18c9586e1fa7031bad1d2a9
44 specs:
55 fizzy-saas (0.1.0)
66 queenbee
Original file line number Diff line number Diff line change @@ -82,16 +82,46 @@ step "Installing RubyGems" bundle install
8282if [ -n " $SAAS " ]; then
8383 saas_setup=$( bundle show fizzy-saas) /bin/setup
8484 source " $saas_setup "
85+ else
86+ if ! nc -z localhost 3306 2> /dev/null; then
87+ if docker ps -aq -f name=fizzy-mysql | grep -q . ; then
88+ step " Starting MySQL" docker start fizzy-mysql
89+ else
90+ step " Setting up MySQL" bash -c '
91+ docker pull mysql:8.4
92+ docker run -d \
93+ --name fizzy-mysql \
94+ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
95+ -p 3306:3306 \
96+ mysql:8.4
97+ echo "MySQL is starting… (it may take a few seconds)"
98+ '
99+ fi
100+ fi
85101fi
86102
87- if [[ $* == * --reset* ]]; then
88- step " Resetting the database" rails db:reset
89- else
90- step " Preparing the database" rails db:prepare
103+ if [ -n " $SAAS " ]; then
104+ if [[ $* == * --reset* ]]; then
105+ step " Resetting the database" rails db:reset
106+ else
107+ step " Preparing the database" rails db:prepare
91108
92- if needs_seeding; then
93- step " Seeding the database" rails db:seed
109+ if needs_seeding; then
110+ step " Seeding the database" rails db:seed
111+ fi
94112 fi
113+ else
114+ for adapter in sqlite mysql; do
115+ if [[ $* == * --reset* ]]; then
116+ step " Resetting the database ($adapter )" env DATABASE_ADAPTER=$adapter rails db:reset
117+ else
118+ step " Preparing the database ($adapter )" env DATABASE_ADAPTER=$adapter rails db:prepare
119+
120+ if needs_seeding; then
121+ step " Seeding the database ($adapter )" env DATABASE_ADAPTER=$adapter rails db:seed
122+ fi
123+ fi
124+ done
95125fi
96126
97127step " Cleaning up logs and tempfiles" rails log:clear tmp:clear
Original file line number Diff line number Diff line change 77
88 step "Style: Ruby" , "bin/rubocop"
99
10- step "Security: Gem audit" , "bin/bundler-audit check --update"
10+ step "Security: Gem audit" , "bin/bundler-audit check --update"
1111 step "Security: Importmap audit" , "bin/importmap audit"
12- step "Security: Brakeman audit" , "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
12+ step "Security: Brakeman audit" , "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
13+
14+ if Fizzy . saas?
15+ step "Tests: SaaS" , "SAAS=true BUNDLE_GEMFILE=Gemfile.saas bin/rails test:all"
16+ else
17+ step "Tests: MySQL" , "SAAS=false BUNDLE_GEMFILE=Gemfile DATABASE_ADAPTER=mysql bin/rails test:all"
18+ step "Tests: SQLite" , "SAAS=false BUNDLE_GEMFILE=Gemfile DATABASE_ADAPTER=sqlite bin/rails test:all"
19+ end
1320
14- step "Tests: Open source" , "bin/rails test"
15- step "Tests: System" , "bin/rails test:system"
1621
1722 if success?
1823 step "Signoff: All systems go. Ready for merge and deploy." , "gh signoff"
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module Fizzy
22 class << self
33 def saas?
44 return @saas if defined? ( @saas )
5- @saas = !!( ENV [ "SAAS" ] || File . exist? ( File . expand_path ( "../tmp/saas.txt" , __dir__ ) ) )
5+ @saas = !!( ( ( ENV [ "SAAS" ] || File . exist? ( File . expand_path ( "../tmp/saas.txt" , __dir__ ) ) ) && ENV [ "SAAS" ] != "false" ) )
66 end
77
88 def db_adapter
You can’t perform that action at this time.
0 commit comments