Runs custom configuration steps for the packages that ship with support
    in acorn.
322488
def _conf_packages(args):
    
    from acorn.config import config_dir
    from os import path
    from acorn.base import testmode
    target = config_dir(True)
    alternate = path.join(path.abspath(path.expanduser("~")), ".acorn")
    if not testmode and target != alternate:# pragma: no cover
        msg.err("Could not configure custom ~/.acorn directory.")
        exit(0)

    from acorn.utility import reporoot
    from glob import glob
    from os import chdir, getcwd
    from shutil import copy
    current = getcwd()
    source = path.join(reporoot, "acorn", "config")
    chdir(source)
    count = 0

    #For the unit testing, we don't clobber the local directory, so the copies
    #are disabled.
    for json in glob("*.json"):
        if not testmode:# pragma: no cover
            copy(json, target)
        count += 1
    for cfg in glob("*.cfg"):
        if not testmode:# pragma: no cover
            copy(cfg, target)
        count += 1

    #Switch the directory back to what it was.
    chdir(current)        
    msg.okay("Copied {0:d} package files to {1}.".format(count, target))
1125832
def configure():
    
    yaml.add_multi_representer(Step, step_multi_representer)
    yaml.add_multi_constructor('!step', step_multi_constructor)
    yaml.Dumper.ignore_aliases = lambda *args: True
624100
def prepare_app_pipeline():
    """"""
    runner = ForemastRunner()
    runner.write_configs()
    runner.create_app()
    runner.create_pipeline()
    runner.cleanup()
211498
def install_packages():
    

    if env.verbosity:
        print env.host, "INSTALLING & CONFIGURING NODE PACKAGES:"
    #Get a list of installed packages
    p = run("dpkg -l | awk '/ii/ {print $2}'").split('\n')
    
    #Remove apparmor - TODO we may enable this later
    if env.overwrite or not server_state('apparmor-disabled') and 'apparmor' in p:
        with settings(warn_only=True):
            sudo('/etc/init.d/apparmor stop')
            sudo('update-rc.d -f apparmor remove')
            set_server_state('apparmor-disabled')

    #The principle we will use is to only install configurations and packages
    #if they do not already exist (ie not manually installed or other method)
    env.installed_packages[env.host] = []
    role = env.role_lookup[env.host_string]
    packages = get_packages()
    for package in packages:
        if not package in p:
            install_package(package)
            if env.verbosity:
                print ' * installed',package
            env.installed_packages[env.host].append(package)
    if env.overwrite or env.installed_packages[env.host]: #always store the latest complete list
        set_server_state('packages_installed', packages)
        env.installed_packages[env.host] = packages

    if env.overwrite and 'apache2' in env.installed_packages[env.host]: 
            #some sensible defaults -might move to putting this config in a template
            sudo("rm -f /etc/apache2/sites-enabled/000-default")
            sed('/etc/apache2/apache2.conf',before='KeepAlive On',after='KeepAlive Off',use_sudo=True, backup='')
            sed('/etc/apache2/apache2.conf',before='StartServers          2', after='StartServers          1', use_sudo=True, backup='')
            sed('/etc/apache2/apache2.conf',before='MaxClients          150', after='MaxClients          100', use_sudo=True, backup='')
            for module in env.APACHE_DISABLE_MODULES:
                sudo('rm -f /etc/apache2/mods-enabled/%s*'% module)
    #Install base python packages
    #We'll use easy_install at this stage since it doesn't download if the package
    #is current whereas pip always downloads.
    #Once both these packages mature we'll move to using the standard Ubuntu packages
    if (env.overwrite or not server_state('pip-venv-wrapper-installed')) and 'python-setuptools' in packages:
        sudo("easy_install virtualenv")
        sudo("easy_install pip")
        sudo("easy_install virtualenvwrapper")
        if env.verbosity:
            print " * easy installed pip, virtualenv, virtualenvwrapper"
        set_server_state('pip-venv-wrapper-installed')
    if not contains("/home/%s/.profile"% env.user,"source /usr/local/bin/virtualenvwrapper.sh"):
        append("/home/%s/.profile"% env.user, "export WORKON_HOME=$HOME/env")
        append("/home/%s/.profile"% env.user, "source /usr/local/bin/virtualenvwrapper.sh")

    #cleanup after easy_install
    sudo("rm -rf build")
31856
def custom_conf(self, conf):
        ''''''
        if conf:
            for (key, val) in conf.items():
                self.__conf[key] = val
        return self
1027725
@Action(
            restrictTo = RestrictTo.PROTOTYPING
    )
    @MemberOrder(sequence="20")
    public void installFixtures() {
        findFixtureScriptFor(SettingsModuleAppSetUpFixture.class).run(null);
    }
977287
def run():
    

    deps_dir = os.path.join(build_root, 'modularcrypto-deps')
    if os.path.exists(deps_dir):
        shutil.rmtree(deps_dir, ignore_errors=True)
    os.mkdir(deps_dir)

    try:
        print("Staging ci dependencies")
        _stage_requirements(deps_dir, os.path.join(package_root, 'requires', 'ci'))

        print("Checking out modularcrypto packages for coverage")
        for other_package in other_packages:
            pkg_url = 'https://github.com/wbond/%s.git' % other_package
            pkg_dir = os.path.join(build_root, other_package)
            if os.path.exists(pkg_dir):
                print("%s is already present" % other_package)
                continue
            print("Cloning %s" % pkg_url)
            _execute(['git', 'clone', pkg_url], build_root)
        print()

    except (Exception):
        if os.path.exists(deps_dir):
            shutil.rmtree(deps_dir, ignore_errors=True)
        raise

    return True
839673
def build_tree(self):
        """"""
        for spec in self.specs:
            if spec.ismodule:
                self.modules.append(Module(spec.name, spec.path, dsm=self))
            else:
                self.packages.append(Package(
                    spec.name, spec.path,
                    dsm=self, limit_to=spec.limit_to,
                    build_tree=True,
                    build_dependencies=False,
                    enforce_init=self.enforce_init))
369508
def run(self):
        
        run_command = (
            settings.project_customization.runfile.read_text().split()
        )
        chmod_string = (
            "chmod +x "
            + settings.project_customization.runfile.absolute().as_posix()
        )
        subprocess.run(chmod_string.split())
        subprocess.run(
            run_command, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr
        )
698614
public void apply(CitrusAppConfiguration configuration) {
        setPackages(configuration.getPackages());
        setTestClasses(configuration.getTestClasses());
        setIncludes(configuration.getIncludes());
        addDefaultProperties(configuration.getDefaultProperties());
    }
348529
def run(configobj=None):
    
    acscteforwardmodel(configobj['input'],
                       exec_path=configobj['exec_path'],
                       time_stamps=configobj['time_stamps'],
                       verbose=configobj['verbose'],
                       quiet=configobj['quiet'],
                       single_core=configobj['single_core']
                       )
61271
def _set_packages(self, node):
        '''
        
        '''
        pkgs = etree.SubElement(node, 'packages')
        for pkg_name, pkg_version in sorted(self._data.software.get('packages', {}).items()):
            pkg = etree.SubElement(pkgs, 'package')
            pkg.set('name', pkg_name)

        # Add collections (SUSE)
        if self.__grains__.get('os_family', '') == 'Suse':
            for ptn_id, ptn_data in self._data.software.get('patterns', {}).items():
                if ptn_data.get('installed'):
                    ptn = etree.SubElement(pkgs, 'namedCollection')
                    ptn.set('name', ptn_id)

        return pkgs
1012945
public function run()
    {
        // Main configuration.
        Configuration::create(['name'        => 'Application version',
                               'description' => 'Current application version.',
                               'code'        => 'application-version',
                               'value'       => '0.0.1', ]);

        Configuration::create(['name'        => 'Tenant Application Key',
                               'description' => 'Tentant application key for all API transactions.',
                               'code'        => 'tenant-key',
                               'value'       => str_random(10), ]);

        DeliveryStatus::saveMany([
            ['name' => 'New', 'description' => 'New delivery, just entered on the system'],
            ['name' => 'Assigned', 'description' => 'Assigned to a Courier'],
            ['name' => 'On hold at origin', 'description' => 'On Hold, at the origin'],
            ['name' => 'In transit', 'description' => 'In transit, progressed by the Courier'],
            ['name' => 'On hold at destination', 'description' => 'On Hold, at the destination'],
            ['name' => 'Delivered', 'description' => 'Delivered successfully at the destination'],
            ['name' => 'Cancelled', 'description' => 'Cancelled (by client or coordination)'],
        ]);

        // Load main roles.
        // A main role will allow the system to automatically inject business rules
        // in case it's necessary.
        MainRole::saveMany([
            ['name' => 'Client based', 'code' => 'client'],
            ['name' => 'Courier based', 'code' => 'courier'],
            ['name' => 'Employee based', 'code' => 'employee'],
            ['name' => 'Admin based', 'code' => 'admin'],
            ['name' => 'Super admin based', 'code' => 'super-admin'],
        ]);

        // Load default profiles.
        Profile::saveMany([
            ['name' => 'Super Admin', 'code' => 'super-admin', 'description' => 'Super admin profile, view everything and has access to system tools.'],
            ['name' => 'Admin', 'code' => 'admin', 'description' => 'Admin profile, access to manage all data entities, except access to system tools.'],
            ['name' => 'Client Admin', 'code' => 'client-admin', 'description' => 'Access to modify its own client data, and to add new users to its own client.'],
            ['name' => 'Client Standard', 'code' => 'client-standard', 'description' => 'Access to create new service requests. Display only access to client data.'],
            ['name' => 'Client Display Only', 'code' => 'client-display-only', 'description' => 'Access to its own client as display only.'],
            ['name' => 'Courier Standard', 'code' => 'courier-standard', 'description' => 'Access to its own Courier data, can also manage its own service requests.'],
            ['name' => 'Courier Display Only', 'code' => 'courier-display-only', 'description' => 'Access to its own Courier data as display only.'],
            ['name' => 'Employee Standard', 'code' => 'employee-standard', 'description' => 'Access to Employee features, and to manage allowed data in a daily basis.'],
            ['name' => 'Employee Finance', 'code' => 'employee-finance', 'description' => 'Privileged access to finantial data, and to the respective finacial dashboards.'],
            ['name' => 'Employee Coordination', 'code' => 'employee-coordination', 'description' => 'Privileged access to the coordination features only.'],
            ['name' => 'Employee Display Only', 'code' => 'employee-display-only', 'description' => 'Access to employee features as display only.'],
        ]);

        // Load default policies.
        Policy::saveMany([
            ['name'               => 'Surveyor Profile default',
             'code'               => 'surveyor-profile-default',
             'model'              => 'Waygou\Surveyor\Models\Profile',
             'policy'             => 'Waygou\Xheetah\Policies\Surveyor\Profile\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for surveyor profiles.', ],

            ['name'               => 'Surveyor Scope default',
             'code'               => 'surveyor-scope-default',
             'model'              => 'Waygou\Surveyor\Models\Scope',
             'policy'             => 'Waygou\Xheetah\Policies\Surveyor\Scope\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for surveyor scopes.', ],

            ['name'               => 'Surveyor Policy default',
             'code'               => 'surveyor-policy-default',
             'model'              => 'Waygou\Surveyor\Models\Policy',
             'policy'             => 'Waygou\Xheetah\Policies\Surveyor\Policy\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for surveyor policies.', ],

            ['name'               => 'Address default',
             'code'               => 'address-default',
             'model'              => 'Waygou\Xheetah\Models\Address',
             'policy'             => 'Waygou\Xheetah\Policies\Address\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for addresses.', ],

            ['name'               => 'Cost center default',
             'code'               => 'cost-center-default',
             'model'              => 'Waygou\Xheetah\Models\CostCenter',
             'policy'             => 'Waygou\Xheetah\Policies\CostCenter\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for cost centers.', ],

            ['name'               => 'Delivery default',
             'code'               => 'delivery-default',
             'model'              => 'Waygou\Xheetah\Models\Delivery',
             'policy'             => 'Waygou\Xheetah\Policies\Delivery\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for deliveries.', ],

            ['name'               => 'Main Role default',
             'code'               => 'main-role-default',
             'model'              => 'Waygou\Xheetah\Models\MainRole',
             'policy'             => 'Waygou\Xheetah\Policies\MainRole\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for main roles.', ],

            ['name'               => 'Client default',
             'code'               => 'client-default',
             'model'              => 'Waygou\Xheetah\Models\Client',
             'policy'             => 'Waygou\Xheetah\Policies\Client\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for clients.', ],

            ['name'               => 'Delivery Type default',
             'code'               => 'delivery-type-default',
             'model'              => 'Waygou\Xheetah\Models\DeliveryType',
             'policy'             => 'Waygou\Xheetah\Policies\DeliveryType\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for delivery types.', ],

            ['name'               => 'Delivery Status default',
             'code'               => 'delivery-status-default',
             'model'              => 'Waygou\Xheetah\Models\DeliveryStatus',
             'policy'             => 'Waygou\Xheetah\Policies\DeliveryStatus\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for delivery statuses.', ],

            ['name'               => 'Delivery Status Change default',
             'code'               => 'delivery-status-change-default',
             'model'              => 'Waygou\Xheetah\Models\DeliveryStatusChange',
             'policy'             => 'Waygou\Xheetah\Policies\DeliveryStatusChange\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for delivery status changes.', ],

             /*
            ['name' => 'Manages its own Client',
             'code' => 'client-only',
             'model' => 'Waygou\Xheetah\Models\Client',
             'policy' => 'Waygou\Xheetah\Policies\Client\RestrictToOwn',
             'is_data_restricted' => true,
             'description' => 'Restricts data to its own Client.'],
            */

            ['name'               => 'User default',
             'code'               => 'user-default',
             'model'              => 'Waygou\Xheetah\Models\User',
             'policy'             => 'Waygou\Xheetah\Policies\User\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for users.', ],

             /*
            ['name' => 'Client views its Couriers',
             'code' => 'couriers-from-client',
             'model' => 'Waygou\Xheetah\Models\Child\Courier',
             'policy' => 'Waygou\Xheetah\Policies\Child\Courier\RestrictToClientUsers',
             'is_data_restricted' => true,
             'description' => 'Restricts data to user Client Couriers.'],
            */

            ['name'               => 'Courier default',
             'code'               => 'courier-default',
             'model'              => 'Waygou\Xheetah\Models\Childs\Courier',
             'policy'             => 'Waygou\Xheetah\Policies\Childs\Courier\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for couriers.', ],

            ['name'               => 'Client User default',
             'code'               => 'client-user-default',
             'model'              => 'Waygou\Xheetah\Models\Childs\ClientUser',
             'policy'             => 'Waygou\Xheetah\Policies\Childs\ClientUser\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for client users.', ],

             /*
            ['name' => 'Courier manages its data',
             'code' => 'courier-only',
             'model' => 'Waygou\Xheetah\Models\Childs\Courier',
             'policy' => 'Waygou\Xheetah\Policies\Childs\Courier\RestrictToOwn',
             'is_data_restricted' => true,
             'description' => 'Restrict data to its own Courier.'],
            */

            ['name'               => 'Employee default',
             'code'               => 'employee-default',
             'model'              => 'Waygou\Xheetah\Models\Childs\Employee',
             'policy'             => 'Waygou\Xheetah\Policies\Childs\Employee\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for employees.', ],

            ['name'               => 'Duration Type default',
             'code'               => 'duration-type-default',
             'model'              => 'Waygou\Xheetah\Models\DurationType',
             'policy'             => 'Waygou\Xheetah\Policies\DurationType\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for duration types.', ],

            ['name'               => 'Vehicle Type default',
             'code'               => 'vehicle-type-default',
             'model'              => 'Waygou\Xheetah\Models\VehicleType',
             'policy'             => 'Waygou\Xheetah\Policies\VehicleType\DefaultPolicy',
             'is_data_restricted' => false,
             'description'        => 'Default policy for vehicle types.', ],

             /*
            ['name' => 'Employee manages its data',
             'code' => 'employee-only',
             'model' => 'Waygou\Xheetah\Models\Childs\Employee',
             'policy' => 'Waygou\Xheetah\Policies\Childs\RestrictToOwn',
             'is_data_restricted' => true,
             'description' => 'Restrict data to employees to manage themselves only.'],
             */
        ]);

        // Scopes.
        Scope::saveMany([
            ['name'        => 'Show my own Client',
             'description' => 'Scopes Clients to the client of the logged user.',
             'code'        => 'client-scope-myself',
             'model'       => 'Waygou\Xheetah\Models\Client',
             'scope'       => 'Waygou\Xheetah\Scopes\Client\RestrictToMyClient', ],
        ]);

        // Scopes.
        Scope::saveMany([
            ['name'        => 'Show my users from my Client',
             'description' => 'Scopes the Users (main role = client) that belong to the same client as the logged user.',
             'code'        => 'client-user-my-users',
             'model'       => 'Waygou\Xheetah\Models\Childs\ClientUser',
             'scope'       => 'Waygou\Xheetah\Scopes\Childs\ClientUser\RestrictToItsOwnClientUsers', ],
        ]);

        // Apply scopes to profiles.
        Profile::where('code', 'client-admin')->first()->scopes()->attach(
            [Scope::where('code', 'client-scope-myself')->first()->id,
             Scope::where('code', 'client-user-my-users')->first()->id, ]
        );

        Profile::where('code', 'client-standard')->first()->scopes()->attach(
            [Scope::where('code', 'client-scope-myself')->first()->id,
             Scope::where('code', 'client-user-my-users')->first()->id, ]
        );

        Profile::where('code', 'client-display-only')->first()->scopes()->attach(
            [Scope::where('code', 'client-scope-myself')->first()->id,
             Scope::where('code', 'client-user-my-users')->first()->id, ]
        );

        // Apply policies to profiles.
        // Super admin -- Full access to all entities + system tools.
        Profile::where('code', 'super-admin')->first()->policies()->attach(
            [Policy::where('code', 'delivery-status-change-default')->first()->id],
            ['can_view_any'     => true,
             'can_view'         => true,
             'can_create'       => false,
             'can_update'       => false,
             'can_delete'       => false,
             'can_restore'      => false,
             'can_force_delete' => false,
            ]
        );

        // Apply policies to profiles.
        // Super admin -- Full access to all entities + system tools.
        Profile::where('code', 'super-admin')->first()->policies()->attach(
            [Policy::where('code', 'main-role-default')->first()->id,
             Policy::where('code', 'client-default')->first()->id,
             Policy::where('code', 'cost-center-default')->first()->id,
             Policy::where('code', 'courier-default')->first()->id,
             Policy::where('code', 'user-default')->first()->id,
             Policy::where('code', 'delivery-type-default')->first()->id,
             Policy::where('code', 'employee-default')->first()->id,
             Policy::where('code', 'duration-type-default')->first()->id,
             Policy::where('code', 'delivery-default')->first()->id,
             Policy::where('code', 'delivery-status-default')->first()->id,
             Policy::where('code', 'vehicle-type-default')->first()->id,
             Policy::where('code', 'client-user-default')->first()->id,
             Policy::where('code', 'address-default')->first()->id,
             Policy::where('code', 'surveyor-profile-default')->first()->id,
             Policy::where('code', 'surveyor-policy-default')->first()->id,
             Policy::where('code', 'surveyor-scope-default')->first()->id,
            ],
            ['can_view_any'     => true,
             'can_view'         => true,
             'can_create'       => true,
             'can_update'       => true,
             'can_delete'       => true,
             'can_restore'      => true,
             'can_force_delete' => false,
            ]
        );
    }
201379
function(callback) {
                self.configureDatabases(function(err) {

                    if (err) {
                        process.exit(111);
                        return;
                    }

                    self.configureApplicationStack(
                        app, server, callback
                    );
                });
            }
997989
def prepare(ctx, new_version=None, version_part=None, hide=True,
            dry_run=False):
    """"""
    if new_version is not None:
        bump_version(ctx, new_version, version_part=version_part,
                     dry_run=dry_run)
    build_packages(ctx, hide=hide)
    packages = ensure_packages_exist(ctx, check_only=True)
    print_packages(packages)
655161
def configure(root_directory, build_path, cmake_command, only_show):
    
    default_build_path = os.path.join(root_directory, 'build')

    # check that CMake is available, if not stop
    check_cmake_exists('cmake')

    # deal with build path
    if build_path is None:
        build_path = default_build_path
    if not only_show:
        setup_build_path(build_path)

    cmake_command += ' -B' + build_path
    print('{0}\n'.format(cmake_command))
    if only_show:
        sys.exit(0)

    run_cmake(cmake_command, build_path, default_build_path)
895399
public void run(T configuration, Environment environment) throws Exception {
        for (ConfiguredBundle<? super T> bundle : configuredBundles) {
            bundle.run(configuration, environment);
        }
    }