<NME> init.rb.rbt
<BEF> #!/usr/bin/env ruby
# encoding: utf-8

# default encoding setup
Encoding.default_internal = "utf-8"
Encoding.default_external = "utf-8"

# This file should set Rango environment
# You can run your scripts with ./init.rb my-script.rb
# See http://wiki.github.com/botanicus/rango/rango-boot-process

# bundler
begin
  # Require the preresolved locked set of gems.
  require File.expand_path("../.bundle/environment", __FILE__)
rescue LoadError
  # Fallback on doing the resolve at runtime.
  require "rubygems"
  require "bundler"
  Bundler.setup
end

require "rango/stacks/controller"

# http://wiki.github.com/botanicus/rango/environments-support
require "rango/environments"

environment = (RACK_ENV if defined?(RACK_ENV)) || ENV["RACK_ENV"] || "development"
ENV["RACK_ENV"] = (RACK_ENV ||= environment)
unless %w[test development stage production].include?(environment)
  abort "Unknown environment: #{environment}"
end

# we need to load dependencies before boot, so bootloaders will be called
Rango.logger.info("Loading dependencies for #{environment}")
Bundler.require_env(environment)

Rango.boot(environment: environment)

# environment-specific settings
require_relative "environments"
#   ./init.rb file
Rango.parse(ARGV)

<MSG> Better environments handling in stack

<DFF> @@ -22,20 +22,15 @@ end
 
 require "rango/stacks/controller"
 
-# http://wiki.github.com/botanicus/rango/environments-support
-require "rango/environments"
-
-environment = (RACK_ENV if defined?(RACK_ENV)) || ENV["RACK_ENV"] || "development"
-ENV["RACK_ENV"] = (RACK_ENV ||= environment)
-unless %w[test development stage production].include?(environment)
-  abort "Unknown environment: #{environment}"
+unless %w[test development stage production].include?(Rango.environment)
+  abort "Unknown environment: #{Rango.environment}"
 end
 
 # we need to load dependencies before boot, so bootloaders will be called
-Rango.logger.info("Loading dependencies for #{environment}")
-Bundler.require_env(environment)
+Rango.logger.info("Loading dependencies for #{Rango.environment}")
+Bundler.require_env(Rango.environment)
 
-Rango.boot(environment: environment)
+Rango.boot
 
 # environment-specific settings
 require_relative "environments"

Better environments handling in stack