Development: Difference between revisions

From SoylentNews
Jump to navigation Jump to search
No edit summary
Line 22: Line 22:
* [[CssWork]] - pages for ongoing css work
* [[CssWork]] - pages for ongoing css work
* [[SlashDocumentationIndex]] - A single place to find Slash docs, one day it will be organized and accurate
* [[SlashDocumentationIndex]] - A single place to find Slash docs, one day it will be organized and accurate
 
* [[IncidentLog]] - Documentation of how incidents occurred and how they were mitigated


== Slashcode Primer ==
== Slashcode Primer ==

Revision as of 20:58, 11 March 2014

This page should be merged with Dev/Sys

Welcome

We are currently looking for volunteers to help develop SoylentNews slashcode. Anyone willing is free to help, but we really need good perl devs. Slashcode is based heavily on perl and most pages have some type of perl code on them. We also seek non-perl devs, there is plenty of stuff that you can do without touching the code too much.

Our code is hosted on GitHub at https://github.com/SoylentNews/slashcode. Have a look and see how you can contribute. Bugs are now on GitHub Bugs.

Volunteers should send an email to dev@soylentnews.org expressing your areas of interest and what your coding strengths are. Also you can hop onto SoylentNews:IRC and join the #dev channel. Come by and express your interest to paulej72, audioguy, or mrcoolbp.

Currently we are undergoing a bit of a reorganization and we hope to have more information available here soon about our short term and long term goals for the code.

Who we are

  • paulej72 -- Head catherder for Dev -- email:paulej72@soylentnews.org
  • Ncommander -- The real head of Dev but due to time constrains of being the head of SN only a member.
  • audioguy -- right hand man to paulej72 and second in command for Dev. See AudioGuyWorkNotes for current todo and working notes

Index of Development Pages and Resources

Slashcode Primer

Slashcode is a complex beast. Here is the listing of the repo:

Bundle
Slash	
bin
docs
httpd
plugins
sbin
sql
tagboxes
themes
utils


We really are only concerned with three of these directories: Slash, plugins, and themes. The first directory, Slash, is the home of the slash.pm module and its related code. The module, slash.pm, does all of the back end work of slashcode. It provides a set of APIs that are used to generate pages and manipulate the database. This is where the heavy perl coding is done. We definitely need help with this section in both expanding our knowledge and working with the code. (As I started on this from a css/html slant I do not have a good idea of what is here --pauej72)

The second main part of the system are the themes. In this case we have only one theme called slashcode. The theme is broken down into pieces the first is htdocs. htdocs is all of the static html files, perl files that directly start page generation events, the css files, images, and other static code. The second part of the theme is the templates. These templates are loaded into the database an are used by slash to layout the data from different sources and turn them into html files that apache can send to the user. Templates re a mixture of perl, slash coding, and html. Templates use slash calls to load other templates and usually each template leaves a breadcrumb in the final html with a start and end comment with the template's name and id. These breadcrumbs make it easy to find out which template file is generating the particular piece of html that you need to change.

Slashcode also has a plugin architecture that allows certain system to be bolted on to the main system. The main system is basically articles, comments and users. The pulgins add the admin interface, the messaging system, enhanced login, journals, and other things. The files for these plugging are in the plugins folder, not in the theme folder. The issue with plugins is that it contains both front end code such as templates, css and pl files, it also has perl modules that are loaded into the perl engine.

The rest of the directories are used for build and install purposes and probably will not need to be modified regularly.

This is a work in progress so please check back here for more.

Development VM

(audiogy note - will leave this here for the moment, it belongs on its own page as referenced above)

The Dev VM can be downloaded from http://torrents.soylentnews.org/. This is a vim that is designed to run on VirtualBox. Information and downloads of VirtualBox are available here: http://torrents.soylentnews.org/.

Once you get the VM downloaded and the VirtualBox up and ruining, you will want to do a File:Import Appliance in VirtualBox. This will unpack the VM into you environment. Start up the VM and log in with the username and password of slash.

The VM has port forwarding setup to you local system for ssh and http.

ssh: 8022
http; 1337

For ssh your connection string should be:

ssh slash@127.0.0.1 -p 8022

For websites, apache will use the name localhost instead of 127.0.0.1 so you will need to use:

http://localhost:1337

Apache is turned off in the VM. You will need to turn it on using the command:

apachectl start

The slash user home directory is in /srv/slashdev/. The slashcode GitHub repository is located in slashcode. This is where you will make changes to the code you want to test. The actual slashcode install is located in slash.

The first thing you should probably do is update the repo to the latest version. cd to slashcode and run git pull.

Now we need to install the new code to slash. Here is a script that will help with that. Create a new file called deployslash.sh in the slash home directory and give chmod it to 755.

deployslash.sh

#! /bin/sh


echo === Install from git repo ===
echo
cd /srv/slashdev/slashcode
make USER=slash GROUP=slash SLASH_PREFIX=/srv/slashdev/slash install

echo
echo
echo === Clean up CSS and install Templates ==
echo
rm -rf /srv/slashdev/slash/site/slashdev/htdocs/*css

/srv/slashdev/slash/bin/symlink-tool -U
/srv/slashdev/slash/bin/template-tool -U

echo
echo
echo === Restart Apache==
echo
/srv/slashdev/apache/bin/apachectl restart

This script will be part of the next version of the Dev VM.

To do simple updates, you would make changes to the files in slashcode and redeploy using the deployslash.sh script.

What if you want to develop code and have it merged into the main repo? In this case you will need to setup your own copy of the repo do do your development work. First if you do not have your own account on GitHub please set one up. Next go to the slashcode site https://github.com/SoylentNews/slashcode and click on Fork in the upper right. Fork the repo to your user account.

Now on the VM go to slashcode. We will setup your copy of the repo as a remote. Run the commands:

git remote add {name} {url-to-your-GitHub-repo}

git fetch {name}

checkout {name}/master


Redeploy slash and you are working from your own repo. As you may have noticed the primary work is being done on the master branch. You will not need to worry about the other branches of the code for now.

Once you get code you like, and have it committed to your personal fork, you can do a Pull Request, https://help.github.com/articles/using-pull-requests, that will create a ticket for the SoylentNews/slashcode repo to merge your commits to the master branch. After proper testing by the Dev team and other sanity checks, you code will be merged and eventually put on to the production servers.


Just a note: I am new to git, so the above directions are what I have been using. If people have a better method for doing this please feel free to update this page with the new information --pauulej72.