Sha256: cd050fb26b1066dcff3adf7103810e64b2e4175f0a4d7bd8eb4116d4db6f0164

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby
#
# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, Sebastian Staudt

if ENV['RUBIKON_DEV']
  require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'rubikon')
else
  require 'rubygems'
  require 'rubikon'
end

# A Rubikon application demonstrating the configuration feature
class ConfigSample < Rubikon::Application::Base

  dir = File.dirname __FILE__
  global_dir = File.join dir, 'global'
  local_dir = File.join dir, 'local'

  set :config_file, 'config.yml'
  set :config_paths, [ global_dir, local_dir ]

  global_flag :'exclude-local' do
    set :config_paths, [ global_dir ]

    puts "Seems like you changed the truth...\n\n"
  end

  default do
    puts "A pretty #{config[:string]} example of Rubikon's config."
    puts "#{config[:number]} is greater than 1."
    puts "A lie is never #{config[:boolean]}."
    puts 'Global configs are loaded...' if config[:global]
    puts 'and overriden by local configs' if config[:local]
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubikon-0.6.0 samples/config/config_sample.rb
rubikon-0.5.3 samples/config/config_sample.rb
rubikon-0.5.2 samples/config/config_sample.rb
rubikon-0.5.1 samples/config/config_sample.rb
rubikon-0.5.0 samples/config/config_sample.rb