merge master

This commit is contained in:
xdite 2013-02-13 15:16:39 +08:00
commit a7908e07d1
260 changed files with 3643 additions and 759 deletions

6
.gitignore vendored
View File

@ -19,6 +19,9 @@ dump.rdb
/cache
/coverage/*
config/database.yml
config/redis.yml
# Ignore the default SQLite database and db dumps
/db/*.sqlite3
/dbs/*.sql
@ -59,3 +62,6 @@ config/fog_credentials.yml
# Scripts used for downloading/refshing db
script/download_db
script/refresh_db
# temp directory for chef (used to configure vagrant VM)
chef/tmp/*

View File

@ -2,6 +2,8 @@ language: ruby
rvm:
- 1.9.3
before_script:
- cp config/database.yml.sample config/database.yml
- cp config/redis.yml.sample config/redis.yml
- psql -c 'create database discourse_test;' -U postgres
- rake db:migrate
script: 'rake spec && bundle exec guard-jasmine --server-timeout=60'

128
DEVELOPER-ADVANCED.md Normal file
View File

@ -0,0 +1,128 @@
# Discourse Advanced Developer Install Guide
This guide is aimed at advanced Rails developers who have installed their own Rails apps before. If you are new
to rails, you are likely much better off with our **[Discourse Vagrant Developer Guide](https://github.com/discourse/discourse/blob/master/VAGRANT.md)**.
## First Steps
1. Install and configure PostgreSQL 9.1+
2. Install and configure Redis 2+
3. Install Rails 1.9.3 and Bundler.
3. Clone the project.
4. Create development and test databases in postgres.
5. Copy `config/database.yml.sample' and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml.sample` and input the correct values to point to your postgres and redis instances.
6. We recommend starting with seed data to play around in your development environment. [Download Seed SQL Data](http://discourse.org/vms/dev-discourse-seed.sql). Install it into postgres using a command like this: `psql -d discourse_development < dev-discourse-seed.sql`.
## Before you start Rails
1. `bundle install`
2. `rake db:migrate`
3. `rake db:test:prepare`
4. Try running the specs: `bundle exec rspec`
5. `bundle exec rails server`
You should now be able to connect to rails on http://localhost:3000 - try it out! The seed data includes a pinned topic that explains how to get an admin account, so start there! Happy hacking!
# Building your own Vagrant VM
Here are the steps we used to create the **[Vagrant Virtual Machine](https://github.com/discourse/discourse/blob/master/VAGRANT.md)**. They might be useful if you plan on setting up an environment from scratch on Linux:
## Base box
Vagrant version 1.0.5. With this Vagrantfile:
Vagrant::Config.run do |config|
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
config.vm.network :hostonly, '192.168.10.200'
if RUBY_PLATFORM =~ /darwin/
config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
end
end
vagrant up
vagrant ssh
## Some basic setup:
sudo su -
ln -sf /usr/share/zoneinfo/Canada/Eastern /etc/localtime
apt-get -yqq update
apt-get -yqq install python-software-properties
apt-get -yqq install vim curl expect debconf-utils git-core build-essential zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev libpcre3 libpcre3-dev
## Unicode
echo "export LANGUAGE=en_US.UTF-8" >> /etc/bash.bashrc
echo "export LANG=en_US.UTF-8" >> /etc/bash.bashrc
echo "export LC_ALL=en_US.UTF-8" >> /etc/bash.bashrc
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
## RVM and Ruby
apt-get -yqq install libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config curl build-essential git
su - vagrant -c "sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
adduser vagrant rvm
source /etc/profile.d/rvm.sh
su - vagrant -c "rvm pkg install libyaml"
su - vagrant -c "rvm install 1.9.3-p374"
su - vagrant -c "rvm use 1.9.3-p374 --default"
echo "gem: --no-rdoc --no-ri" >> /etc/gemrc
su - vagrant -c "echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc"
## Postgres 9.1
Configure so that the vagrant user doesn't need to provide username and password.
apt-get -yqq install postgresql postgresql-contrib-9.1 libpq-dev postgresql-server-dev-9.1
su - postgres
psql -c "CREATE USER vagrant WITH PASSWORD 'password';"
psql -c "ALTER USER vagrant WITH PASSWORD 'password';"
createdb vagrant
psql -c "CREATE EXTENSION hstore;"
psql -c "ALTER USER vagrant CREATEDB"
psql -c "create database discourse_development owner vagrant encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner vagrant encoding 'UTF8' TEMPLATE template0;"
Also, a user "discourse" is needed when importing a database image.
createuser --createdb --superuser discourse
psql -c "ALTER USER discourse WITH PASSWORD 'password';"
Edit /etc/postgresql/9.1/main/pg_hba.conf to have this:
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
host all all 0.0.0.0/0 trust # wide-open
Download a database image from [http://discourse.org/vms/dev-discourse-seed.sql][1]
Load it (as vagrant user):
psql -d discourse_development < dev-discourse-seed.sql
## Redis
mkdir /tmp/redis_install
cd /tmp/redis_install
wget http://redis.googlecode.com/files/redis-2.6.7.tar.gz
tar xvf redis-2.6.7.tar.gz
cd redis-2.6.7
make
make install
cd utils
./install_server.sh
# Press enter to accept all the defaults
/etc/init.d/redis_6379 start

View File

@ -90,5 +90,7 @@ end
group :development do
gem 'better_errors'
gem 'binding_of_caller' # I tried adding this and got an occational crash
gem 'librarian', '>= 0.0.25', require: false
gem 'pry-rails'
end

View File

@ -98,6 +98,7 @@ GEM
airbrake (3.1.2)
activesupport
builder
archive-tar-minitar (0.5.2)
arel (3.0.2)
barber (0.2.0)
execjs
@ -112,6 +113,20 @@ GEM
facter (>= 1.6.12)
timers (>= 1.0.0)
certified (0.1.1)
chef (11.2.0)
erubis
highline (>= 1.6.9)
json (~> 1.7.6, >= 1.4.4)
mixlib-authentication (>= 1.3.0)
mixlib-cli (~> 1.3.0)
mixlib-config (>= 1.1.2)
mixlib-log (>= 1.3.0)
mixlib-shellout
net-ssh (~> 2.6)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0)
rest-client (>= 1.0.4, < 1.7.0)
yajl-ruby (~> 1.1)
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
clockwork (0.4.1)
@ -174,6 +189,7 @@ GEM
haml (3.1.7)
has_ip_address (0.0.1)
hashie (1.2.0)
highline (1.6.15)
hike (1.2.1)
hiredis (0.4.5)
hpricot (0.8.6)
@ -188,6 +204,7 @@ GEM
progress (~> 2.4.0)
image_size (1.1.1)
in_threads (1.1.1)
ipaddress (0.8.0)
jasminerice (0.0.10)
coffee-rails
haml
@ -198,6 +215,11 @@ GEM
json (1.7.7)
jwt (0.1.5)
multi_json (>= 1.0)
librarian (0.0.26)
archive-tar-minitar (>= 0.5.2)
chef (>= 0.10)
highline
thor (~> 0.15)
libv8 (3.11.8.13)
listen (0.7.2)
lumberjack (1.0.2)
@ -208,6 +230,12 @@ GEM
metaclass (0.0.1)
method_source (0.8.1)
mime-types (1.21)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.4.1)
mixlib-shellout (1.1.0)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.5.1)
@ -216,6 +244,11 @@ GEM
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.6.3)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
nokogiri (1.5.6)
oauth (0.4.7)
oauth2 (0.8.0)
@ -224,6 +257,14 @@ GEM
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
ohai (6.16.0)
ipaddress
mixlib-cli
mixlib-config
mixlib-log
mixlib-shellout
systemu
yajl-ruby
oj (2.0.3)
omniauth (1.1.1)
hashie (~> 1.2)
@ -356,8 +397,8 @@ GEM
rack (~> 1.4)
rack-protection (~> 1.3)
tilt (~> 1.3, >= 1.3.3)
slim (1.3.0)
temple (~> 0.4.1)
slim (1.3.6)
temple (~> 0.5.5)
tilt (~> 1.3.3)
slop (3.4.3)
spork (0.9.2)
@ -366,7 +407,8 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
temple (0.4.1)
systemu (2.5.2)
temple (0.5.5)
terminal-notifier-guard (1.5.3)
terminal-table (1.4.5)
therubyracer (0.11.3)
@ -389,6 +431,7 @@ GEM
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
yajl-ruby (1.1.0)
PLATFORMS
ruby
@ -423,6 +466,7 @@ DEPENDENCIES
image_optim
jasminerice
jquery-rails
librarian (>= 0.0.25)
message_bus!
mocha
multi_json

View File

@ -13,26 +13,15 @@ Whenever you need ...
## Getting Started
If you're interested in helping us develop Discourse, please start with our **[Discourse Developer Install Guide](https://github.com/discourse/discourse/blob/master/DEVELOPMENT.md)**, which includes instructions to get up and running in a development environment.
If you're interested in helping us develop Discourse, please start with our **[Discourse Vagrant Developer Guide](https://github.com/discourse/discourse/blob/master/VAGRANT.md)**, which includes instructions to get up and running in a development environment using a virtual machine. It's the easiest way to hack on Discourse.
If you're familiar with how Rails works and are comfortable setting up your own environemnt, you can use our **[Discourse Advanced Developer Guide](https://github.com/discourse/discourse/blob/master/DEVELOPER-ADVANCED.md)**
### Requirements
* PostgreSQL 9.1+
* Redis 2+
### The quick and easy setup
```
git clone git@github.com:discourse/discourse.git
cd discourse
bundle install
rake db:create
rake db:migrate
rake db:seed_fu
redis-cli flushall
thin start
```
## Vision
This is the **Civilized Discourse Construction Kit**, a fully open-source package of forum software that is free to use and contribute to. Discourse embraces the changes that are necessary to evolve forum software, namely:
@ -64,6 +53,7 @@ This vision translates to the following functional commitments:
## Contributing
[![Build Status](https://travis-ci.org/discourse/discourse.png)](https://travis-ci.org/discourse/discourse)
[![Code Climate](https://codeclimate.com/github/discourse/discourse.png)](https://codeclimate.com/github/discourse/discourse)
Discourse is **100% free** and **open-source**. We encourage and support an active, healthy community that
accepts contributions from the public, and we'd like you to be a part of that community.

View File

@ -1,6 +1,8 @@
# Discourse Developer Install Guide
# Discourse Developer Install Guide (Vagrant)
If you'd like to set up a development environment for Discourse, the easiest way is by using a virtual machine.
If you have experience setting up Rails projects, you might want to take a look at our **[Discourse Advanced Developer Guide](https://github.com/discourse/discourse/blob/master/DEVELOPER-ADVANCED.md)**.
It also contains instructions on building your own Vagrant VM.
The following instructions will automatically download and provision a virtual machine for you to begin hacking
on Discourse with:
@ -49,7 +51,7 @@ Once your VM is up to date, you can start a rails instance using the following c
bundle exec rails server
```
In a few seconds, rails will start server pages. To access them, open a web browser to http://localhost:4000 - if it all worked you should see discourse! Congratulations, you are ready to start working!
In a few seconds, rails will start serving pages. To access them, open a web browser to http://localhost:4000 - if it all worked you should see discourse! Congratulations, you are ready to start working!
You can now edit files on your local file system, using your favorite text editor or IDE. When you reload your web browser, it should have the latest changes.

23
Vagrantfile vendored
View File

@ -27,4 +27,27 @@ Vagrant::Config.run do |config|
nfs_setting = RUBY_PLATFORM =~ /darwin/ ? true : false
config.vm.share_folder("v-root", "/vagrant", ".", :nfs => nfs_setting)
chef_cookbooks_path = ["chef/cookbooks"]
# The first chef run just upgrades the chef installation using omnibus
config.vm.provision :chef_solo do |chef|
chef.binary_env = "GEM_HOME=/opt/vagrant_ruby/lib/ruby/gems/1.8/ GEM_PATH= "
chef.binary_path = "/opt/vagrant_ruby/bin/"
chef.cookbooks_path = chef_cookbooks_path
chef.add_recipe "recipe[omnibus_updater]"
chef.add_recipe "discourse"
chef.json = { :omnibus_updater => { 'version_search' => false }}
end
# The second chef run uses the updated chef-solo and does normal configuration
config.vm.provision :chef_solo do |chef|
chef.binary_env = "GEM_HOME=/opt/chef/embedded/lib/ruby/gems/1.9.1/ GEM_PATH= "
chef.binary_path = "/opt/chef/bin/"
chef.cookbooks_path = chef_cookbooks_path
chef.add_recipe "recipe[apt]"
chef.add_recipe "recipe[build-essential]"
chef.add_recipe "recipe[phantomjs]"
chef.add_recipe "recipe[vim]"
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Some files were not shown because too many files have changed in this diff Show More