Данная лабораторная работа посвещена изучению компонентов Boost на примере program_options
$ open http://www.boost.org/doc/libs/1_65_0/doc/html/program_options.html- 1. Создать публичный репозиторий с названием lab11 на сервисе GitHub
- 2. Выполнить инструкцию учебного материала
- 3. Ознакомиться со ссылками учебного материала
- 4. Составить отчет и отправить ссылку личным сообщением в Slack
Устанавливаем переменные окружения GITHUB_USERNAME, настраиваем текстовый редактор.
$ export GITHUB_USERNAME=TalkedDevotee
$ alias edit=vim
$ alias gsed=sed # for *-nix system$ cd ${GITHUB_USERNAME}/workspace
$ pushd .
$ source scripts/activateСкачиваем предыдущую лабораторную работу.
$ git clone https://github.com/${GITHUB_USERNAME}/lab10 projects/lab11
$ cd projects/lab11
$ git remote remove origin
$ git remote add origin https://github.com/${GITHUB_USERNAME}/lab11Редактируем BOOST в CMakeLists.txt и demo.cpp.
# boost::program_options
$ edit CMakeLists.txt
$ edit sources/demo.cppСобираем проект.
$ cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=_install
$ cmake --build _build --target install
$ mkdir artifacts && cd artifactsТестирование по умолчанию.
$ echo "text1 text2 text3" | ../_install/bin/demo
$ test -f default.log
$ echo $?
0Редактируем файл конфигурации.
$ mkdir ${HOME}/.config
$ echo "output=config.log" > ${HOME}/.config/demo.cfg
$ echo "text1 text2 text3" | ../_install/bin/demo
$ test -f config.log
$ echo $?
0Создаем env.log.
$ export DEMO_OUTPUT=env.log
$ echo "text1 text2 text3" | ../_install/bin/demo
$ test -f env.log
$ echo $?
0Создаем arg.log.
$ echo "text1 text2 text3" | ../_install/bin/demo --output arg.log
$ test -f arg.log
$ echo $?
0Настраиваем .travis.yml.
$ cat >> .travis.yml <<EOF
- cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=_install
- cmake --build _build --target install
- mkdir artifacts && cd artifacts
- echo "text1 text2 text3" | ../_install/bin/demo
- test -f default.log
- mkdir ${HOME}/.config
- echo "output=config.log" > ${HOME}/.config/demo.cfg
- echo "text1 text2 text3" | ../_install/bin/demo
- test -f config.log
- export DEMO_OUTPUT=env.log
- echo "text1 text2 text3" | ../_install/bin/demo
- test -f env.log
- echo "text1 text2 text3" | ../_install/bin/demo --output arg.log
- test -f arg.log
EOFМеняем название.
$ gsed -i 's/lab10/lab11/g' README.mdПушим изменения.
$ git add .
$ git commit -m"changed format output"
$ git push origin masterАвторизуем travis без токена и подключаем гит к travis.
$ travis login --auto
$ travis enable$ popd
$ export LAB_NUMBER=11
$ git clone https://github.com/tp-labs/lab${LAB_NUMBER} tasks/lab${LAB_NUMBER}
$ mkdir reports/lab${LAB_NUMBER}
$ cp tasks/lab${LAB_NUMBER}/README.md reports/lab${LAB_NUMBER}/REPORT.md
$ cd reports/lab${LAB_NUMBER}
$ edit REPORT.md
$ gistup -m "lab${LAB_NUMBER}"Copyright (c) 2017 Братья Вершинины