예제 #1
0
command = sys.argv[1]
type = sys.argv[2]
if command in ['add', 'remove', 'default']:
    if len(sys.argv) != 4:
        usage()
    branch = sys.argv[3]

cfg = utils.get_build_config()
if not cfg.verify_aws():
    print "Error: Need both AWS_KEY and AWS_SECRET in the environment or config.json"
    sys.exit(1)

bucket = cfg.open_bucket()
branches_key = '%s/branches.json' % type
branches = utils.get_key_json_object(bucket, branches_key)


def list_branches():
    if not 'branches' in branches:
        print 'No branches for %s' % type
        sys.exit(1)

    print 'Building branches for %s:' % type
    for branch in branches['branches']:
        if 'defaultBranch' in branches and branches['defaultBranch'] == branch:
            print ' *%s (default)' % branch
        else:
            print '  %s' % branch

예제 #2
0
command = sys.argv[1]
type = sys.argv[2]
if command in ['add', 'remove', 'default']:
	if len(sys.argv) != 4:
		usage()
	branch = sys.argv[3]
	
cfg = utils.get_build_config()
if not cfg.verify_aws():
	print "Error: Need both AWS_KEY and AWS_SECRET in the environment or config.json"
	sys.exit(1)

bucket = cfg.open_bucket()
branches_key = '%s/branches.json' % type
branches = utils.get_key_json_object(bucket, branches_key)

def list_branches():
	if not 'branches' in branches:
		print 'No branches for %s' % type
		sys.exit(1)
	
	print 'Building branches for %s:' % type
	for branch in branches['branches']:
		if 'defaultBranch' in branches and branches['defaultBranch'] == branch:
			print ' *%s (default)' % branch
		else:
			print '  %s' % branch

def check_branch_exists():
	if not 'branches' in branches or not branch in branches['branches']:	
예제 #3
0
	sys.exit(1)

class JSONObject(object):
	def __init__(self, json):
		self.__dict__['json'] = json

	def __getattr__(self, name):
		return JSONObject(self.__dict__['json'][name])

	def __setattr__(self, name, value):
		self.__dict__['json'][name] = value

	def __getitem__(self, name):
		return JSONObject(self.__dict__['json'][name])

	def __setitem__(self, name, value):
		self.__dict__['json'][name] = value

	def __str__(self):
		return simplejson.dumps(self.__dict__['json'])

bucket = cfg.open_bucket()
index_key = '%s/%s/index.json' % (type, branch)
index = JSONObject(utils.get_key_json_object(bucket, index_key, default=[]))

if expression == None:
	print str(index)
else:
	result = eval(expression)
	print str(result)
예제 #4
0
class JSONObject(object):
    def __init__(self, json):
        self.__dict__['json'] = json

    def __getattr__(self, name):
        return JSONObject(self.__dict__['json'][name])

    def __setattr__(self, name, value):
        self.__dict__['json'][name] = value

    def __getitem__(self, name):
        return JSONObject(self.__dict__['json'][name])

    def __setitem__(self, name, value):
        self.__dict__['json'][name] = value

    def __str__(self):
        return simplejson.dumps(self.__dict__['json'])


bucket = cfg.open_bucket()
index_key = '%s/%s/index.json' % (type, branch)
index = JSONObject(utils.get_key_json_object(bucket, index_key, default=[]))

if expression == None:
    print str(index)
else:
    result = eval(expression)
    print str(result)