Power Build is a photo album builder which generates a site based on the images in a project. It works from command line.
- Ruby version 2.0 or higher
- Mac or Linux (Nothing has been tested on Windows.)
- This tool is for hosting on GitHub pages. Other sites may not be compatible.
Run:
$gem install power-build
or manually write gem 'power-build'
in the Gemfile before you run $bundle
.
In the root of your project, run:
$power init
It creates a config file in your project directory. You can adjust the content depending on how you want to build your site, but don't change the file name.
$power build
You can skip the build
and just run power
. This command generates a static site which allows you to host on github pages. Basically it creates a index.html
and a folder assets
with other stuff in it.
$power delete
Clean all files generated by power-build.
Further commands and shortcuts will display at:
$power help
The config file looks like this:
{
"title": "Your Site Title",
// Displaying the source on you nav-bar
"host_link": "https://github.com/nkj20932/power-build",
"host_display_text": "GitHub",
// Select the folder you store images
"root_folder": "storage",
// Website language: either "zh-tw" or "en"
"language": "zh-tw"
}
- Remember to keep the file content in JSON format. Don't break it.
- Currently there are only two languages for display: English and Traditional Chinese.
root_folder
for the images should be in your root folder. Otherwise the links and images will not be displayed. Check the folder structure in the next section.
Before site generation, you need to include at least the folder of your images:
My_project_folder
|-- image_root_folder
If so, your folder will look like this after site generation:
My_project_folder
|-- image_root_folder
|-- power-build.config
|-- assets
|-- index.html
Everything in your project root folder will be ignored. Files already in your assets
directory will not be overwritten during build, so any change in custom.js
or custom.css
will preserve.
The image folder should be stored by categories like this:
image_root_folder
|-- category_1
| |-- image_1.jpg
| |-- image_2.png
| |-- image_3.gif
|
|-- category_2
|-- category_3
|-- image_1.jpg
|-- image_2.png
All images will be categorized with their folder name. Images not in a subfolder will be categorized as "Uncategorized". For example:
my_album/
|-- family/
| |-- brother.jpg
| |-- mother.png
| |-- sister.gif
|
|-- my_life/
|-- my_pet/
|-- James Bond.jpg
|-- Samuel Jackson.png
brother.jpg
will be labelled as "family", while James Bond.jpg
and Samuel Jacson.png
will be labelled as "Uncategorized".
Only this structure followed can the site be generated in the correct format as in the demo.
After generation, push from the branch gh-pages
to Github and enjoy.
The project follows MIT Licence. Any issue, pull-request, feature-request, or comment is welcomed.