Why can't TeamCity run this Rake build using Albacore? - rake

I created a build script using Rake & Albacore which builds a solution and executes unit tests. I am trying to set it up in TeamCity. I am getting this error.
Cannot start build runner: If you wan't to use bundler please install
it at first. The gem wasn't found in Gem paths of Ruby SDK with
interpreter: 'C:\Ruby187\bin/ruby.exe'.
Hide stacktrace
jetbrains.buildServer.agent.rakerunner.RakeTasksBuildService$MyBuildFailureException:
If you wan't to use bundler please install it at first. The gem wasn't
found in Gem paths of Ruby SDK with interpreter:
'C:\Ruby187\bin/ruby.exe'. Gem paths: C:/Ruby187/lib/ruby/gems/1.8
C:/Users/af/.gem/ruby/1.8
I added one parameter, where Albacore is installed. But, I am still getting the error.
GEM_PATH=C:\Ruby187\lib\ruby\gems\1.8\gems\albacore-0.3.4\albacore.gemspec

Ok finally was able to resolve the problem. I simply created a batch file that executes the rake task and instead of using "Rake Build Step" in Team city; used the command line build step and executed the batch file. It also gives me complete log of all the build steps, tests run etc.
Hopefully this will help someone else too. You don't need to setup a Rake Build Step as it turns out.

It's not clear that Albacore was missing. The error message indicates that TeamCity cannot find Rake itself!
Cannot start build runner
What was the exact Rake task configuration? Specifically the Ruby Interpreter configuration section? You can tell TeamCity exactly which Ruby to run, which will affect which gems are available (and Rake is just a gem).
It looks like you have a Ruby 1.8.7 installed and that you must have installed Albacore
cmd> gem install albacore
Do you also have Rake installed? In Ruby 1.8.7, the Rake gem was not included by default. You can list the machine's installed gems by
cmd> gem list --local
You'll should install Rake.
cmd> gem install rake
I'm not actually sure how you ended up getting this to work. What's the contents of the batch file? Do you have any other Ruby/Rake installed?

Related

How to setup rake to compile mruby gems?

I am trying to build the example gem from here following the mruby documentation for building gems.
I'm on a Mac OS Catalina, and I have installed RVM to manage my installation mruby. Right now which ruby returns /Users/mdorier/.rvm/rubies/mruby-2.0.1/bin/ruby so I can see that mruby is used.
The example gem above has an mrbgem.rake file, so even though the documentation doesn't explain how to build the gem, I suppose rake should be invoked in that directory. I didn't have rake installed, so I tried to install it with gem install rake, but it seems that Mac OS's native gem executable in /usr/bin got invoked, apparently installing the normal ruby's rake gem. When I call that rake, it doesn't find a Rakefile in the directory. If I specify rake -f mrbgem.rake, it tells me NameError: uninitialized constant MRuby.
I see that mruby doesn't have a gem command but seems to have a mgem that can be installed with gem. I installed it. I see that there is a mruby-rake mgem available, which I activated using mgem add mruby-rake, but it doesn't change what the rake command points to.
Can someone explain how I can install and use the proper rake command to build this mruby gem?

cannot build apache thrift due to ruby rake errors

I am trying to build thrift from source tarball (https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz), but it fails with this error:
Making all in rb
make[3]: Entering directory `/home/akonsu/a/thrift-0.9.0/lib/rb'
/usr/local/bin/rake
rake aborted!
cannot load such file -- rspec/core/rake_task
I would appreciate any help.
this helped:
gem install rspec
What also helps, if you are not interested in Ruby in the first place, is configure Thrift to do without.
$ ./configure --without-ruby
So that is --without-ruby, and NOT --without-rb as some other sources suggest.
and then run make and sudo make install.
It is a known bug apparently.
I found this here: https://issues.apache.org/jira/browse/THRIFT-1367
(I am on on Mac OS X 10.7.5, BTW. I don't know about any other versions/platforms...)

building ember.js with rake

I'm trying to learn ember so I created a local git repository cloned from github so I could stay up to date with it. I've never used rake before so I also downloaded and installed that from http://rake.rubyforge.org/. Rake appeared to install correctly and when I ran rake --help I got the help options so I think it's all okay. So then in my command prompt, I did a CD to the directory that has the github files for ember. From my reading, since there's a Rakefile in the ember directory it sounds like I can just CD to that directly and run rake. But when I do that I get the following errors. I'm sorry but I have no experience with rake so I'm not sure what I am doing wrong... or if it's something in the build file?
c:\inetpub\wwwroot\dev\js\ember.js>rake
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rake/rake_module.rb:25: warning: redundant nested repeat operator
c:/inetpub/wwwroot/dev/js/ember.js/Rakefile:485: warning: ambiguous first argument; put parentheses or even spaces
c:/inetpub/wwwroot/dev/js/ember.js/Rakefile:487: warning: ambiguous first argument; put parentheses or even spaces
rake aborted!
cannot load such file -- bundler/setup
c:/inetpub/wwwroot/dev/js/ember.js/Rakefile:3:in `<top (required)>' (See full trace by running task with --trace)
c:\inetpub\wwwroot\dev\js\ember.js>
You need to install bundler (so you can get all of the gems ember's rake tasks depend on).
gem install bundler
Then, inside your ember directory:
bundle install
rake -T

rake snorby:setup

while running:
rake snorby:setup
getting below error:
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.
(See full trace by running task with --trace)
Please help.
Try
bundle exec rake snorby:setup
this error derived from the fact that you have multiple versions of rake gem, even newer than the one required by your Gemfile.
You can see this by typing
gem list rake
that should print on your console something like this:
*** LOCAL GEMS ***
rake (0.9.2.2, 0.8.7)
since rake is a tool you launch from the outside of a Rails (bundler) environment, it cannot know anything about bundle version unless you explicitly specify to follow bundler's version directions with the bundle exec command.

libxml-ruby on windows xp problem

About a month ago I installed libxml-ruby using
gem install libxml-ruby
and it worked fine.
Then i went to install it on another machine today and it failed with this error:
C:\Windows\system32>gem install -r libxml-ruby
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake RUBYARCHDIR=c:/ruby/lib/ruby/
gems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-60/lib RUBYLIBDIR=c:/ruby/lib/ruby/g
ems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-60/lib
'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake' is not recognized as an int
ernal or external command,
operable program or batch file.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-1.
1.3-x86-mswin32-60 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/libxml-ruby-1.1.3-x86-mswin32-6
0/ext/mingw/gem_make.out
I have rake installed and win32-api
I then got confused if I had really installed libxml-ruby on my machine previously and tried uninstalling and reinstalling it. It now fails with the same error message on my machine and some scripts i've written to parse xml, which used to work, no longer work. Has anyone else tried installing libxml-ruby lately on windows xp? It appears to be completely broken.
I got the same problem, and ended up figuring out a decent work-around.
It seems the error is correct
'c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake'
isn't a valid executable. It needs to run rake from the root ruby/bin folder, where the wrapping batch file can be found.
Rummaging through the rubygems code, I found that Gem::Ext::RakeBuilder tries to build extensions using
cmd = ENV['rake'] || Gem.bin_path('rake') rescue Gem.default_exec_format % 'rake'
So, simply setting the rake environment variable to something valid before running the gem install should help:
C:\>set rake=c:\ruby-1.8.6-26\bin\rake.bat
C:\>gem install libxml-ruby --no-rdoc --no-ri
Building native extensions. This could take a while...
Successfully installed libxml-ruby-1.1.3-x86-mswin32-60
1 gem installed
(I skipped installing rdoc and ri because it prints out a bunch of formatting warnings, making it more difficult to paste the results in here.)