Package org.torquebox.core.runtime

Examples of org.torquebox.core.runtime.RubyRuntimeMetaData


       
        if ( rubyAppMetaData == null || rackAppMetaData == null ) {
            return;
        }
       
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachmentRubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if ( runtimeMetaData != null && runtimeMetaData.getRuntimeType() != null ) {
            return;
        }

        if (runtimeMetaData == null) {
            runtimeMetaData = new RubyRuntimeMetaData();
            unit.putAttachmentRubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );
        }

        runtimeMetaData.setBaseDir( rubyAppMetaData.getRoot() );
        runtimeMetaData.setEnvironment( rubyAppMetaData.getEnvironmentVariables() );
        runtimeMetaData.setRuntimeType( RubyRuntimeMetaData.RuntimeType.RACK );
        runtimeMetaData.appendLoadPath( new RubyLoadPathMetaData( rubyAppMetaData.getRoot() ) );
        runtimeMetaData.appendLoadPath( new RubyLoadPathMetaData( new File( rubyAppMetaData.getRoot(), "lib" ) ) );

        RuntimeInitializer initializer = new RackRuntimeInitializer( rubyAppMetaData, rackAppMetaData );
        RuntimePreparer preparer = new BundlerAwareRuntimePreparer( rubyAppMetaData );
        runtimeMetaData.setRuntimeInitializer( initializer );
        runtimeMetaData.setRuntimePreparer( preparer );
    }
View Full Code Here


        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }

        RubyAppMetaData rubyAppMetaData = unit.getAttachment( RubyAppMetaData.ATTACHMENT_KEY );
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );

        if (rubyAppMetaData != null && runtimeMetaData != null) {
            RubyRuntimeFactory factory = new RubyRuntimeFactory( runtimeMetaData.getRuntimeInitializer(),
                    runtimeMetaData.getRuntimePreparer() );

            List<String> loadPaths = new ArrayList<String>();

            for (RubyLoadPathMetaData loadPath : runtimeMetaData.getLoadPaths()) {
                loadPaths.add( loadPath.getPath().getAbsolutePath() );
            }

            Module module = unit.getAttachment( Attachments.MODULE );

            if (module != null) {
                factory.setClassLoader( module.getClassLoader() );
            }

            factory.setServiceRegistry( phaseContext.getServiceRegistry() );
            factory.setLoadPaths( loadPaths );
            factory.setApplicationName( rubyAppMetaData.getApplicationName() );
            factory.setUseJRubyHomeEnvVar( this.useJRubyHomeEnvVar );
            factory.setApplicationEnvironment( rubyAppMetaData.getEnvironmentVariables() );
            factory.setDebug( runtimeMetaData.isDebug() );
            factory.setInteractive( runtimeMetaData.isInteractive() );
            factory.setProfileApi( runtimeMetaData.isProfileApi() );

            if (runtimeMetaData.getVersion() == RubyRuntimeMetaData.Version.V1_9) {
                factory.setRubyVersion( CompatVersion.RUBY1_9 );
            } else if (runtimeMetaData.getVersion() == RubyRuntimeMetaData.Version.V1_8) {
                factory.setRubyVersion( CompatVersion.RUBY1_8 );
            } else if (runtimeMetaData.getVersion() == RubyRuntimeMetaData.Version.V2_0) {
                factory.setRubyVersion( CompatVersion.RUBY2_0 );
            }

            RubyRuntimeMetaData.CompileMode compileMode = runtimeMetaData.getCompileMode();

            if (compileMode == RubyRuntimeMetaData.CompileMode.JIT) {
                factory.setCompileMode( CompileMode.JIT );
            } else if (compileMode == RubyRuntimeMetaData.CompileMode.OFF) {
                factory.setCompileMode( CompileMode.OFF );
View Full Code Here

        if (rubyAppMetaData == null) {
            return;
        }

        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );

        if (runtimeMetaData != null && runtimeMetaData.getRuntimeType() != null) {
            return;
        }

        if (runtimeMetaData == null) {
            runtimeMetaData = new RubyRuntimeMetaData();
            unit.putAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY, runtimeMetaData );
        }

        File root = rubyAppMetaData.getRoot();
        runtimeMetaData.setBaseDir( root );
        runtimeMetaData.setEnvironment( rubyAppMetaData.getEnvironmentVariables() );
        runtimeMetaData.setRuntimeType( RubyRuntimeMetaData.RuntimeType.BARE );
        runtimeMetaData.appendLoadPath( new RubyLoadPathMetaData( root ) );
        runtimeMetaData.appendLoadPath( new RubyLoadPathMetaData( new File( root, "lib" ) ) );
        runtimeMetaData.appendLoadPath( new RubyLoadPathMetaData( new File( root, "config" ) ) );

        RuntimeInitializer initializer = new BaseRuntimeInitializer( rubyAppMetaData );
        RuntimePreparer preparer = null;
        File gemfile = new File( root, "Gemfile" );
        if (gemfile.exists()) {
            preparer = new BundlerAwareRuntimePreparer( rubyAppMetaData );
        } else {
            preparer = new BaseRuntimePreparer( rubyAppMetaData );
        }
        runtimeMetaData.setRuntimeInitializer( initializer );
        runtimeMetaData.setRuntimePreparer( preparer );

    }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if (runtimeMetaData != null) {
            try {
                runtimeMetaData.appendLoadPath( "app/stomplets" );
                runtimeMetaData.appendLoadPath( "stomplets" );
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException( e );
            }
        }
    }
View Full Code Here

    public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        if (DeploymentUtils.isUnitRootless( unit )) {
            return;
        }
        RubyRuntimeMetaData runtimeMetaData = unit.getAttachment( RubyRuntimeMetaData.ATTACHMENT_KEY );
       
        if (runtimeMetaData != null) {
            try {
                runtimeMetaData.appendLoadPath( "app/tasks" );
                runtimeMetaData.appendLoadPath( "tasks" );
                runtimeMetaData.appendLoadPath( "app/processors" );
                runtimeMetaData.appendLoadPath( "processors" );
            } catch (Exception e) {
                throw new DeploymentUnitProcessingException( e );
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.torquebox.core.runtime.RubyRuntimeMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.