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 4325294
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:14:50+00:00 2026-05-21T09:14:50+00:00

I am trying to get into Ruby / Rake. I thought it would be

  • 0

I am trying to get into Ruby / Rake. I thought it would be a good idea to separate some configuration out of the Rakefile in a file called configuration. This file has the following content:

email="nobody@nowhere.com"
password="somepassword"
proxy_server="someproxy.com:8080"
puts "config loaded"

Then in my Rakefile I load the configuration file by

load 'configuration'

and use the variables defined later on, e.g.:

task :dummy do
    sh = "echo #{proxy_server}" 
end

But then I get an error stating that the variable is not defined:

rake aborted!
undefined local variable or method `proxy_server' for #<Object:0xb783595c>

How can I access the configuration variables defined in the configuration file?

  • 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-21T09:14:50+00:00Added an answer on May 21, 2026 at 9:14 am

    Visibility: variables from configuration file are not visible in the script that has executed it. You need to establish a common context, for example using global variables (even if globals are evil:-)) like:

    $proxy_server="someproxy.com:8080"
    

    and then

    task :dummy do
        sh = "echo #{$proxy_server}" 
    end
    

    But since rake files are Ruby themselves why use a separate configuration file in the first place? If you need to change the config you can as well edit rake file.

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

Sidebar

Related Questions

I was trying to get Matz and Flanagan's Ruby Programming Language metaprogramming chapter into
I am trying to get into android development, after some reading i have settled
I'm diving into Ruby on Rails and I'm trying to get a grasp on
I've been trying to get a ruby file to require another ruby file and
I'm trying to get into the habit of coding to an interface rather than
I'm just trying to get into the benefits of using CSS vs. tables, but
I'm currently trying to get into Java Web Development in general in Spring more
I am just trying to get into python, but I've found it very difficult
I'm trying to get into mobile UI Automation. I've run into an issue installing
I'm just trying to get more into stl semantics, and converting old loops over

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.