Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Load the correct Rails environment based on operation requested #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/environments/add_project.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CruiseControl::Application.configure do |config|
CruiseControl::Application.configure do
config.active_support.deprecation = :notify

# No special settings required
config.after_initialize do
CruiseControl.require_site_config_if_needed
end
end
end
4 changes: 2 additions & 2 deletions cruise
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby

ENV["RAILS_ENV"] = "production"
#ENV["RAILS_ENV"] ||= "production"
ENV_PATH = File.expand_path("../config/environment", __FILE__)

require File.expand_path("../config/boot", __FILE__)
require File.expand_path("../lib/cruise_control/init", __FILE__)
require File.expand_path('../lib/cruise_control/version', __FILE__)

CruiseControl::Init.new.run
CruiseControl::Init.new.run
5 changes: 4 additions & 1 deletion lib/cruise_control/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def method_for_command(command)
end

def start
ENV["RAILS_ENV"] ||= "production"
require ENV_PATH

unless ARGV.include?('-p') || ARGV.include?('--port')
Expand Down Expand Up @@ -62,6 +63,7 @@ def start
end

def stop
ENV["RAILS_ENV"] ||= "production"
require ENV_PATH

stop_builders
Expand All @@ -84,6 +86,7 @@ def stop_builders
end

def add
ENV["RAILS_ENV"] = "add_project"
require ENV_PATH
load File.join(File.dirname(__FILE__), '..', '..', 'script', 'add_project')
end
Expand Down Expand Up @@ -130,4 +133,4 @@ def help
end

end
end
end