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

dd/359/do_with_docker_v5 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

captainenhancement
Copy link

@captainenhancement captainenhancement commented Feb 24, 2019

same as PR #4 (do_with_docker() feature and it's tests, reformatted according Lua-coding-guidelines) but without devel history

upd:
= no changes in code
= test passes successfully
* 2 commits -> 3 commits

@agladysh
Copy link
Member

NB: лучше ссылаться на PR вот так: #4

@RussDragon
Copy link
Contributor

Вынеси, пожалуйста, добавление необходимых докеры файлов в отдельный коммит.

@captainenhancement captainenhancement force-pushed the dd/359/do_with_docker_v5 branch 3 times, most recently from aef47f8 to b49f3c2 Compare February 26, 2019 17:49
@captainenhancement
Copy link
Author

готово


require 'lua-nucleo' -- for import()

-- for lfs.chdir(), lfs.currentdir()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень странные манипуляции. Объясни, что тут происходит, пожалуйста.
Откуда берется первый lfs? Почему не использовать конструкцию вида new_lfw = require 'lfs'?

Copy link
Author

@captainenhancement captainenhancement Feb 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проблема: когда импортится lfs, он без-условно пишет свою таблицу в глобальную переменную
решение: 1)в переменную orig_lfs сохраняется предыдущее значение lfs (скорее всего, null)
2)require-им lfs
3)в new_lfs пишем то, что установил модуль при загрузке
4)восстанавливаем глобальную lfs её оригинальным, старым значением
создаем для удобства локальную (внутри модуля) lfs, которая выглядит привычно

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Во-первых, в Lua нет null'а, есть nil.
Во-вторых, я не понимаю, почему нельзя просто сделать local lfs = require 'lfs'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть (оставить пока как есть)

pk-test/docker.lua Outdated Show resolved Hide resolved
pk-test/docker.lua Outdated Show resolved Hide resolved
pk-test/docker.lua Outdated Show resolved Hide resolved
pk-test/docker.lua Outdated Show resolved Hide resolved
test/cases/0030-docker.lua Outdated Show resolved Hide resolved
test/cases/0030-docker.lua Outdated Show resolved Hide resolved
test/data/echoserv_container5/stalone_echoserv.lua Outdated Show resolved Hide resolved
test/data/echoserv_container5/stalone_echoserv.lua Outdated Show resolved Hide resolved
test/data/echoserv_container5/stalone_echoserv.lua Outdated Show resolved Hide resolved
@RussDragon
Copy link
Contributor

Дополнительно: мне не нравится, что обертки над LFS находятся в одном файле с кодом docker'а. Конструктивных предложений нет, но читать тяжело.

@captainenhancement captainenhancement force-pushed the dd/359/do_with_docker_v5 branch from b49f3c2 to 6f454b4 Compare March 19, 2019 06:55
@captainenhancement
Copy link
Author

captainenhancement commented Mar 19, 2019

готово. перезапушено (форспуш)

sock:close()
break
end
sock:send(line.."\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Потерял пробелы

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть

--------------------------------------------------------------------------------

local log, dbg, spam, log_error
= import 'lua-aplicado/log.lua' { 'make_loggers' } (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отступ

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"=" должно быть точно под "l" из "log" (подвинуть на 1 вперед), или "=" должно быть на 2 пробела от начала?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Под log.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть

-----------------------------------------------------------------------

local log, dbg, spam, log_error
= import 'lua-aplicado/log.lua' { 'make_loggers' } (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется, по историческим причинам гайдлайны не разрешают писать так импорт в одну строку.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень странно. Попроси AG прокомментировать

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

гайдлайны это разрешают (по крайней мере для логгеров), вот там даже цитата есть

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть (оставлено в одну строку)

'do_with_docker() is called with arguments: dir =',
cfg_dir,
'handler =',
handler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем так много строк?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в одну строку они не поместятся в 80 символов

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А в две? :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть (сделано в две)

@captainenhancement captainenhancement force-pushed the dd/359/do_with_docker_v5 branch from 6f454b4 to 307f0d3 Compare March 23, 2019 08:26
@captainenhancement
Copy link
Author

captainenhancement commented Mar 23, 2019

готово. перезапушено (форспуш) 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants