Difference between gem and plugin


#1

Can someone tell me the difference ins the gem versions and the plugin
versions? do they work together? need both?

Don F.


#2

On Fri, Oct 3, 2008 at 4:46 PM, Donald F. removed_email_address@domain.invalid wrote:

Can someone tell me the difference ins the gem versions and the plugin
versions? do they work together? need both?

You do not need both. The plugin versions are for Ruby on Rails
projects. Rails had a way of loading plugins from the vendor/plugins/
directory. This will most likely deprecate (or become less and less
used) as Rails has added support for bundling gems with the project
in the vendor/gems/ directory.

The gem versions of rspec are the ones that are intended for everyday
use. I would go with those unless you are supporting a Rails
application in the 1.2.x family or earlier.

Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com


#3

How do you go plugin-less for RSpec? The plugins require you to generate
some files, so how do you do that without a plugin? Is there still a
rake task in the gem to generate the required files?


#4

“Zach D.” removed_email_address@domain.invalid writes:

On Fri, Oct 3, 2008 at 4:46 PM, Donald F. removed_email_address@domain.invalid wrote:

Can someone tell me the difference ins the gem versions and the plugin
versions? do they work together? need both?

You do not need both. The plugin versions are for Ruby on Rails
projects. Rails had a way of loading plugins from the vendor/plugins/
directory. This will most likely deprecate (or become less and less
used) as Rails has added support for bundling gems with the project
in the vendor/gems/ directory.

rspec-rails is now published as a gem as well.

I am 100% plugin free when it comes to RSpec.

Pat


#5

Cool.

However what happens when my app is currently using the plugin version,
is it easy to migrate to the gem? Should I regenerate the files? I guess
there is somewhere a line that says to rspec “look into vendor/plugins”?


#6

On Sat, Oct 4, 2008 at 11:54 AM, Fernando P. removed_email_address@domain.invalid
wrote:

How do you go plugin-less for RSpec? The plugins require you to generate
some files, so how do you do that without a plugin? Is there still a
rake task in the gem to generate the required files?

I’ll post this up on the wiki, but the steps are:

[sudo] gem install rspec-rails
script/generate rspec

That’s it.

rspec is a dependency of rspec-rails, so installing the rspec-rails
gem will also install the rspec gem.

Once installed, if you type ‘script/generate’ with no arguments,
you’ll see all the rspec generators listed. ‘script/generate rspec’
generates the files necessary to work with rspec without having to
install the plugins in your app.

Cheers,
David


#7

On Sat, Oct 4, 2008 at 12:01 PM, Fernando P. removed_email_address@domain.invalid
wrote:

Cool.

However what happens when my app is currently using the plugin version,
is it easy to migrate to the gem? Should I regenerate the files? I guess
there is somewhere a line that says to rspec “look into vendor/plugins”?

Just delete the plugin directories.

Cheers,
David


#8

On Sat, Oct 4, 2008 at 2:58 PM, David C. removed_email_address@domain.invalid
wrote:

That’s it.

rspec is a dependency of rspec-rails, so installing the rspec-rails
gem will also install the rspec gem.

Once installed, if you type ‘script/generate’ with no arguments,
you’ll see all the rspec generators listed. ‘script/generate rspec’
generates the files necessary to work with rspec without having to
install the plugins in your app.

It doesn’t :stuck_out_tongue:

Just tried that on a fresh application, and when call script/generate
rspec it just not find it and don’t execute it :stuck_out_tongue:

Also, going to the gem version instead of the plugin requires a new
set of script files, since they try to look for vendor/plugins/
instead of doing:

require ‘rubygems’
require ‘spec’

Last, but not least, you need to do

config.gem ‘rspec-rails’, :lib => ‘spec/rails’ since Rails will try by
default to load ‘rspec-rails’ module instead.

Wow, lot of details :stuck_out_tongue:

Cheers,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams


#9

On Sat, Oct 4, 2008 at 1:38 PM, David C. removed_email_address@domain.invalid
wrote:

script/generate rspec

require ‘rubygems’
version of rubygems? It works as I prescribed for me with the

Besides the OS, what’s different in your system?

Also - the script files prepend vendor/plugins/rspec/lib to the path,
but if they are not there, there shouldn’t be a problem. That just
ensures that if you DO have the plugin installed it takes precedence
over the gem.


#10

On Sat, Oct 4, 2008 at 4:41 PM, David C. removed_email_address@domain.invalid
wrote:

Also - the script files prepend vendor/plugins/rspec/lib to the path,
but if they are not there, there shouldn’t be a problem. That just
ensures that if you DO have the plugin installed it takes precedence
over the gem.

But require ‘rubygems’ on top is missing, ending with LoadError due
missing ‘spec’ :stuck_out_tongue:

Will get back to you with facts and all the details, 1.3.0 was
released with a bug on Windows so I need to cook a sandboxed ruby with
trunk version instead.


Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams


#11

On Sat, Oct 4, 2008 at 1:06 PM, Luis L. removed_email_address@domain.invalid
wrote:

require ‘spec’

Last, but not least, you need to do

config.gem ‘rspec-rails’, :lib => ‘spec/rails’ since Rails will try by
default to load ‘rspec-rails’ module instead.

Wow, lot of details :stuck_out_tongue:

Hmmm. Wonder if this is a windows thing. Or maybe you have an older
version of rubygems? It works as I prescribed for me with the
following:

$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
$ gem -v
1.3.0
$ rails -v
Rails 2.1.1
$ spec --version
rspec 1.1.8

Besides the OS, what’s different in your system?


#12

Hi,

Going plugin-less for RSpec went 99% smoothly, here is the only error
message I got:

$ ./script/generate rspec
Gem::SourceIndex#search support for Regexp patterns is deprecated
/usr/local/ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/lookup.rb:211:in
`each’ is outdated


#13

By the way for a RoR application, can I also go plugin-less for Webrat
and Cucumber? From what I understand I still need to install these two
as plugins.


#14

On Sat, Oct 4, 2008 at 1:43 PM, Luis L. removed_email_address@domain.invalid
wrote:

missing ‘spec’ :stuck_out_tongue:
I’ve added that to script/spec:

http://github.com/dchelimsky/rspec-rails/commit/931f3700cf90f44f10ad599b360b20ebbbe95eab

Will get back to you with facts and all the details, 1.3.0 was
released with a bug on Windows so I need to cook a sandboxed ruby with
trunk version instead.

Thanks for your help!

Cheers,
David


#15

On Sun, Oct 5, 2008 at 10:51 AM, Fernando P. removed_email_address@domain.invalid
wrote:

By the way for a RoR application, can I also go plugin-less for Webrat
and Cucumber? From what I understand I still need to install these two
as plugins.

Why ask us when you can ask rubygems?

$ gem q -drn cucumber
$ gem q -drn webrat

Cheers,
David


#16

On Sun, Oct 5, 2008 at 10:45 AM, Fernando P. removed_email_address@domain.invalid
wrote:

Hi,

Going plugin-less for RSpec went 99% smoothly, here is the only error
message I got:

$ ./script/generate rspec
Gem::SourceIndex#search support for Regexp patterns is deprecated
/usr/local/ruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/lookup.rb:211:in
`each’ is outdated

That’s actually not related to rspec.

The deprecation notice is coming from Rubygems-1.3, and is referencing
rails code, not rspec code.


#17

Why ask us when you can ask rubygems?

Well I prefer to ask (and sound stupid 5 minutes) than not ask (and be
stupid all my life), that’s the way I work. From the cucumber github
wiki located at: http://github.com/aslakhellesoy/cucumber/wikis


Installation

(Rails people – see Ruby on Rails).

After you have installed Ruby or JRuby – install Cucumber with the
following command:
Ruby:

gem install cucumber

When I go to the Ruby on Rails wiki page, Aslak says to install Cucumber
as a plugin. Therefore I was wondering if for a Rails app, installing
Cucumber as a gem was okay.

In the past, even though the RSpec gem existed, it was recommended to
install the plugin version of rspec if it was going to be used with a
Rails app.


#18

On Sun, Oct 5, 2008 at 11:20 AM, Fernando P. removed_email_address@domain.invalid
wrote:

In the past, even though the RSpec gem existed, it was recommended to
install the plugin version of rspec if it was going to be used with a
Rails app.

Didn’t mean to make you feel bad or stupid. Was just offering you a
way to answer at least part of your question. Teach a man to fish, and
all.

That said, here’s some fish:

As of 1.1.5, rspec-rails is now released as a gem. If you’re using
rails >= 2.0, you can use rspec/rspec-rails gems because the rspec
generator (script/generate rspec) is visible, and the generated files
are all you need in the rails app.

Cucumber and webrat are both released as gems.

My recommendation is to use gems for all these tools, except in cases
where you need functionality that is in git, but not in the latest
gem. Even then, I’d recommend downloading
source from git and building the gem locally rather than adding the
code to your repo.

Of course, this all assumes just a local build on your development
machine. If you’ve got a build machine running scenarios and code
examples, you might find it easier to keep unreleased code in your
app.

Another option would be to use gems by default, and then store them in
vendor/gems instead of vendor/plugins when you need functionality
between releases.

HTH,
David


#19

I have removed the plugins for both cucumber and webrat. Now I am having
the following error message when running rake features or
./script/generate cucumber:

/usr/local/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.6/lib/cucumber/cli.rb:83:in
read': No such file or directory - cucumber.yml (Errno::ENOENT) from /usr/local/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.6/lib/cucumber/cli.rb:83:inparse_args_from_profile’