Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 0 additions & 245 deletions README

This file was deleted.

86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
See the [README](http://rails.documentation.codyrobbins.com/2.3.18/) of the Ruby on Rails 2.3.18 Documentation for more info.

# Running the OpenStreetView

Step-to-step tested in Ubuntu 12.04.4 LTS "Precise".

## System dependencies
```bash
sudo apt-get install build-essential git ruby ruby-dev libmysqlclient-dev mysql-server imagemagick
```

## Rails
```bash
sudo apt-get install rubygems
sudo gem install -v=2.3.18 rails
```
This command take a few seconds to start showing output.

**If you face "Gem.source_index deprecated"** (issue #38) at the "Web start", you can switch to `slimgems` and retrace the steps of the "Ruby dependencies" section (below):

```bash
sudo gem install slimgems
sudo gem install -v=2.3.18 rails
```
This has happened with Ubuntu 12.04.4 LTS "Precise".

Attention! In this case, do not forget to retrace the steps of the "Ruby dependencies" section (below).

## OSV + auth
```bash
sudo mkdir -p /srv/http
cd !$

# $MYGITDIR example: /home/USER/Git/
sudo ln -s $MYGITDIR/OpenStreetView openstreetview
cd $MYGITDIR/OpenStreetView

git clone git://github.com/technoweenie/restful-authentication.git vendor/plugins/restful_authentication
```

For fixing the issue #37:
```bash
mv fix_issue_37.patch vendor/plugins/restful_authentication/
cd vendor/plugins/restful_authentication/
patch lib/authorization/aasm_roles.rb < fix_issue_37.patch

# do not forget to come back:
cd $MYGITDIR/OpenStreetView
```
This because the project [restful-authentication](https://github.com/technoweenie/restful-authentication) is not accepting pull requests there are four years.

## Ruby dependencies
```bash
sudo rake gems:install
sudo gem install mysql
```

## Database creation
```bash
cat << EOF | mysql -h localhost -u root -p
CREATE DATABASE openstreetview_org_development;
GRANT ALL ON openstreetview_org_development.* TO DB_USER@localhost IDENTIFIED BY 'DB_PASS';
EOF

# change the connection config
sed -i 's@/tmp/mysql.sock@/var/run/mysqld/mysqld.sock@' config/database.yml
sed -i 's@username: root@username: DB_USER@' config/database.yml
sed -i 's@password:@password: DB_PASS@' config/database.yml

rake db:migrate RAILS_ENV="development"
```

## Web start
```bash
./script/server -e development -p3002
```

1. Access `http://localhost:3002` → [Go!](http://localhost:3002)
1. Create an account
1. Access the log: `less -R log/development.log`
1. Get a activation link that looks with <tt>http://localhost:3002/activate/b082238ef819c39136d71a3558821b0cd5577b10</tt>
1. Access it
1. You can to access your account now!

Remember that you need to run `script/tools/processor.rb` manually and **keep it running**.

44 changes: 44 additions & 0 deletions fix_issue_37.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--- lib/authorization/aasm_roles.rb 2014-03-12 23:33:33.000000000 -0300
+++ lib/authorization/aasm_roles.rb 2014-03-12 23:32:39.000000000 -0300
@@ -10,30 +10,30 @@
include StatefulRolesInstanceMethods
include AASM
aasm_column :state
- aasm_initial_state :pending
- aasm_state :passive
- aasm_state :pending, :enter => :make_activation_code
- aasm_state :active, :enter => :do_activate
- aasm_state :suspended
- aasm_state :deleted, :enter => :do_delete
+ aasm.initial_state :pending
+ aasm.state :passive
+ aasm.state :pending, :enter => :make_activation_code
+ aasm.state :active, :enter => :do_activate
+ aasm.state :suspended
+ aasm.state :deleted, :enter => :do_delete

- aasm_event :register do
+ aasm.event :register do
transitions :from => :passive, :to => :pending, :guard => Proc.new {|u| !(u.crypted_password.blank? && u.password.blank?) }
end

- aasm_event :activate do
+ aasm.event :activate do
transitions :from => :pending, :to => :active
end

- aasm_event :suspend do
+ aasm.event :suspend do
transitions :from => [:passive, :pending, :active], :to => :suspended
end

- aasm_event :delete do
+ aasm.event :delete do
transitions :from => [:passive, :pending, :active, :suspended], :to => :deleted
end

- aasm_event :unsuspend do
+ aasm.event :unsuspend do
transitions :from => :suspended, :to => :active, :guard => Proc.new {|u| !u.activated_at.blank? }
transitions :from => :suspended, :to => :pending, :guard => Proc.new {|u| !u.activation_code.blank? }
transitions :from => :suspended, :to => :passive