Power Build
Power Build is a photo album builder which generates a site based on the images in a project. It works as a command line application.
Visit Demo Site for a general understanding.
Requirement
- 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.
Installation
Run:
$gem install power-build
or manually write gem 'power-build'
in the Gemfile before you run $bundle
.
Commands
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 pages in it.
$power delete
Clean all files generated by power-build.
Config
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.
Folder Structure
Before site generation, you need to include at least the folder of your images:
My_project_folder
|-- image_root_folder
If so, after site generation, your folder will look like this:
My_project_folder
|-- image_root_folder
|-- power-build.config
|-- assets
|-- index.html
However, in your image folder, the images should be stored by categories like this:
image_root_folder
|-- category_1
| |-- image_1
| |-- image_2
| |-- image_3
|
|-- category_2
|-- category_3
Only the structure is followed can the site be generated in the correct format as in the demo.
Issues & Contribution
The project follows MIT Licence. Any issue, pull-request, feature-request, or comment is welcome.