Hey Nathan,

So what I was doing was this. I am working on a new web app written with
extJS. I have a CFC that I call that builds the client side app. It reads
all of the ux and util directories and generates a config file used by
jsBuilder to compress, combine and minify the JS used on the client side as
well as compress and move CSS and resources.

I am working towards getting a CI server setup and also need to ensure all
developers can run a build locally. That's where the problem arises. The
developers (JS developers) will not have CF installed on their local machine
(or our pre-configured EC2 instance), and so I need to move the process of
generating the jsBuilder config and executing it out of CF and into
something that can run on any developers workstation - without a big install
and setup. 

Since its just 1 CFC, I thought I could just use the java classes. But of
course there are dependencies.

I found a wicked, super cool solution to this last night! I downloaded Ralio
Express and was able to get it to execute my CFC with basically zero setup.
Ralio Express is freakin  awesome! There's no installer, you just run
start.bat to start the server and stop.bat to stop it. So I've added it to
my SVN and written an ANT task that starts it up and then runs the CFC that
indexes all the directories, read in an XML config file and calls (via
cfexcecute) the CFC that handles the build.

My ANT task has these targets:

<target name="startRalio" description="Starting Ralio Server"
depends="MakeDirectories">
                <java jar="tools/build/ralio/lib/start.jar"
                   dir="tools/build/ralio/"
           fork="true"
                   spawn="true"
           maxmemory="512M">
                <arg value="-h"/>
                    <arg value="-DSTOP.PORT=8887"/>
                        <arg value="-DSTOP.KEY=railo"/>
                </java>
                
                <!-- wait for server to start up -->
                <waitfor maxwait="10" maxwaitunit="second">
                <and>
                    <socket server="localhost" port="8888"/>
                    <http url="http://localhost:8888/index.cfm"/>
                </and>
                </waitfor>

                
        </target>

        <target name="doBuild" description="Call the Ralio script to in turn
call JsBuilder and do compilation" depends="startRalio">                
                <get src="http://localhost:8888/build/doBuild.cfm";
dest="buildresult.txt" />
                
                <!-- look for buildresult.txt, read the result and throw an
error if any errors exist -->
                 <loadfile property="buildresult"
srcFile="${desktop.build.dir}buildresult.html"/>
                 <echo message="${buildresult}"/>

                 <antcall target="checkResult" />   
                 <antcall target="stopRalio" />
        </target>


Never used Ralio before, but very impressed with it!

Brook

-----Original Message-----
From: Nathan Strutz [mailto:str...@gmail.com] 
Sent: August-06-11 12:39 PM
To: cf-talk
Subject: Re: Run a class file generated with CF outside of CF


Yeah, it's probably not going to happen. I mean, I am getting famous for
saying that it's software, so we can do anything, but the problem is the
amount of work it takes to do a thing. In this case you have to load a good
amount of the CF server into memory, all the other related classes (one
..class for the cfc, one for each cffunction, etc.), then fake a request &
response object, or whatever servlets do (I knew at one point). Your best
bet is to not do this.

It would be much easier to call your CF server rather than try to use the
generated code out of context. There are many ways to call into CF from
Java. The easiest one would be to hit it via a HTTP URI. Second easiest
would be a web service. Third, you can use the CF services gateway - you can
set up a local socket listener, which should be really performant. Also, I
think Terrence Ryan had a project on RIAForge that lets you call it via the
command line console.

I wonder, what is the underlying reason for wanting to call the generated
classes? Sort of an odd request. Why are you doing this? Maybe there's a
better way to accomplish your end goal.

nathan strutz
[www.dopefly.com] [hi.im/nathanstrutz] [about.me/nathanstrutz]


On Sat, Aug 6, 2011 at 10:53 AM, Brook Davies <cft...@logiforms.com> wrote:

>
> Hey, I don't know if this is possible. I want to take a class file 
> from the cfclasses/ directory and run it from the command line outside 
> of the CF server.  It complains about not being able to find some cf
related classes.
> I assume this is not at all possible since the classes include lots of 
> CF specific classes for various functions. Is that right? Is this not 
> possible?
>
>
>
> Brook
>
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346567
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to