How to include a link to index.html of content generated by another program in reST - code-coverage

My RST directory looks like this:
.
|-- Makefile
|-- build
| |-- doctrees
| `-- html
| |-- codecov <-- Generated by coverage.py
| |-- index.html
| | .... <-- Generated by Sphinx
|-- make.bat
`-- source
|-- _static
|-- changelog.rst
|-- conf.py
|-- contact.rst
|-- getting_started.rst
|-- index.rst
`-- introduction.rst
In my index.rst, I would like to create a relative link titled Code Coverage that points to codecov/index.html. I am not sure how to do that because it is outside my source folder. The 'codecov' folder is auto generated when I run code coverage in python. How to accomplish this?
.. toctree::
:caption: Table of Contents
:maxdepth: 2
introduction
getting_started
changelog
contact
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

You have at least two options.
Use an external link.
`Code Coverage <../_build/codecov/index.html>`_
Put this in a toctree directive.
.. toctree::
Code Coverage <https://www.example.com/_build/codecov/index.html>
There may be other options, but let's see if either satisfies your need.

Related

Cross compiling opencv project for ARM and called in go project gocv

I compiled opencv and gocv for ARM under the host Ubuntu 20.04.3 LTS follows the steps as below.
1. Apt install arm-linux-gnueabi-gcc, arm-linux-gnueabi-g++
2. Compile and install opencv
cmake -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv
make -j16
make install
After installed. A folder named install was created in current dir and got shared libs as below.
../arm2build/install/lib
|-- cmake
| `-- opencv4
| |-- OpenCVConfig-version.cmake
| |-- OpenCVConfig.cmake
| |-- OpenCVModules-release.cmake
| `-- OpenCVModules.cmake
|-- libopencv_calib3d.so -> libopencv_calib3d.so.405
|-- libopencv_calib3d.so.4.5.4
|-- libopencv_calib3d.so.405 -> libopencv_calib3d.so.4.5.4
|-- libopencv_core.so -> libopencv_core.so.405
|-- libopencv_core.so.4.5.4
|-- libopencv_core.so.405 -> libopencv_core.so.4.5.4
|-- libopencv_dnn.so -> libopencv_dnn.so.405
|-- libopencv_dnn.so.4.5.4
|-- libopencv_dnn.so.405 -> libopencv_dnn.so.4.5.4
|-- libopencv_features2d.so -> libopencv_features2d.so.405
|-- libopencv_features2d.so.4.5.4
|-- libopencv_features2d.so.405 -> libopencv_features2d.so.4.5.4
|-- libopencv_flann.so -> libopencv_flann.so.405
|-- libopencv_flann.so.4.5.4
|-- libopencv_flann.so.405 -> libopencv_flann.so.4.5.4
|-- libopencv_gapi.so -> libopencv_gapi.so.405
|-- libopencv_gapi.so.4.5.4
|-- libopencv_gapi.so.405 -> libopencv_gapi.so.4.5.4
|-- libopencv_highgui.so -> libopencv_highgui.so.405
|-- libopencv_highgui.so.4.5.4
|-- libopencv_highgui.so.405 -> libopencv_highgui.so.4.5.4
|-- libopencv_imgcodecs.so -> libopencv_imgcodecs.so.405
|-- libopencv_imgcodecs.so.4.5.4
|-- libopencv_imgcodecs.so.405 -> libopencv_imgcodecs.so.4.5.4
|-- libopencv_imgproc.so -> libopencv_imgproc.so.405
|-- libopencv_imgproc.so.4.5.4
|-- libopencv_imgproc.so.405 -> libopencv_imgproc.so.4.5.4
|-- libopencv_ml.so -> libopencv_ml.so.405
|-- libopencv_ml.so.4.5.4
|-- libopencv_ml.so.405 -> libopencv_ml.so.4.5.4
|-- libopencv_objdetect.so -> libopencv_objdetect.so.405
|-- libopencv_objdetect.so.4.5.4
|-- libopencv_objdetect.so.405 -> libopencv_objdetect.so.4.5.4
|-- libopencv_photo.so -> libopencv_photo.so.405
|-- libopencv_photo.so.4.5.4
|-- libopencv_photo.so.405 -> libopencv_photo.so.4.5.4
|-- libopencv_stitching.so -> libopencv_stitching.so.405
|-- libopencv_stitching.so.4.5.4
|-- libopencv_stitching.so.405 -> libopencv_stitching.so.4.5.4
|-- libopencv_video.so -> libopencv_video.so.405
|-- libopencv_video.so.4.5.4
|-- libopencv_video.so.405 -> libopencv_video.so.4.5.4
|-- libopencv_videoio.so -> libopencv_videoio.so.405
|-- libopencv_videoio.so.4.5.4
`-- libopencv_videoio.so.405 -> libopencv_videoio.so.4.5.4
3. Build gocv/cmd/version project with cgo
CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ CGO_CPPFLAGS='-I/opt/arm2build/install/include/opencv4' CGO_LDFLAGS='-L/opt/arm2build/lib -lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_dnn -lopencv_calib3d -lopencv_flann -lopencv_photo' GOOS=linux GOARCH=arm go build -tags=customenv .
After do that will generate ELF
root#793d7120f9df:/opt/go/gocv/cmd/version# file version
version: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, BuildID[sha1]=038c80350b7a0c9e72b10021c66c31c2dbb4df2c, for GNU/Linux 3.2.0, not stripped
My questions is how to run the ELF version in android with arm processor?
I copied the static libraries in install/libs to mobile's /system/lib/. copied the version file to /data/local/tmp and grant execute privilege.
Then exec the version got output "./version: No such file or directory".
130|cactus:/data/local/tmp # ./version
/system/bin/sh: ./version: No such file or directory
I found the reason is about dynamic link interpreter which android do not has linux platform's interpreter.
After rebuild opencv with NDK got static libs. And build go project with NDK's clang compiler, the problem would be solved.

Backup Jenkins log folder via ThinBackup

I want to backup all .log* files under $JENKINS_HOME/logs via thinBackups Backup additional files Feature. Folder structure is as follows:
/var/lib/jenkins/logs/
|-- health-checker.log
|-- slaves
| |-- Slave\ 1
| | `-- slave.log
| |-- Slave\ 2
| | `-- slave.log
| `-- Slave\ 3
| `-- slave.log
`-- tasks
|-- Connection\ Activity\ monitoring\ to\ agents.log
|-- Connection\ Activity\ monitoring\ to\ agents.log.1
|-- Download\ metadata.log
|-- Download\ metadata.log.1
|-- Fingerprint\ cleanup.log
|-- Fingerprint\ cleanup.log.1
|-- Periodic\ background\ build\ discarder.log
|-- Periodic\ background\ build\ discarder.log.1
|-- Workspace\ clean-up.log
|-- Workspace\ clean-up.log.1
|-- telemetry\ collection.log
|-- telemetry\ collection.log.1
What I have now is the following regex:
^(logs|tasks|.*\.log.*)
which catches the top level health-checker.log and also all logs below tasks. But how do I extend this regex to also include all logs from all slaves (Slave 1, Slave 2 and Slave 3)?
I tried the following regex
^(logs|tasks|.*\.log.*)^(logs|slaves|Slave\ 1|.*\.log.*)
which does not work. I also cannot find any further explanation for the regex formatting thinBackup is using.
P.S. Our security departement requires backup of all logs for the last 90 days.
I think this plugin is buggy when it comes to include and exclude regex. If you exclude .*xml it shouldn't backup any files ending in xml but some files (not all) are still backed up.

Manage Plugin's Asset in Rails

I am just trying to figure out what's the best way to manage Plugin's Asset in Rails.
For Eg. Let's consider Bootstrap.
I understand there is "vendor" directory for that but even there
I like to keep below directory structure:
App
|-- assets
| |-- plugins
| | |-- bootstrap
| | | |-- fonts
| | | |-- css
| | | | |-- bootstrap.css
| | | | |-- bootstrap.min.css
| | | |-- js
| | | | |-- bootstrap.js
| | | | |-- bootstrap.min.js
I DON'T LIE to follow below directory structure:
App
|-- assets
| |-- fonts
| |-- css
| | |-- application.css
| | |-- bootstrap.css
| | |-- bootstrap.min.css
| | |-- common-style.css
| |-- js
| | |-- application.js
| | |-- bootstrap.js
| | |-- bootstrap.min.js
| | |-- common-script.css
As you can notice above, now if you start adding plugins, files goes into general folders rather grouping all assets with respect to a plugin stay together. If not grouped it will look messy, isn't it?
I understand there is "vendor" directory even there I LIKE to keep below directory structure:
|-- App
|-- vendor
| |-- assets
| | |-- javascripts
| | |-- stylesheets
| |-- bootstrap
| | |-- fonts
| | |-- css
| | | |-- bootstrap.css
| | | |-- bootstrap.min.css
| | |-- js
| | | |-- bootstrap.js
| | | |-- bootstrap.min.js
I DON'T LIKE to follow below directory structure:
|-- App
|-- vendor
| |-- fonts
| |-- assets
| |-- stylesheets
| | |-- bootstrap.css
| | |-- bootstrap.min.css
| | |-- iCheck.css
| |-- javascripts
| | |-- bootstrap.js
| | |-- bootstrap.min.js
| | |-- iCheck.js
Rails has a special directory for adding third party assets. It's called vendor. Underneath it you will find vendor/assets, which contains javascripts and stylesheets subdirectories. So use that instead of app/assets. The latter is where you are supposed to save your own files.
If you are using something like Bootstrap, and this stands true for most plugins, well, it's even easier. Most frameworks are packaged into gems. This means you don't have to worry about manually adding the asset files as the Asset Pipeline handles all of that for you. At most you just have to include the files in your manifest.
A JavaScript file in application.js, for example:
//= require jquery
If you want to go a step further and enforce your own directory structure, you will have to change Rails' config:
config.assets.precompile += %w(vendor/custom_dir/*.jpg)
config.assets.precompile += %w(vendor/custom_dir/*.js)
You can read more about this on Rails guides
You might also find this issue helpful.

How to add LESS files to a rails app

I can't seem to get this to work in my rails app. At a high level, I wan't to use LESS in my app and have it go through the asset pipeline.
This is what my assets look like:
assets
|
|--- javascript
|
|--- stylesheets
|
|-- reset.less
|-- my-mixins.less
|-- my-variables.less
|-- base.less
|
|--- images
|
|--- libs
|
|---foo
|
|--css
|
|--- foo-mixins.less
|
|--- bar.less
I would like to import "my-mixins.less", "my-variables.less" and "foo-mixins.less" into "base.less", as well as other files. "bar.less" should also be added to specific pages if needed.
How would I go about doing this?
This should work, assuming you're using the less-rails gem.
First, add this to somewhere in your configuration (I have mine in my environment.rb):
YourApp::Application.configure do
config.less.paths << File.join(Rails.root, 'app', 'assets', 'less')
end
Now, if you have a file setup like this:
assets
|
|--- javascript
|
|--- css
| |--- site-stylesheet.css.less
|
|--- less
|--- my-mixins.less
You can import my-mixins in site-stylesheet by using:
#import "my-mixins"
And import the stylesheet into your app with:
<%= stylesheet_link_tag "site-stylesheet" %>
You should be able to extrapolate from there for your specific directory structure.
In base.css.less you can write #import "my-variables.less"; and it should work.
The files have to be in the "vendor/assets" or "vendor/plugins" (both at the root level) folder in order to reference them with relative paths.

How can I get autotest to notice changes in subdirectories?

I have some submodules organized like this:
|-- app
| |-- models
| | |-- foo
| | | |-- foo-1.rb
| | | |-- foo-2.rb
| | | |-- foo-3.rb
| | |-- foo.rb
How can I get autotest to notice changes made to foo-*.rb, and then run the appropriate specs?
You can populate your autotest/discover.rb file with mappings:
Autotest.add_hook :initialize do |at|
# match the model name (the whole Regex object is in _)
at.add_mapping(%r%^app/models/(foo)/\w+\.rb$%, true) do |filename, _|
"spec/models/#{_[1]}_spec.rb"
end
end
You can find more how to use the mappings and hooks in the API docs.
Perhaps you should investigate watchr
https://github.com/mynyml/watchr
It's similar to autotest, while being quite a bit more configurable and more easily setup.
Another interesting alternative is guard.

Resources