• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introducing Fire: Similar to Cake’s Bake and RoR’s script/generate

#11
[eluser]FrankieShakes[/eluser]
[quote author="walesmd" date="1186464174"]Yeah Frankie - that's something I knew would become an issue and just never got to messing with it. As the blog posts said - it was a quick 10 minute hack job to get started on my own CI app. I believe Windows will understand the Unix separator with no issues - so I'll probably just go with that.[/quote]

No worries... It's been working great so far!

One thing I've been trying to figure out, since posting my last msg, is how to determine the OS using PHP CLI? Is there a way?

#12
[eluser]Michael Wales[/eluser]
From the PHP documentation:
Quote:php_uname() will return the OS of the system currently running PHP.
The constant PHP_OS will return the OS that did the build of PHP being run.

There is some debate as to whether or not PHP_OS returns the build machine or does in fact return a cleaner string representing the OS currently running PHP.

I just did a test on this machine (WinXP, Service Pack 2) and the return was:
Quote:Windows NT (computer name) 5.1 build 2600
WINNT

for the following code:
Code:
<?php
  echo php_uname() . "\n";
  echo PHP_OS;
?>

I seriously doubt Zend is building PHP on Windows boxes, so I'd say the PHP_OS constant is a pretty good choice.

#13
[eluser]Michael Wales[/eluser]
Hijacked from ezComponents:

Code:
private function setSystemInfoReader()
    {
        // Determine OS
        $uname = php_uname( 's' );

        if ( substr( $uname, 0, 7 ) == 'Windows' )
        {
            $this->systemInfoReader = new ezcSystemInfoWindowsReader( $uname );
            $this->osType = 'win32';
            $this->osName = 'Windows';
            $this->fileSystemType = 'win32';
            $this->lineSeparator= "\r\n";
            $this->backupFileName = '.bak';
        }
        else if ( substr( $uname, 0, 6 ) == 'Darwin' )
        {
            $this->systemInfoReader = new ezcSystemInfoMacReader();
            $this->osType = 'mac';
            $this->osName = 'Mac OS X';
            $this->fileSystemType = 'unix';
            $this->lineSeparator= "\n";
            $this->backupFileName = '~';
        }
        else
        {
            $this->osType = 'unix';
            if ( strtolower( $uname ) == 'linux' )
            {
                $this->systemInfoReader = new ezcSystemInfoLinuxReader();
                $this->osName = 'Linux';
                $this->fileSystemType = 'unix';
                $this->lineSeparator= "\n";
                $this->backupFileName = '~';
            }
            else if ( strtolower( substr( $uname, 0, 7 ) ) == 'freebsd' )
            {
                $this->systemInfoReader = new ezcSystemInfoFreeBsdReader();
                $this->osName = 'FreeBSD';
                $this->fileSystemType = 'unix';
                $this->lineSeparator= "\n";
                $this->backupFileName = '~';
            }
            else
            {
                $this->systemInfoReader = null;
                return false;
            }
        }
        return true;
    }

#14
[eluser]FrankieShakes[/eluser]
Haha.. I found that right after I posted. Actually, this is what I get:

Code:
Darwin Pandora.local 8.10.0 Darwin Kernel Version 8.10.0: Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh
Darwin

I would have expected the PHP_OS constant to return "OS X", but Darwin does make sense.

#15
[eluser]FrankieShakes[/eluser]
[quote author="walesmd" date="1186466459"]Hijacked from ezComponents:[/quote]

Weird, a Google search turned up the exact same script, with the exception of the "Darwin" check... instead, this one had "Mac".

#16
[eluser]Derek Allard[/eluser]
Michael, looks very promising! Thanks for releasing this. I've moved it into "ignited code" where it seems to best fit, but if you want it back in application development, just say the word and I'll drop it back.

Thanks again.

#17
[eluser]Michael Wales[/eluser]
No problem Derek - I wasn't sure where to post it. Ignited Code makes me think of plugins, helpers, etc. developed for CI. This is more along the lines of straight PHP that just helps out with PHP.

Regardless, Ignited Code will work fine. Smile Thanks for the compliments and everyone be on the lookout for the next version of Fire soon. The response I have received so far off the really crappy hack job has been great and has encouraged me to further develop this - with serious releasability in mind.

#18
[eluser]barbazul[/eluser]
This looks really good for guys who love typing in their consoles.

For guys who don't (that was me 2 months ago) there's a set of Zend Studio autocompleting shortcut I found somewhere in the forum which made coding really easy.

But I still think this could be really great.

I'm currently working on the migration of other RoR features myself which I believe could become great improvements to my coding under CI

#19
[eluser]Kemik[/eluser]
Quick question. Do you need SSH access to use this? I'm using a reseller cPanel account Sad

#20
[eluser]Michael Wales[/eluser]
It's not really designed to use on a live server - I wouldn't recommend it. I designed it for use on localhost while developing your application, which is really how your workflow should go anyways.

Develop on localhost in a closed and secure environment, then upload to the real world when you are ready. Unless of course, your using CI in an enterprise environment. Then it's completely different and I am sure a lot of people would love to hear your experience using CI in that environment - I know I sure would!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.