module Rails::Generators::Actions

def gem(*args)


gem "rails", "3.0", :git => "git://github.com/rails/rails"
gem "technoweenie-restful-authentication", :lib => "restful-authentication", :source => "http://gems.github.com/"
gem "rspec", :group => :test

==== Example

is specified, add the gem to the given environment.
Adds an entry into Gemfile for the supplied gem. If env
def gem(*args)
  options = args.extract_options!
  name, version = args
  # Deal with deprecated options
  { :env => :group, :only => :group,
    :lib => :require, :require_as => :require }.each do |old, new|
    next unless options[old]
    options[new] = options.delete(old)
    ActiveSupport::Deprecation.warn "#{old.inspect} option in gem is deprecated, use #{new.inspect} instead"
  end
  # Deal with deprecated source
  if source = options.delete(:source)
    ActiveSupport::Deprecation.warn ":source option in gem is deprecated, use add_source method instead"
    add_source(source)
  end
  # Set the message to be shown in logs. Uses the git repo if one is given,
  # otherwise use name (version).
  parts, message = [ name.inspect ], name
  if version ||= options.delete(:version)
    parts   << version.inspect
    message << " (#{version})"
  end
  message = options[:git] if options[:git]
  log :gemfile, message
  options.each do |option, value|
    parts << ":#{option} => #{value.inspect}"
  end
  in_root do
    append_file "Gemfile", "gem #{parts.join(", ")}\n", :verbose => false
  end
end