RtkDev:Clone and configure the project
From RevTK
Contents |
Clone the project
Clone the Github project, note that this will create the subdirectory for you:
$ git clone git://github.com/fabd/RevTK.git $ cd revtk
Or if you don't plan to use Git yet, you can download the source here.
Download dependencies
Download YUI 3.0.0, make sure to select "Full Developer Kit". Save it somewhere in your development path (not in the RevTK codebase), for example ~/Dev/Frameworks/yui_3.0.0
Configure your local version
Create the local database:
$ mysql -u root -h localhost -p<PASSWORD> mysql> CREATE DATABASE revtk; mysql> USE revtk; mysql> SOURCE data/schemas/revtk_schema.sql; mysql> exit
Copy the example settings file apps/revtk/config/settings.example.php to settings.php in the same location:
$ cp apps/revtk/config/settings.example.php apps/revtk/config/settings.php
And edit your database connection settings:
# change this part... 'database_connection' => array ( 'database' => 'revtk', 'host' => 'localhost', 'username' => 'root', 'password' => 'YOUR_MYSQL_PASSWORD', 'set_names_utf8' => true ),
Create an admin user and a test user. You can add the options --email <EMAIL_ADDRESS> and --location "<COUNTRY_CITY>" if you want:
$ php batch/maintenance/createUser.php --username "admin" --password "admin" --level 9 $ php batch/maintenance/createUser.php --username "foobar" --password "foobar"
Load the contents of the kanjis table. Perl scripts that were used to generate the data from KANJIDIC files and such will be included at some point, for now it is easier to load data from a file.
$ unzip -d data data/table_kanjis.utf8.zip $ mysql -u root -h localhost -p<PASSWORD> revtk mysql> LOAD DATA LOCAL INFILE 'data/table_kanjis.utf8' INTO TABLE kanjis; mysql> exit
Create the Core documentation settings file, this file does not require editing:
$ cp apps/core/config/settings.example.php apps/core/config/settings.php
Create the Juicer configuration file. Juicer is a build tool that will concatenate javascript and stylesheets. Copy the example file and then edit it (`juicer.config.php`) and follow the comments inside (install the required javascript framework, set the paths correctly):
$ cp apps/revtk/config/juicer.config.example.php apps/revtk/config/juicer.config.php
Note: these are the simplest steps to get you up and running with a local DEVELOPMENT MODE version of the website. The production web site requires other environments to be defined in the settings.php file such as 'prod' and 'staging'. Each environment can override any of the settings, so each environment can use a different database, password, emails, and so on.
Setup the virtual host
Some quick snippets to setup your virtual host.
Add the subdomain to your hosts file:
# Mac OS: /private/etc/hosts # Windows: C:\WINDOWS\system32\drivers\etc\hosts 127.0.0.1 kanji.dev.localhost
Add the virtual host definition, set the paths to point to the web subfolder of the project.
On Mac OS you can edit /private/etc/apache2/httpd.conf, but what works for me is editing the user specific file at /private/etc/apache2/users/<USERNAME>.conf
# Mac OS: /private/etc/apache2/users/<USERNAME>.conf
# Windows: C:\Program files\Apache Group\Apache2\conf\httpd.conf
# I have that on Windows
NameVirtualHost 127.0.0.1
# I have that on Mac OS
NameVirtualHost *:80
<VirtualHost *:80>
ServerName kanji.dev.localhost
DocumentRoot /Users/faB/Sites/RevTK/web
<Directory "/Users/faB/Sites/RevTK/web">
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
Restart Apache! And be wary of the aggressive browser caching from Chrome, use "Clear Browsing Data" if in doubt.
Notes on the local version
Members List The members list will be nearly empty most of the time, because it looks for recent activity. Even if you create a lot of users and review some flashcards with those, they will eventually fall out of the list.
Site news You'll have to use some kind of database GUI to edit these. There is some backend code but for security reasons, I'm not sure it should go into the repository. In the backend I have a very simple sitenews table list using the same table widgets you can see on the members list, with edit links. I have a simple form to edit the site news content. We really should switch to a blog so that users can comment on the site announcements (TODO).
LocalAssets For this first public open source release, I have included a "LocalAssets" helper, which task is to include proprietary or sensitive content (eg. PayPal data, affiliate ids, ...) into the website templates. I've tried to keep these "local assets" to a minimum to allow anyone willing, to collaborate with the site's documentation and other content of the website.
The way it currently works is that "local" assets use a file naming pattern excluded from commits, as configured in the .gitignore file. So the project maintainer has some extra files that don't go into the commits. By default, when a cloned copy looks for these files, they are not there, so a small box is inserted in the template instead, with a message indicating the name of the asset (eg. "Public site content: donateForm").
