Running PACT test is throwing a Ruby Load Error - ruby

I am trying to run a pact test for a typescript/angular service, from Visual Studio Code .I am getting the following error:
ERROR (15568 ): pact-node#10.11.11: Pact Binary Error: C:/projects/App/sample.webapp/node_modules/#pact-foundation/pact-node/standalone/win32-1.88.40/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- bundler/setup (ERROR (15568): pact-node#10.11.11: Pact Binary Error: LoadError)
from C:/projects/App/sample.webapp/node_modules/#pact-foundation/pact-node/standalone/win32-1.88.40/pact/lib/ruby/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

This issue was resolved in Ruby v3.0.2 (see this PR https://github.com/ruby/ruby/pull/4505). Though contributors are not going to repack Pact library with the latest Ruby version and still suggest to workaround the problem by locating your project directory close to the root c:\ or start using pact-js v3.

It looks like the infamous windows long path issue. See that issue for further details, but the simplest option is to move your project directory closer to the root of c:.
For context, Ruby is bundled into Pact JS as a core engine for matching, broker interaction, and verification logic. Our v3 (which does not suffer this issue) is going to have a rust core, you can try out the beta here: https://github.com/pact-foundation/pact-js/#pact-js-v3

Related

How to fix "s3_website" issue while pushing Jekyll site on CloudFront through gitlab CI/CD?

I have created Pipeline in GitLabs and I am using docker as gitlab-runner. I want to push Jekyll website on s3 website. And to do so, I am using s3_website gem. I have 4 stages defined in my pipeline. Where I am building Jekyll, creating Artifacts using Gulp, executing test on my jekyll site and then deploying.
All steps are working fine but while doing deployment, I'm getting following error. And i could not figure it how to get this solve.
[fail] Could not load the site: Failed to parse ERB in /builds/myproject/s3_website.yml:
(SyntaxError) /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_warn.rb:15: syntax error, unexpected tLABEL
module_function define_method(:warn) {|*messages, uplevel: nil|
It is working perfectly fine on my local machine when I'm not on Docker. But when I try to do the same thing using docker. It is giving me above error.
I tried it with ruby 2.3, 2.4, 2.5, 2.6 on my docker machine. However no luck.
bundle exec s3_website push
I am expecting this to deploy the site on S3 bucket and corresponding cloudfront.
Any clue would be appreciated.
We ran into this same error on CircleCI. If I understand correctly, the s3_website gem wraps a Java .jar that's using JRuby 1.7, and something must have changed in one of the Docker images or Ruby gems that causes it to start inheriting the system's Ruby 2+ path. As a result, its JRuby 1.7 tries to load Ruby gems that only work in Ruby 2.0 and above, so it runs into errors.
As a workaround, instead of letting the s3_website gem invoke the .jar file itself, I tell the s3_website gem to only download the .jar file, then I manually invoke it:
bundle exec s3_website install
java -cp $(bundle show s3_website)/*.jar s3.website.Push
I reported this on the s3_website project's GitHub page.
Same error message but different solution.
The root of my problem was that the S3_ACCESS_KEY_ID wasn't set properly. I source'd my .env file
source .env
And that loaded the access key variable and the deploy worked.

LoadError: Could not open library 'libcurl'

curl-7.61.1_6-win64-mingw (for libcurl and curl)
windows 10 OS Build: 17134.346
java version "1.8.0_191"ruby
ruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.191-b12 on 1.8.0_191-b12 +jit [mswin32-x86_64]
I'm trying to access a neo4j database using neo4j-core (8.1.4) gem with the HTTP adapter and I receive the error below. A couple of notes:
The machine was originally an 8.1 OS that I upgraded to windows 10. But I have also tried a fresh install.
I'm working with libcurl from curl-7.61.1-win64-mingw. I have tried both the 64 and 32 bit versions.
The NEO4J server works fine
I get the error when I try to establish a session neo4j_session = Neo4j::Core::CypherSession.new(neo4j_adaptor)
I try to install the curb gem and I get the error "Can't find libcurl or curl/curl.h (RuntimeError)". CURB has a dependencies on libcurl (i understand).
The curl.exe is in the path and works great. I ensured that the path containing the libcurl.dll and the curl.exe where first in the path order.
I executed the same script just using ruby, to eliminate any jruby specific issues, with the same problem: (LoadError)libcurl': The specified module could not be found.
I tried to register the dll with RegSvr32 but it says it cannot find the dll. However, the DLL is clearly at the location I'm specifying. I think this supports the idea that its one of libcurls dependencies...but not sure.
At this point its pretty clear that the system cannot find libcurl. So, I:
Update the path to point at the directory that libcurl.dll is in
I also try putting the DLL in known working path locations
Looked on haxx to better understand the prerequisites. No help.
I use dependency walker on libcurl-x64.dll (curl-7.61.1-win64-mingw) and I get the following in the log:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
and here is a sample of a modules it says are missing:
API-MS-WIN-CORE-CONSOLE-L3-2-0.DLL
API-MS-WIN-CORE-CRT-L1-1-0.DLL
API-MS-WIN-CORE-LARGEINTEGER-L1-1-0.DLL
I guess im surprised at the number of modules that are reported as missing considering the machine works fine otherwise. It appears that some were removed as part of architectural changes based on this: https://social.msdn.microsoft.com/Forums/en-US/a28331ae-19a3-4a34-b3ba-1e8fd4430375/missing-apimswincore-dlls
Libcurl is common tool and so I am surprised by the remarkable pain in the ass this has been.
Any thoughts? I'm reluctant to do a clean build at this point and hunting on DLL sites seems like a non starter.
The error
LoadError: Could not open library 'libcurl' : The operation completed successfully.
Could not open library 'libcurl.dll' : The operation completed successfully.
Could not open library 'libcurl.so.4' : The operation completed successfully.
Could not open library 'libcurl.so.4.dll' : The operation completed successfully.
block in ffi_lib at C:/jruby-9.2.0.0/lib/ruby/stdlib/ffi/library.rb:114
map at org/jruby/RubyArray.java:2557
ffi_lib at C:/jruby-9.2.0.0/lib/ruby/stdlib/ffi/library.rb:84
<module:Curl> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:7
<module:Ethon> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:2
<main> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:1
require at org/jruby/RubyKernel.java:970
require at C:/jruby-9.2.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
<module:(root)> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curl.rb:1
<module:Curl> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curl.rb:27
<main> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curl.rb:13
require at org/jruby/RubyKernel.java:970
require at C:/jruby-9.2.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
<main> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon/curl.rb:8
require at org/jruby/RubyKernel.java:970
require at C:/jruby-9.2.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
<main> at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon.rb:1
require at org/jruby/RubyKernel.java:970
require at C:/jruby-9.2.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
block in (root) at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/ethon-0.11.0/lib/ethon.rb:15
block in (root) at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/typhoeus-1.3.0/lib/typhoeus.rb:1
(root) at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/typhoeus-1.3.0/lib/typhoeus.rb:2
(root) at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/neo4j-core-8.1.4/lib/neo4j/core/cypher_session/adaptors/http.rb:1
HTTP at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/neo4j-core-8.1.4/lib/neo4j/core/cypher_session/adaptors/http.rb:20
block in faraday_connection at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/neo4j-core-8.1.4/lib/neo4j/core/cypher_session/adaptors/http.rb:162
initialize at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/faraday-0.15.3/lib/faraday/connection.rb:89
new at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/faraday-0.15.3/lib/faraday.rb:70
faraday_connection at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/neo4j-core-8.1.4/lib/neo4j/core/cypher_session/adaptors/http.rb:154
initialize at C:/jruby-9.2.0.0/lib/ruby/gems/shared/gems/neo4j-core-8.1.4/lib/neo4j/core/cypher_session/adaptors/http.rb:117
<main> at import-into-neo4j.rb:11
I've run out of time. The answer is (sadly) a workaround: neography
The neography gem apparently avoids the libcurl dependency which has been a plague on my existence and yet still provides enough abstraction. Thanks.

Sikuli IDE can't import cucumber gem in JRuby?

I'm using SikuliX IDE 1.1.2 (with JRuby support enabled), and I'm trying to get cucumber working from within the Sikuli IDE.
I have found this article which just covers what I need:
http://www.jmest.org/wp-content/uploads/JMESTN42350420.pdf
I have also found the related github and I am now trying to run a sample script in Ruby that I found here: https://github.com/rssdev10/sikulix-ide-templates/blob/master/examples/libreoffice-writer-test/test-cucumber.sikuli
But when I try to run this script from the Sikuli IDE, I get:
LoadError: no such file to load -- cucumber/rspec/disable_option_parser require at org/jruby/RubyKernel.java:939 require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54 start_cucumber at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:31 cucumber_test at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:56 SikulixCucumber at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:62 <top> at C:/Users/at080olimath/Downloads/sikulix-ide-templates-master/examples/libreoffice-writer-test/test-cucumber.sikuli:67
[error] script [ test-cucumber ] stopped with error in line 31
[error] LoadError ( (LoadError) no such file to load -- cucumber/rspec/disable_option_parser )
On a Google Drive link, I was able to find a .jar file which contains all the gems needed (cucumber etc.), but the archive is old (2014) and contains a beta verison of the Sikuli IDE:
https://drive.google.com/drive/folders/0Bwx0cbtdU5K6STg2T0l5UWlIRXc
As per my understanding, I would need a way to build the sikulix.jar with the Cucumber gem included... But I cannot manage to figure out where to get started.
On this documentation page, I can also find that this is possible to include cucumber in sikuli.jar:
https://github.com/RaiMan/SikuliX1
If you want to experiment with the special JRuby support (rSpec,
cucumber, ...) you have to look into the modules JRubyAddOns and
JRubyGem. Both have to be built manually if needed (not contained in
the local developement build).
While I was able to find the JRubyGem, I am unable to find the JRubyAddOns anywhere... And I don't know what to do next :(
How should I proceed to get cucumber working from within the SikuliX IDE 1.1.2?
Thank you for your help
I think stock Cucumber Gem has C-dependencies that won't execute VM-side for Jruby. This here: https://rubygems.org/gems/cucumber-jvm/versions/2.0.1-java might be more what you're looking for. Good luck!

Could not find 'flat-ui.css' in any of your source paths while generating Flat UI Pro in rails app

I am integrating licensed version of flat-ui-pro with my Rails app.
For this, I am using 'designmodo-flatuipro-rails' gem
My environments are:-
OS - Windows7 32-bit
Ruby - 1.9.3p327
Rails - 4.0.0
twitter-bootstrap-rails - 2.2.8
jquery-ui-rails - 4.0.5
designmodo-flatuipro-rails - 1.1.4.2
I have generated "bootstrap_and_overrides.css" file by bootstrap generator at location "app/assets/stylesheets/". I am not using ".less" files for bootstrap.
I am also not getting Cannot detect twitter-bootstrap-rails install error
and Invalid Flat UI Pro directory error while running the flatUI generating command. It means I am inside the right FlatUI directory.
When I run the flat-ui-pro generate command rails g flatuipro:install ./FlatUI/HTML/UI/Flat-UI-Pro-1.1.4, It is throwing a error
Could not find "./FlatUI/HTML/UI/Flat-UI-Pro-1.1.4/css/flat-ui.css" in any of yo
ur source paths. Your current source paths are:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/designmodo-flatuipro-rails-1.1.4.2/lib/gener
ators/flatuipro/install/templates
I am getting the same error while passing the FlatUI directory containing PSD and HTML both.
I am not understanding why generator can not recognizing flat-ui.css in the right directory.
I used differ version of gem "designmodo-flatuipro-rails", "~> 1.2.2.0.branch" with the other version of FlatUI-Pro directory (1.2.2) but also getting the same error.
This is tree of FlatUiPro directory:-
Please reply with good suggestions.
Thanks.
Try changing your relative-path to the Flat-UI Pro Directory to "absolute" in the rails "generate" command, seems to work only for absolute paths!
After getting stuck very much, I found the solution.
I was hitting command in cmd-prompt:-
rails g flatuipro:install ./FlatUI/HTML/UI/Flat-UI-Pro-1.1.4
It will work with Mac/Ubuntu OS as creator of flatui-gem explained in the issue created on github <<Link of Github Issue>>
In Windows, it is mandatory to put the flatui directory out of the project folder.
For example:-
My FlatUIPro directory saved in "D:" drive, so my command will be
rails g flatuipro:install D:/FlatUI
or
rails g flatuipro:install D:/FlatUI/HTML/UI/Flat-UI-Pro-1.1.4
Please check your Flat UI Pro directory... you really are missing demo.css for some reason. Try re-downloading the Flat UI Pro assets from designmodo

Error at the end of Installation of Ruby 2.0.0 on Mac Mountain Lion, also no mysql.sock file

I am a total noob to Ruby and Rails, so any help is appreciated about this.
I installed Ruby 2.0.0 using RVM. It got most of the way through, when I got this error message:
Error running 'env GEM_PATH=/Users/victoriamielke/.rvm/gems/ruby-2.0.0-p0:/Users/victoriamielke/.rvm/gems/ruby-2.0.0-p0#global:/Users/victoriamielke/.rvm/gems/ruby-2.0.0-p0:/Users/victoriamielke/.rvm/gems/ruby-2.0.0-p0#global GEM_HOME=/Users/victoriamielke/.rvm/gems/ruby-2.0.0-p0 /Users/victoriamielke/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /Users/victoriamielke/.rvm/src/rubygems-2.0.3/setup.rb --verbose',
please read /Users/victoriamielke/.rvm/log/ruby-2.0.0-p0/rubygems.install.log
Installation of rubygems did not complete successfully.
I also opened up rubygems.install.log, and it said near the end:
ERROR: While executing gem ... (NoMethodError)
undefined method `fu_stream_blksize' for #<Gem::Commands::SetupCommand:0x007fcab29f5838>
What caused the failure of Rubygems to install?
Another problem am having is the error message ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2). I tried a Google search on this, which said I needed to find the mysql.sock file. Well, I have never found this file on my computer and could not find out in plain English how to add it or generate it.
Looks like the installation error is a recent known issue. If you're a beginner I recommend using Ruby 1.9.3, since 2.0.0 is brand new and you'll certainly find bugs in both the language implementation and libraries that haven't been tested on 2.0.0 yet.
The second issue is unrelated. It could be that you haven't started MySQL (did you run mysql.server start?), file permissions, MySQL configuration, or any number of other issues. You're not supposed to create /tmp/mysql.sock yourself, it's created automatically by MySQL. Please open a separate question about it.

Resources