コード例 #1
0
ファイル: manager.py プロジェクト: CodingDog/mercury
    def do_add(self, arguments):
        """add a new remote module repository"""

        if len(arguments.options) == 1:
            url = arguments.options[0]

            Remote.create(url)

            print "Added remote: %s.\n" % url
        else:
            print "usage: mercury module remote create http://path.to.repository/\n"
コード例 #2
0
    def do_add(self, arguments):
        """add a new remote module repository"""

        if len(arguments.options) == 1:
            url = arguments.options[0]

            Remote.create(url)

            print "Added remote: %s.\n" % url
        else:
            print "usage: mercury module remote create http://path.to.repository/\n"
コード例 #3
0
ファイル: manager.py プロジェクト: CodingDog/mercury
    def do_remove(self, arguments):
        """remove a remote module repository"""

        if len(arguments.options) == 1:
            url = arguments.options[0]

            try:
                Remote.delete(url)

                print "Removed remove %s.\n" % url
            except UnknownRemote:
                print "The target (%s) is not a remote module repository.\n" % url
        else:
            print "usage: mercury module remote delete http://path.to.repository/\n"
コード例 #4
0
    def do_remove(self, arguments):
        """remove a remote module repository"""

        if len(arguments.options) == 1:
            url = arguments.options[0]

            try:
                Remote.delete(url)

                print "Removed remove %s.\n" % url
            except UnknownRemote:
                print "The target (%s) is not a remote module repository.\n" % url
        else:
            print "usage: mercury module remote delete http://path.to.repository/\n"
コード例 #5
0
ファイル: installer.py プロジェクト: warlock0007/mercury
 def __read_remote_module(self, module):
     """
     Read a module file from a remote, and return the source.
     """
     
     for url in Remote.all():
         source = Remote.get(url).download(module)
         
         # if we found the source, we return straight away - this allows us to
         # install the module from the first source that we come across
         if source != None:
             return source
     
     return None
コード例 #6
0
ファイル: manager.py プロジェクト: CodingDog/mercury
    def do_list(self, arguments):
        """shows a list of all remotes"""

        print "Remote repositories:"
        for url in Remote.all():
            print "  %s" % url
        print
コード例 #7
0
    def do_list(self, arguments):
        """shows a list of all remotes"""

        print "Remote repositories:"
        for url in Remote.all():
            print "  %s" % url
        print
コード例 #8
0
ファイル: installer.py プロジェクト: warlock0007/mercury
 def __get_combined_index(self):
     """
     Fetches INDEX files from all known remotes, and builds a combined INDEX
     listing of all available modules.
     """
     
     index = set([])
     
     for url in Remote.all():
         source = Remote.get(url).download("INDEX.xml")
         
         if source != None:
             modules = xml.fromstring(source)
             
             index = index.union(map(lambda m: ModuleInfo(url, m.attrib['name'], m.find("./description").text), modules.findall("./module")))
     
     return filter(lambda m: m != None and m != "", index)
コード例 #9
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldNotRemoteARemoteTheDoesNotExist(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes([])
     
     try:
         assert Remote.delete("http://myremote.com/")
         
         assert False, "expected UnknownRemote"
     except UnknownRemote:
         pass
コード例 #10
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldGetNoneIfARemoteDoesNotExist(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes([])
     
     assert Remote.get("http://myremote.com/") == None
コード例 #11
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldGetARemote(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes(["http://myremote.com/"])
     
     assert isinstance(Remote.get("http://myremote.com/"), Remote)
コード例 #12
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldRemoveARemote(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes(["http://myremote.com/"])
     
     assert Remote.delete("http://myremote.com/")
     assert Remote.all() == []
コード例 #13
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldNotReAddARemote(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes(["http://myremote.com/"])
     
     assert not Remote.create("http://myremote.com/")
     assert Remote.all() == ["http://myremote.com/"]
コード例 #14
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldRetrieveAllWithoutAConfigFile(self):
     Configuration._Configuration__config = self.mockConfigWithoutRemotes()
     # if there are no remotes specified, we should create a default one pointing
     # to the Github repository
     
     assert Remote.all() == ['https://raw.github.com/mwrlabs/mercury-modules/repository/']
コード例 #15
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldRetrieveASingleRemote(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes(['http://www.mercury.com'])
     
     assert Remote.all() == ['http://www.mercury.com']
コード例 #16
0
ファイル: remote_test.py プロジェクト: 0xr0ot/drozer
 def testItShouldRetrieveNoRemotes(self):
     Configuration._Configuration__config = self.mockConfigWithRemotes([])
     
     assert Remote.all() == []