opal/opal-rails

View on GitHub
bin/rails-sandbox

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

# frozen_string_literal: true

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