Sha256: 7af8f1b979c743172e3f43017ee9b4df4fe051306f94669f1b47f70da2e109d6

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

# --                                                            ; {{{1
#
# File        : localconfig/admin.rb
# Maintainer  : Felix C. Stegerman <flx@obfusk.net>
# Date        : 2014-10-21
#
# Copyright   : Copyright (C) 2014  Felix C. Stegerman
# Licence     : LGPLv3+
#
# --                                                            ; }}}1

require 'localconfig/config'

# namespace
module LocalConfig

  class Config                                                  # {{{1

    # set to true to disable rake tasks in railtie
    attr_accessor :no_rake

    # block will be run on admin_exists
    def on_admin_exists(&b)
      @admin_exists = b
    end

    # block will be run on admin_create
    def on_admin_create(&b)
      @admin_create = b
    end

    # run block set w/ on_admin_exists
    def admin_exists(username)
      @admin_exists[username]
    end

    # run block set w/ on_admin_create
    def admin_create(username, password, email)
      @admin_create[username, password, email]
    end

    # run admin_exists w/ $USERNAME
    def admin_exists_from_env
      admin_exists ENV['USERNAME']
    end

    # run admin_create w/ $USERNAME, $PASSWORD, $EMAIL
    def admin_create_from_env
      admin_create ENV['USERNAME'], ENV['PASSWORD'], ENV['EMAIL']
    end

  end                                                           # }}}1

end

# vim: set tw=70 sw=2 sts=2 et fdm=marker :

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
localconfig-0.3.3 lib/localconfig/admin.rb
localconfig-0.3.2 lib/localconfig/admin.rb
localconfig-0.3.1 lib/localconfig/admin.rb
localconfig-0.3.0 lib/localconfig/admin.rb