How do I create a Ruby template?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I create a Ruby template?

Joshua Oransky
I'm just getting started with Sling. I've played around with the  
examples and feel pretty comfortable with the layout.

However, I need to use Ruby as my scripting language. What extension  
do I use for a template that uses Ruby code? I tried various  
extensions, but nothing works.

Thanks in advance - Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Rory Douglas-2
I think the extension you need is .erb (see
org.apache.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)

Joshua Oransky wrote:
> I'm just getting started with Sling. I've played around with the
> examples and feel pretty comfortable with the layout.
>
> However, I need to use Ruby as my scripting language. What extension
> do I use for a template that uses Ruby code? I tried various
> extensions, but nothing works.
>
> Thanks in advance - Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
I tried that one. I get this:

Node dumped by HtmlRendererServlet

Node path: /content/maniatv/gameology

Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}

Node properties

jcr:primaryType: nt:unstructured


I've looked all over for the answer. This doesn't seem to be a topic  
explored very much.

-Josh

On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:

> I think the extension you need is .erb (see  
> org
> .apache
> .sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
>
> Joshua Oransky wrote:
>> I'm just getting started with Sling. I've played around with the  
>> examples and feel pretty comfortable with the layout.
>>
>> However, I need to use Ruby as my scripting language. What  
>> extension do I use for a template that uses Ruby code? I tried  
>> various extensions, but nothing works.
>>
>> Thanks in advance - Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Rory Douglas-2
Have you installed the ruby scripting bundle - I don't think it's
installed by default in the launchpad app?

Joshua Oransky wrote:

> I tried that one. I get this:
>
> Node dumped by HtmlRendererServlet
>
> Node path: /content/maniatv/gameology
>
> Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}
>
> Node properties
>
> jcr:primaryType: nt:unstructured
>
>
> I've looked all over for the answer. This doesn't seem to be a topic
> explored very much.
>
> -Josh
>
> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>
>> I think the extension you need is .erb (see
>> org.apache.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
>>
>>
>> Joshua Oransky wrote:
>>> I'm just getting started with Sling. I've played around with the
>>> examples and feel pretty comfortable with the layout.
>>>
>>> However, I need to use Ruby as my scripting language. What extension
>>> do I use for a template that uses Ruby code? I tried various
>>> extensions, but nothing works.
>>>
>>> Thanks in advance - Josh
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
In reply to this post by Rory Douglas-2
Rory,

        I think that's the issue; I don't have the bundle installed. There  
isn't a lot of information on how to get this bundle, however. I tried  
following the directions on http://wiki.apache.org/jackrabbit/ApacheSling/SlingGuideInstall 
  but they don't match up with what I'm seeing. I downloaded and tried  
to upload the pom.xml file since it contains SVN URLs thinking that  
CRX would just download the files, to no avail. That guide makes it  
seem like the bundle repository is something like apt-get or fink, but  
I can't figure out how to get it to connect to the repository.

        I appreciate any help!

        -Josh





Have you installed the ruby scripting bundle - I don't think it's  
installed by default in the launchpad app?
Joshua Oransky wrote:
I tried that one. I get this:

Node dumped by HtmlRendererServlet

Node path: /content/maniatv/gameology

Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}

Node properties

jcr:primaryType: nt:unstructured


I've looked all over for the answer. This doesn't seem to be a topic  
explored very much.
-Josh

On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:

I think the extension you need is .erb (see  
org
.apache
.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
Joshua Oransky wrote:
I'm just getting started with Sling. I've played around with the  
examples and feel pretty comfortable with the layout.
However, I need to use Ruby as my scripting language. What extension  
do I use for a template that uses Ruby code? I tried various  
extensions, but nothing works.
Thanks in advance - Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Felix Meschberger-2
In reply to this post by Rory Douglas-2
Hi,

Rory Douglas schrieb:
> Have you installed the ruby scripting bundle - I don't think it's
> installed by default in the launchpad app?

That's what I also think is the problem here. The launchpad does not
include the ruby bundle by default. So either you add the ruby
dependency to the launchpad/app project or you deploy it yourself.

To deploy it yourself, just launch sling and enter the scripting/ruby
source folder and do the following:

    mvn -P autoInstallBundle clean install

Provided Sling is running on the default port 8080 and root context,
this should install the ruby bundle in Sling. If sling is not running in
the default setup, you have to specify the sling.url property, such as:

    mvn -P autoInstallBundle \
       -Dsling.url=<a href="http://host:post/ctx/system/console">http://host:post/ctx/system/console \
       clean install

Hope this helps.

Regards
Felix

>
> Joshua Oransky wrote:
>> I tried that one. I get this:
>>
>> Node dumped by HtmlRendererServlet
>>
>> Node path: /content/maniatv/gameology
>>
>> Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}
>>
>> Node properties
>>
>> jcr:primaryType: nt:unstructured
>>
>>
>> I've looked all over for the answer. This doesn't seem to be a topic
>> explored very much.
>>
>> -Josh
>>
>> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>>
>>> I think the extension you need is .erb (see
>>> org.apache.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
>>>
>>>
>>> Joshua Oransky wrote:
>>>> I'm just getting started with Sling. I've played around with the
>>>> examples and feel pretty comfortable with the layout.
>>>>
>>>> However, I need to use Ruby as my scripting language. What extension
>>>> do I use for a template that uses Ruby code? I tried various
>>>> extensions, but nothing works.
>>>>
>>>> Thanks in advance - Josh
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Felix Meschberger-2
In reply to this post by Joshua Oransky
Hi Josh,

Joshua Oransky schrieb:
> Rory,
>
>     I think that's the issue; I don't have the bundle installed. There
> isn't a lot of information on how to get this bundle, however. I tried
> following the directions on
> http://wiki.apache.org/jackrabbit/ApacheSling/SlingGuideInstall but they

The Sling docs in the Jackrabbit wiki are outdated and invalid. Please
refer to the Sling site at http://incubator.apache.org/sling for more up
to date information.

> don't match up with what I'm seeing. I downloaded and tried to upload
> the pom.xml file since it contains SVN URLs thinking that CRX would just
> download the files, to no avail. That guide makes it seem like the
> bundle repository is something like apt-get or fink, but I can't figure
> out how to get it to connect to the repository.

We are considering building a repository similar to the apt-get stuff
for Sling. In the realm of OSGi this is called the OSGi Bundle
Repository or OBR for short. Currently we don't have it yet.

It is not decided yet, what will go into such a repository (except for
the released bundles, of course).

Regards
Felix

>
>     I appreciate any help!
>
>     -Josh
>
>
>
>
>
> Have you installed the ruby scripting bundle - I don't think it's
> installed by default in the launchpad app?
> Joshua Oransky wrote:
> I tried that one. I get this:
>
> Node dumped by HtmlRendererServlet
>
> Node path: /content/maniatv/gameology
>
> Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}
>
> Node properties
>
> jcr:primaryType: nt:unstructured
>
>
> I've looked all over for the answer. This doesn't seem to be a topic
> explored very much.
> -Josh
>
> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>
> I think the extension you need is .erb (see
> org.apache.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
>
> Joshua Oransky wrote:
> I'm just getting started with Sling. I've played around with the
> examples and feel pretty comfortable with the layout.
> However, I need to use Ruby as my scripting language. What extension do
> I use for a template that uses Ruby code? I tried various extensions,
> but nothing works.
> Thanks in advance - Josh
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
Felix,

        I have a feeling you are correct. I did what you said, and it appears  
to have installed. However, .erb files are still not being  
interpreted. I'm using CRX, not Jackrabbit, and I check /system/
bundles and it does not show any new bundles, specifically Ruby ones,  
installed.

        I am going to try this method on Jackrabbit, but was curious if this  
should also work on CRX?

        Thanks man...

        -Josh


On Aug 26, 2008, at 12:24 AM, Felix Meschberger wrote:

> Hi Josh,
>
> Joshua Oransky schrieb:
>> Rory,
>>    I think that's the issue; I don't have the bundle installed.  
>> There isn't a lot of information on how to get this bundle,  
>> however. I tried following the directions on http://wiki.apache.org/jackrabbit/ApacheSling/SlingGuideInstall 
>>  but they
>
> The Sling docs in the Jackrabbit wiki are outdated and invalid.  
> Please refer to the Sling site at http://incubator.apache.org/sling 
> for more up to date information.
>
>> don't match up with what I'm seeing. I downloaded and tried to  
>> upload the pom.xml file since it contains SVN URLs thinking that  
>> CRX would just download the files, to no avail. That guide makes it  
>> seem like the bundle repository is something like apt-get or fink,  
>> but I can't figure out how to get it to connect to the repository.
>
> We are considering building a repository similar to the apt-get  
> stuff for Sling. In the realm of OSGi this is called the OSGi Bundle  
> Repository or OBR for short. Currently we don't have it yet.
>
> It is not decided yet, what will go into such a repository (except  
> for the released bundles, of course).
>
> Regards
> Felix
>
>>    I appreciate any help!
>>    -Josh
>> Have you installed the ruby scripting bundle - I don't think it's  
>> installed by default in the launchpad app?
>> Joshua Oransky wrote:
>> I tried that one. I get this:
>> Node dumped by HtmlRendererServlet
>> Node path: /content/maniatv/gameology
>> Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}
>> Node properties
>> jcr:primaryType: nt:unstructured
>> I've looked all over for the answer. This doesn't seem to be a  
>> topic explored very much.
>> -Josh
>> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>> I think the extension you need is .erb (see  
>> org
>> .apache
>> .sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)  
>> Joshua Oransky wrote:
>> I'm just getting started with Sling. I've played around with the  
>> examples and feel pretty comfortable with the layout.
>> However, I need to use Ruby as my scripting language. What  
>> extension do I use for a template that uses Ruby code? I tried  
>> various extensions, but nothing works.
>> Thanks in advance - Josh


Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
Felix,

        I attached the logs that happened when I ran your command. I';ve  
tried restarting CRX, but still .erb files are not interpreted.  
However, simply changing the extension to .jst or .esp causes output.  
Currently, there is no code in my file, only text.

        Here's the command line messaging:

Joshua-Oranskys-MacBook-Pro:ruby joshuaoransky$ mvn -P  
autoInstallBundle -Dsling.url=http://localhost:7402/ctx/system/console 
clean install
[INFO] Scanning for projects...
[INFO]  
----------------------------------------------------------------------------
[INFO] Building Sling - Scripting - Ruby Support
[INFO]    task-segment: [clean, install]
[INFO]  
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /Users/joshuaoransky/Downloads/slingsrc/
sling/scripting/ruby/target
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] ********************** WARNING (SLING-443)  
**********************************
     [echo] On most platforms, building Sling currently requires setting
     [echo] MAVEN_OPTS="-Xmx256M", see https://issues.apache.org/jira/browse/SLING-443
     [echo] You might get a "java.lang.OutOfMemoryError: Java heap  
space" if that
     [echo] setting is not correct.
     [echo]  
*****************************************************************************
[INFO] Executed tasks
[INFO] [compiler:compile]
[INFO] Compiling 2 source files to /Users/joshuaoransky/Downloads/
slingsrc/sling/scripting/ruby/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [bundle:bundle]
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive  
invocation.
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [source:jar {execution: attach-sources}]
[INFO] Building jar: /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT-sources.jar
[INFO] [install:install]
[INFO] Installing /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT.jar to /Users/joshuaoransky/.m2/repository/org/apache/sling/
org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar
[INFO] Installing /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT-sources.jar to /Users/joshuaoransky/.m2/repository/org/apache/
sling/org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT-sources.jar
[INFO] [bundle:install]
[INFO] Parsing file:/Users/joshuaoransky/.m2/repository/repository.xml
[INFO] Installing org/apache/sling/org.apache.sling.scripting.ruby/
2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.ruby-2.0.0-
incubator-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] [sling:install {execution: install-bundle}]
[INFO] Installing Bundle org.apache.sling.scripting.ruby(/Users/
joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar) to http://localhost:7402/ctx/system/console
[INFO] Bundle installed
[INFO]  
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]  
------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Wed Aug 27 15:33:18 PDT 2008
[INFO] Final Memory: 15M/45M
[INFO]  
------------------------------------------------------------------------





On Aug 27, 2008, at 1:27 PM, Felix Meschberger wrote:

> Hi Josh,
>
> Joshua Oransky schrieb:
>> Felix,
>>   I have a feeling you are correct. I did what you said, and it  
>> appears to have installed. However, .erb files are still not being  
>> interpreted. I'm using CRX, not Jackrabbit, and I check /system/
>> bundles and it does not show any new bundles, specifically Ruby  
>> ones, installed.
>>   I am going to try this method on Jackrabbit, but was curious if  
>> this should also work on CRX?
>
> It makes no difference. In fact Sling does not care what repository  
> implements the JCR interface as long as there is one...
>
> Do you have any log messages in the logs/error.log file regarding  
> the installation of the bundle ?
>
> Regards
> Felix
>
>>   Thanks man...
>>   -Josh
>> On Aug 26, 2008, at 12:24 AM, Felix Meschberger wrote:
>>> Hi Josh,
>>>
>>> Joshua Oransky schrieb:
>>>> Rory,
>>>>  I think that's the issue; I don't have the bundle installed.  
>>>> There isn't a lot of information on how to get this bundle,  
>>>> however. I tried following the directions on http://wiki.apache.org/jackrabbit/ApacheSling/SlingGuideInstall 
>>>>  but they
>>>
>>> The Sling docs in the Jackrabbit wiki are outdated and invalid.  
>>> Please refer to the Sling site at http://incubator.apache.org/ 
>>> sling for more up to date information.
>>>
>>>> don't match up with what I'm seeing. I downloaded and tried to  
>>>> upload the pom.xml file since it contains SVN URLs thinking that  
>>>> CRX would just download the files, to no avail. That guide makes  
>>>> it seem like the bundle repository is something like apt-get or  
>>>> fink, but I can't figure out how to get it to connect to the  
>>>> repository.
>>>
>>> We are considering building a repository similar to the apt-get  
>>> stuff for Sling. In the realm of OSGi this is called the OSGi  
>>> Bundle Repository or OBR for short. Currently we don't have it yet.
>>>
>>> It is not decided yet, what will go into such a repository (except  
>>> for the released bundles, of course).
>>>
>>> Regards
>>> Felix
>>>
>>>>  I appreciate any help!
>>>>  -Josh
>>>> Have you installed the ruby scripting bundle - I don't think it's  
>>>> installed by default in the launchpad app?
>>>> Joshua Oransky wrote:
>>>> I tried that one. I get this:
>>>> Node dumped by HtmlRendererServlet
>>>> Node path: /content/maniatv/gameology
>>>> Resource metadata: {sling.resolutionPath=/content/maniatv/
>>>> gameology}
>>>> Node properties
>>>> jcr:primaryType: nt:unstructured
>>>> I've looked all over for the answer. This doesn't seem to be a  
>>>> topic explored very much.
>>>> -Josh
>>>> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>>>> I think the extension you need is .erb (see  
>>>> org
>>>> .apache
>>>> .sling
>>>> .scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)  
>>>> Joshua Oransky wrote:
>>>> I'm just getting started with Sling. I've played around with the  
>>>> examples and feel pretty comfortable with the layout.
>>>> However, I need to use Ruby as my scripting language. What  
>>>> extension do I use for a template that uses Ruby code? I tried  
>>>> various extensions, but nothing works.
>>>> Thanks in advance - Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Felix Meschberger-2
Hi Josh,

The Maven output just says, that it has been successfully building the
bundle and sent it to the Sling system. Actually sending to the Sling
system is only part of the story.

The other part of the story is, what the Sling system actually does with
this. This is found in the logs/error.log file in your ${sling.home}
folder. That would actually be the interesting part here.

Joshua Oransky schrieb:
>     I attached the logs that happened when I ran your command. I';ve
> tried restarting CRX, but still .erb files are not interpreted. However,
> simply changing the extension to .jst or .esp causes output. Currently,
> there is no code in my file, only text.

Changing the extension to .jst or .esp just causes another ScriptEngine
to be used, which shows that the basic mechanism actually works. Only
that the ruby script is not being called.

Regards
Felix

>
>     Here's the command line messaging:
>
> Joshua-Oranskys-MacBook-Pro:ruby joshuaoransky$ mvn -P autoInstallBundle
> -Dsling.url=http://localhost:7402/ctx/system/console clean install
> [INFO] Scanning for projects...
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] Building Sling - Scripting - Ruby Support
> [INFO]    task-segment: [clean, install]
> [INFO]
> ----------------------------------------------------------------------------
>
> [INFO] [clean:clean]
> [INFO] Deleting directory
> /Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target
> [INFO] [enforcer:enforce {execution: enforce-java}]
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
>     [echo] ********************** WARNING (SLING-443)
> **********************************
>     [echo] On most platforms, building Sling currently requires setting
>     [echo] MAVEN_OPTS="-Xmx256M", see
> https://issues.apache.org/jira/browse/SLING-443
>     [echo] You might get a "java.lang.OutOfMemoryError: Java heap space"
> if that
>     [echo] setting is not correct.
>     [echo]
> *****************************************************************************
>
> [INFO] Executed tasks
> [INFO] [compiler:compile]
> [INFO] Compiling 2 source files to
> /Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/classes
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] No sources to compile
> [INFO] [surefire:test]
> [INFO] No tests to run.
> [INFO] [bundle:bundle]
> [INFO] Preparing source:jar
> [WARNING] Removing: jar from forked lifecycle, to prevent recursive
> invocation.
> [INFO] [enforcer:enforce {execution: enforce-java}]
> [INFO] [source:jar {execution: attach-sources}]
> [INFO] Building jar:
> /Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT-sources.jar
>
> [INFO] [install:install]
> [INFO] Installing
> /Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar
> to
> /Users/joshuaoransky/.m2/repository/org/apache/sling/org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar
>
> [INFO] Installing
> /Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT-sources.jar
> to
> /Users/joshuaoransky/.m2/repository/org/apache/sling/org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT-sources.jar
>
> [INFO] [bundle:install]
> [INFO] Parsing file:/Users/joshuaoransky/.m2/repository/repository.xml
> [INFO] Installing
> org/apache/sling/org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar
>
> [INFO] Writing OBR metadata
> [INFO] [sling:install {execution: install-bundle}]
> [INFO] Installing Bundle
> org.apache.sling.scripting.ruby(/Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar)
> to http://localhost:7402/ctx/system/console
> [INFO] Bundle installed
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 17 seconds
> [INFO] Finished at: Wed Aug 27 15:33:18 PDT 2008
> [INFO] Final Memory: 15M/45M
> [INFO]
> ------------------------------------------------------------------------
>
>
>
>
> On Aug 27, 2008, at 1:27 PM, Felix Meschberger wrote:
>
>> Hi Josh,
>>
>> Joshua Oransky schrieb:
>>> Felix,
>>>   I have a feeling you are correct. I did what you said, and it
>>> appears to have installed. However, .erb files are still not being
>>> interpreted. I'm using CRX, not Jackrabbit, and I check
>>> /system/bundles and it does not show any new bundles, specifically
>>> Ruby ones, installed.
>>>   I am going to try this method on Jackrabbit, but was curious if
>>> this should also work on CRX?
>>
>> It makes no difference. In fact Sling does not care what repository
>> implements the JCR interface as long as there is one...
>>
>> Do you have any log messages in the logs/error.log file regarding the
>> installation of the bundle ?
>>
>> Regards
>> Felix
>>
>>>   Thanks man...
>>>   -Josh
>>> On Aug 26, 2008, at 12:24 AM, Felix Meschberger wrote:
>>>> Hi Josh,
>>>>
>>>> Joshua Oransky schrieb:
>>>>> Rory,
>>>>>  I think that's the issue; I don't have the bundle installed. There
>>>>> isn't a lot of information on how to get this bundle, however. I
>>>>> tried following the directions on
>>>>> http://wiki.apache.org/jackrabbit/ApacheSling/SlingGuideInstall but
>>>>> they
>>>>
>>>> The Sling docs in the Jackrabbit wiki are outdated and invalid.
>>>> Please refer to the Sling site at http://incubator.apache.org/sling 
>>>> for more up to date information.
>>>>
>>>>> don't match up with what I'm seeing. I downloaded and tried to
>>>>> upload the pom.xml file since it contains SVN URLs thinking that
>>>>> CRX would just download the files, to no avail. That guide makes it
>>>>> seem like the bundle repository is something like apt-get or fink,
>>>>> but I can't figure out how to get it to connect to the repository.
>>>>
>>>> We are considering building a repository similar to the apt-get
>>>> stuff for Sling. In the realm of OSGi this is called the OSGi Bundle
>>>> Repository or OBR for short. Currently we don't have it yet.
>>>>
>>>> It is not decided yet, what will go into such a repository (except
>>>> for the released bundles, of course).
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>>>  I appreciate any help!
>>>>>  -Josh
>>>>> Have you installed the ruby scripting bundle - I don't think it's
>>>>> installed by default in the launchpad app?
>>>>> Joshua Oransky wrote:
>>>>> I tried that one. I get this:
>>>>> Node dumped by HtmlRendererServlet
>>>>> Node path: /content/maniatv/gameology
>>>>> Resource metadata: {sling.resolutionPath=/content/maniatv/gameology}
>>>>> Node properties
>>>>> jcr:primaryType: nt:unstructured
>>>>> I've looked all over for the answer. This doesn't seem to be a
>>>>> topic explored very much.
>>>>> -Josh
>>>>> On Aug 20, 2008, at 12:02 PM, Rory Douglas wrote:
>>>>> I think the extension you need is .erb (see
>>>>> org.apache.sling.scripting.ruby.ErbScriptEngineFactory#ERB_SCRIPT_EXTENSION)
>>>>> Joshua Oransky wrote:
>>>>> I'm just getting started with Sling. I've played around with the
>>>>> examples and feel pretty comfortable with the layout.
>>>>> However, I need to use Ruby as my scripting language. What
>>>>> extension do I use for a template that uses Ruby code? I tried
>>>>> various extensions, but nothing works.
>>>>> Thanks in advance - Josh
>

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Bertrand Delacretaz
In reply to this post by Joshua Oransky
Hi Josh,

On Thu, Aug 28, 2008 at 12:52 AM, Joshua Oransky <[hidden email]> wrote:
> ...I';ve
> tried restarting CRX, but still .erb files are not interpreted....

The scripting/ruby bundle was broken in the current trunk, see SLING-632.

It should work now, but uses jruby 1.0 again, I didn't have time to
look at the additional dependencies required by jruby 1.1.1. We'll
need to have a closer look if someone needs the latest and greatest
jruby.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Bertrand Delacretaz
On Thu, Aug 28, 2008 at 8:48 AM, Bertrand Delacretaz
<[hidden email]> wrote:
> ...The scripting/ruby bundle was broken in the current trunk, see SLING-632.
>
> It should work now, but uses jruby 1.0 again, I didn't have time to
> look at the additional dependencies required by jruby 1.1.1....

Felix gave me a hint about this, the scripting/ruby module now works
using the latest jruby 1.1.3.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
Bertrand,

        Thanks for the effort! When I run mvn -P autoInstallBundle -
Dsling.url=http://localhost:8080/ctx/system/console clean install I  
get a build error. Nothing shows up in the $sling.home/logs/error.log.



Joshua-Oranskys-MacBook-Pro:ruby joshuaoransky$ mvn -P  
autoInstallBundle -Dsling.url=http://localhost:8080/ctx/system/console 
clean install
[INFO] Scanning for projects...
[INFO]  
----------------------------------------------------------------------------
[INFO] Building Sling - Scripting - Ruby Support
[INFO]    task-segment: [clean, install]
[INFO]  
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /Users/joshuaoransky/Downloads/slingsrc/
sling/scripting/ruby/target
Downloading: http://people.apache.org/repo/m2-incubating-repository/org/jruby/jruby-complete/1.1.3/jruby-complete-1.1.3.pom
Downloading: http://repo1.maven.org/maven2/org/jruby/jruby-complete/1.1.3/jruby-complete-1.1.3.pom
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
      [echo] ********************** WARNING (SLING-443)  
**********************************
      [echo] On most platforms, building Sling currently requires  
setting
      [echo] MAVEN_OPTS="-Xmx256M", see https://issues.apache.org/jira/browse/SLING-443
      [echo] You might get a "java.lang.OutOfMemoryError: Java heap  
space" if that
      [echo] setting is not correct.
      [echo]  
*****************************************************************************
[INFO] Executed tasks
[INFO] [compiler:compile]
[INFO] Compiling 2 source files to /Users/joshuaoransky/Downloads/
slingsrc/sling/scripting/ruby/target/classes
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [bundle:bundle]
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive  
invocation.
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [source:jar {execution: attach-sources}]
[INFO] Building jar: /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT-sources.jar
[INFO] [install:install]
[INFO] Installing /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT.jar to /Users/joshuaoransky/.m2/repository/org/apache/sling/
org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar
[INFO] Installing /Users/joshuaoransky/Downloads/slingsrc/sling/
scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-
SNAPSHOT-sources.jar to /Users/joshuaoransky/.m2/repository/org/apache/
sling/org.apache.sling.scripting.ruby/2.0.0-incubator-SNAPSHOT/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT-sources.jar
[INFO] [bundle:install]
[INFO] Parsing file:/Users/joshuaoransky/.m2/repository/repository.xml
[INFO] Installing org/apache/sling/org.apache.sling.scripting.ruby/
2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.ruby-2.0.0-
incubator-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] [sling:install {execution: install-bundle}]
[INFO] Installing Bundle org.apache.sling.scripting.ruby(/Users/
joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/
org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar) to http://localhost:8080/ctx/system/console
[ERROR] Installation failed, cause: Created
[INFO]  
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]  
------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Tue Sep 02 18:26:49 PDT 2008
[INFO] Final Memory: 15M/42M
[INFO]  
------------------------------------------------------------------------

On Aug 28, 2008, at 12:14 AM, Bertrand Delacretaz wrote:

> On Thu, Aug 28, 2008 at 8:48 AM, Bertrand Delacretaz
> <[hidden email]> wrote:
>> ...The scripting/ruby bundle was broken in the current trunk, see  
>> SLING-632.
>>
>> It should work now, but uses jruby 1.0 again, I didn't have time to
>> look at the additional dependencies required by jruby 1.1.1....
>
> Felix gave me a hint about this, the scripting/ruby module now works
> using the latest jruby 1.1.3.
>
> -Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Bertrand Delacretaz
Hi,

On Wed, Sep 3, 2008 at 3:39 AM, Joshua Oransky <[hidden email]> wrote:
> ...When I run mvn -P autoInstallBundle
> -Dsling.url=http://localhost:8080/ctx/system/console clean install I get a
> build error. Nothing shows up in the $sling.home/logs/error.log...

Looks like your sling.url is wrong, if you open it from a browser you
should see the OSGi console. I guess the correct one is
http://localhost:8080/system/console

>... [INFO] Installing Bundle
> org.apache.sling.scripting.ruby(/Users/joshuaoransky/Downloads/slingsrc/sling/scripting/ruby/target/org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar)
> to http://localhost:8080/ctx/system/console
> [ERROR] Installation failed, cause: Created...

I guess the install plugin gets a "created" HTTP response instead of
what it expects, which would be the case if using a wrong install URL:
in this case the SlingPostServlet will create a new node.

-Bertrand

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
Thanks! That worked!

On Sep 2, 2008, at 11:52 PM, Bertrand Delacretaz wrote:

> Hi,
>
> On Wed, Sep 3, 2008 at 3:39 AM, Joshua Oransky <[hidden email]>  
> wrote:
>> ...When I run mvn -P autoInstallBundle
>> -Dsling.url=http://localhost:8080/ctx/system/console clean install  
>> I get a
>> build error. Nothing shows up in the $sling.home/logs/error.log...
>
> Looks like your sling.url is wrong, if you open it from a browser you
> should see the OSGi console. I guess the correct one is
> http://localhost:8080/system/console
>
>> ... [INFO] Installing Bundle
>> org.apache.sling.scripting.ruby(/Users/joshuaoransky/Downloads/
>> slingsrc/sling/scripting/ruby/target/
>> org.apache.sling.scripting.ruby-2.0.0-incubator-SNAPSHOT.jar)
>> to http://localhost:8080/ctx/system/console
>> [ERROR] Installation failed, cause: Created...
>
> I guess the install plugin gets a "created" HTTP response instead of
> what it expects, which would be the case if using a wrong install URL:
> in this case the SlingPostServlet will create a new node.
>
> -Bertrand


Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
In reply to this post by Bertrand Delacretaz
Ok, so it seems not everything is working with ERB files...

If I do some simple Ruby code, like:

<%
puts "Hello, World!"
%>

There is no error, but there is also no output.

If I put:

<%= "Hello, World!" %>

There IS output.

In fact, it seems like it is actually parsing the code, because bogus  
code throws an error. However, nothing in the <% %> ever shows up. I  
even tried the "rendering-test.erb" file that comes with the source --  
still nothing.

I read through the ERB docs at ruby-doc.org and tried some variations  
from there with no luck. Any help is appreciated!

-Josh

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Alexander Klimetschek
On Sat, Sep 6, 2008 at 10:23 PM, Joshua Oransky <[hidden email]> wrote:
> Ok, so it seems not everything is working with ERB files...
>
> If I do some simple Ruby code, like:
>
> <%
> puts "Hello, World!"
> %>
>
> There is no error, but there is also no output.

AFAIK puts writes to the stdout by default (it's a system call,
nothing specific to erb), which probably goes into nirvana inside the
ruby script engine execution.

> If I put:
>
> <%= "Hello, World!" %>
>
> There IS output.

This is the way to output stuff from erbs.

If you run an erb from the command line, the <%= %> would print your
output, and puts could be used to print warning messages etc. to the
console. So I guess this behaviour is perfectly normal.

Regards,
Alex


--
Alexander Klimetschek
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How do I create a Ruby template?

Joshua Oransky
Thanks... That works...

And just for posterity,  <% out.print() %> is the way to do it  
strictly in script.

-Josh

On Sep 7, 2008, at 9:53 AM, Alexander Klimetschek wrote:

> On Sat, Sep 6, 2008 at 10:23 PM, Joshua Oransky <[hidden email]>  
> wrote:
>> Ok, so it seems not everything is working with ERB files...
>>
>> If I do some simple Ruby code, like:
>>
>> <%
>> puts "Hello, World!"
>> %>
>>
>> There is no error, but there is also no output.
>
> AFAIK puts writes to the stdout by default (it's a system call,
> nothing specific to erb), which probably goes into nirvana inside the
> ruby script engine execution.
>
>> If I put:
>>
>> <%= "Hello, World!" %>
>>
>> There IS output.
>
> This is the way to output stuff from erbs.
>
> If you run an erb from the command line, the <%= %> would print your
> output, and puts could be used to print warning messages etc. to the
> console. So I guess this behaviour is perfectly normal.
>
> Regards,
> Alex
>
>
> --
> Alexander Klimetschek
> [hidden email]