class GitlabBitbarLibConfig
Attributes
exe_dir[R]
exe_file[R]
Public Class Methods
new(launch_file)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 6 def initialize launch_file @exe_dir = File.dirname(File.expand_path(launch_file)) @exe_file = File.expand_path(launch_file) @config_file= File.expand_path('~/.bitbar_gitlab_cnf.yml') load_config if exists? end
Public Instance Methods
delete()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 21 def delete File.delete @config_file end
exists?()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 17 def exists? true if File.exists? @config_file end
get_key(sym)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 35 def get_key sym @config[sym.to_s.upcase] if @config.key?(sym.to_s.upcase) end
key_is_set(key)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 52 def key_is_set key if get_key(key) and get_key(key) != 0 true end end
load_config()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 25 def load_config @config = YAML.load_file(@config_file) end
missing_warning()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 58 def missing_warning puts "WARNING, could not execute BITBAR_GITLAB" puts puts "make sure '~/.bitbar_gitlab_cnf.yml' exists." puts "You might want to run 'gitlab-bitbar-plugin.rb install'" end
save_config()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 29 def save_config File.open(@config_file, 'w') do |f| f.write(@config.to_yaml) end end
save_init(init_conf)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 13 def save_init init_conf File.open(@config_file, 'w') { |file| file.write(init_conf.to_yaml) } end
set_key(sym, val)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 39 def set_key sym, val @config[sym.to_s.upcase] = val save_config end
toggle_on?(key)
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 44 def toggle_on? key if @config['TOGGLE_'+key.to_s.upcase] and @config['TOGGLE_'+key.to_s.upcase] !=0 true else false end end
try_exe_dir_exists()
click to toggle source
# File lib/bitbar_gitlab/gitlab_bitbar_lib_config.rb, line 65 def try_exe_dir_exists unless get_key :exe_util_dir set_key :exe_util_dir, @exe_dir end end