Jump to content

corsonr

Member
  • Posts

    2
  • Joined

  • Last visited

corsonr's Achievements

Helping Hand

Helping Hand (3/5)

1

Reputation

  1. Hi @dfay and @smarg19, Yes it seems that you are right, after a talk on Twitter with Jonas Nordstrom (@windyjonas) I found the answer. So, I added the following lines to my myscript.sh: export PATH=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH export PATH=$PATH:/usr/local/bin:/Applications/MAMP/Library/bin And that worked. So, yes you were right, it was a matter of path. Many thanks for your participation in this topic, it's much appreciated. If you need any help on WordPress/WooCommerce related stuff just let me know, i'll be pleased to help you ;-)
  2. Hi guys and gals! First of all I'd like to thank you all for the past workflows I downloaded and for all the help I found on this forum! ;-) Please note i'm a newbie in workflows and bash stuff! I am working on a workflow for WP-CLI (http://wp-cli.org/). The aim of that script is to easily install a WordPress site in the following folder Applications/MAMP/htdocs/Dropbox. It has two parameters, the site slug and the site name. The problem I'm facing is that if I run the script from the Terminal, it works fine, but from the workflow it fails. What I have done: - installed WP-CLI (it works from the Terminal) - created a bash script - placed that .sh file in Applications/MAMP/htdocs/Dropbox - placed a .bash_profile file in users/remi/ - created the workflow to load the .sh file The .bash_profile file content is (required when using MAMP): # FIX PHP MAMP for WP-CLI export PATH=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH export PATH=$PATH:/Applications/MAMP/Library/bin/ What works: - in the terminal the following command does work: cd Applications/MAMP/htdocs/Dropbox bash myscript.sh sitename "My WP Blog" It downloads latest WordPress version, create the sitename folder in Applications/MAMP/htdocs/Dropbox, etc... in other words, that works! What fails: - launching the myscript.sh file from Alfred 2 workflow. - the error message that I get in the debug console of Alfred is: [ERROR: alfred.workflow.action.script] Code 127: /Applications/MAMP/htdocs/Dropbox/myscript.sh: line 97: wp: command not found Here is my workflow content: bash /Applications/MAMP/htdocs/Dropbox/myscript.sh {query} And here is the beginning of my myscript.sh file: #!/bin/bash # # How to launch script ? # bash myscript.sh sitename "My WP Blog" # $1 = folder name & database name # $2 = Site title # VARS # admin email email="my@email.com" # local url login # --> Change to fit your server URL model (eg: http://localhost:8888/my-project) url="http://"$1"/" # admin login admin="admin-$1" # path to install your WPs pathtoinstall="/Applications/MAMP/htdocs/Dropbox/" # path to plugins.txt (not accurate, but the script fails before it's used!) pluginfilepath="/Desktop/plugins.txt" # end VARS --- # =============== # = Fancy Stuff = # =============== # not mandatory at all # Stop on error set -e # colorize and formatting command line # You need iTerm and activate 256 color mode in order to work : http://kevin.colyar.net/wp-content/uploads/2011/01/Preferences.jpg green='\x1B[0;32m' cyan='\x1B[1;36m' blue='\x1B[0;34m' grey='\x1B[1;30m' red='\x1B[0;31m' bold='\033[1m' normal='\033[0m' # Jump a line function line { echo " " } # Sript has something to say function bot { line echo -e "${blue}${bold}( script says )${normal} $1" } # ============================== # = The show is about to begin = # ============================== # Welcome ! bot "${blue}${bold}Hi!${normal}" echo -e " I am about to install the following WordPress site : ${cyan}$2${normal}" # CHECK : Directory doesn't exist # go to wordpress installs folder # --> Change : to wherever you want cd $pathtoinstall # check if provided folder name already exists if [ -d $1 ]; then bot "${red}Folder ${cyan}$1${red} already exists${normal}." echo " I am not going any further!" line # quit script exit 1 fi # create directory bot "Creating folder : ${cyan}$1${normal}" mkdir -p -m 777 $1 cd $1 # Download WP bot "I am downloading WordPress..." wp core download --force // and the script continues, but it fails at 1st wp call If I run the workflow, only the sitename folder is created in Applications/MAMP/htdocs/Dropbox and the first wp occurence breaks the process. So, i'm definitely missing something, but I don't know why. Any inputs on this would be highly appreciated. Of course I'll share the full workflow here, once it will be working. I'm open to any ideas and criticism! ;-)
×
×
  • Create New...