Error while running a Rake Task

0

I need to perform some custom tasks, however, whenever I try, I get the following message: Application has been already initialized. I searched in various places, including the OS in English, but to no avail. It does not seem to have a definitive solution. My application is running normally, with Puma and Nginx. My tasks file looks like this:

namespace :access do
    require "modules/blockade.rb"

    desc "Block everybody"
    task block: :environment do
        (...)
    end

    desc "Unblock everybody"
    task unblock: :environment do
        (...)
    end
end

And this file of require , basically like this:

require "#{ENV["PWD"]}/config/environment.rb"

module Blockade
    (...)
end

Can anyone tell me what I'm doing wrong?

    
asked by anonymous 07.12.2015 / 16:34

1 answer

0

I did not get to test but something tells me that this line:

require "#{ENV["PWD"]}/config/environment.rb"

is causing your problem. What do you need to do exactly to have to give a require in environment.rb?

If you just need to load environment variables look for these gems:

foreman

figaro

    
05.01.2016 / 18:00