コード例 #1
0
ファイル: PackageBuild.py プロジェクト: tinyogre/Projeny
def installBindings():

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    demoConfig = os.path.realpath(os.path.join(ProjenyDir, 'Demo/Projeny.yaml'))
    Prj.installBindings(demoConfig)
コード例 #2
0
    def testSingletonType(self):
        Container.bind('Qux').toSingle(Qux)

        test1 = Test1()
        test2 = Test2()

        self.assertIs(test1.qux, test2.qux)
コード例 #3
0
    def test1(self):
        config = {
            'PathVars': {
                'foo': 'yep [bar]',
                'bar': 'result2',
                'nest1': 'asdf [foo]',
            }
        }
        Container.bind('Config').toSingle(Config, [config])

        Container.bind('VarManager').toSingle(VarManager)

        pathMgr = Container.resolve('VarManager')

        assertThat(pathMgr.hasKey('foo'))
        assertThat(not pathMgr.hasKey('asdf'))
        assertThat(pathMgr.tryGet('bobsdf') == None)
        assertThat(
            pathMgr.expand('before [bar] after') == 'before result2 after')
        assertThat(
            pathMgr.expand('before [foo] after') == 'before yep result2 after')

        assertThat(not pathMgr.hasKey('qux'))
        pathMgr.add('qux', 'sadf')
        assertThat(pathMgr.hasKey('qux'))
        assertThat(pathMgr.expand('[qux]') == 'sadf')

        assertThat(pathMgr.expand('[nest1]') == 'asdf yep result2')

        print('Done')
コード例 #4
0
    def testTransientInstance(self):
        Container.bind('Qux').to(Qux)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
コード例 #5
0
    def _request(self):
        if not Container.hasBinding(self._identifier):
            return self._default

        obj = Container.resolve(self._identifier)
        self._assertion(obj)
        return obj
コード例 #6
0
ファイル: TestConfigYaml.py プロジェクト: wyb314/Projeny
    def testMultiple(self):

        Container.bind('Config').toSingle(Config, loadYamlFilesThatExist(ScriptDir + '/ExampleConfig.yaml', ScriptDir + '/ExampleConfig2.yaml'))

        config = Container.resolve('Config')

        # From 1
        assertIsEqual(config.getString('receipt'), 'Oz-Ware Purchase Invoice')

        # From 2
        assertIsEqual(config.getString('thing1'), 'Foo')

        # Second one should override
        assertIsEqual(config.getString('foo2'), 'ipsum')

        assertIsEqual(config.getString('nest1', 'firstName'), 'Dorothy')

        # Test concatenating lists together
        assertIsEqual(config.getList('list1'), ['lorem', 'ipsum', 'asdf', 'joe', 'frank'])

        # Test concatenating dictionaries together
        assertIsEqual(config.getDictionary('dict1'), {'joe': 5, 'mary': 15, 'kate': 5, 'jim': 10})

        assertIsEqual(config.tryGetDictionary(None, 'asdfasdfasdf'), None)
        assertIsEqual(config.tryGetDictionary({ 5: 1 }, 'asdfasdfasdf'), { 5: 1 })

        assertIsEqual(config.tryGetList(None, 'asdfasdfasdf'), None)
        assertIsEqual(config.tryGetList([1, 2], 'asdfasdfasdf'), [1, 2])

        assertIsEqual(config.tryGetBool(False, 'zxvzasdfasdfasdf'), False)
        assertIsEqual(config.tryGetBool(True, 'zxvzasdfasdfasdf'), True)

        assertIsEqual(config.tryGetString('asdf', 'zxvzasdfasdfasdf'), 'asdf')

        assertIsEqual(config.tryGetInt(5, 'zxvzasdfasdfasdf'), 5)
コード例 #7
0
    def testSingletonType(self):
        Container.bind('Qux').toSingle(Qux)

        test1 = Test1()
        test2 = Test2()

        self.assertIs(test1.qux, test2.qux)
コード例 #8
0
ファイル: PackageBuild.py プロジェクト: asmboom/Projeny
def installBindings():

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    demoConfig = os.path.realpath(os.path.join(ProjenyDir, 'Demo/Projeny.yaml'))
    Prj.installBindings(demoConfig)
コード例 #9
0
ファイル: Inject.py プロジェクト: AcamTech/Zenject
    def _request(self):
        if not Container.hasBinding(self._identifier):
            return self._default

        obj = Container.resolve(self._identifier)
        self._assertion(obj)
        return obj
コード例 #10
0
ファイル: TestVarManager.py プロジェクト: AcamTech/Zenject
    def test1(self):
        config = {
            'PathVars': {
                'foo': 'yep [bar]',
                'bar': 'result2',
                'nest1': 'asdf [foo]',
            }
        }
        Container.bind('Config').toSingle(Config, [config])

        Container.bind('VarManager').toSingle(VarManager)

        pathMgr = Container.resolve('VarManager')

        assertThat(pathMgr.hasKey('foo'))
        assertThat(not pathMgr.hasKey('asdf'))
        assertThat(pathMgr.tryGet('bobsdf') == None)
        assertThat(pathMgr.expand('before [bar] after') == 'before result2 after')
        assertThat(pathMgr.expand('before [foo] after') == 'before yep result2 after')

        assertThat(not pathMgr.hasKey('qux'))
        pathMgr.add('qux', 'sadf')
        assertThat(pathMgr.hasKey('qux'))
        assertThat(pathMgr.expand('[qux]') == 'sadf')

        assertThat(pathMgr.expand('[nest1]') == 'asdf yep result2')

        print('Done')
コード例 #11
0
    def testTransientInstance(self):
        Container.bind('Qux').to(Qux)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
コード例 #12
0
    def testTransientInstanceWithParam(self):
        Container.bind('Qux').to(Qux, 5)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 5)
コード例 #13
0
    def testSingletonMethodWithParam(self):
        Container.bind('Qux').toSingle(GetQux, 4)

        test1 = Test1()
        test2 = Test2()

        self.assertIs(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 4)
コード例 #14
0
    def testUseDefault(self):
        Container.bind('Foo').to(1)
        Container.bind('Test1').toSingle(Test1)

        test1 = Container.resolve('Test1')

        self.assertEqual(test1.foo, 1)
        self.assertEqual(test1.bar, 5)
コード例 #15
0
    def testTransientInstanceWithParam(self):
        Container.bind('Qux').to(Qux, 5)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 5)
コード例 #16
0
    def testSingletonMethodWithParam(self):
        Container.bind('Qux').toSingle(GetQux, 4)

        test1 = Test1()
        test2 = Test2()

        self.assertIs(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 4)
コード例 #17
0
    def testUseDefault(self):
        Container.bind('Foo').to(1)
        Container.bind('Test1').toSingle(Test1)

        test1 = Container.resolve('Test1')

        self.assertEqual(test1.foo, 1)
        self.assertEqual(test1.bar, 5)
コード例 #18
0
    def testTransientMethod(self):

        Container.bind('Qux').to(GetQux, 6)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 6)
コード例 #19
0
    def testTransientMethod(self):

        Container.bind('Qux').to(GetQux, 6)

        test1 = Test1()
        test2 = Test2()

        self.assertIsNot(test1.qux, test2.qux)
        self.assertEqual(test1.qux.GetValue(), 6)
コード例 #20
0
ファイル: TestConfigYaml.py プロジェクト: wyb314/Projeny
    def testSpecialChars(self):
        Container.bind('Config').toSingle(Config, loadYamlFilesThatExist(ScriptDir + '/ExampleConfig.yaml', ScriptDir + '/ExampleConfig2.yaml'))

        config = Container.resolve('Config')

        assertIsEqual(config.tryGetString(None, 'foo4'), 'asdf')

        assertIsEqual(config.tryGetString(None, 'foo5'), 'zxcv')

        assertIsEqual(config.tryGetString(None, 'foo6'), 'asdf')
        assertIsEqual(config.tryGetString(None, 'foo7'), 'zxcv')
コード例 #21
0
ファイル: TestSystemHelper.py プロジェクト: AcamTech/Zenject
    def test1(self):
        assertThat(False, "TODO")
        #Container.bind('Config').toSingle(ConfigXml)
        Container.bind('VarManager').toSingle(VarManager)
        Container.bind('SystemHelper').toSingle(SystemHelper)
        Container.bind('Logger').toSingle(Logger)

        self._test1(Container.resolve('SystemHelper'))
コード例 #22
0
ファイル: TestConfigYaml.py プロジェクト: wyb314/Projeny
    def testSimple(self):
        yamlPath = ScriptDir + '/ExampleConfig.yaml'

        Container.bind('Config').toSingle(Config, loadYamlFilesThatExist(yamlPath))

        config = Container.resolve('Config')

        assertIsEqual(config.getString('date'), '2012-08-06')
        assertIsEqual(config.getString('receipt'), 'Oz-Ware Purchase Invoice')

        assertIsEqual(config.getList('places'), ['New Jersey', 'New York'])
        assertRaisesAny(lambda: config.getString('places'))
        assertRaisesAny(lambda: config.getDictionary('places'))

        assertIsEqual(config.getDictionary('customer'),
          {'first_name': 'Dorothy', 'family_name': 'Gale'})

        # Tests YAML references
        assertIsEqual(config.getString('foo1'), config.getString('receipt'))
コード例 #23
0
    def testOverrideDefault(self):
        Container.bind('Foo').to(2)
        Container.bind('Test1').to(Test1)
        Container.bind('Bar').to(3)

        test1 = Container.resolve('Test1')

        self.assertEqual(test1.foo, 2)
        self.assertEqual(test1.bar, 3)
コード例 #24
0
    def testOverrideDefault(self):
        Container.bind('Foo').to(2)
        Container.bind('Test1').to(Test1)
        Container.bind('Bar').to(3)

        test1 = Container.resolve('Test1')

        self.assertEqual(test1.foo, 2)
        self.assertEqual(test1.bar, 3)
コード例 #25
0
ファイル: TestLogger.py プロジェクト: AcamTech/Zenject
    def testOutputToFile(self):
        assertThat(False)
        #Container.bind('Config').toSingle(ConfigXml)
        Container.bind('VarManager').toSingle(VarManager, {
            'LogPath': ScriptDir + '/logtest.txt',
            'LogPathPrevious': ScriptDir + '/logtest.prev.txt',
        })

        log = Logger(False, True)

        log.heading("heading 1")
        log.info("info 1")
        log.error("error 1")
        log.good("good 1")
        log.info("info 2")
        log.heading("heading 2")
        log.info("info 3")
        log.finished("Done")

        log.dispose()
コード例 #26
0
ファイル: TestLogger.py プロジェクト: zzragida/Zenject
    def testOutputToFile(self):
        assertThat(False)
        #Container.bind('Config').toSingle(ConfigXml)
        Container.bind('VarManager').toSingle(
            VarManager, {
                'LogPath': ScriptDir + '/logtest.txt',
                'LogPathPrevious': ScriptDir + '/logtest.prev.txt',
            })

        log = Logger(False, True)

        log.heading("heading 1")
        log.info("info 1")
        log.error("error 1")
        log.good("good 1")
        log.info("info 2")
        log.heading("heading 2")
        log.info("info 3")
        log.finished("Done")

        log.dispose()
コード例 #27
0
def _main():
    # Here we split out some functionality into various methods
    # so that other python code can make use of them
    # if they want to extend projeny
    parser = argparse.ArgumentParser(description='Unity Package Manager')
    addArguments(parser)

    argv = sys.argv[1:]

    # If it's 2 then it only has the -cfg param
    if len(argv) == 0:
        parser.print_help()
        sys.exit(2)

    args = parser.parse_args(sys.argv[1:])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, args.verbose,
                                         args.veryVerbose)

    if args.createConfig:
        _createConfig()
    else:
        if args.configPath:
            assertThat(os.path.isfile(args.configPath),
                       "Could not find config file at '{0}'", args.configPath)
            mainConfigPath = args.configPath
        else:
            mainConfigPath = findMainConfigPath()

        installBindings(mainConfigPath)
        installPlugins()

        Container.resolve('PrjRunner').run(args)
コード例 #28
0
ファイル: Prj.py プロジェクト: Ariequ/Projeny
def _main():
    # Here we split out some functionality into various methods
    # so that other python code can make use of them
    # if they want to extend projeny
    parser = argparse.ArgumentParser(description='Unity Package Manager')
    addArguments(parser)

    argv = sys.argv[1:]

    # If it's 2 then it only has the -cfg param
    if len(argv) == 0:
        parser.print_help()
        sys.exit(2)

    args = parser.parse_args(sys.argv[1:])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, args.verbose, args.veryVerbose)

    if args.createConfig:
        _createConfig()
    else:
        if args.configPath:
            assertThat(os.path.isfile(args.configPath), "Could not find config file at '{0}'", args.configPath)
            mainConfigPath = args.configPath
        else:
            mainConfigPath = findMainConfigPath()

        installBindings(mainConfigPath)
        installPlugins()

        Container.resolve('PrjRunner').run(args)
コード例 #29
0
ファイル: TestLogger.py プロジェクト: Ariequ/Projeny
    def testOutputToConsole(self):
        self._installBindings()
        log = Container.resolve('Logger')

        with log.heading("heading 1"):
            log.info("test of params: {0}", 5)

            with log.heading("heading 2"):
                log.error("test of params: {0}", 5)
                log.good("test of params: {0}", 5)

            log.info("test of params: {0}", 5)
            log.info("info 1")
            log.error("error 1")
            log.good("good 1")
            log.info("info 2")

            with log.heading("heading 2"):
                log.info("info 3")
                log.good("Done")
コード例 #30
0
    def testOutputToConsole(self):
        self._installBindings()
        log = Container.resolve('Logger')

        with log.heading("heading 1"):
            log.info("test of params: {0}", 5)

            with log.heading("heading 2"):
                log.error("test of params: {0}", 5)
                log.good("test of params: {0}", 5)

            log.info("test of params: {0}", 5)
            log.info("info 1")
            log.error("error 1")
            log.good("good 1")
            log.info("info 2")

            with log.heading("heading 2"):
                log.info("info 3")
                log.good("Done")
コード例 #31
0
ファイル: EditorApi.py プロジェクト: Ariequ/Projeny
def installBindings(configPath):
    Container.bind('LogStream').toSingle(LogStreamConsoleHeadingsOnly)
    Container.bind('LogStream').toSingle(LogStreamFile)
    Prj.installBindings(configPath)
コード例 #32
0
ファイル: CreateRelease.py プロジェクト: andav51/Zenject
def installBindings():

    config = {
        'PathVars': {
            'UnityExePath': 'C:/Utils/Unity/Unity2017.1.0f3/Editor/Unity.exe',
            'LogPath': os.path.join(BuildDir, 'Log.txt'),
            'MsBuildExePath': 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
        },
        'Compilation': {
            'UseDevenv': False
        },
    }
    Container.bind('Config').toSingle(Config, [config])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('VarManager').toSingle(VarManager)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('UnityHelper').toSingle(UnityHelper)
コード例 #33
0
                infoStr = infoBytes.decode('utf8')

                return json.loads(infoStr)

        return None

if __name__ == '__main__':

    import mtm.ioc.Container as Container
    from mtm.config.Config import Config
    from mtm.util.ScriptRunner import ScriptRunner
    from mtm.util.VarManager import VarManager
    from mtm.log.Logger import Logger
    from mtm.util.SystemHelper import SystemHelper
    from mtm.util.ProcessRunner import ProcessRunner
    from mtm.log.LogStreamConsole import LogStreamConsole

    Container.bind('Config').toSingle(Config, [])
    Container.bind('Logger').toSingle(Logger)
    Container.bind('VarManager').toSingle(VarManager, { 'UnityExePath': "C:/Program Files/Unity/Editor/Unity.exe" })
    #Container.bind('LogStream').toSingle(LogStreamConsole, True, True)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)

    path = "C:/Users/Steve/AppData/Roaming/Unity/Asset Store/TripleBrick/3D ModelsEnvironmentsLandscapes/Free Rocks.unitypackage"

    info = UnityPackageAnalyzer().getReleaseInfoFromUnityPackage(path)

    print('Result: ' + str(info.__dict__))

コード例 #34
0
 def testIsInstanceSuccess(self):
     Container.bind('Title').to('yep')
     Test2().Run()
コード例 #35
0
 def testHasMethodFail(self):
     # does not have WriteLine()
     Container.bind('Console').toSingle(Foo)
     Test1().Run()
コード例 #36
0
ファイル: Logger.py プロジェクト: Cyberbanan/Projeny
        if parsedMessage:
            return LogType.Info, parsedMessage

        parsedMessage = self.tryMatchPattern(message, self.debugMaps, self.debugPatterns)
        if parsedMessage:
            return LogType.Debug, parsedMessage

        return LogType.Noise, message


if __name__ == "__main__":
    import mtm.ioc.Container as Container

    class Log1:
        def log(self, logType, message):
            print("log 1: " + message)

    class Log2:
        def log(self, logType, message):
            print("log 2: " + message)

    Container.bind("LogStream").toSingle(Log1)
    Container.bind("LogStream").toSingle(Log2)

    Container.bind("Logger").toSingle(Logger)

    logger = Container.resolve("Logger")

    logger.info("test info")
    logger.error("test error")
コード例 #37
0
def installBindings():

    config = {
        'PathVars': {
            'ScriptDir': ScriptDir,
            'RootDir': RootDir,
            'BuildDir': '[RootDir]/Build',
            'TempDir': '[RootDir]/Temp',
            'WebGlTemplate': '[ScriptDir]/web_config_template.xml',
            'OutputRootDir': '[RootDir]/SampleBuilds',
            'UnityExePath': 'C:/Program Files/Unity/Hub/Editor/2018.1.0f2/Editor/Unity.exe',
            'LogPath': '[BuildDir]/Log.txt',
            'UnityProjectPath': '[RootDir]/UnityProject',
            'MsBuildExePath': 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
        },
        'Compilation': {
            'UseDevenv': False
        },
    }
    Container.bind('Config').toSingle(Config, [config])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('VarManager').toSingle(VarManager)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('UnityHelper').toSingle(UnityHelper)
コード例 #38
0
ファイル: Inject.py プロジェクト: AcamTech/Zenject
 def _request(self):
     objects = Container.resolveMany(self._identifier)
     for obj in objects:
         self._assertion(obj)
     return objects
コード例 #39
0
ファイル: CleanUpPython.py プロジェクト: Ariequ/Projeny
def installBindings():

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, True)
    Container.bind('Config').toSingle(Config, [])

    Container.bind('VarManager').toSingle(VarManager)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
コード例 #40
0
ファイル: OpenInVisualStudio.py プロジェクト: wyb314/Projeny
def installBindings(args):

    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    Prj.installBindings(findConfigPath(args.filePath))
コード例 #41
0
def installBindings():

    config = {
        'PathVars': {
            'UnityExePath':
            'C:/Program Files/Unity/Editor/Unity.exe',
            'LogPath':
            os.path.join(BuildDir, 'Log.txt'),
            'MsBuildExePath':
            'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
        },
        'Compilation': {
            'UseDevenv': False
        },
    }
    Container.bind('Config').toSingle(Config, [config])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('VarManager').toSingle(VarManager)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('UnityHelper').toSingle(UnityHelper)
コード例 #42
0
 def testHasMethodSuccess(self):
     Container.bind('Console').toSingle(Console1)
     Test1().Run()
コード例 #43
0
 def testIsInstanceFailure(self):
     Container.bind('Title').to(2)
     Test2().Run()
コード例 #44
0
 def testIsInstanceFailure(self):
     Container.bind('Title').to(2)
     Test2().Run()
コード例 #45
0
 def _request(self):
     objects = Container.resolveMany(self._identifier)
     for obj in objects:
         self._assertion(obj)
     return objects
コード例 #46
0
 def testIsInstanceSuccess(self):
     Container.bind('Title').to('yep')
     Test2().Run()
コード例 #47
0
def installBindings(mainConfigPath):

    assertIsNotNone(mainConfigPath)
    assertThat(os.path.isfile(mainConfigPath))

    projenyDir = _getProjenyDir()
    projenyConfigPath = os.path.join(projenyDir, ConfigFileName)

    # Put the standard config first so it can be over-ridden by user settings
    configPaths = [projenyConfigPath, mainConfigPath]
    configPaths += _getExtraUserConfigPaths()

    Container.bind('Config').toSingle(Config,
                                      loadYamlFilesThatExist(*configPaths))

    initialVars = {
        'ProjenyDir': projenyDir,
    }

    initialVars['ConfigDir'] = os.path.dirname(mainConfigPath)

    if not MiscUtil.isRunningAsExe():
        initialVars['PythonPluginDir'] = _getPluginDirPath()

    Container.bind('VarManager').toSingle(VarManager, initialVars)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('UnityHelper').toSingle(UnityHelper)
    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('PackageManager').toSingle(PackageManager)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('JunctionHelper').toSingle(JunctionHelper)
    Container.bind('VisualStudioSolutionGenerator').toSingle(
        VisualStudioSolutionGenerator)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('ProjenyVisualStudioHelper').toSingle(
        ProjenyVisualStudioHelper)
    Container.bind('ProjectSchemaLoader').toSingle(ProjectSchemaLoader)
    Container.bind('CommonSettings').toSingle(CommonSettings)
    Container.bind('UnityPackageExtractor').toSingle(UnityPackageExtractor)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('UnityPackageAnalyzer').toSingle(UnityPackageAnalyzer)
    Container.bind('ProjectConfigChanger').toSingle(ProjectConfigChanger)
    Container.bind('PrjRunner').toSingle(PrjRunner)
    Container.bind('UnityEditorMenuGenerator').toSingle(
        UnityEditorMenuGenerator)

    Container.bind('ReleaseSourceManager').toSingle(ReleaseSourceManager)
コード例 #48
0
ファイル: EditorApi.py プロジェクト: svennergr/Projeny
def installBindings(configPath):
    Container.bind('LogStream').toSingle(LogStreamConsoleHeadingsOnly)
    Container.bind('LogStream').toSingle(LogStreamFile)
    Prj.installBindings(configPath)
コード例 #49
0
ファイル: TestLogger.py プロジェクト: AcamTech/Zenject
 def setUp(self):
     Container.clear()
コード例 #50
0
 def setUp(self):
     Container.clear()
コード例 #51
0
        parsedMessage = self.tryMatchPattern(message, self.infoMaps, self.infoPatterns)
        if parsedMessage:
            return LogType.Info, parsedMessage

        parsedMessage = self.tryMatchPattern(message, self.debugMaps, self.debugPatterns)
        if parsedMessage:
            return LogType.Debug, parsedMessage

        return LogType.Noise, message

if __name__ == '__main__':
    import mtm.ioc.Container as Container

    class Log1:
        def log(self, logType, message):
            print('log 1: ' + message)

    class Log2:
        def log(self, logType, message):
            print('log 2: ' + message)

    Container.bind('LogStream').toSingle(Log1)
    Container.bind('LogStream').toSingle(Log2)

    Container.bind('Logger').toSingle(Logger)

    logger = Container.resolve('Logger')

    logger.info('test info')
    logger.error('test error')
コード例 #52
0
    def test1(self):
        Container.bind('Foo1').to(Foo1, 7)
        Container.bind('Foo2').to(Foo2, 6)

        foo2 = Container.resolve('Foo2')
        foo2.Start()
コード例 #53
0
 def _installBindings(self):
     Container.bind('Logger').toSingle(Logger)
     Container.bind('LogStream').toSingle(LogStreamConsole, True, True)
     config = {}
     Container.bind('Config').toSingle(Config, [config])
コード例 #54
0
ファイル: Logger.py プロジェクト: AcamTech/Zenject
        if len(args) > 0:
            msg = msg.format(*args)

        if logType == LogType.Heading:
            msg += '...'

        for stream in self._streams:
            stream.log(logType, msg)

if __name__ == '__main__':
    import mtm.ioc.Container as Container

    class Log1:
        def log(self, logType, msg):
            print('log 1: ' + msg)

    class Log2:
        def log(self, logType, msg):
            print('log 2: ' + msg)

    Container.bind('LogStream').toSingle(Log1)
    Container.bind('LogStream').toSingle(Log2)

    Container.bind('Logger').toSingle(Logger)

    logger = Container.resolve('Logger')

    logger.info('test info')
    logger.error('test error')
コード例 #55
0
ファイル: CreateSampleBuilds.py プロジェクト: wheein/Zenject
def installBindings():

    config = {
        'PathVars': {
            'ScriptDir':
            ScriptDir,
            'RootDir':
            RootDir,
            'BuildDir':
            '[RootDir]/Build',
            'TempDir':
            '[RootDir]/Temp',
            'WebGlTemplate':
            '[ScriptDir]/web_config_template.xml',
            'OutputRootDir':
            '[RootDir]/SampleBuilds',
            'UnityExePath':
            'D:/Utils/Unity/Installs/2018.1.0f2/Editor/Unity.exe',
            'LogPath':
            '[BuildDir]/Log.txt',
            'UnityProjectPath':
            '[RootDir]/UnityProject',
            'MsBuildExePath':
            'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
        },
        'Compilation': {
            'UseDevenv': False
        },
    }
    Container.bind('Config').toSingle(Config, [config])

    Container.bind('LogStream').toSingle(LogStreamFile)
    Container.bind('LogStream').toSingle(LogStreamConsole, True, False)

    Container.bind('ScriptRunner').toSingle(ScriptRunner)
    Container.bind('VarManager').toSingle(VarManager)
    Container.bind('SystemHelper').toSingle(SystemHelper)
    Container.bind('Logger').toSingle(Logger)
    Container.bind('ProcessRunner').toSingle(ProcessRunner)
    Container.bind('ZipHelper').toSingle(ZipHelper)
    Container.bind('VisualStudioHelper').toSingle(VisualStudioHelper)
    Container.bind('UnityHelper').toSingle(UnityHelper)
コード例 #56
0
ファイル: Inject.py プロジェクト: AcamTech/Zenject
 def _request(self):
     obj = Container.resolve(self._identifier)
     self._assertion(obj)
     return obj