Remove the Rails dependency on host by fixing the bin/ra[ke,ils] scripts to use basic sh

This commit is contained in:
Jyri-Petteri Paloposki 2021-08-25 20:02:04 +03:00
parent bb2bcd7245
commit d9e20e6d12
4 changed files with 35 additions and 14 deletions

View file

@ -1,8 +1,13 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
end
#!/bin/sh
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT")
if [ -e ../.use-docker -a ! -e /etc/app-env ];
then
$SCRIPTPATH/../script/docker-environment $0 "$@"
else
$SCRIPTPATH/run-rake "$@"
fi

View file

@ -1,7 +1,13 @@
#!/usr/bin/env ruby
if File.exist?("#{__dir__}/../.use-docker")
exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env")
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
#!/bin/sh
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT")
if [ -e $SCRIPTPATH/../.use-docker -a ! -e /etc/app-env ];
then
$SCRIPTPATH/../script/docker-environment $0 "$@"
else
$SCRIPTPATH/run-rake "$@"
fi

5
bin/run-rails Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

5
bin/run-rake Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run