Sha256: 509a71dc5f164d9035725fd0a5cc565272929dbc57ebd15fc7979b1f5f63b917

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

require 'highline/import'

#
# Get module
#
module Forj
  # This module gets your account/default configuration
  module Get
    def self.get(options, key)
      @account = Lorj::Account.new
      if options[:account_name]
        get_account(options, key)
      else
        get_default(key)
      end
    end

    def self.get_account(options, key)
      if key
        Forj::Settings.account_get(@account, options[:account_name], key)
      else
        Forj::Settings.account_get_all(@account, options[:account_name])
      end
    end

    def self.get_default(key)
      if !key
        Forj::Settings.config_get_all(@account)
      else
        Forj::Settings.config_get(@account, key)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
forj-1.0.18 lib/get.rb
forj-1.0.17 lib/get.rb
forj-1.0.16 lib/get.rb
forj-1.0.15 lib/get.rb
forj-1.0.14 lib/get.rb
forj-1.0.13 lib/get.rb
forj-1.0.12 lib/get.rb
forj-1.0.11 lib/get.rb
forj-1.0.10 lib/get.rb
forj-1.0.9 lib/get.rb
forj-1.0.8 lib/get.rb
forj-1.0.7 lib/get.rb
forj-1.0.6 lib/get.rb
forj-1.0.5 lib/get.rb
forj-1.0.4 lib/get.rb