stubs/stack/content/init.rb.rbt in rango-0.2 vs stubs/stack/content/init.rb.rbt in rango-0.2.1.pre
- old
+ new
@@ -1,6 +1,6 @@
-<% if defined?(JRUBY_VERSION) %>
+<% if RUBY_PLATFORM.eql?("java") %>
<%= shebang rubypath, ["--1.9", "--disable-gems"] %>
<% else %>
<%= shebang rubypath, ["--disable-gems"] %>
<% end %>
# encoding: utf-8
@@ -18,46 +18,21 @@
require_relative "gems/environment.rb"
rescue LoadError => exception
abort "LoadError during loading gems/environment: #{exception.message}\nRun gem bundle to fix it."
end
-require "rango/stacks/controller"
+require "rango"
-# 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.logger.info("Loading dependencies for #{Rango.environment}")
+Bundler.require_env(Rango.environment)
+Rango.boot
-Rango.boot(environment: environment)
+$LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
-# environment-specific settings
-require_relative "environments"
+require "<%= name %>"
-# register applications
-require_relative "views.rb"
-require_relative "models.rb"
-
-# if you will run this script with -i argument, interactive session will begin
-Rango.interactive if ARGV.delete("-i")
-
-# so it can work as a runner
-# ./init.rb: start webserver
-if ARGV.length > 0 && $0.eql?(__FILE__)
- # config.ru
- if ARGV.last.split(".").last.eql?("ru")
- if Rango.development?
- load File.join(File.dirname(__FILE__), "bin", "shotgun")
- else
- load File.join(File.dirname(__FILE__), "bin", "rackup")
- end
- else
- load ARGV.shift
- end
-end
+# Available arguments:
+# ./init.rb -i
+# ./init.rb -i file
+# ./init.rb file
+Rango.parse(ARGV)