Closed taehtinen closed 6 years ago
Thank you for reporting! We have only used OSX while developing so we haven't noticed this limitation yet. I'll look into this and try to make this compatible for Linux users as well.
Can you try out following setup.sh? I got it working with perl on Mac but it would be nice to have it tested on Linux before commiting. So replace setup.sh with following:
#!/bin/bash
# Theme setup.
# Defaults
default_name="Aucor Starter"
default_id="aucor_starter"
default_url="https://aucor_starter.local"
default_locale="fi"
# Directories
basedir="$( cd "$( dirname "$0" )" && pwd )/."
assetsdir="$basedir/assets"
basedir_all_files="$basedir/."
setup_script="$basedir/setup.sh"
# Text styles
bold=$(tput bold)
white=$(tput setaf 7)
pink=$(tput setaf 198)
green=$(tput setaf 2)
txtreset=$(tput sgr0)
echo "${bold}${pink}
aucorauco aucoraucor
raucoraucorau coraucoraucor
corauc or aucora ucora
ucora ucora ucora
ucor aucora ucora
aucor aucorauc orauc
oraucoraucorau coraucorauauco
raucoraucor aucoraucor ${txtreset}"
echo "${bold}
aucor-starter
${txtreset}"
echo "1) Set name for your theme. (Default: $default_name)"
read name
# use default if empty
if test -n "$name"; then
echo ""
else
id=$default_name
fi
echo "2) Set unique id for your theme. Use only a-z and _. (Default: $default_id)"
read id
# use default if empty
if test -n "$id"; then
echo ""
else
id=$default_id
fi
echo "3) Set local development url. (Default: $default_url)"
read url
# use default if empty
if test -n "$url"; then
echo ""
else
url=$default_url
fi
while true; do
read -p "4) Is following information correct?
name: ${bold}${pink}$name${txtreset} (Default: $default_name)
id: ${bold}${pink}$id${txtreset} (Default: $default_id)
url: ${bold}${pink}$url${txtreset} (Default: $default_url)
Proceed to install? [y/N]
" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer y or n.";;
esac
done
echo "
Run setup:
=========="
# style.css
find $basedir -name 'style.css' -type f -exec perl -p -i -e "s|$default_name|$name|g" {} \;
# PHP files
find $basedir_all_files -name '*.php' -type f -exec perl -p -i -e "s|$default_name|$name|g" {} \;
echo "--> Search & replace name ... ${green}done${txtreset}"
# PHP files
find $basedir_all_files -name '*.php' -type f -exec perl -p -i -e "s|$default_id|$id|g" {} \;
# style.css
find $basedir -name 'style.css' -type f -exec perl -p -i -e "s|$default_id|$id|g" {} \;
# bower.json
find $basedir -name 'bower.json' -type f -exec perl -p -i -e "s|$default_id|$id|g" {} \;
# package.json
find $basedir -name 'package.json' -type f -exec perl -p -i -e "s|$default_id|$id|g" {} \;
echo "--> Search & replace id ..... ${green}done${txtreset}"
# manifest.json
find $assetsdir -name 'manifest.json' -type f -exec perl -p -i -e "s|$default_url|$url|g" {} \;
echo "--> Change url .............. ${green}done${txtreset}"
echo "--> ${green}Setup complete!${txtreset}"
echo "--> setup.sh removed"
rm $setup_script
Yes, this works on Ubuntu Linux, everything got replaced as they should have.
This works update works. Why not merge into master?
The master uses the perl version but it was not very clear from this issue. So issue was fixed back in 2017.
@TeemuSuoranta your code above works. But not the current setup.sh from master I am using WSL - windows subsystem for Linux
Here is what I am seeing:
sh setup.sh
This is the output and errors.
Might be worth converting this to gulp for complete compatibility
My WSL issue above is fixed if I git clone from SWL - clone from Ubuntu not Windows. Or change the line endings of the setup.sh file to LF (Linux)
Setup.sh has been created using the BSD version of
sed
, used for example in OSX, and is not compatible with the GNU version found on many Linux systems. The following error occurs:Maybe use
perl
instead for doing the replacement? It'll work the same way on both. For example:find $basedir -name 'style.css' -type f -exec perl -p -i -e "s/$default_name/$name/g" {} \;