aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL.md
blob: f5ec6418b0051294a37db1bb3e711e74739416fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Installation Guide

This guide is based on mac/OS with [Homebrew](https://brew.sh/) and [RVM](https://rvm.io/)

## Ruby

Get a correct `.ruby-version` (Can we remove it from `.gitignore`?)
and install that version.

Example with [rvm](https://rvm.io/):

        rvm install 2.3.1

Add the bundler gem

        gem install bundler

Go into your local repro and install the gems

        bundle

### Caveats

`libv8` might cause you troubles, depending on your local configuration. If you have `libv8` installed (probably because of `node.js`) you might need to tell bundler/Rubygems to use the system version.


        bundle config build.libv8 --with-system-v8
        bundle

or

        gem install libv8 -v '<version>' -- --with-system-v8
        bundle

You will get the correct value of `<version>` from bundler's error message.

## Rails

### Dependencies

As documented [here](https://github.com/dryade/georuby-ext/issues/2) we need some more libs before we can start the `rake` setup tasks. On mac/OS the easiest way is just to install `postgis` now with `homebrew` as this will
install all needed libraries.

### Postgres

#### Create user

      createuser -s -U $USER -P chouette
                  ^    ^      ^
                  |    |      +---- prompt for passwd
                  |    +----- as your default postgres user (remove in case of different config)
                  +---------- superuser

When promted for the password enter the highly secure string `chouette`.


#### Create database

      bundle exec rake db:create
      bundle exec rake db:migrate

      RAILS_ENV=test bundle exec rake db:create
      RAILS_ENV=test bundle exec rake db:migrate

#### Install node.js packages

      bundle exec rake npm:installndle
      
#### Check installation

* Run tests

      bundle exec rake spec
      bundle exec rake teaspoon

* Start local server

      bundle exec rails server

### Authentication

See `config.chouette_authentication_settings`.

Use the database authentication or get an invitation to [STIF Portail](http://stif-portail-dev.af83.priv/).

### Run seed

Run :

      bundle exec rake db:seed

Two users are created : stif-boiv@af83.com/secret and stif-boiv+transporteur@af83.com/secret

If you have access to STIF CodifLigne and Reflex :

      bundle exec rake codifligne:sync
      bundle exec rake reflex:sync

To create Referential with some data (Route, JourneyPattern, VehicleJourney, etc) :

      bundle exec rake referential:create

# Troubleshooting

If Postgres complains about illegal type `hstore` in your tests that is probably because the shared extension is not installed, here is what to do:

      bundle exec rake db:test:purge

Thanks to `lib/tasks/extensions.rake`.