Thanks.
the rake was located at .rvm...

I tried coding:

"/Applications/Dropbox/mac/rubymotion/projects/RubyMotionSamples/ios/Timer" [ "/Users/yjc/.rvm/gems/ruby-2.1.1/bin/rake" try-process ] with-directory

but still getting Error.

Is there someway to pick up the terminal outputs to factor, for easy debugging, I found several words in io vocabulary might give hints but could not figure out how to use... ( such as with-output-streams etc ).

Thanks

Tsun


Doug Coleman 於 2014/12/24 下午3:49 寫道:
Hey,

You don't need to call ``cd`` manually, you can use a combinator for this:

"/Users" [ "ls" try-process ] with-directory
same as
"/Users" [ { "ls" } try-process ] with-directory


OSX has problems with the PATH variable when run from the launcher. You can see what your path is by doing:

"PATH" os-env .
or for readability
"PATH" os-env ":" split [ . ] each

Lauching directly from the terminal shows different paths:
./Factor.app/Contents/MacOS/factor


You can try to find rake after launching Factor both ways:
USE: tools.which
"rake" which .


Maybe this will help you debug.

Cheers,
Doug


On Tue, Dec 23, 2014 at 11:41 PM, tgkuo <tgk...@gmail.com <mailto:tgk...@gmail.com>> wrote:

    Thanks.


    John Benediktsson 於 2014/12/23 下午11:45 寫道:
    The Factor launcher is for directly running processes.

    1) You can run your rake command directly:

        { "rake" "RubyMotionSamples/ios/Timer" } try-process

    I need to change directory first and rake.

    { "cd"
    "/Applications/Dropbox/mac/rubymotion/projects/RubyMotionSamples/ios/Timer"
    } try-process
    { "rake" } try-process

    need to be done at the same time.... or the directory will be
    where the Rakefile is located.

     { "rake"
    "/Applications/Dropbox/mac/rubymotion/projects/RubyMotionSamples/ios/Timer"
    } try-process

    is not working.
    2) Or if you want to "run it in your Terminal.app", then maybe a
    bit of applescript:

        USE: cocoa.apple-script
        "RubyMotionSamples/ios/Timer"
        "tell application \"Terminal\"\n    do script \"rake
    %s\"\nend tell"
        sprintf run-apple-script


    It worked...
    my does:

    HEREVocab:  rubymotion

    USING: formatting fry io.encodings.ascii io.launcher kernel
    lexer multiline.tgCodes sequences urls.encoding cocoa.apple-script ;
    IN: rubymotion

    : set-rake-pathname ( dir  -- str )
        rubymotion-projects-path swap "/" glue      ;

    : run-rake ( str -- )
        "tell application \"Terminal\"\n    do script \"cd %s \nrake
    \"\nend tell"
        sprintf run-apple-script
      ;

    SYNTAX: Rake:
           scan-token set-rake-pathname
       '[ _  run-rake ] append! ;

    Vocab>



    On Tue, Dec 23, 2014 at 7:13 AM, tgkuo <tgk...@gmail.com
    <mailto:tgk...@gmail.com>> wrote:

        Hi, group

        I had a need to run rake command from a TextEditor (
        DevonTHINK) by using the factor service.

        I tried to use:

        : set-rake-pathname ( dir  -- str )
          rubymotion-projects-path swap "/" glue      ;

        : run-terminal ( str -- )
        "Terminal.app"ascii[
        "%s " printf
        ]with-process-writer*;*

        SYNTAX: Rake:
            scan-token set-rake-pathname "cd \"%s\""sprintf
        '[ _ run-terminal "rake" run-terminal ] append! ;

        and then

        Rake: RubyMotionSamples/ios/Timer

        seemed not to work…. Error message in factor:

        Process exited with error code 255

        Launch descriptor:

        T{ process
            { command "Terminal.app" }
            { environment H{ } }
            { environment-mode +append-environment+ }
            { stdin T{ fd { disposed t } { fd 31 } } }
            { group +same-group+ }
            { status 255 }
            { pipe
                T{ pipe
                    { in T{ fd { disposed t } { fd 31 } } }
                    { out T{ fd { disposed t } { fd 37 } } }
                }
            }
        }

        All I need is simply to wake up the terminal.app to execute
        the shell script in it’s window..

        Best regards.

        tgkuo

        
------------------------------------------------------------------------------
        Dive into the World of Parallel Programming! The Go Parallel
        Website,
        sponsored by Intel and developed in partnership with Slashdot
        Media, is your
        hub for all things parallel software development, from weekly
        thought
        leadership blogs to news, videos, case studies, tutorials and
        more. Take a
        look and join the conversation now.
        http://goparallel.sourceforge.net
        _______________________________________________
        Factor-talk mailing list
        Factor-talk@lists.sourceforge.net
        <mailto:Factor-talk@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/factor-talk



    
------------------------------------------------------------------------------
    Dive into the World of Parallel Programming! The Go Parallel Website,
    sponsored by Intel and developed in partnership with Slashdot Media, is your
    hub for all things parallel software development, from weekly thought
    leadership blogs to news, videos, case studies, tutorials and more. Take a
    look and join the conversation now.http://goparallel.sourceforge.net


    _______________________________________________
    Factor-talk mailing list
    Factor-talk@lists.sourceforge.net  
<mailto:Factor-talk@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/factor-talk


    
------------------------------------------------------------------------------
    Dive into the World of Parallel Programming! The Go Parallel Website,
    sponsored by Intel and developed in partnership with Slashdot
    Media, is your
    hub for all things parallel software development, from weekly thought
    leadership blogs to news, videos, case studies, tutorials and
    more. Take a
    look and join the conversation now. http://goparallel.sourceforge.net
    _______________________________________________
    Factor-talk mailing list
    Factor-talk@lists.sourceforge.net
    <mailto:Factor-talk@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/factor-talk




------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net


_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to