PATCH/PUT - Script Licences
189001
def update
      @script_licence.user_id = current_user.id
      @script_licence.org_id = current_user.org_id
      if @script_licence.update(script_licence_params)
        redirect_to script_licences_url, notice: 'Licence was successfully updated.'
        else
          render :edit
      end
    end
913377
function writeLicensesFile(rootDir) {

    var licenses = checkLicenses(rootDir),
        licensesFileContent = "LICENSES " + "\n \n";

    _(licenses).each(function(licenseData, licenseName) {

        licensesFileContent += licenseName + " : ";

        if(licenseData.isMIT) {
            licensesFileContent += "MIT";
        }
        else {
            licensesFileContent += "Unknown License";
        }

        licensesFileContent += "\n \n";

        if(licenseData.content) {
            licensesFileContent += licenseData.content + "\n \n";
        }

    });

    fs.writeFileSync(rootDir + "/LICENSES", licensesFileContent, "utf-8");
}
556586
def license_cleanup(text):
    
    if not text:
        return None
    text = text.rsplit(':', 1)[-1]
    replacements = [
        'licenses',
        'license',
        'licences',
        'licence',
        'software',
        ',',
    ]
    for replacement in replacements:
        text = text.replace(replacement, '')
    text = text.strip().upper()
    text = text.replace(' ', '_')
    text = text.replace('-', '_')
    if any(trigger.upper() in text for trigger in BAD_LICENSES):
        return None
    return text
753441
def put_script(self, id, body, context=None, params=None):
        
        for param in (id, body):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request(
            "PUT", _make_path("_scripts", id, context), params=params, body=body
        )
37721
protected function installDone()
    {
        $this->nl();
        if ($this->seemsFine) {
            $this->output->writeLn("========================================================================");
            $this->nl();
            $this->output->writeLn("                      Repair completed!");
            $this->nl();
            $this->output->writeLn("========================================================================");
        } else {
            $this->output->writeLn("Automatic installation failed to complete cleanly.");
            $this->output->writeLn("Head over to https://github.com/strata-mvc/strata/ to get help.");
        }
        $this->nl();
    }
636462
protected function registerInstallCommand(): void
    {
        $this->app->singleton('orchestra.commands.tenanti.install', function (Application $app) {
            return new InstallCommand($app->make('orchestra.tenanti'));
        });
    }
226136
def apply_and_save(self):
        """"""
        patches = self.patches

        content = None
        with open(self.IN_PATH) as f_in:
            # As setup.py.in file size is 2.4 KByte.
            # it's fine to read entire content.
            content = f_in.read()

        # Replace words.
        for key in self.replaced_word_dict:
            content = content.replace(key, self.replaced_word_dict[key])

        # Apply patches.
        out_patches = []
        for patch in patches:
            pattern = re.compile(patch['src'], re.MULTILINE)
            (content, subs_num) = re.subn(pattern, patch['dest'],
                                          content)
            if subs_num > 0:
                patch['applied'] = True
            out_patches.append(patch)

        for patch in out_patches:
            if patch.get('required') and not patch.get('applied'):
                Log.warn('Patch not applied {0}'.format(patch['src']))

        with open(self.OUT_PATH, 'w') as f_out:
            f_out.write(content)

        self.pathces = out_patches
        # Release content data to make it released by GC quickly.
        content = None
373283
def replace_symbols(script_name, *args)
    args_new = []
    args_copy = args.clone

    url = args[0].clone
    modifiers = args_copy[1]
    if modifiers.class == Hash
      modifiers.delete_if do |key, value|
        delete = url.include? (":" + key.to_s)
        if delete
          url.sub!( (":" + key.to_s), value.to_s )
        end
        delete
      end
    end

    i = 1
    result = [url]
    while args_copy[i]
      unless args_copy[i].empty?

        if args_copy[i].class == Array
          value = args_copy[i]
        else
          value = [args_copy[i]]
        end

        if args_copy[i] != '/?' && url =~ /\*/
          url.sub!("*", value.join(''))
        else
          result.concat(value)
        end

      end
      i+= 1
    end
    result
  end
1312713
def generate_license(args):
    '''
    
    '''

    with open(cwd + licenses_loc + args[2]) as f:
        license = f.read()

    license = license.format(name=args[0],
                             email=args[1],
                             license=args[2],
                             project=args[3],
                             year=args[5])

    with open('LICENSE' + args[4], 'w') as f:
        f.write(license)
        print('licenser: license file added to current directory')
1210794
def write_script(self, script_name, contents, mode="t", blockers=()):
        """"""
        self.delete_blockers(  # clean up old .py/.pyw w/o a script
            [os.path.join(self.script_dir, x) for x in blockers]
        )
        log.info("Installing %s script to %s", script_name, self.script_dir)
        target = os.path.join(self.script_dir, script_name)
        self.add_output(target)

        if self.dry_run:
            return

        mask = current_umask()
        ensure_directory(target)
        if os.path.exists(target):
            os.unlink(target)
        with open(target, "w" + mode) as f:
            f.write(contents)
        chmod(target, 0o777 - mask)
48355
def _update_from_standard_locations():
    ''' 
    '''
    locs = [
        join(expanduser('~'), _config_name),
        join('.', _config_name)
    ]
    if 'PLIERS_CONFIG' in os.environ:
        locs.insert(1, os.environ['PLIERS_CONFIG'])

    from_file(locs, False)
1130385
function _update_site_license( $new_license ) {
            $this->_logger->entrance();

            $this->_license = $new_license;

            if ( ! is_object( $new_license ) ) {
                $this->_site->license_id = null;
                $this->_sync_site_subscription( null );

                return $this->_license;
            }

            $this->_site->license_id = $this->_license->id;

            if ( ! is_array( $this->_licenses ) ) {
                $this->_licenses = array();
            }

            $is_license_found = false;
            for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
                if ( $new_license->id == $this->_licenses[ $i ]->id ) {
                    $this->_licenses[ $i ] = $new_license;

                    $is_license_found = true;
                    break;
                }
            }

            // If new license just append.
            if ( ! $is_license_found ) {
                $this->_licenses[] = $new_license;
            }

            $this->_sync_site_subscription( $new_license );

            return $this->_license;
        }
1304547
def add_scripts_to_package():
    
    global setup_arguments

    if os.path.isdir('scripts'):
        setup_arguments['scripts'] = [
            os.path.join('scripts', f) for f in os.listdir('scripts')
        ]
279034
function(files, licenses) {
        licenses.forEach(function(license) {
          var fileobj = helpers.expand({filter: 'isFile'}, 'licenses/LICENSE-' + license)[0];
          if(fileobj) {
            files['LICENSE-' + license] = fileobj.rel;
          }
        });
      }
120502
def build_license_file(directory, spec):
    
    name, text = '', ''

    try:
        name = spec['LICENSE']
        text = spec['X_MSI_LICENSE_TEXT']
    except KeyError:
        pass # ignore this as X_MSI_LICENSE_TEXT is optional

    if name!='' or text!='':
        file = open( os.path.join(directory.get_path(), 'License.rtf'), 'w' )
        file.write('{\\rtf')
        if text!='':
             file.write(text.replace('\n', '\\par '))
        else:
             file.write(name+'\\par\\par')
        file.write('}')
        file.close()
1224538
def main():
  '''  '''
  arguments = docopt(__doc__, version=__version__)

  if arguments['ls'] or arguments['list']:
    _get_licences()
  elif arguments['--tldr'] and arguments['<NAME>']:
    get_license_summary(arguments['<NAME>'].lower())
  elif arguments['--export'] and arguments['<NAME>']:
    save_license(arguments['<NAME>'].lower())
  elif arguments['<NAME>']:
    print(_get_license_description(arguments['<NAME>'].lower()))
  else:
    print(__doc__)
13457
def script_dup
      r = "require 'fileutils'\n"
      duplicates.each do |entries|
        flg_first = true
        r += "\n"
        entries.each do |entry|
          src = File.join(@dirname, entry.path, entry.name)
          if flg_first
            flg_first = false
            r += "# FileUtils.mv( \"#{src}\", \"#{Dir.tmpdir}\" )\n"
          else
            r += "FileUtils.mv( \"#{src}\", \"#{Dir.tmpdir}\" )\n"
          end
        end
      end
      r
    end