Copy all newsletter related files to application
170590
private function copyNewsletter()
    {
        // models
        $source =  "{$this->appPath}Models{$this->ds}NewsletterSubscriber.php";
        $this->copyFilesFromSource($source, app_path("Models"), 'namespace_views');

        // controllers
        $destination = app_path("Http{$this->ds}Controllers{$this->ds}Admin{$this->ds}Newsletter");
        $source = "{$this->appPath}Controllers{$this->ds}Admin{$this->ds}Newsletter{$this->ds}SubscribersController.php";
        $this->copyFilesFromSource($source, $destination, 'namespace_views');

        // views
        $destination = base_path("resources{$this->ds}views{$this->ds}admin{$this->ds}newsletters");
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}admin{$this->ds}newsletters";
        $this->copyFilesFromSource($source, $destination);

        // migrations
        $source = "{$this->basePath}database{$this->ds}migrations{$this->ds}2017_10_01_181435_create_newsletter_subscribers_table.php";
        $this->copyFilesFromSource($source, database_path("migrations"));

    }
851449
def WriteMessagesFile(file_descriptor, package, version, printer):
    """"""
    _WriteFile(file_descriptor, package, version,
               _Proto2Printer(printer))
603619
def copytree(root_src_dir, root_dst_dir, hardlink=True):
    """"""

    for src_dir, dirs, files in os.walk(root_src_dir):
        dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
        if not os.path.exists(dst_dir):
            os.makedirs(dst_dir)
        for file_ in files:
            src_file = os.path.join(src_dir, file_)
            dst_file = os.path.join(dst_dir, file_)
            try:
                if os.path.exists(dst_file):
                    if hardlink:
                        hfoslog('Removing frontend link:', dst_file,
                                emitter='BUILDER', lvl=verbose)
                        os.remove(dst_file)
                    else:
                        hfoslog('Overwriting frontend file:', dst_file,
                                emitter='BUILDER', lvl=verbose)

                hfoslog('Hardlinking ', src_file, dst_dir, emitter='BUILDER',
                        lvl=verbose)

                if hardlink:
                    os.link(src_file, dst_file)
                else:
                    copy(src_file, dst_dir)
            except PermissionError as e:
                hfoslog(
                    " No permission to remove/create target %s for "
                    "frontend:" % ('link' if hardlink else 'copy'),
                    dst_dir, e, emitter='BUILDER', lvl=error)
            except Exception as e:
                hfoslog("Error during", 'link' if hardlink else 'copy',
                        "creation:", type(e), e, emitter='BUILDER',
                        lvl=error)

            hfoslog('Done linking', root_dst_dir, emitter='BUILDER',
                    lvl=verbose)
511500
private function copyAllWebsiteFiles()
    {
        // routes

        // VIEWS
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}website";
        $destination = resource_path("views{$this->ds}website");
        $this->copyFilesFromSource($source, $destination);

        // WEBSITE master layout
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}layouts{$this->ds}website.blade.php";
        $destination = resource_path("views{$this->ds}layouts");
        $this->copyFilesFromSource($source, $destination);

        // PARTIALS
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}partials";
        $destination = resource_path("views{$this->ds}partials");
        $this->copyFilesFromSource($source, $destination);

        // CONTROLLERS
        $source = "{$this->appPath}Controllers{$this->ds}Website";
        $destination = app_path("Http{$this->ds}Controllers{$this->ds}Website");

        // copy files and replace namespace and views only
        $this->copyFilesFromSource($source, $destination, 'namespace_views');

        // SEEDS
        $search = "{$this->baseNamespace}\Seeds;";
        $source = "{$this->basePath}database{$this->ds}seeds{$this->ds}UsersTableSeeder.php";
        $destination = database_path("seeds");
        $this->copyFilesFromSource($source, $destination, $search, "");

        // EVENTS (todo, admin for now)
        // MAILS (todo, admin for now)
        // NOTIFICATIONS (todo, admin for now)

        // webpack.js, packages.json root files
        $base = $source = $this->basePath . "resources" . $this->ds . "assets_setup" . $this->ds;
        $source = [
            $base . "webpack.mix.js",
            $base . "package.json",
            $base . "package-lock.json",
        ];
        $this->copyFilesFromSource($source, base_path(), false);

        // ASSETS
        $source = "{$this->basePath}resources{$this->ds}assets{$this->ds}";
        $destination = resource_path("assets{$this->ds}");
        // css
        $this->copyFilesFromSource("{$source}css", "{$destination}css", false);
        // fonts
        $this->copyFilesFromSource("{$source}fonts", "{$destination}fonts", false);
        // images
        $this->copyFilesFromSource("{$source}images", "{$destination}images", false);
        // js
        $this->copyFilesFromSource("{$source}js", "{$destination}js", false);
        // sass
        $this->copyFilesFromSource("{$source}sass", "{$destination}sass", false);

        // public/assets
        $this->copyFilesFromSource($this->basePath . 'public', base_path('public'));
    }
381289
def pdfdump(self, filename=None, **kargs):
        """"""
        canvas = self.canvas_dump(**kargs)
        if filename is None:
            fname = get_temp_file(autoext=".pdf")
            canvas.writePDFfile(fname)
            subprocess.Popen([conf.prog.pdfreader, fname+".pdf"])
        else:
            canvas.writePDFfile(filename)
890927
def copy(self, path_patterns, symbolic_link=False, root=None,
             conflicts='fail'):
        '''  '''
        new_filename = build_path(self.entities, path_patterns)
        if not new_filename:
            return None

        if new_filename[-1] == os.sep:
            new_filename += self.filename

        if isabs(self.path) or root is None:
            path = self.path
        else:
            path = join(root, self.path)

        if not exists(path):
            raise ValueError("Target filename to copy/symlink (%s) doesn't "
                             "exist." % path)

        if symbolic_link:
            contents = None
            link_to = path
        else:
            with open(path, 'r') as f:
                contents = f.read()
            link_to = None

        write_contents_to_file(new_filename, contents=contents,
                               link_to=link_to, content_mode='text', root=root,
                               conflicts=conflicts)
1035038
def copy_file(filename):
    """"""

    print("Updating file %s" % filename)
    out_dir = os.path.abspath(DIRECTORY)

    tags = filename[:-4].split("-")

    tags[-2] = tags[-2].replace("m", "")

    new_name = "-".join(tags) + ".whl"
    wheel_flag = "-".join(tags[2:])

    with InWheelCtx(os.path.join(DIRECTORY, filename)) as ctx:
        info_fname = os.path.join(_dist_info_dir(ctx.path), 'WHEEL')
        infos = pkginfo.read_pkg_info(info_fname)
        print("Changing Tag %s to %s" % (infos["Tag"], wheel_flag))
        del infos['Tag']
        infos.add_header('Tag', wheel_flag)
        pkginfo.write_pkg_info(info_fname, infos)

        ctx.out_wheel = os.path.join(out_dir, new_name)

        print("Saving new wheel into %s" % ctx.out_wheel)
778175
protected function copyFiles()
    {
        $skeletonFinder = new SkeletonFinder($this->lookupPaths);
        $sourcePath = $skeletonFinder->findByName($this->skeletonName)->getRealpath();

        $finder = $this->getFinderForFilesToCopy($sourcePath);

        foreach ($finder as $file) {
            $targetFilePath = $this->targetPath.DIRECTORY_SEPARATOR.$file->getRelativePathname();
            $targetFilePath = $this->twigStringRenderer->renderToString($targetFilePath, $this->data);

            $this->fs->copy($file->getRealpath(), $targetFilePath, $this->overwriteEnabled);

            $msg = '[copy] '.$file->getRealpath().' => '.$targetFilePath;

            if ($this->reportingEnabled) {
                $this->report[] = $msg;
            }
        }
    }
185462
def preview_to(recipient)
      @newsletter = build_newsletter
      mail = build_mail
      mail.to = recipient.email
      replace_and_send_mail_safely(mail, recipient)
    end
1209030
public function copyEventsAndNotifications()
    {
        // copy EVENTS
        $this->copyFilesFromSource($this->appPath . 'Events', app_path('Events'));

        // copy LISTENERS
        $this->copyFilesFromSource($this->appPath . 'Listeners', app_path('Listeners'));

        // copy Mail
        $this->copyFilesFromSource($this->appPath . 'Mail', app_path('Mail'));

        // copy Notifications
        $this->copyFilesFromSource($this->appPath . 'Events', app_path('Notifications'));

        // copy EventServiceProvider
        $source = $this->appPath . "Providers{$this->ds}EventServiceProvider.php";
        $this->copyFilesFromSource($source, app_path('Providers'));
    }
150347
def attach(self, filename, filetype="txt"):
		
		shutit = self.shutit
		host_path = '/tmp'
		host_fn = shutit.get_file(filename, host_path)
		if self.config['shutit.core.alerting.emailer.compress']:
			filetype = 'x-gzip-compressed'
			filename = self.__gzip(host_fn)
			host_fn = os.path.join(host_path, os.path.basename(filename))
		file_pointer = open(host_fn, 'rb')
		attach = MIMEApplication(file_pointer.read(), _subtype=filetype)
		file_pointer.close()
		attach.add_header('Content-Disposition', 'attachment', filename=os.path.basename(filename))
		self.attaches.append(attach)
529799
def copyFilepath( self ):
        
        clipboard = QApplication.instance().clipboard()
        clipboard.setText(self.filepath())
        clipboard.setText(self.filepath(), clipboard.Selection)
1079408
def copy_extras(config):
  """"""
  outdir = config['outdir']
  for dst, src in config['extras'].items():
    dst_path = os.path.join(outdir, dst)
    dst_dir = os.path.dirname(dst_path)
    if not os.path.isdir(dst_dir):
      os.makedirs(dst_dir)
    shutil.copy(src, dst_path)
723220
def OnOpenFile(self, event):
        """"""
        dialog = wx.FileDialog(self, style=wx.OPEN|wx.FD_MULTIPLE)
        if dialog.ShowModal() == wx.ID_OK:
            paths = dialog.GetPaths()
            if self.loader:
                # we've already got a displayed data-set, open new window...
                frame = MainFrame()
                frame.Show(True)
                frame.load(*paths)
            else:
                self.load(*paths)
462387
def pdfdump(self, filename = None, **kargs):
        """"""
        d = self._dump_document(**kargs)
        if filename is None:
            filename = get_temp_file(autoext=".pdf")
            d.writePDFfile(filename)
            subprocess.Popen([conf.prog.pdfreader, filename+".pdf"])
        else:
            d.writePDFfile(filename)
        print
871648
public function copyStaticFiles()
    {
        $exclude = ['js', 'javascripts', 'stylesheets', 'less', 'sass'];

        // Include the excludes from the config
        $exclude = array_merge($exclude, (array) $this->app->getSetting('exclude', []));

        // Create pattern
        $pattern = '/\\.(' . implode("|", $exclude) . ')$/';

        // Get list of files & directories to copy
        $to_copy = (array) $this->app->getSetting('copy', []);

        // Assets folder is hardcoded into copy
        $to_copy = array_merge(['assets'], $to_copy);
        $to_copy = array_unique($to_copy);

        // Initialize file system
        $filesystem = new Filesystem();

        // Fire event
        if ($response = Event::fire('copy.before', [$this, $to_copy])) {
            $to_copy = $response[0];
        }

        // Copy
        foreach ($to_copy as $location)
        {
            $fileInfo = new \SplFileInfo($this->source . DIRECTORY_SEPARATOR . $location);

            // Copy a complete directory
            if ($fileInfo->isDir())
            {
                $finder = new Finder();
                $finder->files()
                    ->exclude($exclude)
                    ->notName($pattern)
                    ->in($this->source . DIRECTORY_SEPARATOR . $location);

                foreach ($finder as $file)
                {
                    $path = $location . DIRECTORY_SEPARATOR . $file->getRelativePathname();
                    echo "$path\n";
                    $source = $file->getRealPath();
                    $target = $this->target . DIRECTORY_SEPARATOR . $path;

                    $filesystem->copy($source, $target);

                    $this->app->writeln("Copied: <info>$path</info>");
                }
            }

            // Copy Single File
            else {
                $filesystem->copy($fileInfo->getRealPath(), $this->target . DIRECTORY_SEPARATOR . $location);
                $this->app->writeln("Copied: <info>$location</info>");
            }
        }
    }
676276
def CopyFiles(self):
    """"""

    shutil.move(
        os.path.join(self.package_dir, "debian"),
        os.path.join(self.package_dir, "rpmbuild"))
    if self.fleetspeak_enabled:
      rpm_spec_filename = "fleetspeak.grr.spec.in"
    else:
      rpm_spec_filename = "grr.spec.in"
      shutil.copy(
          config_lib.Resource().Filter(
              "install_data/centos/grr-client.initd.in"),
          os.path.join(self.package_dir, "rpmbuild/grr-client.initd.in"))
      shutil.copy(
          config_lib.Resource().Filter(
              "install_data/systemd/client/grr-client.service"),
          os.path.join(self.package_dir, "rpmbuild/grr-client.service.in"))

    shutil.copy(
        config_lib.Resource().Filter("install_data/centos/" +
                                     rpm_spec_filename),
        os.path.join(self.package_dir, "rpmbuild/grr.spec.in"))

    # Copy prelink blacklist file. Without this file, prelink will mangle
    # the GRR binary.
    shutil.copy(
        config_lib.Resource().Filter(
            "install_data/centos/prelink_blacklist.conf.in"),
        os.path.join(self.package_dir, "rpmbuild/prelink_blacklist.conf.in"))