Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Atom Beautifier won't work in Windows #269

Closed
guillempascual opened this issue Apr 7, 2015 · 5 comments
Closed

PHP Atom Beautifier won't work in Windows #269

guillempascual opened this issue Apr 7, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@guillempascual
Copy link

Hello,

Since I updated the Atom Beautifier plugin this morning it won't work anymore.
The problem seems to be that is trying to run "cmd php-cs-fixer.phar", but it should call "cmd php php-cs-fixer.phar" instead.
Thanks.

Guillem

This is the error message:
"Command failed: C:\WINDOWS\system32\cmd.exe /s /c "("C:\php-5.5.3-Win32-VC11-x64\php-cs-fixer.phar" fix "C:\Users\Guillem\AppData\Local\Temp\input11537-6048-x2ee51") & move "C:\Users\Guillem\AppData\Local\Temp\input11537-6048-x2ee51" "C:\Users\Guillem\AppData\Local\Temp\11537-6048-u9u5tq"" El sistema no puede encontrar el archivo especificado."

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Tue Apr 07 2015 17:09:35 GMT+0200 (Hora de verano romance).


Platform: win32

Versions

Atom Version: 0.189.0

Atom Beautify Version: 0.23.2

Original file to be beautified

Original File Path: C:\htdocs\sermopp.es\httpdocs\exportaEstadisticasPedidosConsumibles.php

Original File Grammar: PHP

Original File Contents:

<?php
include_once("objects.inc");
include_once("local/func.php");
require_once 'stopWatch.php';

$stopwatch = new StopWatch();

//set_time_limit(1800);
//ini_set("memory_limit","128M");

function fputcsvAux ($fields, $delimiter = ';', $enclosure = '"', $mysql_null = false) {
    $delimiter_esc = preg_quote($delimiter, '/');
    $enclosure_esc = preg_quote($enclosure, '/');
    $output = array();
    foreach ($fields as $field) {
        if ($field === null && $mysql_null) {
            $output[] = 'NULL';
            continue;
        }
        $output[] = preg_match("/(?:${delimiter_esc}|${enclosure_esc}|\s)/", $field) ? (
        $enclosure . str_replace($enclosure, $enclosure . $enclosure, $field) . $enclosure
        ) : $field;
    }
    echo join($delimiter, $output)."\n";
}
$fileName = 'sermoppPedidosConsumiblesExport'.date("YmdHis").'.csv';
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$fileName}");
header("Expires: 0");
header("Pragma: public");



$fechaDesdeMostrar = $_REQUEST['fechaDesde'];
$fechaHastaMostrar = $_REQUEST['fechaHasta'];
$fechaDesde = convertTime($fechaDesde)."000000";
$fechaHasta = convertTime($fechaHasta)."235959";



// para las querys más complejas
$conn=new connectionSermopp;
if($esUsuarioIntranet==true){
    fputcsvAux(array_pad(array("Fecha inicio: ",$fechaDesdeMostrar,"Fecha fin: ",$fechaHastaMostrar),14,""));
    fputcsvAux(array("fg21800NumCte","contratoPPU","codigoProveedorPPU","codigoEmpresa","fm10400Client","nombreDelegacion","fm11500Article","fm11500DescArtic","fg20700NumSerie","IPv4","MonochromeImpressions","ColorImpressions","Description","MarkerColor","ProductNumber","ApproxPercentRemaining","Observaciones","fechaLectura","Facturado","FechaProceso","FechaPedido","FechaInstalado"));
}
else{
    if(isset($codigoEmpresaIntermediario)){
    }
    else {

    }
}


    $query = "select p.fg21800NumCte,p.contratoPPU,p.codigoProveedorPPU,p.codigoEmpresa,p.fm10400Client,p.nombreDelegacion,p.fm11500Article,p.fm11500DescArtic,p.fg20700NumSerie,p.IPv4,p.MonochromeImpressions,p.ColorImpressions,p.Description,p.MarkerColor,
p.ProductNumber,p.ApproxPercentRemaining,p.Observaciones,p.fechaLectura,p.Facturado,p.FechaProceso,p.FechaPedido,p.FechaInstalado from `setelsa_sermopp`.`pedidos` as p where `p`.`FechaPedido` >= '".$fechaDesde."' and `p`.`FechaPedido` <= '".$fechaHasta."'";

    //print $avisosAbiertosList.$groupBy;
    $conn->query($query);

while($conn->next_record()){

        $fechaApertura = shortenTime($conn->f("fechaApertura"));
        $fechaAtencion = shortenTime($conn->f("fechaAtencion"));
        $fechaResolucion = shortenTime($conn->f("fechaResolucion"));




    fputcsvAux($linea->export($esUsuarioIntranet));
} // fin while tipoServicio
fputcsvAux(array_pad(array("Tiempo transcurrido: ",sec2hms($stopwatch->elapsed(),true),"","","","","",""),14,""));

// Make sure nothing else is sent, our file is done
exit;

?>

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "indent_size": 4,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options:
Options from Atom Beautify package settings

{
    "php": {
        "cs_fixer_path": "C:\\php-5.5.3-Win32-VC11-x64\\php-cs-fixer.phar",
        "fixers": "",
        "level": ""
    },
    "js": {
        "indent_size": 4,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "css": {
        "indent_size": 4,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "html": {
        "htmlbeautifier_path": "",
        "indent_inner_html": false,
        "indent_size": 4,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 4,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "sql": {
        "indent_size": 4,
        "keywords": "upper",
        "identifiers": "lower",
        "sqlformat_path": ""
    },
    "markdown": {
        "pandoc_path": "",
        "yaml_front_matter": true
    },
    "perl": {
        "perltidy_path": "perltidy",
        "perltidy_profile": ""
    },
    "python": {
        "autopep8_path": "",
        "max_line_length": 79,
        "indent_size": 4,
        "ignore": [
            "E24"
        ]
    },
    "ruby": {
        "rbeautify_path": ""
    },
    "c": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cpp": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "objectivec": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cs": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "d": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "java": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "pawn": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "vala": {
        "uncrustifyPath": "",
        "configPath": ""
    }
}

Home Options:
Options from C:\home\.jsbeautifyrc

{}

EditorConfig Options:
Options from EditorConfig file

{}

Project Options:
Options from .jsbeautifyrc files starting from directory C:\htdocs\sermopp.es\httpdocs and going up to root

[
    {},
    {},
    {}
]

Logs

Error logs: Not yet supported

@Glavin001
Copy link
Owner

The problem seems to be that is trying to run "cmd php-cs-fixer.phar", but it should call "cmd php php-cs-fixer.phar" instead.

This sounds like an issue related to this Pull Request: #263

Looks like Windows needs the php command and Mac/Linux does not.

@Glavin001 Glavin001 added the bug label Apr 7, 2015
@Glavin001 Glavin001 added this to the v1.0.0 milestone Apr 7, 2015
@Glavin001
Copy link
Owner

You could try installing the older Atom Beautify package (temporarily until I have time to fix this):

apm uninstall atom-beautify
apm install [email protected]

Let me know how it goes!

@guillempascual
Copy link
Author

I can confirm that executing manually "php php-cs-fixer.phar fileName.php" from a Windows cmd works ok.
The php command is definitely needed in Windows.

@Glavin001 Glavin001 self-assigned this Apr 7, 2015
@Glavin001
Copy link
Owner

Published patch to v0.23.3
Let me know if it works for you, as I do not use Windows and am unable to test.

@guillempascual
Copy link
Author

As far as I know is working perfectly. Thanks for your awesome job!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants