Sha256: 7580e5b1eb9bc9fea0f7dee3678cf1eba0bcd1fdb9c89287245579fee65fa838
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'inifile' require 'io/console' # Initializes JiraReport settings. module JiraReport class Settings attr_reader :username, :password, :url,\ :period_from, :period_till def initialize(path) read(path) end private def read(path) loaded = IniFile.load(File.expand_path(path)) global = loaded[:global] if loaded global ||= {} @url = global['url'] @username = global['username'] @password = global['password'] @period_from = global['period_from'] @period_till = global['period_till'] @url = ask('Jira url in [jira.company.com] format: ') unless @url @username = ask('Jira username: ') unless @username @password = ask('Jira password: '){ STDIN.noecho(&:gets).chomp! } unless @password @period_from = '-1w' unless @period_from @period_till = 'now()' unless @period_till # TODO: attributes verification end def ask(message, &block) print message if block yield block else gets.chomp! end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jira_report-0.0.1 | lib/jira_report/settings.rb |