Class: Bagotrix

Inherits:
Object
  • Object
show all
Defined in:
lib/bagotrix.rb

Constant Summary collapse

NoUserMsg =
'you must set a github user with Bagotrix.use(username), or run "git config --global github.user"'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.repoObject

Returns the value of attribute repo.



6
7
8
# File 'lib/bagotrix.rb', line 6

def repo
  @repo
end

.userObject

Returns the value of attribute user.



6
7
8
# File 'lib/bagotrix.rb', line 6

def user
  @user
end

.verboseObject

Returns the value of attribute verbose.



6
7
8
# File 'lib/bagotrix.rb', line 6

def verbose
  @verbose
end

Class Method Details

.config(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/bagotrix.rb', line 10

def config(options = {})
  self.user ||= options[:user]
  self.repo = options[:repo] if options[:repo]
  self.verbose = options[:verbose]
end

.load(path) ⇒ Object

Raises:



16
17
18
19
20
21
# File 'lib/bagotrix.rb', line 16

def load(path)
  raise NoUserMsg if user == ''
  uri = "https://github.com/#{user}/#{repo}/raw/master/#{path}.rb"
  puts "loading #{uri}" if verbose
  Object.class_eval(open(uri).read)
end