caterpillar 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/generators/caterpillar/templates/stylesheets/caterpillar/caterpillar.css +9 -2
- data/lib/caterpillar.rb +1 -1
- data/lib/caterpillar/config.rb +3 -0
- data/lib/caterpillar/parser.rb +7 -4
- data/lib/caterpillar/task.rb +84 -2
- data/views/caterpillar/_navigation.html.erb +13 -11
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -11,6 +11,13 @@ filter:alpha(opacity=81);-moz-opacity:.81;opacity:.81;
|
|
11
11
|
|
12
12
|
.caterpillar_navigation ul {
|
13
13
|
list-style-type: none;
|
14
|
+
margin: 4px;
|
15
|
+
padding: 4px;
|
16
|
+
}
|
17
|
+
|
18
|
+
#caterpillar_categories {
|
19
|
+
width: 100%;
|
20
|
+
overflow: auto;
|
14
21
|
}
|
15
22
|
|
16
23
|
.cp_category {
|
@@ -26,9 +33,9 @@ background: white;
|
|
26
33
|
.cp_portlets {
|
27
34
|
float: break;
|
28
35
|
overflow: hidden;
|
29
|
-
margin: 0 40px 10px
|
36
|
+
margin: 0 40px 10px 0px;
|
30
37
|
border: 3px double green;
|
31
|
-
padding: 5px;
|
38
|
+
/* padding: 5px; */
|
32
39
|
}
|
33
40
|
|
34
41
|
.navlink {
|
data/lib/caterpillar.rb
CHANGED
data/lib/caterpillar/config.rb
CHANGED
@@ -28,6 +28,8 @@ module Caterpillar
|
|
28
28
|
|
29
29
|
attr_accessor :routes
|
30
30
|
|
31
|
+
attr_accessor :warbler_conf
|
32
|
+
|
31
33
|
# Sets sane defaults that are overridden in the config file.
|
32
34
|
def initialize
|
33
35
|
@rails_root = File.expand_path(defined?(RAILS_ROOT) ? RAILS_ROOT : Dir.getwd)
|
@@ -36,6 +38,7 @@ module Caterpillar
|
|
36
38
|
@instances = []
|
37
39
|
@javascripts = []
|
38
40
|
@include_all_named_routes = true
|
41
|
+
@warbler_conf = File.join(@rails_root,'config','warble.rb')
|
39
42
|
|
40
43
|
yield self if block_given?
|
41
44
|
end
|
data/lib/caterpillar/parser.rb
CHANGED
@@ -61,10 +61,6 @@ module Caterpillar
|
|
61
61
|
routes.delete(r)
|
62
62
|
end
|
63
63
|
end
|
64
|
-
# fix path variables to be replaced by rails-portlet at runtime
|
65
|
-
path.gsub!(/:uid/,'%UID%')
|
66
|
-
path.gsub!(/:gid/,'%GID%')
|
67
|
-
# TODO: notify user of unsupported variables
|
68
64
|
portlet.update( :path => path )
|
69
65
|
|
70
66
|
### javascripts
|
@@ -101,6 +97,13 @@ module Caterpillar
|
|
101
97
|
|
102
98
|
### javascripts
|
103
99
|
portlet.update( :javascripts => @config.javascripts ) unless portlet[:javascripts]
|
100
|
+
|
101
|
+
# fix path variables to be replaced by rails-portlet at runtime
|
102
|
+
path = portlet[:path]
|
103
|
+
path.gsub!(/:uid/,'%UID%')
|
104
|
+
path.gsub!(/:gid/,'%GID%')
|
105
|
+
# TODO: notify user of unsupported variables
|
106
|
+
portlet.update( :path => path )
|
104
107
|
end
|
105
108
|
|
106
109
|
return portlets
|
data/lib/caterpillar/task.rb
CHANGED
@@ -42,13 +42,14 @@ module Caterpillar
|
|
42
42
|
@name = name
|
43
43
|
@config = Util.eval_configuration(config)
|
44
44
|
yield self if block_given?
|
45
|
+
@xml_files = []
|
45
46
|
send tasks
|
46
47
|
end
|
47
48
|
|
48
49
|
private
|
49
50
|
|
50
51
|
def define_tasks
|
51
|
-
|
52
|
+
define_xml_task
|
52
53
|
define_usage_task
|
53
54
|
define_pluginize_task
|
54
55
|
define_environment_task
|
@@ -64,10 +65,15 @@ module Caterpillar
|
|
64
65
|
define_jar_install_task
|
65
66
|
define_jar_uninstall_task
|
66
67
|
define_jar_version_task
|
68
|
+
define_warble_task
|
69
|
+
define_deploy_task
|
70
|
+
define_deploy_xml_task
|
71
|
+
define_deploy_war_task
|
67
72
|
end
|
68
73
|
|
69
74
|
# the main XML generator task
|
70
|
-
def
|
75
|
+
def define_xml_task
|
76
|
+
@name = :xml
|
71
77
|
desc 'Create all XML files according to configuration'
|
72
78
|
tasks = [:parse,"#{@name}:portlet"]
|
73
79
|
if @config.container.kind_of? Liferay
|
@@ -164,6 +170,7 @@ module Caterpillar
|
|
164
170
|
else
|
165
171
|
file = 'portlet.xml'
|
166
172
|
end
|
173
|
+
@xml_files << file
|
167
174
|
with_namespace_and_config do |name, config|
|
168
175
|
desc 'Create JSR286 portlet XML'
|
169
176
|
task :portlet do
|
@@ -180,6 +187,7 @@ module Caterpillar
|
|
180
187
|
def define_liferayportletappxml_task
|
181
188
|
@name = :xml
|
182
189
|
file = 'liferay-portlet-ext.xml'
|
190
|
+
@xml_files << file
|
183
191
|
with_namespace_and_config do |name, config|
|
184
192
|
desc 'Create Liferay portlet XML'
|
185
193
|
task :liferayportletapp do
|
@@ -196,6 +204,7 @@ module Caterpillar
|
|
196
204
|
def define_liferaydisplayxml_task
|
197
205
|
@name = :xml
|
198
206
|
file = 'liferay-display.xml'
|
207
|
+
@xml_files << file
|
199
208
|
with_namespace_and_config do |name, config|
|
200
209
|
desc 'Create Liferay display XML'
|
201
210
|
task :liferaydisplay do
|
@@ -351,6 +360,79 @@ module Caterpillar
|
|
351
360
|
end
|
352
361
|
end
|
353
362
|
|
363
|
+
|
364
|
+
|
365
|
+
def define_warble_task
|
366
|
+
desc 'Create a WAR package with Warbler'
|
367
|
+
task :warble do
|
368
|
+
unless system('which warble')
|
369
|
+
info 'Warbler was not found in PATH, exiting'
|
370
|
+
exit 1
|
371
|
+
end
|
372
|
+
unless File.exists?(@config.warbler_conf)
|
373
|
+
info 'Warbler configuration file %s was not found, exiting' % @config.warbler_conf
|
374
|
+
exit 1
|
375
|
+
end
|
376
|
+
info 'building WAR package'
|
377
|
+
|
378
|
+
system('ruby -S warble war')
|
379
|
+
|
380
|
+
unless File.exists?(@config.servlet+'.war')
|
381
|
+
info 'cannot find the WAR file, exiting'
|
382
|
+
exit 1
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
def define_deploy_task
|
388
|
+
desc 'Deploy XML files and WAR package to the portlet container'
|
389
|
+
|
390
|
+
raise 'Only deployment to Liferay on Tomcat is supported' unless @config.container.kind_of? Liferay
|
391
|
+
tasks = [:xml, :warble, 'deploy:xml', 'deploy:war']
|
392
|
+
task :deploy => tasks
|
393
|
+
end
|
394
|
+
|
395
|
+
def define_deploy_xml_task
|
396
|
+
@name = :deploy
|
397
|
+
with_namespace_and_config do |name, config|
|
398
|
+
desc 'Deploys the XML files'
|
399
|
+
task :xml do
|
400
|
+
info 'deploying XML files'
|
401
|
+
target = @config.container.WEB_INF
|
402
|
+
|
403
|
+
@xml_files.each do |file|
|
404
|
+
system('cp %s %s' % [file,target])
|
405
|
+
info 'copied %s into %s' % [file,target]
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
def define_deploy_war_task
|
411
|
+
@name = :deploy
|
412
|
+
with_namespace_and_config do |name, config|
|
413
|
+
desc 'Deploys the WAR file'
|
414
|
+
task :war do
|
415
|
+
info 'deploying WAR package'
|
416
|
+
|
417
|
+
file = @config.servlet+'.war'
|
418
|
+
unless File.exists?(file)
|
419
|
+
info 'cannot find the WAR file %s, exiting' % file
|
420
|
+
exit 1
|
421
|
+
end
|
422
|
+
|
423
|
+
target = File.join(@config.container.root,'webapps')
|
424
|
+
info 'removing previous installs'
|
425
|
+
system('rm -rf %s' % File.join(target,@config.servlet+'*'))
|
426
|
+
system('cp %s %s' % [file,target])
|
427
|
+
info 'copied %s into %s' % [file,target]
|
428
|
+
|
429
|
+
end
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
354
436
|
def with_namespace_and_config
|
355
437
|
name, config = @name, @config
|
356
438
|
namespace name do
|
@@ -1,15 +1,17 @@
|
|
1
1
|
<div class="caterpillar_navigation">
|
2
2
|
<%# CATEGORIES -%>
|
3
|
-
|
4
|
-
|
5
|
-
<%
|
6
|
-
|
7
|
-
<%=
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
<%# categories = @caterpillar_navigation.keys -%>
|
4
|
+
<div id="caterpillar_categories">
|
5
|
+
<% @caterpillar_navigation.each_pair do |category,portlets| -%>
|
6
|
+
<% cat = category.gsub(' ','_') -%>
|
7
|
+
<span id="<%=cat-%>" class="cp_category">
|
8
|
+
<%= link_to_function( category,
|
9
|
+
"cp_toggle_category('%s',null);" % cat
|
10
|
+
)
|
11
|
+
-%>
|
12
|
+
</span>
|
13
|
+
<% end -%>
|
14
|
+
</div>
|
13
15
|
|
14
16
|
<%# PORTLET LINKS -%>
|
15
17
|
<% @caterpillar_navigation.each_pair do |category,portlets| -%>
|
@@ -34,7 +36,7 @@
|
|
34
36
|
end
|
35
37
|
-%>
|
36
38
|
<li>
|
37
|
-
<b><%= link_to( portlet[:title], portlet[:reqs]
|
39
|
+
<b><%= link_to( portlet[:title], portlet[:reqs].merge(vars) ) -%></b>
|
38
40
|
<i>needs variables</i> <b><%= vars.keys.inspect -%></b>
|
39
41
|
</li>
|
40
42
|
<% end -%>
|
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: 0.9.
|
4
|
+
version: 0.9.2
|
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: 2008-12-
|
12
|
+
date: 2008-12-19 00:00:00 +02:00
|
13
13
|
default_executable: caterpillar
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|