Sha256: 465f6642ff1e892d509c501f009cfe27394e94e0f814d79d30a0d64042042a86

Contents?: true

Size: 546 Bytes

Versions: 10

Compression:

Stored size: 546 Bytes

Contents

module Unipept
  class Commands::Config < Cri::CommandRunner
    def run
      abort command.help if arguments.empty? || arguments.size > 2

      key, value = *arguments

      if arguments.size == 2
        set_config(key, value)
        puts key + ' was set to ' + value
      else
        puts get_config(key)
      end
    end

    def config
      @config ||= Unipept::Configuration.new
    end

    def set_config(key, value)
      config[key] = value
      config.save
    end

    def get_config(key)
      config[key]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
unipept-2.2.1 lib/commands/unipept/config.rb
unipept-2.2.0 lib/commands/unipept/config.rb
unipept-2.1.1 lib/commands/unipept/config.rb
unipept-2.1.0 lib/commands/unipept/config.rb
unipept-2.0.0 lib/commands/unipept/config.rb
unipept-1.4.1 lib/commands/unipept/config.rb
unipept-1.4.0 lib/commands/unipept/config.rb
unipept-1.3.0 lib/commands/unipept/config.rb
unipept-1.2.0 lib/commands/unipept/config.rb
unipept-1.1.3 lib/commands/unipept/config.rb