Ruby ENOENT error for curl statement - ruby-on-rails

Getting "No such file or directory (errno::ENOENT) error" for following statement
result = %x[curl -k -w "%{http_code}" -m 3 -sL #{url} -o /dev/null]
What I understand that above statement should return the response code and which is not working here.
I don't have much knowledge on Ruby and Rails and encountered above during setting up my testing environment for cucumber.
Will some please help.

Related

Sending Codacy code coverage with Fastlane

I'm trying to send the code coverage report that is created by Slather to Codacy using Fastlane. This is the lane:
desc "Do A Slather and send to Codacy"
lane :code_coverage do |options|
slather(output_directory: "SlatherReports", scheme: "MyApp", configuration: "Debug", workspace: "MyApp.xcworkspace", proj: "MyApp.xcodeproj", cobertura_xml: true, use_bundle_exec: true)
ENV["CODACY_PROJECT_TOKEN"] = options[:codacy_token]
sh "bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)"
end
The Slather worked but the bash script didn't. It returned this error:
[06:40:19]: Exit status of command 'bash <(curl -Ls
https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)'
was 2 instead of 0. sh: -c: line 0: syntax error near unexpected token
`(' sh: -c: line 0: `bash <(curl -Ls
https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml)'
So, how do I fix this? Thanks.
I've found the answer myself. And it's a very simple one (why didn't I think of this earlier?). I just put the whole bash <(curl -Ls https://coverage.codacy.com/get.sh -r SlatherReports/cobertura.xml) line into a different bash script file and call it instead. LOL.

Building OpenCV 3.1 on Ubuntu 16.04 fails (undefined references)

I am trying to install OpenCV3.1 on my Ubuntu 16.04 for development in QT5. Sadly, building it from source always errors out due to undefined references (see below).
I used the following:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_FFMPEG=ON -D WITH_OPENGL=ON -D BUILD_TIFF=ON -D WITH_VTK=ON..
And it works fine. But building it always produces this error
../../lib/libopencv_viz.so.3.1.0: undefined reference to `vtkSTLReader::New()'
../../lib/libopencv_viz.so.3.1.0: undefined reference to `vtkOBJReader::New()'
collect2: error: ld returned 1 exit status
modules/viz/CMakeFiles/opencv_test_viz.dir/build.make:232: recipe for target 'bin/opencv_test_viz' failed
make[2]: *** [bin/opencv_test_viz] Error 1
CMakeFiles/Makefile2:3358: recipe for target 'modules/viz/CMakeFiles/opencv_test_viz.dir/all' failed
make[1]: *** [modules/viz/CMakeFiles/opencv_test_viz.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Of course I googled and tried everything I found. Tried several different cmake flags (or rather, without any), tried reinstalling libvtk5-dev and also tried libvtk6-dev and even build vtk7.1 from source, since I am assuming something is missing from there.
I also tried adding the opencv_contrib via
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_FFMPEG=ON -D WITH_OPENGL=ON -D BUILD_TIFF=ON -D WITH_VTK=ON -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=/home/user/opencv/opencv-3.1.0/opencv_contrib/modules ..
But that already produced the following error
CMake Error at opencv_contrib/modules/text/CMakeLists.txt:22 (ocv_add_testdata): `Unknown CMake command "ocv_add_testdata".
Also please note that I did upgrade/update all the packages that are listed here and here
So basically after two days randomly trying all the possible solutions I could find via google, I am now asking here.
Hopefully someone knows how to fix this, thank you!
Edit: I only get these problems with OpenCV3.1. I do have a working OpenCV 2.4.13
Same happend with me. It was working and suddenly I got the same error. I re-pulled OpenCV 3.1 and it worked again.
It seems that the guys updated something both in Extra Modules and in OpenCV and you have just pull the extra modules.
For the second part, it looks like someone messed up the opencv_contrib/modules/text/CMakeLists.txt
Just edit this file and remove the lines at the end:
ocv_add_testdata(samples/ contrib/text
FILES_MATCHING PATTERN "*.xml" PATTERN "*.xml.gz" REGEX "scenetext[0-9]+.jpg"
COMPONENT "tests"
)
just switch opencv_contrib repository to 3.1.0 tag after clone.
git checkout 3.1.0
and try to build again.
First, make sure you have successfully built and installed vtk on your system;
Then,by using command "locate STLReader" or "locate vtkOBJReader" to ensure "vtkOBJReader" or "STLReader" libs are found in some specific directories. If vtkOBJReader or STLReader related files are found. It means that vtk has changed its structure in the new version, e.g. move vtkOBJReader into a sub library vtkIOGeometry, so you have to tell cmake to find vtkIOGeometry if you want to use that class.
Last, modify opencv3/cmake/OpenCVDetectVTK.cmake, for every find_package(VTK QUIET COMPONENTS ... add an entry vtkIOGeometry.
Success!

Deploy hook syntax error

Trying to give permissions to /public/uploads with deploy hook, during cloud66 deploy to digitalocean, to get carrierwave file uploads working.
I'm receiving the following error:
Error during deployment: Error during after_rails hook: Execution of sudo
/tmp/open_folder_permissions.sh returned a non-zero exit code. Output was:
/tmp/open_folder_permissions.sh:5: syntax error, unexpected tGVAR, expecting keyword_do or
'{' or '(' sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads ^
open_folder_permissions.sh
#! /usr/bin/env ruby
#load environment variables
source /var/.cloud66_env
#assign desired permissions
sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads
deploy_hooks.yml
production:
after_rails:
- source: /.cloud66/files/open_folder_permissions.sh
destination: /tmp/open_folder_permissions.sh
target: rails
execute: true
run_on: all_servers
apply_during: all
sudo: true
What could cause the error?
Your open_folder_permissions.sh doesn't contain valid Ruby code. From the looks of it, it's supposed to be a shell script, not a Ruby script, so you should change the shebang line to a shell interpreter instead of a Ruby interpreter.
#! bin/bash is the right interpreter.

Cryptic error when trying to run POW

I am having a rather weird error message when running POW for my rails app.
I followed the instructions:
- cd ~/.pow
- ln -s /Users/mingyeow/Dailymuses-Server-Side
And got this:
Error starting application
Your Rack app raised an exception when Pow tried to run it.
Error: '/Users/mingyeow/Dailymuses-Server-Side/.powrc' failed to load:
true &&
source '/Users/mingyeow/Dailymuses-Server-Side/.powrc' > /dev/null &&
env > '/var/folders/cl/fd2wt82149x9trkxmsvqrt500000gn/T/pow.18625.1358760244196.27206'
Error: '/Users/mingyeow/Dailymuses-Server-Side/.powrc' failed to load:
true &&
source '/Users/mingyeow/Dailymuses-Server-Side/.powrc' > /dev/null &&
env > '/var/folders/cl/fd2wt82149x9trkxmsvqrt500000gn/T/pow.18625.1358760244196.27206'
at ChildProcess.exithandler (child_process.js:282:15)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:362:16)
at Process.onexit (child_process.js:398:5)
Tried resetting everything I could find.
I've had the exact same error today with an Octopress install.
Does your .powrc look like the following?
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ] ; then
source "$rvm_path/scripts/rvm"
source ".rvmrc"
fi
That's the one provided with Octopress, but I guess it's pretty generic.
In my case, I had modified the .rvmrc file and it contained a syntax error. I corrected the error, deleted the symlink in ~/.pow and created it again, and all went back to normal.
Hope that helps!
(if not, maybe you should update your question with the content of your .powrc file)

Xcode Build error, arm-apple-darwin11-gcc-4.2.1 execvp: No such file or directory

After upgrading to Xcode 4.3.2. I'm getting a metric ton of build errors.
A whole line of them are error code 255
gcc-4.2: error trying to exec '/usr/bin/arm-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Command /usr/bin/gcc-4.2 failed with exit code 255
I noticed that there is no /usr/bin/arm-apple-darwin11-gcc-4.2.1 file on my machine. Could this be the source of the problem?
What's the output of this command?
$ printenv | grep "CC="
It might be honoring your C Compiler (CC) selection. I was getting similar errors (through cocoapods) and doing an
$ export CC=
fixed it for me.

Resources