Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7405095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:21:04+00:00 2026-05-29T05:21:04+00:00

The title is the question, and here’s the context that prompts it. The Gemfile:

  • 0

The title is the question, and here’s the context that prompts it.

The Gemfile:

source "http://rubygems.org"

# Specify your gem's dependencies in the gemspec
gemspec

Here is the top of the rackup file:

require 'rubygems'
require "bundler/setup"

On running the rackup file an error is thrown:

<module:Rack>': GemName is not a class (TypeError)

Why? Because I’m writing a piece of Rack middleware, and the standard layout is:

lib/
  rack/
    gem_name.rb
    gem_name/
      version.rb

gem_name.rb will contain:

module Rack
  class GemName

version.rb will contain:

module Rack
  module GemName
    VERSION = "0.0.1"

Finally, the gem_name.gemspec will contain:

require "rack/flash-in-the-pan/version"
#...
s.version     = Rack::GemName::VERSION

Naming a module and a class by the same name isn’t a problem as long as you don’t require both files at the same time. Normally, this wouldn’t happen, as you either need the version for building the gem, or you need to run the gem library, only one or other gets required.

But, this time I decided to use Bundler to manage the gem’s dependencies. When requiring the gem library via bundler it obviously runs the gemspec too. I can “fix” it easily enough, I define the version number by hand in the gemspec.

So back to my question – why does Bundler need to look in the gemspec at the library’s runtime?

bundler (1.0.21)

Any insight is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:21:04+00:00Added an answer on May 29, 2026 at 5:21 am

    Whenever you run bundler, it has to parse the Gemfile to actually figure out what gems need to be loaded, what has to be added to $LOAD_PATH and so on. As part of that, it has to parse gemspec.

    The Gemfile.lock contains info on all of the gems as well as the dependencies to save startup time, but it doesn’t alleviate the need for it to parse the Gemfile.

    There are various ways you could work around it. Two simple ones would be to use File.read and some regex to pull out the version. Or require the gem_name.rb and gem_name/version.rb files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a question here in stackoverflow with the same title but that is
i didn't really know how to title this question, but here's a thing that
This is my code: Enter your question here: <form method=post action=> Title: <input type=text
This question is a bit of a two-parter. First, the title question. Here's what
OK the question title is vague, but here's the problem. I have a list
I wasn't sure what to title this question. Here's my goal: On page one,
The title is my question. I already found a topic related to this here
Alright, hard to phrase an exact title for this question, but here goes... I
Question is already been asked in title. Here is a code: (function($){ var filter
I think I summed up the question in the title. Here is some further

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.