Skip to content

Instantly share code, notes, and snippets.

@TalkedDevotee
Last active November 19, 2017 21:43
Show Gist options
  • Save TalkedDevotee/01edb546764e585c29800600ca82a39b to your computer and use it in GitHub Desktop.
Save TalkedDevotee/01edb546764e585c29800600ca82a39b to your computer and use it in GitHub Desktop.
lab11

Laboratory work XI

Данная лабораторная работа посвещена изучению компонентов Boost на примере program_options

$ open http://www.boost.org/doc/libs/1_65_0/doc/html/program_options.html

Tasks

  • 1. Создать публичный репозиторий с названием lab11 на сервисе GitHub
  • 2. Выполнить инструкцию учебного материала
  • 3. Ознакомиться со ссылками учебного материала
  • 4. Составить отчет и отправить ссылку личным сообщением в Slack

Tutorial

Устанавливаем переменные окружения 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

Report

$ 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}"

Links

Copyright (c) 2017 Братья Вершинины
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment