Skip to content

Commit 98dbefe

Browse files
authored
Merge branch 'master' into comment-latest
2 parents cf35b17 + 1d72a29 commit 98dbefe

File tree

178 files changed

+2296
-688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2296
-688
lines changed

Docker.md

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@ LinuxFr on Docker
22
-----------------
33

44
To simplify set up of a developement environment, LinuxFr.org can be
5-
run on Docker with `docker-compose up`.
5+
run on Docker with `docker compose up`.
66

77
To init the SQL database schema, you need to wait upto the `database`
8-
and `database-test` containers are ready to listen MySQL connections.
8+
container to be ready to listen MySQL connections.
99

1010
For example, you should see in the logs:
1111

12-
> database-test_1 | 2020-09-21 16:03:12 140126029907968 [Note] mysqld: ready for connections.
13-
>
14-
> database-test_1 | Version: '10.1.46-MariaDB-1\~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
15-
>
1612
> database_1 | 2020-09-21 16:03:12 139820938893312 [Note] mysqld: ready for connections.
1713
>
1814
> database_1 | Version: '10.1.46-MariaDB-1\~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
1915
16+
Or you can check the `database` container status to be "healthy".
17+
2018
Then, open a second terminal and run:
2119

2220
```
23-
docker-compose run linuxfr.org bin/rails db:setup
21+
docker compose exec linuxfr.org bin/rails db:setup
2422
```
2523

2624
Finally, the environment is ready and you can open [http://dlfp.lo](http://dlfp.lo)
2725
in your favorite browser.
2826

29-
Note: to be able to access this URL, you'll need to add the line
30-
`127.0.0.1 dlfp.lo image.dlfp.lo` to the `/etc/hosts` file of your
31-
machine.
27+
Note: to be able to access this URL, you'll need to add the following line
28+
into the `/etc/hosts` file of your machine:
29+
30+
```
31+
127.0.0.1 dlfp.lo image.dlfp.lo
32+
```
3233

3334
Personalize configuration
3435
=========================
@@ -44,7 +45,7 @@ service.
4445

4546
If you want to change the application port and/or other configurations, you can
4647
[override](https://docs.docker.com/compose/extends/)
47-
the docker-compose configuration (in particular the `nginx` service for
48+
the docker compose configuration (in particular the `nginx` service for
4849
the port).
4950

5051
Notice, that if LinuxFr.org doesn't run on port 80, the image cache
@@ -53,7 +54,7 @@ service won't work well and so you won't be able to see images in the news.
5354
Test modifications
5455
==================
5556

56-
The docker-compose is currently configured to share `./app`, `./db` and
57+
The docker compose is currently configured to share `./app`, `./db` and
5758
`./public` directories with the docker container.
5859

5960
So you can update files with your prefered IDE on your machine. Rails
@@ -62,39 +63,61 @@ will directly detect changes and apply them on next page reload.
6263
Furthermore, if you need to access the Rails console, you need a second
6364
terminal and run:
6465

65-
`docker-compose run linuxfr.org bin/rails console`
66+
```
67+
docker compose exec linuxfr.org bin/rails console
68+
```
6669

6770
Note: currently, we didn't configure rails to show directly the
6871
`webconsole` in your browser. That's just because of time needed to
6972
find the good configuration, any help will be appreciated !
7073

71-
Inspect database schema
72-
=======================
74+
Run application tests
75+
=====================
76+
77+
To help maintainers, we are in the process of adding tests to check the
78+
application has still the expected behaviour.
7379

74-
In case you need to inspect the database, you need a second terminal
75-
and run:
80+
To get help about writing tests, see the
81+
[Ruby on Rails documentation](https://guides.rubyonrails.org/testing.html#the-rails-test-runner)
82+
.
7683

77-
`docker-compose run database mysql -hdatabase -ulinuxfr_rails -p linuxfr_rails`
84+
To run tests with Docker environment, you need to use this command:
7885

79-
By default, the requested password is the same as the username.
86+
```
87+
docker compose exec linuxfr.org bin/rails test -v
88+
```
89+
90+
Inspect the database schema
91+
===========================
92+
93+
In case you need to inspect the database, the port `3306` of your machine is
94+
by default bound to the port `3306` of the database container.
95+
96+
Thus you can connect to the linuxfr database with hostname `localhost` and the
97+
username, password and database name defined in the `deployment/default.env`
98+
configuration file (all three last are by default `linuxfr_rails`).
8099

81100
Apply database migrations
82101
=========================
83102

84103
In case you need to apply new database migrations, you need a second
85104
terminal and run:
86105

87-
`docker-compose run linuxfr.org bin/rails db:migrate`
106+
```
107+
docker compose exec linuxfr.org bin/rails db:migrate
108+
```
88109

89110
If you had issue and want to reset all data in your database system,
90111
use:
91112

92-
`docker-compose run linuxfr.org bin/rails db:reset`
113+
```
114+
docker compose exec linuxfr.org bin/rails db:reset
115+
```
93116

94-
Services provided by the docker-compose
117+
Services provided by the docker compose
95118
=======================================
96119

97-
Currently, these services are directly enabled by docker-compose:
120+
Currently, these services are directly enabled by docker compose:
98121

99122
1. The [LinuxFr.org](https://github.com/linuxfrorg/linuxfr.org)
100123
ruby on rails application itself
@@ -111,7 +134,7 @@ For now, these services aren't available:
111134
because it requires to run
112135
LinuxFr.org with a TLS certificate. When the service will accept to
113136
fetch articles with simple `http://`, we'll be able to provide it
114-
directly with docker-compose.
137+
directly with docker compose.
115138
2. The [svgtex service](https://github.com/linuxfrorg/svgtex), because LinuxFr
116139
has hard-coded the `localhost`
117140
hostname in it's [HTML Pipeline tool](https://github.com/linuxfrorg/html-pipeline-linuxfr/blob/linuxfr/lib/html/pipeline/linuxfr.rb#L8)

Gemfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ gem "sass-rails", "~>5.0", require: assets
4545
gem "rails-sass-images", require: assets
4646
gem "uglifier", require: assets
4747

48+
group :development, :test do
49+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
50+
gem "byebug", platforms: :mri
51+
end
52+
4853
group :development do
4954
gem "annotate"
5055
gem "better_errors"
5156
gem "binding_of_caller"
52-
gem "byebug", platform: :mri
5357
gem "capistrano", "~>2.15", github: 'capistrano', branch: 'legacy-v2'
5458
gem "capistrano-maintenance"
5559
gem "letter_opener"
@@ -62,6 +66,12 @@ group :development do
6266
gem "web-console"
6367
end
6468

69+
group :test do
70+
# Adds support for Capybara system testing and selenium driver
71+
gem "capybara", ">= 2.15"
72+
gem "selenium-webdriver"
73+
end
74+
6575
group :production, :alpha do
6676
gem "unicorn", "~>5.1"
6777
gem "gctools", "~>0.2"

INSTALL.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,24 @@ server {
176176
177177
listen 0.0.0.0:80;
178178
179-
location ~ ^/(avatars|medias)/ {
179+
location ~ ^/medias/ {
180180
root /home/linuxfr/linuxfr.org/uploads;
181181
}
182182
183-
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
183+
# Avatars files uploaded on linuxfr server are stored in partitions
184+
# with folder name containing 3 digits
185+
location ~ ^/avatars/\d\d\d/ {
186+
root /home/linuxfr/linuxfr.org/uploads;
187+
}
188+
189+
# Avatars URLs has to be served by the image service
190+
location ~ ^/avatars/ {
191+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
192+
proxy_pass http://localhost:8000;
193+
}
194+
184195
location /img/ {
196+
# To install the LinuxFr img service, see: https://github.com/linuxfrorg/img-LinuxFr.org
185197
proxy_pass http://localhost:8000;
186198
}
187199

app/assets/javascripts/application.coffee

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ $("textarea, #form_answers input").keypress (event) ->
3333

3434
# Add/Remove dynamically links in the news form
3535
langs =
36+
xx: "!? hmmm ?!"
3637
fr: "Français"
37-
en: "Anglais"
3838
de: "Allemand"
39+
en: "Anglais"
3940
eu: "Basque"
4041
ct: "Catalan"
4142
cn: "Chinois"
43+
wq: "Code/binaire"
4244
ko: "Coréen"
4345
da: "Danois"
4446
es: "Espagnol"
47+
ee: "Estonien"
4548
fi: "Finnois"
4649
el: "Grec"
4750
it: "Italien"
@@ -52,7 +55,6 @@ langs =
5255
pt: "Portugais"
5356
ru: "Russe"
5457
sv: "Suédois"
55-
xx: "!? hmmm ?!"
5658

5759
$("#form_links").nested_fields "news", "link", "lien", "fieldset", title: "text", url: "url", lang: langs
5860
$("#form_answers").nested_fields "poll", "answer", "choix", "p", answer: "text"
@@ -63,7 +65,7 @@ $("article.news .edited_by").each ->
6365
nb = field.find("a").length
6466
if nb > 3
6567
was = field.html()
66-
field.html "<a>#{nb} contributeurs</a>"
68+
field.html "<a>#{nb} personnes</a>"
6769
field.one "click", -> field.html was
6870

6971
# Toolbar preferences

app/assets/javascripts/chat.coffee

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ class Chat
144144
.css(display: "none", position: "absolute")
145145
.append("<img src=\"#{@totoz_url}#{totozName}\"/>")
146146
@totoz.append totoz
147-
offset = $(event.target).offset()
148-
[x, y] = [offset.left, offset.top]
149-
totoz.css "z-index": "15", display: "block", top: y + 20, left: x + 20
147+
position = $(event.target).position()
148+
[x, y] = [position.left, position.top + event.target.offsetHeight]
149+
totoz.css "z-index": "15", display: "block", top: y + 5, left: x + 5
150150

151151
destroyTotoz: (event) =>
152152
totozId = encodeURIComponent(event.target.getAttribute("data-totoz-name")).replace(/[%']/g, "")

app/assets/stylesheets/contrib/grayscale.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,11 @@ form#new_diary > p:nth-child(4) {
23112311
position: relative;
23122312
top: 2px;
23132313
}
2314+
*:not(.markItUpHeader) > ul > .link[lang="ee"]:before {
2315+
content: url("/images/langs/ee.png");
2316+
position: relative;
2317+
top: 2px;
2318+
}
23142319
*:not(.markItUpHeader) > ul > .link[lang="el"]:before {
23152320
content: url("/images/contrib/grayscale/flags/el.png");
23162321
position: relative;
@@ -2391,6 +2396,11 @@ form#new_diary > p:nth-child(4) {
23912396
position: relative;
23922397
top: 2px;
23932398
}
2399+
*:not(.markItUpHeader) > ul > .link[lang="wq"]:before {
2400+
content: url("/images/langs/wq.png");
2401+
position: relative;
2402+
top: 2px;
2403+
}
23942404
#phare .link,
23952405
#phare .meta,
23962406
#phare footer {

app/assets/stylesheets/contrib/kaiska-new.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,9 @@ li.link[lang="da"] {
763763
li.link[lang="de"] {
764764
list-style: url("/images/langs/de.png");
765765
}
766+
li.link[lang="ee"] {
767+
list-style: url("/images/langs/ee.png");
768+
}
766769
li.link[lang="el"] {
767770
list-style: url("/images/langs/el.png");
768771
}
@@ -811,6 +814,9 @@ li.link[lang="sv"] {
811814
li.link[lang="xx"] {
812815
list-style: url("/images/langs/xx.png");
813816
}
817+
li.link[lang="wq"] {
818+
list-style: url("/images/langs/wq.png");
819+
}
814820

815821
div.content a[href^="/wiki/"],
816822
div.content a[href^="//linuxfr.org/wiki/"] {

app/assets/stylesheets/contrib/solarized/langs.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ li.link[lang="da"] {
1515
li.link[lang="de"] {
1616
list-style-image: url("/images/langs/de.png");
1717
}
18+
li.link[lang="ee"] {
19+
list-style-image: url("/images/langs/ee.png");
20+
}
1821
li.link[lang="el"] {
1922
list-style-image: url("/images/langs/el.png");
2023
}
@@ -63,3 +66,6 @@ li.link[lang="sv"] {
6366
li.link[lang="xx"] {
6467
list-style-image: url("/images/langs/xx.png");
6568
}
69+
li.link[lang="wq"] {
70+
list-style-image: url("/images/langs/wq.png");
71+
}

app/assets/stylesheets/parts/content.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ul.threads > li.comment,
44
ul.comments_list > li.comment,
55
.markdown_cheatsheet,
66
#contents > form,
7+
#followup_container,
78
form#new_post,
89
body#users-comments #contents > ul > li,
910
body#comments-create #contents > ul > li#comment_new,

app/assets/stylesheets/parts/redaction.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,12 @@ body#redaction-index {
528528
float: left;
529529
margin: 12px 25px 0 0;
530530
}
531+
532+
#followup_mail {
533+
font-family: mono;
534+
hyphens: none;
535+
border-width: 1px;
536+
pre {
537+
white-space: pre-wrap;
538+
}
539+
}

0 commit comments

Comments
 (0)