Hi John,
Attached is a version of page.rb that does what you need I think. I'm not
sure as I'm not sure I understand what you are trying to do now that you
also mention different ports. It will work I think for running several
instances of EPF Wiki in different folders. Assuming you change the
EPFWIKI_HOST to include the folder as discussed earlier, the new page.rb
will include that folder in the snippets that are included at the time a
wiki is created or updated. So it is now EPFWIKI_HOST 'aware'. I think.

About the relocation approach. Running the app from anything other than root
was never considered, so there never was an 'approach' for it. So we are
breaking new ground here. So I'm also not sure that the new page.rb will get
you where you want to be. We might encounter yet another obstacle.
Best Regards,
Onno


On Wed, Mar 2, 2011 at 5:55 PM, John Allen <[email protected]> wrote:

>  Ahh, right, well I've given up and rolled back my changes. The snippets
> are written into the content at import time I think. The code would need to
> be changed to support validating that the snippets are correct at runtime
> otherwise any imported process content is forever bound to the url at import
> time.
>
> Onno thanks for your help, maybe you can think of a more relocation
> friendly approach? If so send me a patch and I'll try it. For now I'm
> falling back on Apache named virtual hosts and will try and get my IS
> department to create new CNAMEs (harder than 3 hours of hacking)
>
> John
>
>  ------------------------------
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *John Allen
> *Sent:* 02 March 2011 16:21
>
> *To:* Eclipse Process Framework Project Developers List
> *Subject:* Re: [epf-dev] NoMethodError in # when using EPF Wiki -
> baselineprocess, comments tab -
>
>  Thanks Onno, that did indeed work.
>
> So, know how I can "sed"/subst those hardcoded snippet text file contents
> so that they become EPFWIKI_HOST aware ? :)
>
> If you can pass me some prototype ruby for "models/page.rb" +158 I will try
> it out ('m currently searching the web for ruby examples)
>
> John
>
>  ------------------------------
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Onno van der Straaten
> *Sent:* 02 March 2011 15:07
> *To:* Eclipse Process Framework Project Developers List
> *Subject:* Re: [epf-dev] NoMethodError in # when using EPF Wiki - baseline
> process, comments tab -
>
> Hi John,
> It seems you should use ActionController::AbstractRequest.relative_url_root.
> Can you try if that works?
> Best Regards,
> Onno
>
> On Wed, Mar 2, 2011 at 4:01 PM, Onno van der Straaten <
> [email protected]> wrote:
>
>> Hi John,
>> You should use 2.0.2. EPF Wiki is based on 2.0.2. The version is specified
>> in the file config/environment.rb
>> RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
>>
>> It might be possible to use a more recent version but certainly not the
>> most recent version. Unless there is a specific reason not to use 2.0.2.
>> please stick with that version. If you want to try another version you need
>> to specificy the version in enviroment.rb or provide it as a environment
>> variable.
>>
>> If you need a more recent version I am willing to consider creating a
>> patch. But I will have to investigate first before I decide to do so given
>> that I need to find the time to create it.
>> Cheers,
>> Onno
>>
>>
>>
>> On Wed, Mar 2, 2011 at 3:11 PM, John Allen <[email protected]> wrote:
>>
>>>  Onno,
>>>
>>> I've finally got round to trying this but am getting an error that
>>> indicates relative_url_root doesnt live on ActionController::Base:Class.
>>>
>>> A quick google hunt (http://www.ruby-forum.com/topic/185961) suggests
>>> that in version 2.0.2 rails it lived on a different class.
>>>
>>> So to the question in hand, what rails version do you think i can run the
>>> wiki under? My colleague that installed it originally said he had problems
>>> using a more modern version of rails.
>>>
>>> What version do you guys use?
>>>
>>> Thanks,
>>> John
>>>
>>>  ------------------------------
>>>  *From:* [email protected] [mailto:[email protected]]
>>> *On Behalf Of *Onno van der Straaten
>>> *Sent:* 08 February 2011 14:36
>>>
>>> *To:* Eclipse Process Framework Project Developers List
>>> *Subject:* Re: [epf-dev] NoMethodError in # when using EPF Wiki -
>>> baseline process, comments tab -
>>>
>>>   Hi John,
>>> If you want to run from a sub folder you will need to change that but
>>> that won't be enough.
>>>
>>> That variable is used for creating hyperlinks in emails that are send
>>> using a scheduled job. The job is of course unaware of the domain name and
>>> so forth. To make sure that links are correct you change that to
>>> ENV['EPFWIKI_HOST'] = "localhost:3000/yourpath"
>>>
>>> In addition to that you also need to add something like
>>> config.action_controller.relative_url_root = '/yourpath'
>>> to environment.rb to ensure that the Rails rooting will be working fine.
>>> I have not tested this before so I'm not sure it will work. But if you
>>> want to try that I'm willing to help you fix any issues you might stumble
>>> upon along the way.
>>> Cheers,
>>> Onno
>>>
>>>
>>> On Tue, Feb 8, 2011 at 3:19 PM, John Allen <[email protected]>wrote:
>>>
>>>>  Thanks Onno,
>>>>
>>>> Will try that right now.
>>>>
>>>> While I'm digging into that can I ask you another questions?
>>>>
>>>> EPFWiki seems to assume its mapped to the root of the web server URL as
>>>> when we use a ProxyPass setting that locates the wiki's under some other
>>>> arbitrary prefix the wiki's pages don't load properly (my developer says
>>>> that the web clients make requests for pages that don't exist).
>>>>
>>>> It's very normal for a web app to ask what it's URL "root" is to prevent
>>>> this issue. Is this what :
>>>>
>>>> ENV['EPFWIKI_HOST'] = "localhost:3000" # used for jobs, when there is no
>>>> host variable in the environment
>>>> Is for?
>>>>
>>>> Thanks in advance,
>>>> John
>>>>
>>>>
>>>>  ------------------------------
>>>> *From:* [email protected] [mailto:[email protected]]
>>>> *On Behalf Of *Onno van der Straaten
>>>> *Sent:* 08 February 2011 14:11
>>>> *To:* Eclipse Process Framework Project Developers List
>>>> *Subject:* Re: [epf-dev] NoMethodError in # when using EPF Wiki -
>>>> baseline process, comments tab -
>>>>
>>>>   Hi John,
>>>> Hard to say from this alone. But can you try the following.
>>>>
>>>> Open the file app/helpers/application_helper.rb and find the method
>>>> link_to_comment. The method contains the following code
>>>> link_to(truncate(strip_tags(comment.text)), :controller => 'pages',
>>>> :action => 'discussion', :site_folder => comment.site.folder, :id =>
>>>> comment.page.id)
>>>>
>>>> Can you remove truncate, so change this line to
>>>> link_to(strip_tags(comment.text), :controller => 'pages', :action =>
>>>> 'discussion', :site_folder => comment.site.folder, :id =>
>>>> comment.page.id)
>>>>
>>>> Restart the web server and try again. This problem could be related to
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=333900 so removing
>>>> truncate can be a workaround.
>>>>
>>>> If problems persist and this is a new installationI suggest you recreate
>>>> the database and try again. Are you doing this on Windows or Linux?
>>>>
>>>> HTH,
>>>> Onno
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Feb 8, 2011 at 2:14 PM, John Allen <[email protected]>wrote:
>>>>
>>>>>  Can anyone suggest why we are getting this:
>>>>>
>>>>> Showing *comments/_comments_list.rhtml* where line *#26* raised:
>>>>>
>>>>> undefined method `length' for #<Enumerable::Enumerator:0x2aae0e6db8e8>
>>>>>
>>>>> Extracted source (around line *#26*):
>>>>>
>>>>> 23:                <% comment.review_note = 'Click to add...' if
>>>>> comment.review_note.blank? %>
>>>>> 24:              <tr>
>>>>> 25:                 <td><%= comment.id %></td>
>>>>> 26:                  <td><%= link_to_comment comment %></td>
>>>>> 27:                  <td><%= comment.created_on.strftime("%I:%M %p
>>>>> %d-%b-%y") %></td>
>>>>> 28:                  <td><%= link_to_user comment.user %></td>
>>>>> 29:                  <td><%= link_to_page comment.page %></td>
>>>>>
>>>>> Trace of template inclusion: /sites/description.rhtml
>>>>>
>>>>> RAILS_ROOT: /apps/epfwiki/epfwiki
>>>>>
>>>>> *Application Trace* <http://dse/sites/comments/3#> | *Framework 
>>>>> Trace*<http://dse/sites/comments/3#>
>>>>>  | *Full Trace* <http://dse/sites/comments/3#>
>>>>> /apps/epfwiki/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/text_helper.rb:50:in
>>>>> `truncate'
>>>>> app/helpers/application_helper.rb:248:in `link_to_comment'
>>>>> app/views/comments/_comments_list.rhtml:26:in
>>>>> `_run_erb_47app47views47comments47_comments_list46rhtml'
>>>>> app/views/comments/_comments_list.rhtml:22:in `each'
>>>>> app/views/comments/_comments_list.rhtml:22:in
>>>>> `_run_erb_47app47views47comments47_comments_list46rhtml'
>>>>> app/views/sites/description.rhtml:52:in
>>>>> `_run_erb_47app47views47sites47description46rhtml'
>>>>> app/controllers/sites_controller.rb:144:in `comments'
>>>>>
>>>>> *Request*
>>>>>
>>>>> *Parameters*:
>>>>>
>>>>> {"id"=>"3"}
>>>>>
>>>>> *Show session dump* <http://dse/sites/comments/3#>
>>>>>
>>>>> *Response*
>>>>>
>>>>> *Headers*:
>>>>>
>>>>> {"cookie"=>[],
>>>>>  "Cache-Control"=>"no-cache"}
>>>>>
>>>>> Thanks,
>>>>> John
>>>>>
>>>>> *______________________________________________*
>>>>> *John Allen -* Solution Architect, Senior Manager
>>>>> *t* +44 (0)207 812 4626 |*** m* +44 (0)778 753 3602
>>>>> *f* +44 (0)207 812 4100 |*** c* +44 (0)207 897 9424 # 93410 59633
>>>>> ***a* Detica | 2 Arundel Street | London | WC2R 3AZ | UK
>>>>> *Please do not send emails to this account protectively marked as
>>>>> restricted or above*
>>>>> *______________________________________________*
>>>>> *www.detica.com* – a BAE Systems company**
>>>>>
>>>>> Please consider the environment before printing this email.
>>>>>
>>>>> This message should be regarded as confidential. If you have received 
>>>>> this email in error please notify the sender and destroy it immediately.
>>>>> Statements of intent shall only become binding when confirmed in hard 
>>>>> copy by an authorised signatory.  The contents of this email may relate 
>>>>> to dealings with other companies within the Detica Limited group of 
>>>>> companies.
>>>>>
>>>>> Detica Limited is registered in England under No: 1337451.
>>>>>
>>>>> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, 
>>>>> England.
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> epf-dev mailing list
>>>>> [email protected]
>>>>> https://dev.eclipse.org/mailman/listinfo/epf-dev
>>>>>
>>>>>
>>>>  Please consider the environment before printing this email.
>>>>
>>>> This message should be regarded as confidential. If you have received this 
>>>> email in error please notify the sender and destroy it immediately.
>>>> Statements of intent shall only become binding when confirmed in hard copy 
>>>> by an authorised signatory.  The contents of this email may relate to 
>>>> dealings with other companies within the Detica Limited group of companies.
>>>>
>>>> Detica Limited is registered in England under No: 1337451.
>>>>
>>>> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, 
>>>> England.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> epf-dev mailing list
>>>> [email protected]
>>>> https://dev.eclipse.org/mailman/listinfo/epf-dev
>>>>
>>>>
>>>  Please consider the environment before printing this email.
>>>
>>> This message should be regarded as confidential. If you have received this 
>>> email in error please notify the sender and destroy it immediately.
>>> Statements of intent shall only become binding when confirmed in hard copy 
>>> by an authorised signatory.  The contents of this email may relate to 
>>> dealings with other companies within the Detica Limited group of companies.
>>>
>>> Detica Limited is registered in England under No: 1337451.
>>>
>>> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, 
>>> England.
>>>
>>>
>>>
>>> _______________________________________________
>>> epf-dev mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/epf-dev
>>>
>>>
>>
> Please consider the environment before printing this email.
>
> This message should be regarded as confidential. If you have received this 
> email in error please notify the sender and destroy it immediately.
> Statements of intent shall only become binding when confirmed in hard copy by 
> an authorised signatory.  The contents of this email may relate to dealings 
> with other companies within the Detica Limited group of companies.
>
> Detica Limited is registered in England under No: 1337451.
>
> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.
>
>
> Please consider the environment before printing this email.
>
> This message should be regarded as confidential. If you have received this 
> email in error please notify the sender and destroy it immediately.
> Statements of intent shall only become binding when confirmed in hard copy by 
> an authorised signatory.  The contents of this email may relate to dealings 
> with other companies within the Detica Limited group of companies.
>
> Detica Limited is registered in England under No: 1337451.
>
> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.
>
>
>
> _______________________________________________
> epf-dev mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/epf-dev
>
>

Attachment: page.rb
Description: application/ruby

_______________________________________________
epf-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/epf-dev

Reply via email to