mattbanks Posted March 21, 2013 Share Posted March 21, 2013 I have a workflow setup to download wordpress, extract it into my dev sites directory, clone a few repos for my starter theme and a few plugins, create a database, run npm install and grunt in a terminal window, etc. The last step I'm trying to do via an output script is run a instance of wp_install() in a PHP script to run the full installation and then have the browser open the site. Here's a gist of the PHP code I'm running: https://gist.github.com/mattbanks/5213396 I tried running it as a PHP output script and changing line 3 to $site = "{query}"; but it wasn't working. I then tried calling: php -f installing.php -- {query} via a Bash script and grabbing {query} as argv[1], but no dice there either. If I copy the file to the root directory of the WordPress install and run it in the browser with a query string of "q" (as setup in the gist), it works properly (ie http://sites.dev/mysite/installing.php?q=mysite). So I tried copying the installing.php file from the workflow directory over to the WordPress site directory I created, which works fine, but I can't get the browser to properly open the file. I know the {query} variable is passing properly because I threw a notification of it and it's there just fine. Here's what I'm trying via a bash output script: cp installing.php ~/Sites/{query} open http://sites.dev/{query}/installing.php?q={query} But it's not opening properly. It's throwing me http://sites.dev/{query} - not finishing off the full URL. Any ideas how I can get it to run properly? Thanks, Matt Link to comment
jdfwarrior Posted March 21, 2013 Share Posted March 21, 2013 I have a workflow setup to download wordpress, extract it into my dev sites directory, clone a few repos for my starter theme and a few plugins, create a database, run npm install and grunt in a terminal window, etc. The last step I'm trying to do via an output script is run a instance of wp_install() in a PHP script to run the full installation and then have the browser open the site. Here's a gist of the PHP code I'm running: https://gist.github.com/mattbanks/5213396 I tried running it as a PHP output script and changing line 3 to $site = "{query}"; but it wasn't working. I then tried calling: php -f installing.php -- {query} via a Bash script and grabbing {query} as argv[1], but no dice there either. If I copy the file to the root directory of the WordPress install and run it in the browser with a query string of "q" (as setup in the gist), it works properly (ie http://sites.dev/mysite/installing.php?q=mysite). So I tried copying the installing.php file from the workflow directory over to the WordPress site directory I created, which works fine, but I can't get the browser to properly open the file. I know the {query} variable is passing properly because I threw a notification of it and it's there just fine. Here's what I'm trying via a bash output script: cp installing.php ~/Sites/{query} open http://sites.dev/{query}/installing.php?q={query} But it's not opening properly. It's throwing me http://sites.dev/{query} - not finishing off the full URL. Any ideas how I can get it to run properly? Thanks, Matt In the bash script area, on the first line, try setting {query} to a variable then just using the variable everywhere else. query="{query}" cp installing.php ~/Sites/$query open http://sites.dev/{query}/installing.php?q=$query Link to comment
mattbanks Posted March 21, 2013 Author Share Posted March 21, 2013 (edited) In the bash script area, on the first line, try setting {query} to a variable then just using the variable everywhere else. query="{query}" cp installing.php ~/Sites/$query open http://sites.dev/{query}/installing.php?q=$query Tried that, but the URL it gives is now: http://sites.dev/test%0A/installing.php?q=test%0A where {query} is "test". I have every box checked for escaping characters in the Output Script window, so I'm not sure how to get rid of the %0A. Any ideas? Edited March 21, 2013 by mattbanks Link to comment
mattbanks Posted March 21, 2013 Author Share Posted March 21, 2013 So it turns out in the Action Script, where I was echoing the {query} variable, I forgot to echo -n to strip the newline. This is what happens when I write a combination of Bash, PHP and AppleScript on almost no sleep because my 6 month old son is sick... Link to comment
jdfwarrior Posted March 21, 2013 Share Posted March 21, 2013 So it turns out in the Action Script, where I was echoing the {query} variable, I forgot to echo -n to strip the newline. This is what happens when I write a combination of Bash, PHP and AppleScript on almost no sleep because my 6 month old son is sick... Yikes. I'l feel your pain soon enough. I have a kid on the way as well I was actually curious to see more and see if something like that was the issue. I wanted to check the result of setting {query} to a variable first before we moved on though. Glad you were able to sort it out. Link to comment
mattbanks Posted March 22, 2013 Author Share Posted March 22, 2013 Yikes. I'l feel your pain soon enough. I have a kid on the way as well I was actually curious to see more and see if something like that was the issue. I wanted to check the result of setting {query} to a variable first before we moved on though. Glad you were able to sort it out. Congrats! It's utterly amazing having a kid, but also more exhausting than you can ever imagine Wish I could share this workflow - too much personal info in there (related to locations on my machine, Dropbox, MySQL passwords, etc) Link to comment
jdfwarrior Posted March 22, 2013 Share Posted March 22, 2013 Congrats! It's utterly amazing having a kid, but also more exhausting than you can ever imagine Wish I could share this workflow - too much personal info in there (related to locations on my machine, Dropbox, MySQL passwords, etc) You could always turn it into one where you could save settings in a config file and distribute to other users. Just make sure you distribute a blank config thats easy for others to fill in for their needs. Link to comment
erist Posted April 16, 2013 Share Posted April 16, 2013 Would love this workflow with a config file! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now