When downloading xcode 11 with xcode-install 2.6.1, we get this error
xcversion update: NoMethodError: undefined methodfirst' for nil:NilClass
Its a known issue https://github.com/xcpretty/xcode-install/issues/348
How to fix it?
Works for any ruby version manager (chruby, rvm, rbenv, etc or no version manager)
When you call
xcversion update
Get the path of the failing file -> install.rb
Open it in your editor
Comment line 382
A workaround is to comment out the failing call in install.rb, however its path varies by installation.
Check the output of the xcversion command to find it:
Available session is not valid any more. Continuing with normal login.
/usr/local/lib/ruby/gems/2.4.0/gems/xcode-install-2.4.4/lib/xcode/install.rb:444:in `prereleases': undefined method `first' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.4.0/gems/xcode-install-2.4.4/lib/xcode/install.rb:379:in `fetch_seedlist'
--> /usr/local/lib/ruby/gems/2.4.0/gems/xcode-install-2.4.4/lib/xcode/install.rb
Open that install.rb in a text editor, go to line #382 which calls the prereleases function and comment it out by changing it to
##xcodes += prereleases.reject { |pre| names.include?(pre.name) }
(Note: this is exactly the same solution as provided by Ted, but without the flashing gifs.)
Related
When I execute the code
b.javascript_dialog().exists?
it works fine in WATIR 3.0.0 but it's throwing the following error in WATIR 4.0.2, Why it is so? Have they given any other function corresponding to "javascript_dialog()"?
hello.rb:8:in <main>': undefined methodjavascript_dialog' for # (NoMethodError)
From the changelog for v3.1.0:
Remove Browser#(javascript_)dialog. Use Browser#alert API instead.
The javascript_dialog has been replaced by alert:
b.alert.exists?
Trying to use GC module in Ruby 1.9.3
In repl (or script) getting this error
include GC
=> Object
GC.enable
=> false
GC.malloc_allocations
NoMethodError: undefined method `malloc_allocations' for GC:Module
From the 1.9.3 GC Module docs, malloc_allocations is a public class method so why is Ruby saying that it is an undefined method?
The docs are omitting that you need to edit gc.c and set CALC_EXACT_MALLOC_SIZE to 1 before recompiling ruby in order for this method to be available. This flag also turns on the tracking required to support this feature.
See for example https://github.com/ruby/ruby/blob/ruby_1_9_3/gc.c#L3718
It goes like this (note that I enabled echo in pik.bat). All latest release versions downloaded today (though there may be some collisions with old software not properly uninstalled)
F:\ruby\pik>pik.bat
F:\ruby\pik>"F:\ruby\pik\pik_runner.exe" "F:\ruby\pik\pik.bat"
There was an error.
Error: can't dup NilClass
in: pathname.rb:205:in dup'
in: pathname.rb:205:ininitialize'
in: pik/commands/add_command.rb:17:in new'
in: pik/commands/add_command.rb:17:inadd'
in: pik/commands/add_command.rb:13:in `execute'
in: pik_runner:27
Pik runs in its own environment, so make sure the Ruby environment is in the PATH. For example, if Pik is installed in C:\tools, path should be modified as following
C:\tools;C:\Ruby\ruby-1.8.7-p374\bin;
You must install pik .30 or higher.
I get this error:
Error: undefined method `like' for Sequel:Module
using:
#info = DB[:info].where(Sequel.like(:content, "%#{params[:sc]}%")) if params[:sc]
I found the example code in Sequel's documentation:
DB[:artists].where(Sequel.like(:name, 'A%'))
What's wrong with my code?
Which version of Sequel are you running? The documentation assumes the latest version, so if you aren't using the latest version, you should upgrade.
I'm following the ruby on rails tutorial: http://railstutorial.org/chapters/static-pages#top
I'm up to using rspec. Having installed the win32console gem, it outputs gibberish in the console, i assume it is outputting the ansi colour change codes:
>rspec spec/
?[31mF?[0m?[31mF?[0m
Finished in 0.34376 seconds
?[31m2 examples, 2 failures?[0m
1) PagesController GET 'home' should be successful
Failure/Error: Unable to find C to read failed line
?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x22294e0>?[0m
?[90m # ./spec/controllers/pages_controller_spec.rb:7:in `block (3 levels) in <top (required)>'?[0m
2) PagesController GET 'contact' should be successful
Failure/Error: Unable to find C to read failed line
?[31mundefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2:0x2173d28>?[0m
?[90m # ./spec/controllers/pages_controller_spec.rb:14:in `block (3 levels) in <top (required)>'?[0m
Any tips how to fix this?
Ansicon works a treat!
http://adoxa.110mb.com/ansicon/index.html
Download, extract it somewhere, and do:
ansicon -i
Then close/reopen the command prompt. Sweet!
There was a bug in beta releases of RSpec 2. If you upgrade to latest you should now see colors if you have win32console installed.
See this: http://github.com/rspec/rspec-core/issuesearch?state=closed&q=color#issue/143
UPDATE: Keep an eye on this thread:
http://groups.google.com/group/rubyinstaller/browse_thread/thread/2d2a62db7281509a/?pli=1
Update:
Rspec is still very buggy with windows coloring, especially if you're trying to use it with Autotest and/or Spork.
If you are still seeing escape codes, a quick hack is to edit the following file (exact path will depend on your version of RSpec)
%RUBY_HOME%\lib\ruby\gems\1.9.1\gems\rspec-core-2.0.1\bin\rspec
And add the following line
require 'win32console'