caterpillar 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ = 1.0.1
2
+ - added test for liferay session variables
3
+ - fixed XML validation error on 5.2.3 (all portlets are now uninstanceable)
4
+ - fix jar installation; do not copy VCS files
5
+ - require lportal version 1.0.18
6
+
1
7
  = 1.0.0
2
8
  - improved rubygem loading; detect RAILS_GEM_VERSION
3
9
  - included portlet test bench
@@ -5,7 +5,7 @@
5
5
  #++
6
6
 
7
7
  module Caterpillar
8
- VERSION='1.0.0'
8
+ VERSION='1.0.1'
9
9
  end
10
10
 
11
11
  this_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
@@ -1,6 +1,7 @@
1
1
  #--
2
2
  # (c) Copyright 2008,2009 Mikael Lammentausta
3
- # See the file LICENSES.txt included with the distribution for
3
+ #
4
+ # See the file MIT-LICENSE included with the distribution for
4
5
  # software license details.
5
6
  #++
6
7
 
@@ -227,11 +228,13 @@ module Caterpillar
227
228
  xml << " <portlet-name>%s</portlet-name>\n" % portlet[:name]
228
229
  xml << " <icon>/%s/favicon.ico</icon>\n" % portlet[:servlet]
229
230
  # can there be several portlet instances on the same page?
230
- xml << " <instanceable>true</instanceable>\n"
231
- # define the control panel category for 5.2 and newer
231
+ xml << " <instanceable>false</instanceable>\n"
232
+ # define the control panel category for 5.2 and newer -
233
+ # Note that when the control panel settings are defined,
234
+ # the portlet cannot be instanceable.
232
235
  unless @version[/5.1/]
233
236
  xml << " <control-panel-entry-category>#{portlet[:category]}</control-panel-entry-category>\n"
234
- xml << " <control-panel-entry-weight>99.0</control-panel-entry-weight>\n"
237
+ xml << " <control-panel-entry-weight>1.0</control-panel-entry-weight>\n"
235
238
  end
236
239
  # include javascripts?
237
240
  js_tag = (@version[/5.1/] ? 'header' : 'footer') + '-portal-javascript'
@@ -370,7 +370,7 @@ module Caterpillar
370
370
 
371
371
  require 'find'
372
372
  Find.find(source) do |file|
373
- if File.basename(file) =~ /rails-portlet-#{version}/
373
+ if File.basename(file) =~ /^rails-portlet-#{version}.jar$/
374
374
  portlet_jar = file
375
375
  end
376
376
  end
@@ -381,17 +381,17 @@ module Caterpillar
381
381
  old_version = file[/(\d.\d.\d).jar/,1]
382
382
  # check if there's an update available
383
383
  if version.gsub(/\./,'').to_i > old_version.gsub(/\./,'').to_i
384
- info 'Rails-portlet version %s is found, but an update is available.' % old_version
384
+ info 'Rails-portlet version %s is found, but an update is available' % old_version
385
385
  old_jar = file
386
386
  else
387
- info 'Rails-portlet version %s is already installed.' % old_version
387
+ info 'Rails-portlet version %s is already installed (%s)' % [old_version,file]
388
388
  exit 0
389
389
  end
390
390
  end
391
391
  end
392
392
 
393
393
  exit 1 unless system('cp %s %s' % [portlet_jar,target])
394
- info 'installed Rails-portlet version %s to %s' % [version, target]
394
+ info 'installed Rails-portlet version %s (%s)' % [version, File.join(target,portlet_jar)]
395
395
  if old_jar
396
396
  exit 1 unless system('rm -f %s' % old_jar)
397
397
  info '..removed the old version %s' % old_jar
@@ -0,0 +1,8 @@
1
+ class Caterpillar::LiferayController < Caterpillar::ApplicationController
2
+
3
+ def session_variables
4
+ @uid = params[:uid]
5
+ @gid = params[:gid]
6
+ end
7
+
8
+ end
@@ -37,6 +37,29 @@ module Caterpillar #:nodoc:
37
37
  'caterpillar/test_bench/user/:action',
38
38
  {:controller => 'Caterpillar::User'})
39
39
 
40
+
41
+ @set.add_route(
42
+ 'caterpillar/test_bench/liferay/:action',
43
+ {:controller => 'Caterpillar::Liferay'})
44
+
45
+ # Liferay session variables.
46
+ #
47
+ # Watch out for route conflicts!
48
+ # If the route would be /something/:uid,
49
+ # a later defined route /something/:gid would never match.
50
+
51
+ @set.add_route(
52
+ 'caterpillar/test_bench/liferay/:action/uid/:uid',
53
+ {:controller => 'Caterpillar::Liferay'})
54
+
55
+ @set.add_route(
56
+ 'caterpillar/test_bench/liferay/:action/gid/:gid',
57
+ {:controller => 'Caterpillar::Liferay'})
58
+
59
+ @set.add_route(
60
+ 'caterpillar/test_bench/liferay/:action/uid/:uid/gid/:gid',
61
+ {:controller => 'Caterpillar::Liferay'})
62
+
40
63
  end
41
64
  end
42
65
  end
@@ -1,8 +1,14 @@
1
1
  <body>
2
+ <h1>
3
+ Rails-portlet test bench
4
+ </h1>
5
+ <p style="font-size: 14px;">
6
+ These are isolated test cases of the Rails-portlet. These cases cover the most common techniques used in dynamic web applications. The <%= link_to_exit_portlet 'source code', 'http://rails-portlet.rubyforge.org/svn/trunk/caterpillar/portlet_test_bench/' -%> can be used as a reference for using the same features in other Rails apps.
7
+ </p>
2
8
 
3
9
  <h1>HTTP</h1>
4
10
 
5
- <%= link_to 'URL parameters',
11
+ <%= link_to 'URL parameter passing',
6
12
  :controller => 'Caterpillar::HttpMethods', :action => :parameter -%><br />
7
13
 
8
14
  <%= link_to 'HTTP POST form',
@@ -60,6 +66,8 @@
60
66
  <%= link_to 'Link outside the portlet',
61
67
  :controller => 'Caterpillar::Resource', :action => :exit_portlet -%><br />
62
68
 
69
+ <%= link_to 'Liferay session variables',
70
+ :controller => 'Caterpillar::Liferay', :action => :session_variables -%><br />
63
71
 
64
72
 
65
73
  <%#= link_to 'Login',
@@ -0,0 +1,34 @@
1
+ <h1>Liferay session variables</h1>
2
+ <p>
3
+ These tests check that Liferay session variables are available in Rails.
4
+ </p>
5
+
6
+ <p>
7
+ These variables are accessible in Java JSR286 portlets from the Liferay API.
8
+ When the Rails-portlet receives a request where the URL contains keywords %UID% or %GID%, these are replaced by the values received from the Liferay API. Rails receives a request with the actual UID number and GID numbers, respectively. The page (Layout in the database) where the portlet is has defined this Group.
9
+ </p>
10
+
11
+ <p>
12
+ <%= link_to 'UID', url_for(:action => :session_variables)+'/uid/%UID%' -%><br/>
13
+ <%#= link_to 'UID debug', url_for(:action => :session_variables)+'/uid/10000' -%><br/>
14
+ <% if @uid -%>
15
+ <span style="font-size: 14px;">
16
+ Received UID: <%= @uid %>
17
+ </span>
18
+ <% end -%>
19
+ </p>
20
+
21
+ <p>
22
+ <%= link_to 'GID', url_for(:action => :session_variables)+'/gid/%GID%' -%><br/>
23
+ <%#= link_to 'GID debug', url_for(:action => :session_variables)+'/gid/20000' -%><br/>
24
+ <% if @gid -%>
25
+ <span style="font-size: 14px;">
26
+ Received GID: <%= @gid %>
27
+ </span>
28
+ <% end -%>
29
+ </p>
30
+
31
+ <p style="font-size: 18px;">
32
+ <%= link_to 'Reset', :action => :session_variables -%>
33
+ </p>
34
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caterpillar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Lammentausta
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-22 00:00:00 +03:00
12
+ date: 2009-07-12 00:00:00 +03:00
13
13
  default_executable: caterpillar
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -101,6 +101,7 @@ files:
101
101
  - portlet_test_bench/controllers/caterpillar/js_controller.rb
102
102
  - portlet_test_bench/controllers/caterpillar/user_controller.rb
103
103
  - portlet_test_bench/controllers/caterpillar/css_controller.rb
104
+ - portlet_test_bench/controllers/caterpillar/liferay_controller.rb
104
105
  - portlet_test_bench/views
105
106
  - portlet_test_bench/views/caterpillar
106
107
  - portlet_test_bench/views/caterpillar/application
@@ -123,6 +124,8 @@ files:
123
124
  - portlet_test_bench/views/caterpillar/resource/images.html.erb
124
125
  - portlet_test_bench/views/caterpillar/login
125
126
  - portlet_test_bench/views/caterpillar/login/index.html.erb
127
+ - portlet_test_bench/views/caterpillar/liferay
128
+ - portlet_test_bench/views/caterpillar/liferay/session_variables.html.erb
126
129
  - portlet_test_bench/views/caterpillar/js
127
130
  - portlet_test_bench/views/caterpillar/js/jquery.html.erb
128
131
  - portlet_test_bench/views/caterpillar/js/link_to_post.html.erb