def gem(*args)
      options = extract_options!(args)
      name, version = args

      # 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]

      say_status :gemfile, message

      options.each do |option, value|
        parts << "#{option}: #{value.inspect}"
      end

      in_root do
        str = "gem #{parts.join(", ")}"
        str = "\n" + str
        append_file "Gemfile", str, :verbose => false
      end
    end
def gem(*args)
      options = extract_options!(args)
      name, version = args

      # 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]

      say_status :gemfile, message

      options.each do |option, value|
        parts << "#{option}: #{value.inspect}"
      end

      in_root do
        str = "gem #{parts.join(", ")}"
        str = "\n" + str
        append_file "Gemfile", str, :verbose => false
      end
    end
Adds an entry into Gemfile for the supplied gem.

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