We are downloading the latest Cordova documentation and want to generate it with Jenkins.
We are using RVM to manage the Ruby instances.
Here is the relevant shell execution in the Jenkins job.
#!/bin/bash
source "$HOME/.rvm/scripts/rvm"
echo "====== Setting up ruby ========================================"
rvm use "1.7.8"
set -e
echo "====== Installing cordova docs dependencies ==================="
gem install bundler
gem install nokogiri
cd "${WORKSPACE}/submodule_apache_cordova_docs"
bundle install
cd -
echo "====== Generating documents ==================================="
rvm current
ruby -v
${WORKSPACE}/submodule_apache_cordova_docs/bin/generate
and this is the output for that section
[workspace] $ /bin/bash /tmp/hudson1421417307959072745.sh
====== Setting up ruby =====================================
Using /var/lib/jenkins/.rvm/gems/jruby-1.7.8
====== Installing cordova docs dependencies ================
Successfully installed bundler-1.7.2
1 gem installed
Successfully installed nokogiri-1.6.3.1-java
1 gem installed
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using json 1.8.1
Using nokogiri 1.5.9
Using rspec 1.3.0
Using bundler 1.7.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
/var/lib/jenkins/jobs/Build-Documentation/workspace
====== Generating documents ================================
jruby-1.7.8
jruby 1.7.8 (1.9.3p392) 2013-11-14 0ce429e on OpenJDK 64-Bit Server VM 1.7.0_65-b32 [linux-amd64]
SyntaxError: /var/lib/jenkins/jobs/Build-Documentation/workspace/submodule_apache_cordova_docs/bin/../lib/cordova/jodoc.rb:28: syntax error, unexpected tCONSTANT
#template_directories = [ File.join TEMPLATE_PATH, 'default' ]
^
require at org/jruby/RubyKernel.java:1084
require at /var/lib/jenkins/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
require at /var/lib/jenkins/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
(root) at /var/lib/jenkins/jobs/Build-Documentation/workspace/submodule_apache_cordova_docs/bin/../lib/docs_generator.rb:1
require at org/jruby/RubyKernel.java:1084
(root) at /var/lib/jenkins/jobs/Build-Documentation/workspace/submodule_apache_cordova_docs/bin/../lib/docs_generator.rb:26
(root) at /var/lib/jenkins/jobs/Build-Documentation/workspace/submodule_apache_cordova_docs/bin/generate:22
Build step 'Execute shell' marked build as failure
Finished: FAILURE
As far as I can see all the dependency versions are correct, including Ruby.
This is the file that errors: https://github.com/apache/cordova-docs/blob/master/lib/cordova/jodoc.rb
What is causing the error?
Thanks
Related
I'm newbie to Ruby and Jekyll. Recently I've tried to install Jekyll Multiple Languages Plugin onto my GitLab Pages instance. I've managed to successfully add
'gem install jekyll-multiple-languages-plugin
bundle install'
into the .gitlab-ci.yml but when I try to add
gems:
jekyll-multiple-languages-plugin
into _config.yml in order to use it on the site my commit fails with the following error:
Using jekyll-watch 1.5.0
Using jekyll 3.4.3
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
$ jekyll build -d public
Configuration file: /builds/myusername/forty-jekyll-theme/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-multiple-languages-plugin or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-multiple-languages-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.4.3 | Error: jekyll-multiple-languages-plugin
ERROR: Job failed: exit code 1
I have used this method because any attempt to edit Gemfile ends up in commit error. I've also tried to do all presented steps except adding bundle install. In that case I get the same error, but the beginning looks like:
18 gems installed
$ gem install jekyll-multiple-languages-plugin
Successfully installed jekyll-multiple-languages-plugin-1.5.1
1 gem installed
$ jekyll build -d public
I did not manage to find the way to solve it on Stack Overflow nor other sites. For example this did not help
With the awesome support of allejo from Jekyll's IRC channel I've managed to solve the problem. Here are the steps:
I've used Gemfile. Now it looks like
source 'https://rubygems.org'
gem 'jekyll'
group :jekyll_plugins do
gem 'jekyll-multiple-languages-plugin'
end
The second modified thing was .gitlab-ci.yml (the first line - image: ruby - is also included)
image: ruby
pages:
stage: build
script:
# - gem install jekyll
- gem install bundler
# - gem install jekyll-multiple-languages-plugin
- bundle install
- bundle exec jekyll build -d public
# - jekyll build -d public
artifacts:
paths:
- public
only:
- master
It produced a bug, but it was only caused by the lack of declared language which is part of standard plugin configuration.
It seems that the workflow that I use to build and install gems locally does not translate when the gemspec has platform = "java".
I am using Jruby 1.7.18, installed with rvm
$ which gem
/Users/USERNAME/.rvm/rubies/jruby-1.7.18/bin/gem
When I build a gem with the default platform, everything goes according to plan:
$ grep platform batching_core.gemspec
# spec.platform = "java"
$ gem build batching_core.gemspec
Successfully built RubyGem
Name: batching_core
Version: 0.1.0
File: batching_core-0.1.0.gem
$ gem install batching_core-0.1.0.gem
jar dependencies found on non-java platform gem - do not install jars
Successfully installed batching_core-0.1.0
1 gem installed
Note the success message of "Successfully installed batching_core-0.1.0"
But when my project requires me to use platform=java so that I can require some jar files. I can build the gem, but I cannot install it. The installation ends without the success message, and I cannot require the gem in irb:
$ grep platform batching_core.gemspec
spec.platform = "java"
$ gem build batching_core.gemspec
Successfully built RubyGem
Name: batching_core
Version: 0.1.0
File: batching_core-0.1.0-java.gem
$ gem install batching_core-0.1.0-java.gem
$
^^ Note the lack of output. No success message, no output at all.
$ irb
jruby-1.7.18 :001 > require 'batching_core'
LoadError: no such file to load -- batching_core
from org/jruby/RubyKernel.java:1071:in `require'
from /Users/USERNAME/.rvm/rubies/jruby-1.7.18/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
I tried the solution suggested here, but got the same result.
Creating a gem using Jruby and not Ruby
EDIT: Here's the project that causes the issue:
https://github.com/ValerieAnne563/so34754484
It looks to me like the gem does not contain the file you're trying to require. Can you check the contents to see if "batching_core.rb" is in the gem's lib dir?
As for the warning...I'm confused about your environment. This is a gem with a jar in it being installed on JRuby? Maybe it would clarify some things if you link to the project or post the gemspec.
/gems/htmlentities-4.3.2/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
/gems/ruby-2.2.0/gems/fog-core-1.25.0/lib/fog/core/collection.rb:144: warning: circular argument reference - filters
The obvious suspicion is that these gems don't like ruby 2.2.0, but things seem to be working
Should I fear future, imminent failures, or has these gems just haven't caught up yet?
Both problems were solved in newer versions of these gems.
If I am depending on gems like that, I usually wait a little bit before switching the project to the latest and greatest ruby in production. Gems need time to get compatible with all the changes.
I to have like this error when install redmine 3.2:
/usr/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466
All is simple - just edit this file and remove duplicated line!)
But sometimes need just check your htmlentities version and remove not needed
gem list htmlentities
gem uninstall htmlentities -v '4.x.x'
My System Config: Win 8.1 + SQL 2016 Expr SP1 + Redmine DB (type SQL 2012 CS AI) + Redmine 3.3.1 + Ruby 2.3.3 + devkit + ImageMagick-6.9.6-8-Q16-HDRI-x64-dll (ImageMagick-7.0.3 Not working!)
Fix issue with htmlentities-4.3.1 "key inodot"
gem install htmlentities -v '4.3.4'
gem uninstall htmlentities -v '4.3.1'
Fix issue with error load "tiny_tds"
gem install tiny_tds -v '1.0.5'
gem uninstall tiny_tds -v '0.6.2'
Change all dependencies in Gemfile & Gemfile.lock from old version to new installed.
All other commands from Installing Redmine Guide Site.
Result:
c:\inetpub\redmine>bundle exec rake db:migrate
migrating
add_column(:roles, :settings, :text)
-> 0.0019s
-> -1 rows
AddRolesSettings: migrated (0.0027s)
c:\inetpub\redmine>set REDMINE_LANG=ru
c:\inetpub\redmine>bundle exec rake redmine:load_default_data
Default configuration data loaded.
c:\inetpub\redmine>bundle exec rails server webrick -e production
=> Booting WEBrick
=> Rails 4.2.7.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-12-13 15:14:25] INFO WEBrick 1.3.1
[2016-12-13 15:14:25] INFO ruby 2.3.3 (2016-11-21) [x64-mingw32]
[2016-12-13 15:14:25] INFO WEBrick::HTTPServer#start: pid=4468 port=3000
[2016-12-13 16:02:58] INFO going to shutdown ...
[2016-12-13 16:02:58] INFO WEBrick::HTTPServer#start done.
Exiting`enter code here`
gem uninstall htmlentities -v '4.3.2'
gem install htmlentities -v '4.3.4'
I am using using Windows 8 with cygwin. I am trying to configure Omega4 Drupal theme.
I have ruby version 1.9.3p547 (2014-05-14 revision 45962) [x86_64-cygwin]
I have installed ruby gems version 2.4.1 from https://rubygems.org/ , as shown also when I run the gem -v command:
$ gem -v
2.4.1
I have Drupal installed in folder c:\xampp\htdocs\drupal , and cygwin is accessible by cygdrive.
I navigate to the folder of my subtheme and then run the command like so:
$ drush omega-guard
which: no tput in (/home/prem/.rvm/gems/ruby-1.9.3-p547#omega.furniure/bin:/home/ prem/.rvm/gems/ruby-1.9.3-p547#global/bin:/home/prem/.rvm/rubies/ruby-1.9.3-p547 /bin:/home/prem/.rvm/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS Client:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Intel/OpenCL SDK/3.0/bin/x86:/cygdrive/c/Program Files (x86)/Intel/OpenCL SDK/3.0/bin/x64:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files/Java/jre7/bin:/cygdrive/c/Ruby200-x64/bin:/cygdrive/c/Ruby193/bin: /cygdrive/c/ProgramData/Drush:/cygdrive/c/Program Files (x86)/Drush/GnuWin32/bin:/cygdrive/c/Program Files (x86)/Drush/Php:/cygdrive/c/Program Files (x86)/Drush/cwRsync/bin:/cygdrive/c/xampp/php)
Which theme do you want to run Guard for?
[0] : Cancel
[1] : furniure (Subtheme of Omega) - Please provide a description for your
theme.
[2] : Ohm (Subtheme of Omega) - Omega based demonstration theme. Serves as a
best-practice reference for the Omega documentation. Ohm will be
constantly updated as best practice evolves so shouldn't be used in
production.
[3] : Omega - A powerful HTML5 base theme framework utilizing tools like
Sass, Compass, Grunt, Bower, Ruby Version Manager, Bundler and more.
1
There was a problem with your setup: [error]
Resolving dependencies...
Bundler can't satisfy your Gemfile's dependencies.
Install missing gems with `bundle install`.
However when I run the below command I run into an error I don't understand:
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.3.6
TypeError: can't convert nil into String
An error occurred while installing sass (3.4.1), and Bundler cannot continue.
Make sure that `gem install sass -v '3.4.1'` succeeds before bundling.
$ gem install sass -v 3.4.1
ERROR: While executing gem ... (TypeError)
can't convert nil into String
So my question is about the above error While executing gem ... (TypeError) can't convert nil into String: how can I resolve this error?
My Environment
Vanilla Ubuntu 12.10, no rvm or renv.
> gem --version
1.8.23
> ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
> bundle --version
Bundler version 1.2.1
My problem
I have a rake task to package my gems and upload them to my development and production servers. The problem is that the rake task fails when the Gemfile includes git or path gems. Bundler already supports packaging of these type of gems and it works great on my terminal but it fails when running withing a rake task and I cannot find out why.
My rake task
> cat lib/tasks/upload.rake
namespace :deploy do
desc "Package all gems and upload to remote server"
task :upload => [:environment] do |t, args|
if ! system("bundle package --all")
raise "TOTAL FAIL"
end
# Magic method to upload vendor/cache to remote server
end
end
My tries
Running bundle package in the terminal works:
> bundle package --all
....
Using bson (1.7.0)
Using bson_ext (1.7.0)
Using cancan (1.6.8) from git://github.com/ryanb/cancan.git (at /home/ryujin/Projects/rails/Encluster4/vendor/cache/cancan-4dcd54459482)
Using carrierwave (0.7.0)
Using coffee-script-source (1.4.0)
....
Updating files in vendor/cache
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating files in vendor/cache
Running bundle package withing irb also works:
> irb
irb> system("bundle package --all")
...
Using ansi (1.4.3)
Using bson (1.7.0)
Using bson_ext (1.7.0)
Using cancan (1.6.8) from git://github.com/ryanb/cancan.git (at /home/ryujin/Projects/rails/Encluster4/vendor/cache/cancan-4dcd54459482)
Using carrierwave (0.7.0)
Using coffee-script-source (1.4.0)
...
Updating files in vendor/cache
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating files in vendor/cache
=> true
But bundle package does not work when executed within my simple rake task:
> bundle exec rake deploy:upload
Updating files in vendor/cache
Could not find cancan-1.6.8.gem for installation
rake aborted!
TOTAL FAIL
Tasks: TOP => deploy:upload
(See full trace by running task with --trace)
I find not reason why this could fail. I am running in the same environment all the time. I already checked the bundle exec file is the same (/usr/local/bin/bundle) on all three cases. I have no traces or rvm or renv or anything like that. Also tried running the task without bundle exec and the same problem.
Thanks in advance for any tips on why this happens.
I had the same trouble.
I checked the environment variables and find out that the bundler modifies RUBYOPT:
$ bundle exec env > benv.txt
$ env > env.txt
$ diff -u env.txt benv.txt
--- env.txt 2012-12-05 17:13:10.000000000 +0400
+++ benv.txt 2012-12-05 17:13:07.000000000 +0400
## -72,4 +72,8 ##
CDPATH=.
install_flag=1
rvm_hook=
-_=/usr/bin/env
+_=/Users/denis/.rvm/gems/ruby-1.9.3-p327#global/bin/bundle
+_ORIGINAL_GEM_PATH=/Users/denis/.rvm/gems/ruby-1.9.3-p327:/Users/denis/.rvm/gems/ruby-1.9.3-p327#global
+BUNDLE_BIN_PATH=/Users/denis/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/bin/bundle
+BUNDLE_GEMFILE=/Users/denis/src/my-project/Gemfile
+RUBYOPT=-I/Users/denis/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib -rbundler/setup
So, to workaround I do this:
system %Q(/usr/bin/env RUBYOPT= bundle package)
Hope this helps!
One can also prefer to use
Bundler.with_clean_env do
sh "bundle update --source .."
end
and indeed it is an RUBYOPT problem as mentioned by Denis