Sha256: d72a2515b75f7e04bd1a687b614985b854977b34d23508cf27f7095134361872
Contents?: true
Size: 1.54 KB
Versions: 5
Compression:
Stored size: 1.54 KB
Contents
%w{ rubygems hashie active_resource }.each {|lib| require lib } class TaskMapper end %w{ common helper project ticket comment authenticator provider exception dummy/dummy.rb tester/tester.rb }.each {|lib| require File.dirname(__FILE__) + '/taskmapper/' + lib } # This is the TaskMapper class # class TaskMapper attr_reader :provider, :symbol attr_accessor :default_project # This initializes the TaskMapper instance and prepares the provider # If called without any arguments, it conveniently tries searching for the information in # ~/.taskmapper.yml # See the documentation for more information on the format of that file. # # What it DOES NOT do is auto-require the provider...so make sure you have the providers required. def initialize(system = nil, authentication = nil) if system.nil? or authentication.nil? require 'yaml' data = YAML.load_file File.expand_path(ENV['TASKMAPPER_CONFIG'] || '~/.taskmapper.yml') system = system.nil? ? data['default'] || data.first.first : system.to_s authentication = data[system]['authentication'] if authentication.nil? and data[system]['authentication'] end self.extend TaskMapper::Provider.const_get(system.to_s.capitalize) authorize authentication @symbol = system.to_sym @provider = TaskMapper::Provider.const_get(system.to_s.capitalize) end # Providers should over-write this method def authorize(authentication = {}) raise TaskMapper::Exception.new("This method must be reimplemented in the provider") end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
taskmapper-1.0.1 | lib/taskmapper.rb |
taskmapper-1.0.0 | lib/taskmapper.rb |
taskmapper-0.9.0 | lib/taskmapper.rb |
taskmapper-0.8.1 | lib/taskmapper.rb |
taskmapper-0.8.0 | lib/taskmapper.rb |