Help creating a foreman plugin

This may seem like a simple thing to the ruby gurus but as a complete newb
to ruby I cant figure it out.

All I need to do is create a very simple foreman plugin to add a static
html link to the foreman menu. I've been looking at the 'How to create a
plugin' wiki
(How to Create a Plugin - Foreman).

I have cloned the git repo to '/opt/mldsrepolink', run the rename script
and created the below file:

cat /usr/share/foreman/bundler.d/Gemfile.local.rb
gem 'mldsrepolink', :path => '/opt/mldsrepolink'

After restarting httpd I can no longer access foreman:

Gem loading error: cannot load such file – mldsrepolink (RuntimeError)
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:30:in strict_error' /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:56:inrescue in block in system_require'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:37:in block in system_require' /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:ineach'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in system_require&#39; /usr/share/foreman/config/application.rb:13:in<top (required)>'
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in require&#39; /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:inrequire'
/usr/share/foreman/config/environment.rb:2:in &lt;top (required)&gt;&#39; /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:inrequire'
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in require&#39; config.ru:3:inblock in <main>'
/opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/builder.rb:51:in instance_eval&#39; /opt/rh/ruby193/root/usr/share/gems/gems/rack-1.4.1/lib/rack/builder.rb:51:ininitialize'
config.ru:1:in new&#39; config.ru:1:in<main>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in eval&#39; /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:inpreload_app'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:150:in &lt;module:App&gt;&#39; /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:29:in<module:PhusionPassenger>'
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:28:in `<main>'

Is the info on the wiki page still valid? Im running foreman 1.5 on Redhat 6

All help appreciated.
Jeff

It's valid, but only on a development installation using Bundler. The
RPM installs use a tool called bundler_ext for production-style installs
using RPMs rather than rubygems.

You'll either need to set up a development environment (i.e.
Foreman :: Contribute) or generate a .gem file (gem
build *.gemspec) and install this on your EL system with "scl enable
ruby193 gem install …/foo-1.0.gem" which you can use then from the
Gemfile.local.rb without the :path option.

Cheers,

··· On 19/05/14 13:57, Jeff wrote: > This may seem like a simple thing to the ruby gurus but as a complete > newb to ruby I cant figure it out. > > All I need to do is create a very simple foreman plugin to add a static > html link to the foreman menu. I've been looking at the 'How to create a > plugin' wiki > (http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin). > > I have cloned the git repo to '/opt/mldsrepolink', run the rename script > and created the below file: > > cat /usr/share/foreman/bundler.d/Gemfile.local.rb > gem 'mldsrepolink', :path => '/opt/mldsrepolink' > > After restarting httpd I can no longer access foreman: > > Gem loading error: cannot load such file -- mldsrepolink (RuntimeError) > > > > Is the info on the wiki page still valid? Im running foreman 1.5 on Redhat 6


Dominic Cleal
Red Hat Engineering

>
> <snip>

generate a .gem file (gem
> build *.gemspec) and install this on your EL system with "scl enable
> ruby193 gem install …/foo-1.0.gem" which you can use then from the
> Gemfile.local.rb without the :path option.
>
>
>
perfect, seems to be getting further now. Thanks.

··· On Monday, 19 May 2014 13:59:50 UTC+1, Dominic Cleal wrote: