Welcome to mirror list, hosted at ThFree Co, Russian Federation.

get_config.rb « script - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: da8bb55db0d26167a1a798b2d95d8b2817370dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2010-2011, Diaspora Inc.  This file is
# licensed under the Affero General Public License version 3 or later.  See
# the COPYRIGHT file.

unless ARGV.length >= 1
  $stderr.puts "Usage: ./script/get_config.rb var=option | option [...]"
  Process.exit(1)
end

require 'rubygems'
require 'pathname'

require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/module/delegation'

module Rails
  def self.root
    @@root ||= Pathname.new(File.expand_path(File.join(File.dirname(__FILE__), "..")))
  end

  def self.env
    env = 'development'
    env = ENV['RAILS_ENV'] if ENV.has_key?('RAILS_ENV')
    env.downcase
  end
end

require Rails.root.join("config/load_config")

ARGV.each do |arg|
  var, setting_name = arg.split("=")
  setting_name = var unless setting_name
  setting = AppConfig[setting_name]
  setting = setting.get if setting.respond_to?(:_proxy?)
  if var != setting_name
    puts "#{var}=#{setting}"
  else
    puts setting
  end
end