darksonic37 / mybb-shetup Goto Github PK
View Code? Open in Web Editor NEWShell script that downloads and prepares MyBB to be installed
License: Do What The F*ck You Want To Public License
Shell script that downloads and prepares MyBB to be installed
License: Do What The F*ck You Want To Public License
I saw this article on Nettuts+ the other day and I thought it was worth mentioning.
http://net.tutsplus.com/tutorials/tools-and-tips/test-driving-shell-scripts
I'm fairly new to TDD myself, but I'm willing to learn. Given the nature of the script I'm sure there are a lot of corner cases in which it would just fail. I was hoping we could look into shunit2 and write some tests using it to automate the testing process.
The DB function hasn't been added to main yet. It still needs to validate that mysql is at a place in $PATH, else we need to ask the user for a path to it.
Assigning myself to the task, since that was my little addon.
The way the download part of the script works is not as I originally intended. Take a look at the command_pick
and download
functions. It basically checks if either git, wget, curl or lynx are available and downloads the branch using whichever command was available first.
The user should be asked if he wants to download the latest code from a branch on GitHub (master/stable/feature) or a specific version (1.6.5, 1.6.9, 1.6.10 or 1.8.1). If the user chose to download a branch it must use git to clone the repository, so as to fetch the latest code. If git isn't available, abort the script. And if the user chose a specific version like 1.6.5 the script should check if either wget or curl are available and download 1.6.5 from the tagged versions on GitHub using whichever command was available first.
Thoughts on this? I am also considering dropping lynx from the list of download methods. It's pointless. Almost any machine will have either wget or curl installed. Tons of other scripts rely solely on wget or curl to download stuff.
We should check the user's PHP version before running the PHP server.
If it's less than 5.4, we could just echo a message. Otherwise, open the server.
We'll need to do something like PHP_VERSION=php -v
and find the version number within.
Joshs-iMac:mybb-shetup josh$ ./mybb-shetup.sh
__ __ ____ ____
| \/ | | _ \| _ \
| \ / |_ _| |_) | |_) |
| |\/| | | | | _ <| _ <
| | | | |_| | |_) | |_) |
|_| |_|\__, |____/|____/
__/ |
|___/
Because free never tasted so good!
Welcome to mybb-shetup, the MyBB shell installer. This script will help you set up a copy of MyBB in a minute!
Press [ENTER] to continue... or press CTRL+C to quit.
Where would you like to install MyBB to (FULL PATH)? []/Users/josh/Desktop/mybb-shetup-test
The path you entered does not exist. Would you like to create it? [Y/n]Y
Creating /Users/josh/Desktop/mybb-shetup-test...
What branch would you like to download? [MASTER/stable/feature]feature
Do you want to install MyBB feature to ? [Y/n]Y
./mybb-shetup.sh: line 170: pick_command: command not found
Joshs-iMac:mybb-shetup josh$
I was reading some bash stuff on best practices, portability and whatnot and came across a cool folder structure.
https://github.com/ymattw/sandbox/blob/master/sh/bash-best-practices.md#organize-your-source-tree
Any thoughts on this? I think it could be beneficial to split code into multiple files. It's clearly far more organized (better than what we have anyway). It also looks really pro. :P
On the other hand this no longer allows the script to be a single file download & run sort of thing. Not that it really matters, but it does lose that aspect to it.
It would also require some additional steps during installation to be able to run the script typing just mybbshetup
. Upon cloning the repo, you would have to move the whole folder somewhere and symlink /bin/run.sh
to /usr/local/bin/mybbshetup
or something like that. Again, this doesn't really matter because installation is supposed to be a quick copy & paste from the readme.
I would expect people to run the script on shells other than bash. I myself use zsh, and it's certainly quite popular in the web development community. As such I think it's important to make the script as portable as possible.
I just gave it a run on zsh and it's totally failing. So we need to fix it and make it work on the various shells out there. I did some research and I've already committed some stuff. I'll just dump the links here if it's any useful. They're all about bash technically, but you'll often find POSIX-compliant solutions to stuff.
http://andreinc.net/2011/09/04/bash-scripting-best-practice/
http://mywiki.wooledge.org/BashPitfalls
http://mywiki.wooledge.org/BashFAQ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.