I'm just getting started with trying to move my infrastructure over to Chef, and I think I must be missing something obvious.
I'm using the chef-rvm cookbook to install RVM, and I'd like it to install Ruby 1.9.3p125 and set that as the default.
Here's my base server role:
name "base"
description "Basic configuration for all nodes"
run_list(
'recipe[git]',
'recipe[sudo]',
'recipe[ubuntu]',
'recipe[rvm]',
'recipe[postgresql::client]'
)
override_attributes(
:authorization => {
:sudo => {
:users => ["ubuntu"],
:passwordless => true
}
},
:rvm => {
:rubies => ["ruby-1.9.3-p125"],
:default_ruby => "ruby-1.9.3-p125",
:global_gems => ['bundler', 'rake']
}
)
This runs without any problems, but if I ssh into the server after it's finished, rvm doesn't list any installed rubies:
ubuntu#test.server:~$ rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
Is this even the correct way to specify that certain rubies be installed? If not, what is the correct way? If so, what am I doing wrong?
There's nothing wrong with your code. The problem lies in the fact that you never told Chef to install the Rubies that you defined in your role.
You have included recipe[rvm] in the role's run_list, which translates to recipe[rvm::default]. Looking into the cookbook's documentation, you find that this recipe:
Installs the RVM gem and initializes Chef to use the Lightweight Resources and Providers (LWRPs). Use this recipe explicitly if you only want access to the LWRPs provided.
What you want can be best achieved by substituting recipe[rvm] for recipe[rvm::system] in the run_list:
Installs the RVM codebase system-wide (that is, into /usr/local/rvm) and installs Rubies, global gems, and specific gems driven off attribute metadata. This recipe includes default and system _ install.
Use this recipe by itself if you want RVM system-wide with Rubies installed, etc.
Related
How does one vendor a npm package in deno?
import_map.json:
{
"imports": {
"lume/": "https://deno.land/x/lume#v1.12.1/",
}
}
Lume has some npm dependencies, like https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.0.tgz.
deno.jsonc:
{
"importMap": "import_map.json",
}
dev_deps.ts:
export * as lume from "https://deno.land/x/lume#v1.12.1/mod.ts";
command:
$ deno vendor --force --unstable dev_deps.ts
# ...
Download https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.1.3.tgz
# ...
thread 'main' panicked at 'Could not find local path
for npm:markdown-it-attrs#4.1.3', cli/tools/vendor/mappings.rs:138:11
I tried adding export * as ma from "npm:markdown-it-attrs"; to dev_depts.ts, but it did nothing.
I found the following issue on github.
Maybe this issue does have something to do with it.
I didn't find anything about how to resolve the problem in the official deno documentation and the lume documentation.
Unfortunately, currently you cannot use import_map in your Deno project if your goal is to publish a module that aims to be used in other applications, simply because you don't handle the way deno runtime will start.
From the application point of view, the deno run command cannot search every import_map configurations in your dependencies and handle them properly.
The import_map feature should be used only at end application level.
The fallback is to use by onvention a deps.ts source file to centralize all your dependencies.
I installed calabash on a new machine, but tests that I ran on my old machine will not run.
As far as I can tell, both machines are set up the same way. They pull the project from the same repository, which includes a Gemfile with calabash-cucumber version 0.18.0. I set the same BUNDLE_ID, DEVICE_ENDPOINT, and DEVICE_TARGET values and use the same physical device.
When I try to run the tests in the console on the new machine, I get this:
$ bundle exec calabash-ios console
Running irb...
irb(main):001:0> start_test_server_in_background
ArgumentError: Could not find a device with a UDID or name matching 'com.my.apps.bundle.id'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/device.rb:126:in `device_with_identifier'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/device.rb:160:in `detect_device'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop/core.rb:71:in `run_with_options'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/run_loop-2.1.1/lib/run_loop.rb:134:in `run'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:718:in `block in new_run_loop'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:716:in `times'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:716:in `new_run_loop'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/launcher.rb:584:in `relaunch'
from /Users/rjones/gambit/gemstubs/ruby/2.1.0/gems/calabash-cucumber-0.18.0/lib/calabash-cucumber/core.rb:943:in `start_test_server_in_background'
from (irb):1
from /Users/rjones/.rbenv/versions/2.1.5/bin/irb:11:in `<main>'
Any ideas why this isn't working?
Please update to 0.19.0.
Can you also paste the exact command you are using to start the
irb(main):001:0> start_test_server_in_background
ArgumentError: Could not find a device with a UDID or name matching
'com.my.apps.bundle.id'
It looks like you set your DEVICE_TARGET to the bundle id? If not, then you have found a bug. It is possible that 0.18.0 is not compatible with run-loop 2.1.1. Downgrade to run_loop 2.0.9 if you want to verify that this is the problem.
I experienced the same issue, when updating cucumber gem from version 1.3.19 to version 2.3.3. I also run tests on physical devices
edit: Sorry, forgot to mention, that I updated run_loop too from version 2.0.6 to 2.1.3
So the versions:
run_loop (2.1.3)
calabash-cucumber (0.18.1)
I guess these are the two that could affect this part, and cucumber was not involved
I found a solution, by setting the variable DEVICE instead of DEVICE_TARGET
For example:
BUNDLE_ID=<bundle_id> DEVICE=<dev_udid> DEVICE_ENDPOINT=<dev_ip> cucumber
Instead of
BUNDLE_ID=<bundle_id> DEVICE_TARGET=<dev_udid> DEVICE_ENDPOINT=<dev_ip> cucumber
I am using Rails 4.0.2, Guard 2.2.4, guard-rspec 4.2.4, rspec-rails 2.14.0, Capybara 2.2.1 and Poltergeist 1.5.0 on Ruby 2.0.0-p353 and OSX Mavericks.
When I run bundle exec guard I got a lot of failure with this error message :
An error occurred in an after hook
Errno::EACCES: Permission denied - /usr/local/Cellar/phantomjs
occurred at /Users/gillesmath/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/open3.rb:211:in `spawn'
I checked the permission on /usr/local/Cellar/phantomjs and didn't notice anything unusual. I can run phantomjs without 'sudo'.
My spec_helper file look like this :
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", FILE)
require 'rspec/rails'
require 'rspec/autorun'
require "capybara/rspec"
require 'webmock/rspec'
require 'capybara/poltergeist'
Dir[Rails.root.join("spec/support/*/.rb")].each { |f| require f }
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
WebMock.disable_net_connect!(:net_http_connect_on_start => true, :allow_localhost => true)
Capybara.javascript_driver = :poltergeist
I can't see what is wrong because the owner:group is the same for both the rails app and the /usr/local/Cellar/phantomjs dir and its content.
Thanks for your help
That error makes it look like it's trying to execute the /usr/local/Cellar/phantomjs directory instead of the executable inside it. I think Poltergeist scans your PATH for the first thing called phantomjs. Is /usr/local/Cellar in your PATH?
If so, I'd recommend taking it out, since executables should never appear in there directly.
If you can't, another option is to configure Poltergeist with an explicit path to phantomjs in your setup code: https://github.com/jonleighton/poltergeist#customization
It looks like someone has already opened a pull request with a fix to skip directories in the Cliver gem that Poltergeist uses, so hopefully that will be fixed soon!
I have a Puppet manifest that installs the Zurb Foundation gem:
class compass {
package { ["rubygems"]:
ensure => 'installed'
}
package { ['zurb-foundation']:
ensure => '3.0.6',
provider => 'gem',
require => Package['rubygems']
}
}
This causes the following error when running puppet apply:
err: /Stage[main]/Compass/Package[zurb-foundation]/ensure: change from absent to 3.0.6 failed: Could not update: Execution of '/usr/bin/gem install -v 3.0.6 --include-dependencies --no-rdoc --no-ri zurb-foundation' returned 1: INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Building native extensions. This could take a while...
ERROR: Error installing zurb-foundation:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
at /etc/puppet/manifests/classes/compass.pp:25
However, doing a gem list yields the following results:
# gem list
*** LOCAL GEMS ***
chunky_png (1.2.8)
compass (0.12.2)
fssm (0.2.10)
rake (10.1.0)
rb-fsevent (0.9.3)
sass (3.2.0.alpha.277)
zurb-foundation (3.0.6)
The error causes puppet apply to not complete properly, since a lot of items are skipped because of failed dependencies. What can I do?
I think that the problem is that you don't have the ruby dev kit installed for you ruby (that's what's used to build native extensions).
You'll want to add something like (it may be different depending on your version of ruby):
package { 'ruby-dev':
ensure => installed,
before => Package['zurb-foundation'],
}
This should allow the gem to be built properly and let your puppet run finish too.
How does one install ruby-opengl-0.60.1 on Ubuntu?
I keep trying
$ gem install ruby-opengl --version 0.60.1
and I am running into the following error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
ERROR: 'rake/gempackagetask' is obsolete and no longer supported. Use
'rubygems/package_task' instead.
/home/matias/.rvm/gems/ruby-1.9.3-p362#sampleGemset/gems/ruby-opengl-0.60.1/
Rakefile:24:in `<top (required)>'
Perhaps I could manually change the "package task" parameter in the Rakefile
and then attempt a local gem install?...
I have found the following urls where the package can be downloaded for manual installation:
rubyforge.org/frs/?group_id=2103
launchpad.net/ubuntu/+source/ruby-opengl/0.60.1+dfsg1-2
And the following appears to be a patch or a small modification:
gist.github.com/tociyuki/2479308
I tried downloading the gem from the launchpad url, and then I tried
$ gem install ruby-opengl-0.60.1.gem
from the Downloads folder, and it gave me a ton of errors.
I eventually tried:
$ sudo apt-get install libopengl-ruby
which seemed to work, and now when I do:
$ gem list -r ruby-opengl
I get:
\*** REMOTE GEMS \***
ruby-opengl (0.61.0, 0.60.0 i386-mswin32)
ruby-opengl2 (0.60.6)
I believe that i386-mswin32 is version 0.60.1 for windows.
With this configuration, I try running Sapphire.rb and it still doesn't work.
I already have ruby-opengl versions 0.60.0 and 0.61.0 installed, but I need 0.60.1 because it creates the 'gl', 'glu', and 'glut' extensions which are required in order to run some .rb files which I have copied from other people. These .rb files are video games created with the Gosu gem.
This is for use specifically with the Gosu gem. Even more specifically, I am trying to run the Sapphire game (github.com/KoBeWi/Sapphire), which also requires the Texplay gem.
Or is there another way to activate the 'gl', 'glu', and 'glut' extensions?
Thanks to the nice people at libgosu for providing the answer:
$ gem install opengl --pre
took care of everything! Now if someone else runs into this
same difficulty, the answer is here!