Travis CI for Github? - github

I have a minimalistic .travis.yml file, which consists of:
php:
- "5.4"
But on console, it fails with:
$ rvm use default --install --binary --fuzzy
Using /home/travis/.rvm/gems/ruby-1.9.3-p448
$ ruby --version
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
$ rvm --version
rvm 1.21.3 (latest-minor) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
$ gem --version
2.0.3
$ rake
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/travis/.rvm/gems/ruby-1.9.3-p448#global/bin/ruby_noexec_wrapper:14:in `eval'
/home/travis/.rvm/gems/ruby-1.9.3-p448#global/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
The command "rake" exited with 1.
Done. Your build exited with 1.
It's defaulting to ruby when I have specified PHP as the language, whats wrong here ?

Try making your .travis.yml a little less minimalist:
language: php
php:
- 5.4
Also, using php with travis uses phpenv instead of rvm
Read up more on it here:
http://about.travis-ci.org/docs/user/languages/php/

It took me some time to figure out so I'm posting here for anyone else that may encounter this in the future:
I had no idea that, in YAML, whitespace has meaning. Tabs/spaces (and possibly \r\n ("windows") vs \n ("linux")) matter. A simple change I did to my .yml file made a night-and-day difference (build failed before, built correctly after).
Lesson learned here: YAML cares about whitespace. Make sure your .travis.yml file is correct!

Related

Swift Build no such command

python-swiftclient 3.0.0
Ubuntu 16.04.1 LTS
I type in swift build and it returns the list of swift commands and says at the end no such command. Could not find anyone describing this specific command line response.
That's because you use either python-swiftclient either your PATH is wrong.
If swift --version returns:
python-swiftclient 3.0.0
Then you aren't currently calling swift build system. Check this link and update your swift release here.
Else check that you call the right swift executable by doing:
which swift
The output is the executable you are actually calling.
Environmental variable failure
just
source ~/.bashrc
Seems that the entire swift environment is needed, so visit the swift download page, and choose your system (mine is ubuntu 18.04):
$ wget https://download.swift.org/swift-5.5.2-release/ubuntu1804/swift-5.5.2-RELEASE/swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ tar -xf swift-5.5.2-RELEASE-ubuntu18.04.tar.gz
$ PATH=~/swift-5.5.2-RELEASE-ubuntu18.04/usr/bin:$PATH
This solution worked perfect for me.

Bundle with capistrano installed by chef

I'm configuring a vagrant box using chef and then deploying my app using capistrano.
my chef recipe to install bundler is the following:
include_recipe "rbenv"
include_recipe "rbenv::ruby_build"
rbenv_ruby node[:rbenv][:ruby] do
global true
end
rbenv_gem "bundler" do
ruby_version node[:rbenv][:ruby]
end
using the Riot rbenv cookbook
When I try using the bundle with capistrano I figured that the executed bundle is one that was preinstalled on the box, rather than the one installed by chef.
Here's the problem:
$ which bundle
/opt/rbenv/shims/bundle
$ sudo which bundle
/usr/bin/bundle
$ sudo su -
root# which bundle
/opt/rbenv/shims/bundle
Basically it appears that Capistrano runs the commands using the second form, were it uses the /usr/bin/bundle.
I've tried running:
$ sudo bundle
/usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8:in `require': no such file to load -- rubygems (LoadError)
from /usr/lib/ruby/vendor_ruby/bundler/rubygems_ext.rb:8
from /usr/lib/ruby/vendor_ruby/bundler.rb:11:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:11
from /usr/bin/bundle:4:in `require'
from /usr/bin/bundle:4
and I obtain exactly the same exception I see in Capistrano.
If I manually uninstall bundler then here's what I obtain:
$ bundle
Bundler::GemfileNotFound
$ sudo bundle
sudo: bundle: command not found
$ sudo su -
root# bundle
Bundler::GemfileNotFound
UPDATE
I've figured that the whole ruby version is not available for sudoers:
$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ sudo ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
even more troubles.
Can you help me ?
thanks.
The problem is not that the rbenv-managed Ruby is not available to sudoers. The problem is that the system Ruby is used by default, unless overridden by something else -- usually .bashrc or a /etc/profile.d/* or such.
Since capistrano doesn't source any of these files, it uses the system Ruby.
You should tell cap to use the rbenv bin paths before the system ones by adding:
set :default_environment, {
'PATH' => "/opt/rbenv/shims:/opt/rbenv/bin:$PATH"
}
to your deploy.rb file.
Update
In Capistrano v3, the :default_environment has been renamed to :default_env.
Apparently tweaking with the default_env is a possibility, but not the preferred way.
as:
set :default_environment, {
'PATH' => "/opt/rbenv/shims:/opt/rbenv/bin:$PATH"
}
is not maintained by capistrano and probably even dangerous.
The preferred way is to look into the program one wants to run for a way to fix this.
In particular my problem: the RVM needs to be initialized upon shell startup, and any RVM installation tool will include your .bashrc with the call to the proper init script at the end of the file. Also at the beginning of .bashrc there's a command that exits the script when it's called on a non interactive shell.
Accidentally Capistrano runs the scripts on a non interactive shell, so when it calls RVM commands they are not initialized, in the non interactive shell.
The solution in my case was to edit the .bashrc file in chef so to call the RVM init script before exiting.

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

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?

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