Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (30 sloc) 0.895 kb
4aeb4b3a » coreyhaines
2009-07-13 Plenty of confusion since either fakeweb or github is being a pain
1 $:.unshift(File.dirname(__FILE__))
a6ca254f » qrush
2009-07-13 Shuffling some requires around
2
3 require 'rubygems'
4 require 'httparty'
5 require 'json'
6
56ff3dcb » qrush
2009-07-13 Cleaned up the github api immensely
7 require 'repository'
493248ea » coreyhaines
2009-07-13 Making binding work and figuring out more of the DSL
8
9 class Enforcer
7356ea1e » coreyhaines
2009-07-13 Adding api key
10 def initialize(account_name, api_key)
d3f87e9b » coreyhaines
2009-07-13 Added account name to enforcer
11 @account_name = account_name
7356ea1e » coreyhaines
2009-07-13 Adding api key
12 @api_key = api_key
4aeb4b3a » coreyhaines
2009-07-13 Plenty of confusion since either fakeweb or github is being a pain
13 end
493248ea » coreyhaines
2009-07-13 Making binding work and figuring out more of the DSL
14
15 def project(project_name, &block)
16 instance_eval(&block)
17 return if @collaborators.nil?
18
56ff3dcb » qrush
2009-07-13 Cleaned up the github api immensely
19 repo = Repository.new(@account_name, @api_key, project_name)
20
21 existing_collaborators = repo.list
0c80b05f » coreyhaines
2009-07-13 Removing people too that don't belong
22
23 { :add => @collaborators - existing_collaborators,
24 :remove => existing_collaborators - @collaborators}.each_pair do |action, collaborators|
56ff3dcb » qrush
2009-07-13 Cleaned up the github api immensely
25 collaborators.each do |collaborator|
26 repo.send(action, collaborator)
27 end
0c80b05f » coreyhaines
2009-07-13 Removing people too that don't belong
28 end
29 end
30
493248ea » coreyhaines
2009-07-13 Making binding work and figuring out more of the DSL
31 def collaborators(*names)
32 @collaborators = names
33 end
34 end
4aeb4b3a » coreyhaines
2009-07-13 Plenty of confusion since either fakeweb or github is being a pain
35
7356ea1e » coreyhaines
2009-07-13 Adding api key
36 def Enforcer(account_name, api_key, &block)
37 enforcer = Enforcer.new(account_name, api_key)
d3f87e9b » coreyhaines
2009-07-13 Added account name to enforcer
38 enforcer.instance_eval(&block)
4aeb4b3a » coreyhaines
2009-07-13 Plenty of confusion since either fakeweb or github is being a pain
39 end
Something went wrong with that request. Please try again.