caterpillar 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/xml_test.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+ require File.dirname(File.expand_path(__FILE__))+'/test_helper'
3
+
4
+ class XmlTest < Caterpillar::TestCase # :nodoc:
5
+
6
+ def test_portlet_xml
7
+ xml = Caterpillar::Portlet.xml(@portlets)
8
+ assert_not_nil xml
9
+ assert !xml.empty?
10
+ end
11
+
12
+ def test_liferay_display_xml
13
+ xml = Caterpillar::Liferay.new(@config).display_xml(@portlets)
14
+ assert_not_nil xml
15
+ assert !xml.empty?
16
+ end
17
+
18
+ def test_liferay_portlet_xml
19
+ xml = Caterpillar::Liferay.new(@config).portletapp_xml(@portlets)
20
+ assert_not_nil xml
21
+ assert !xml.empty?
22
+ end
23
+
24
+ end
@@ -0,0 +1,45 @@
1
+ <div class="caterpillar_navigation">
2
+ <%# CATEGORIES -%>
3
+ <% categories = @caterpillar_navigation.keys -%>
4
+ <% @caterpillar_navigation.each_pair do |category,portlets| -%>
5
+ <% cat = category.gsub(' ','_') -%>
6
+ <span id="<%=cat-%>" class="cp_category">
7
+ <%= link_to_function( category,
8
+ "cp_toggle_category('%s',null);" % cat
9
+ )
10
+ -%>
11
+ </span>
12
+ <% end -%>
13
+
14
+ <%# PORTLET LINKS -%>
15
+ <% @caterpillar_navigation.each_pair do |category,portlets| -%>
16
+ <div id="<%=category.gsub(' ','_')-%>_portlets" class="cp_portlets" style="display: none;">
17
+ <ul>
18
+ <% portlets.each do |portlet| -%>
19
+ <% begin -%>
20
+ <%# check required variables -%>
21
+ <% portlet[:vars].each do |var|
22
+ raise if params[var].nil?
23
+ end -%>
24
+
25
+ <li><%= link_to( portlet[:title], portlet[:reqs] ) -%></li>
26
+
27
+ <% rescue
28
+ vars = {}
29
+ undef_vars = []
30
+ portlet[:vars].each do |var|
31
+ val = @caterpillar_navigation_defaults[var] || 0
32
+ vars.update( var => val )
33
+ undef_vars << var unless params[var]
34
+ end
35
+ -%>
36
+ <li>
37
+ <b><%= link_to( portlet[:title], portlet[:reqs]+vars ) -%></b>
38
+ <i>needs variables</i> <b><%= vars.keys.inspect -%></b>
39
+ </li>
40
+ <% end -%>
41
+ <% end -%>
42
+ </ul>
43
+ </div>
44
+ <% end -%>
45
+ </div>
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: caterpillar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Mikael Lammentausta
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-17 00:00:00 +02:00
13
+ default_executable: caterpillar
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: lportal
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.4
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.3
34
+ version:
35
+ description: = Caterpillar
36
+ email: mikael.lammentausta@gmail.com
37
+ executables:
38
+ - caterpillar
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README
43
+ - LICENSES.txt
44
+ files:
45
+ - Rakefile
46
+ - install.rb
47
+ - init.rb
48
+ - lib/caterpillar
49
+ - lib/caterpillar/config.rb
50
+ - lib/caterpillar/navigation.rb
51
+ - lib/caterpillar/liferay_portlet.rb
52
+ - lib/caterpillar/usage.rb
53
+ - lib/caterpillar/liferay.rb
54
+ - lib/caterpillar/version.rb
55
+ - lib/caterpillar/portlet.rb
56
+ - lib/caterpillar/parser.rb
57
+ - lib/caterpillar/util.rb
58
+ - lib/caterpillar/task.rb
59
+ - lib/caterpillar.rb
60
+ - lib/web
61
+ - lib/web/portlet_name.rb
62
+ - generators/caterpillar
63
+ - generators/caterpillar/templates
64
+ - generators/caterpillar/templates/stylesheets
65
+ - generators/caterpillar/templates/stylesheets/caterpillar
66
+ - generators/caterpillar/templates/stylesheets/caterpillar/caterpillar.css
67
+ - generators/caterpillar/templates/config
68
+ - generators/caterpillar/templates/config/portlets.rb
69
+ - generators/caterpillar/templates/images
70
+ - generators/caterpillar/templates/images/caterpillar
71
+ - generators/caterpillar/templates/images/caterpillar/caterpillar.gif
72
+ - generators/caterpillar/templates/javascripts
73
+ - generators/caterpillar/templates/javascripts/caterpillar
74
+ - generators/caterpillar/templates/javascripts/caterpillar/caterpillar.js
75
+ - generators/caterpillar/caterpillar_generator.rb
76
+ - generators/caterpillar/USAGE
77
+ - db/migrate
78
+ - db/migrate/20081205000001_lportal_portlets.rb
79
+ - db/migrate/20081205000002_lportal_sequences.rb
80
+ - views/caterpillar
81
+ - views/caterpillar/_navigation.html.erb
82
+ - README
83
+ - LICENSES.txt
84
+ has_rdoc: true
85
+ homepage: http://rails-portlet.rubyforge.org
86
+ post_install_message:
87
+ rdoc_options:
88
+ - --main
89
+ - README
90
+ - --line-numbers
91
+ - --inline-source
92
+ - -U
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ version:
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: "0"
106
+ version:
107
+ requirements: []
108
+
109
+ rubyforge_project: rails-portlet
110
+ rubygems_version: 1.3.1
111
+ signing_key:
112
+ specification_version: 2
113
+ summary: Caterpillar helps building Rails applications for JSR286 portlets.
114
+ test_files:
115
+ - test/portlets_test.rb
116
+ - test/xml_test.rb