summaryrefslogtreecommitdiff
path: root/bin/rails-sandbox
blob: c89b2ae1c14317faf831b043419a541008450490 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env ruby

app_root = 'sandbox'

unless File.exist? "#{app_root}/bin/rails"
  warn 'Creating the sandbox app...'
  Dir.chdir "#{__dir__}/.." do
    system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
      warn 'Automatic creation of the sandbox app failed'
      exit 1
    end
  end
end

Dir.chdir app_root
exec 'bin/rails', *ARGV