How do you run Homebrew internal tests? - ruby

I have some test modifications for the homebrew project but when I try and run them:
$ ruby Homebrew/test/caveats_spec.rb
Traceback (most recent call last):
2: from test/caveats_spec.rb:4:in `<main>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- formula (LoadError)
What gives? I don't see a rakefile either...

Appears the canonical way is via
brew tests which runs all internal tests with the right include path setup.
And to run just one file like tests/caveats_spec.rb (gleaned from brew tests --help)
brew tests --only caveats

Related

Ruby gem command crash shell Fastlane & Cocoapods

I am having issues running fastlane and cocoapods for a month now. Any idea what is the issue? Tried RVM, changing the version and so on but nothing works.
I reinstalled fastlane then cocopoda started working again. Now fastlane does not work, error below.
It seems like you wanted to load some plugins, however they couldn't be loaded
[22:05:14]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/
Traceback (most recent call last):
8: from /usr/local/bin/fastlane:23:in `<main>'
7: from /usr/local/bin/fastlane:23:in `load'
6: from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/bin/fastlane:23:in `<top (required)>'
5: from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
4: from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
3: from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane/lib/fastlane/commands_generator.rb:352:in `run'
2: from /Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
1: from /Library/Ruby/Gems/2.6.0/gems/fastlane-2.170.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:50:in `run!'
/Library/Ruby/Gems/2.6.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:411:in `parse_global_options': ambiguous option: --v (OptionParser::AmbiguousOption)
You didn't include a minimal reproducible example in your post so I can't say for sure if this is the issue because I can't see how you're invoking fastlane. I recommend that you add a complete MRE to questions so people can see exactly how you got to where you are.
That said, it's probably that you are running fastlane --v and not fastlane -v:
$ fastlane --help
...
-v, --version Display version information

No signature files found in META-INF. Cannot proceed (RuntimeError)

I am trying to use calabash-android to start a test sever on a phone in android studio. I am new to this and gotten this far thanks to tutorials.
I downloaded java, ruby, calabash-android, set-up environment variables, created a key store in the .calabash-settings, have a .debug-keystore file in my .android folder.
I am stuck as to what this problem is I can run bundle exec calabash-android resign app-debug.apk fine but when i do bundle exec calabash-android run app-debug.apk, I get the following error message. I am obviously missing something but i am unsure what:
C:\Users\Dell\AndroidStudioProjects\Calabash>bundle exec calabash-android build app-debug.apk
WARNING: skipped META-INF/CERT.RSA as unsafe
Traceback (most recent call last):
8: from C:/Ruby26-x64/bin/calabash-android:23:in `<main>'
7: from C:/Ruby26-x64/bin/calabash-android:23:in `load'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/bin/calabash-android:76:in `<top (required)>'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/bin/calabash-android-build.rb:2:in `calabash_build'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:162:in `fingerprint_from_apk'
3: from C:/Ruby26-x64/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:163:in `block in fingerprint_from_apk'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:163:in `chdir'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:177:in `block (2 levels) in fingerprint_from_apk': **No signature files found in META-INF. Cannot proceed. (RuntimeError)**
I encountered the same issue with latest available versions of ruby (v3.0.2p107) and calabash (v0.9.22).
I avoided the issue by using "bundle install" command and specifying a GemFile with previous versions.
# Contents of Gemfile
source "https://rubygems.org"
ruby "2.5.1"
gem 'calabash-android', '0.9.5'
gem 'cucumber'
gem 'rexml'
gem 'rubyzip', '1.2.1'
You may want to refer to similar issues raised such as https://github.com/calabash/calabash-android/issues/802

How do I correctly use the Ruby Tk module?

I'm currently trying to create a basic GUI application in Ruby using the Tk module. Whenever I attempt to require the module (as tk or tcltklib), I get the following LoadError:
LoadError (126: The specified module could not be found. - C:/Ruby25/lib/ruby/gems/2.5.0/gems/tk-0.2.0/lib/tcltklib.so)
Currently, I have:
Installed Tcl (ActiveTcl) from the ActiveState website, specifically the 8.5.18.0 version for Windows (x86).
Installed Ruby with RubyInstaller for Windows, specifically Ruby+Devkit 2.5.3-1 (x86). The MSYS2 development toolchain was also selected to be installed, and all 3 components were chosen during ridk install.
Run gem install tk. The RubyInstaller changelog notes that, as of version 2.4.1-1, tk is no longer part of the standard library but can still be installed with gem install tk.
Attempted to require 'tk' and require 'tcltklib' in IRB and received the error above.
When running the following through IRB
require 'tk'
The output is
Traceback (most recent call last):
8: from C:/Ruby25/bin/irb:11:in `<main>'
7: from (irb):3
6: from C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
5: from C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
4: from C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
3: from C:/Ruby25/lib/ruby/gems/2.5.0/gems/tk-0.2.0/lib/tk.rb:7:in `<top (required)>'
2: from C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
1: from C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
LoadError (126: The specified module could not be found. - C:/Ruby25/lib/ruby/gems/2.5.0/gems/tk-0.2.0/lib/tcltklib.so)
The referenced file (C:/Ruby25/lib/ruby/gems/2.5.0/gems/tk-0.2.0/lib/tcltklib.so) does in fact exist though and this error seems different to the one output when requiring a non-existent module.
There seems to be very little information on this specific error, in fact, the only related things I could find were 10 year old posts on the Ruby forum which didn't yield much information.

RVM after install ruby 2.5.1 got error require': cannot load such file -- bundler/setup

After install ruby 2.5.1 using RVM (lasted), when i run rails s, i got error bellow:
Traceback (most recent call last):
5: from bin/rails:3:in `<main>'
4: from bin/rails:3:in `require_relative'
3: from /Users/thiensubs/Documents/super-control/config/boot.rb:3:in `<top (required)>'
2: from /Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
1: from /Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- bundler/setup (LoadError)
Any body can help me?
You need to check your gem list and see if bundler is installed, then bundle install (--without production)
Check that you don't have a .ruby-version file with just "2.5" in it. Switching mine to "2.5.1" fixed this.
Worked for me
gem update --system

How to resolve LoadError: cannot load such file error in jenkins

I am trying to run a ruby file from jenkins shell.
I wrote following commands in jenkins shell-
cd /home/user/Desktop/Rubyfolder
ruby test.rb
But when i am running the build it is returning error:
+ cd /home/user/Desktop/Rubyfolder
+ ruby test.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rest_client (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/user/Desktop/RubyScript/api_url.rb:2:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test.rb:1:in `<main>'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
It is returning success when i am running it from my system console.
Please help. Thanks in advance.
It looks like Jenkins isn't loading the RVM environment where your Gem is installed. Check out RVM's instructions on integrating it. There's also a plugin that might be helpful.
The summary steps are:
Make sure RVM is installed for the jenkins user
Run source "$HOME/.rvm/scripts/rvm" from jenkins .bashrc
Add rvm use ruby_version[#gemset] in your setup script
Or use rvm rubyversion[#gemset] do <command>

Resources