Commit 2829c673 authored by elijah's avatar elijah
Browse files

clean up included documentation

parent 3d1053aa
upgrade to latest thinking sphinx
deleting a page tag causes the discussions to get loaded for the ajax request.
this should not be the case.
destroying groups
needs a lot of work
what to do with orphaned pages?
all the pages that have cached the owner_name should get cleared out.
(or maybe not, instead link to 'anonymous'?)
what about everywhere else? create GroupGhost with the same id but with no content?
when notices are rendered as pages, they still fade.
i18n blows up if the session language is set to swedish.
alert messages don't stack for modalbox
confirmation before destroy contact
page search:
should be 'watching' instead of 'watched'
once active, needs to indicate i clicked on 'my pages -> own'.
need ajaxy history
the split panel is not something that we should keep, unless it can
be made to work when the screen gets small.
wiki:
need history
pages:
need 'show print' option.
Crabgrass is a web application designed for activist groups to be better able to collaborate online.
![crabgrass](public/images/crabgrass.png)
Crabgrass is based on Ruby on Rails and MySQL. It is released under the AGPL license, version 3.
Crabgrass is a web application designed for activist groups to be better able to collaborate online. Mostly, it is a glorified wiki with fine-grain control over access rights.
For installation notes, see INSTALL.
\ No newline at end of file
Crabgrass is based on Ruby on Rails and MySQL. It is released under the AGPL license, version 3.
For installation notes, see [doc/INSTALL.md](doc/INSTALL.md).
Contents:
1. [Install for development](#install-for-development)
2. [Install for testing](#install-for-testing)
3. [Install for production](#install-for-production)
4. [Configuration options](#configuration-options)
1. Install for development
2. Install for testing
3. Install for production
4. Configuration options
5. Database options
6. Troubleshooting
1. Install for development
Install for development
====================================================
Install basic ruby environment
......@@ -43,19 +39,19 @@ Alternatively you can install bundler with your package manager.
Install rails and required gems
cd crabgrass-core
bundle install
cd crabgrass-core
bundle install
Create a secret
rake create_a_secret
rake create_a_secret
Create the database:
cp config/database.yml.example config/database.yml
rake db:create
rake db:schema:load
rake db:fixtures:load
cp config/database.yml.example config/database.yml
rake db:create
rake db:schema:load
rake db:fixtures:load
Install helper applications:
......@@ -80,7 +76,7 @@ Connect to the web application from your browser:
See doc/development_tips for information on the arguments to script/server
2. Install for testing
Install for testing
====================================================
Install additional gems needed for testing:
......@@ -97,7 +93,7 @@ Run tests:
bundle exec rake
3. Install for production
Install for production
====================================================
install prerequisites
......@@ -168,7 +164,7 @@ one for you from the schedule.rb config file.
whenever --update-crontab -f config/misc/schedule.rb
4. Configuration options
Configuration options
====================================================
All the options that you might want to change live in three places:
......@@ -178,10 +174,3 @@ All the options that you might want to change live in three places:
3. config/crabgrass/crabgrass-<mode>.yml.
See config/crabgrass/README for more information.
6. Troubleshooting
====================================================
delayed_job -- Currently, it seems to fail if you have multiple 'daemons' gems install.
If you encounter this problem, run `gem uninstall daemons; gem uninstall delayed_job; rake gems:install` as root.
== Welcome to Rails
Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern.
This pattern splits the view (also called the presentation) into "dumb" templates
that are primarily responsible for inserting pre-built data in between HTML tags.
The model contains the "smart" domain objects (such as Account, Product, Person,
Post) that holds all the business logic and knows how to persist themselves to
a database. The controller handles the incoming requests (such as Save New Account,
Update Product, Show Post) by manipulating the model and directing data to the view.
In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in
link:files/vendor/rails/activerecord/README.html.
The controller and view are handled by the Action Pack, which handles both
layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of
Rails. You can read more about Action Pack in
link:files/vendor/rails/actionpack/README.html.
== Getting Started
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
and your application name. Ex: rails myapp
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
4. Follow the guidelines to start developing your application
== Web Servers
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
with a variety of other web servers.
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
More info at: http://mongrel.rubyforge.org
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
== Apache .htaccess example for FCGI/CGI
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
# ErrorDocument 500 /500.html
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
== Debugging Rails
Sometimes your application goes wrong. Fortunately there are a lot of tools that
will help you debug it and get it back on the rails.
First area to check is the application log files. Have "tail -f" commands running
on the server.log and development.log. Rails will automatically display debugging
and runtime information to these files. Debugging info will also be shown in the
browser on requests from 127.0.0.1.
You can also log your own messages directly into the log file from your code using
the Ruby logger class from inside your controllers. Example:
class WeblogController < ActionController::Base
def destroy
@weblog = Weblog.find(params[:id])
@weblog.destroy
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
end
end
The result will be a message in your log file along the lines of:
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
More information on how to use the logger is at http://www.ruby-doc.org/core/
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
These two online (and free) books will bring you up to speed on the Ruby language
and also on programming in general.
== Debugger
Debugger support is available through the debugger command when you start your Mongrel or
Webrick server with --debugger. This means that you can break out of execution at any point
in the code, investigate and change the model, AND then resume execution!
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Example:
class WeblogController < ActionController::Base
def index
@posts = Post.find(:all)
debugger
end
end
So the controller will accept the action, run the first line, then present you
with a IRB prompt in the server window. Here you can do things like:
>> @posts.inspect
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
>> @posts.first.title = "hello from a debugger"
=> "hello from a debugger"
...and even better is that you can examine how your runtime objects actually work:
>> f = @posts.first
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
>> f.
Display all 152 possibilities? (y or n)
Finally, when you're ready to resume execution, you enter "cont"
== Console
You can interact with the domain model by starting the console through <tt>script/console</tt>.
Here you'll have all parts of the application configured, just like it is when the
application is running. You can inspect domain models, change values, and save to the
database. Starting the script without arguments will launch it in the development environment.
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
To reload your controllers and models after launching the console run <tt>reload!</tt>
== dbconsole
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
You would be connected to the database with the credentials defined in database.yml.
Starting the script without arguments will connect you to the development database. Passing an
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
Currently works for mysql, postgresql and sqlite.
== Description of Contents
app
Holds all the code that's specific to this particular application.
app/controllers
Holds controllers that should be named like weblogs_controller.rb for
automated URL mapping. All controllers should descend from ApplicationController
which itself descends from ActionController::Base.
app/models
Holds models that should be named like post.rb.
Most models will descend from ActiveRecord::Base.
app/views
Holds the template files for the view that should be named like
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
syntax.
app/views/layouts
Holds the template files for layouts to be used with views. This models the common
header/footer method of wrapping views. In your views, define a layout using the
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
call <% yield %> to render the view using this layout.
app/helpers
Holds view helpers that should be named like weblogs_helper.rb. These are generated
for you automatically when using script/generate for controllers. Helpers can be used to
wrap functionality for your views into methods.
config
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
db
Contains the database schema in schema.rb. db/migrate contains all
the sequence of Migrations for your schema.
doc
This directory is where your application documentation will be stored when generated
using <tt>rake doc:app</tt>
lib
Application specific libraries. Basically, any kind of custom code that doesn't
belong under controllers, models, or helpers. This directory is in the load path.
public
The directory available for the web server. Contains subdirectories for images, stylesheets,
and javascripts. Also contains the dispatchers and the default HTML files. This should be
set as the DOCUMENT_ROOT of your web server.
script
Helper scripts for automation and generation.
test
Unit and functional tests along with fixtures. When using the script/generate scripts, template
test files will be generated for you and placed in this directory.
vendor
External libraries that the application depends on. Also includes the plugins subdirectory.
If the app has frozen rails, those gems also go here, under vendor/rails/.
This directory is in the load path.
Themes are defined by folders in extensions/themes.
Themes are defined by folders in `extensions/themes`.
The structure of the folder is like this:
themename/
images/ -- directory for theme assets
init.rb -- main theme definition
navigation.rb -- navigation definition
themename/
images/ -- directory for theme assets
init.rb -- main theme definition
navigation.rb -- navigation definition
== Assets
## Assets
The "images" is a directory to hold the files that should be publicly available for this theme. The images directory will be available at the url /theme/<themename>/images. If you want to generate a path for a file extensions/themes/themename/images/icon.png, you would do url('icon.png') in init.rb or current_theme.url('icon.png') elsewhere.
== Theme Definition
## Theme Definition
The init.rb is the main theme definition file.
The init.rb is the main theme definition file.
=== Quoting
### Quoting
the theme code does a good job of figuring out if a value, when rendered as css,
should have quotes around it or not. you can force it to not have quotes by
creating a symbol, like so...
masthead {
height :"100px"
}
masthead {
height :"100px"
}
In this case, this is not needed, because values in px units are not quoted by default anyway.
=== HTML blocks
### HTML blocks
'html' is a special option. it takes either a string, a hash, or a block.
'html' is a special option. it takes either a string, a hash, or a block.
* string: inserts this value directly into the template
* hash: the template will call render() and pass in the hash.
* block: this will get eval'ed in the context of the view.
* string: inserts this value directly into the template
* hash: the template will call render() and pass in the hash.
* block: this will get eval'ed in the context of the view.
examples:
html '<h1>hi mom</h1>'
html :partial => '/views/layouts/hi.html'
html { content_tag(:h1, 'hi mom') }
html '<h1>hi mom</h1>'
html :partial => '/views/layouts/hi.html'
html { content_tag(:h1, 'hi mom') }
=== CSS blocks
### CSS blocks
'css' is a special option. The text you feed it will get included in the stylesheet as a sass mixin. This means you can make sass calls (using scss format). For example:
css "background-color: #010203 + #040506;"
css %{
$translucent-red: rgba(255, 0, 0, 0.5);
color: opacify($translucent-red, 0.8);
background-color: transparentize($translucent-red, 50%);
}
css "background-color: #010203 + #040506;"
css %{
$translucent-red: rgba(255, 0, 0, 0.5);
color: opacify($translucent-red, 0.8);
background-color: transparentize($translucent-red, 50%);
}
note: the %{} is a way to define a string in ruby, just not one that is used very often.
== Navigation Definition
## Navigation Definition
The code for the navigation definition is parsed once at startup, but you can include code blocks for any of the values that will get executed at runtime.
crabgrass-core is a basic, paired down crabgrass.
known bugs
==============================
upgrade to latest thinking sphinx
deleting a page tag causes the discussions to get loaded for the ajax request.
this should not be the case.
destroying groups
needs a lot of work
what to do with orphaned pages?
all the pages that have cached the owner_name should get cleared out.
(or maybe not, instead link to 'anonymous'?)
what about everywhere else? create GroupGhost with the same id but with no content?
when notices are rendered as pages, they still fade.
i18n blows up if the session language is set to swedish.
alert messages don't stack for modalbox
confirmation before destroy contact
page search:
should be 'watching' instead of 'watched'
once active, needs to indicate i clicked on 'my pages -> own'.
need ajaxy history
the split panel is not something that we should keep, unless it can
be made to work when the screen gets small.
wiki:
need history
pages:
need 'show print' option.
remote processing
==============================
......@@ -15,52 +50,67 @@ integrate documentcloud.org for displaying pdfs and docs.
things to work on
============================
Misc Quick
* grouphome: summary links break left column formatting
* remove details from page feeds for now
Misc
* banner width problems: https://labs.riseup.net/code/issues/4360
* Speed Problems Across App
* Search
Pages
* gallery > show formatting problems
* tasklist text doesnt line up with checkboxes
* survey page formatting and error message: https://labs.riseup.net/code/issues/4362
* wiki - versioning is a mess, full page edit form is too narrow, trying to open multiple sections for editing isnt working (see issue)
groups
. destroying group
. request to expell
* destroying group
* request to expell
directory
. group
. person
* group
* person
account
. reset lost password
. cracklib
* reset lost password
* cracklib
sphinx
. new sphinx
. better fields for sphinx
. get rid of page_terms
* new sphinx
* better fields for sphinx
* get rid of page_terms
pages
. history
. text page
. poll page
. asset page
. folder page
* history
* text page
* poll page
* asset page
* folder page
plugins
. write new plugin system
* write new plugin system
themes
. add more themes
* add more themes
tests
. minitest
. write more tests
* minitest
* write more tests
i18n
. identify used and unused keys
. a system to translate
. better en.yml organization
* identify used and unused keys
* a system to translate
* better en.yml organization
misc
. replace backgroundrb - kclair
. clean up css class usage for tabs - bootstrap and cg use different ones now - azul
* replace backgroundrb - kclair
* clean up css class usage for tabs - bootstrap and cg use different ones now - azul
new features
. issues
. notices
* issues
* notices
rails 3
============================
......@@ -105,7 +155,7 @@ indexes?
mailing list integration
=============================
two main problems:
two main problems:
(1) queuing and processing incoming messages
(2) queuing outgoing messages
......@@ -185,7 +235,7 @@ delayed database updates
Most of the database updates that are slow for the user are things that don't
need to be done right away. For example, you change one tiny thing about a page
and it kicks of tons and tons of database updates, but these are just for searching
and it kicks of tons and tons of database updates, but these are just for searching
and could be delayed.
A huge speed improvement can be acheived by running these, and the sphinx indexing,
......@@ -218,7 +268,7 @@ networked job queues:
https://github.com/ivanvanderbyl/cloudist (rabbitmq)
https://github.com/defunkt/resque (reddit)
http://mperham.github.com/sidekiq/ (faster than resque, api compatible)
backgrounding long running code:
https://github.com/tra/spawn
https://github.com/Try2Code/jobQueue
......@@ -237,7 +287,7 @@ On linux, fixes thread timeout problems:
http://systemtimer.rubyforge.org/
Unsorted links:
http://code.google.com/p/activemessaging/wiki/ActiveMessaging
http://code.google.com/p/activemessaging/wiki/ActiveMessaging
http://codeforpeople.rubyforge.org/svn/bj/trunk/README
https://github.com/barttenbrinke/worker_queue/
https://github.com/starling/active_queue
......@@ -255,8 +305,8 @@ Type A List
* avatar
* display name
* login
* online status
* you friend/ groups / networks
* online status
* you friend/ groups / networks
Type B List
......@@ -264,7 +314,7 @@ Only visible on the profile page of a user, but there can be Multiple or non at
* pictures, may be multiple.
* contact info
** email
** email
** phone