alchemy_cms 2.1.rc2 → 2.1.rc3
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/Gemfile +1 -0
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js +3 -3
- data/app/assets/stylesheets/alchemy/elements.css.scss +20 -9
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.css.scss +3 -2
- data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +1 -40
- data/app/helpers/alchemy/admin/contents_helper.rb +7 -1
- data/app/helpers/alchemy/admin/elements_helper.rb +1 -5
- data/app/helpers/alchemy/admin/essences_helper.rb +50 -6
- data/app/helpers/alchemy/elements_helper.rb +17 -11
- data/app/helpers/alchemy/pages_helper.rb +75 -56
- data/app/models/alchemy/content.rb +23 -14
- data/app/models/alchemy/element.rb +56 -46
- data/app/views/alchemy/admin/contents/_missing.html.erb +2 -1
- data/app/views/alchemy/admin/contents/create.js.erb +7 -6
- data/app/views/alchemy/admin/dashboard/index.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +11 -9
- data/app/views/alchemy/navigation/_renderer.html.erb +1 -1
- data/config/locales/alchemy.de.yml +1 -1
- data/config/locales/alchemy.en.yml +21 -21
- data/lib/alchemy/capistrano.rb +57 -48
- data/lib/alchemy/page_layout.rb +6 -8
- data/lib/alchemy/version.rb +1 -1
- data/spec/helpers/pages_helper_spec.rb +76 -2
- data/spec/integration/pages_controller_spec.rb +1 -1
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/element_spec.rb +23 -0
- metadata +32 -31
@@ -63,15 +63,24 @@ module Alchemy
|
|
63
63
|
self.element.contents
|
64
64
|
end
|
65
65
|
|
66
|
-
#
|
66
|
+
# Makes a copy of source and also copies the associated essence.
|
67
|
+
#
|
68
|
+
# You can pass a differences hash to update the attributes of the copy.
|
69
|
+
#
|
70
|
+
# === Example
|
71
|
+
#
|
72
|
+
# @copy = Alchemy::Content.copy(@content, {:element_id => 3})
|
73
|
+
# @copy.element_id # => 3
|
74
|
+
#
|
67
75
|
def self.copy(source, differences = {})
|
68
76
|
differences[:position] = nil
|
69
77
|
differences[:id] = nil
|
70
|
-
attributes = source.attributes.merge(differences)
|
71
|
-
content = self.create!(attributes
|
72
|
-
new_essence = content.essence.
|
73
|
-
new_essence.save
|
74
|
-
|
78
|
+
attributes = source.attributes.except("id").merge(differences)
|
79
|
+
content = self.create!(attributes)
|
80
|
+
new_essence = content.essence.class.new(content.essence.attributes.except('id'))
|
81
|
+
new_essence.save!
|
82
|
+
raise "Essence not cloned" if new_essence.id == content.essence_id
|
83
|
+
content.update_attribute(:essence_id, new_essence.id)
|
75
84
|
content
|
76
85
|
end
|
77
86
|
|
@@ -120,17 +129,17 @@ module Alchemy
|
|
120
129
|
|
121
130
|
# Returns a string to be passed to Rails form field tags to ensure we have same params layout everywhere.
|
122
131
|
#
|
123
|
-
# Example:
|
124
|
-
#
|
125
|
-
#
|
132
|
+
# === Example:
|
133
|
+
#
|
134
|
+
# <%= text_field_tag content.form_field_name, content.ingredient %>
|
135
|
+
#
|
136
|
+
# === Options:
|
126
137
|
#
|
127
|
-
# Options:
|
128
|
-
# ========
|
129
138
|
# You can pass an Essence column_name. Default is self.essence.ingredient_column
|
130
139
|
#
|
131
|
-
# Example:
|
132
|
-
#
|
133
|
-
#
|
140
|
+
# ==== Example:
|
141
|
+
#
|
142
|
+
# <%= text_field_tag content.form_field_name(:link), content.ingredient %>
|
134
143
|
#
|
135
144
|
def form_field_name(essence_column = self.essence.ingredient_column)
|
136
145
|
"contents[content_#{self.id}][#{essence_column}]"
|
@@ -166,6 +166,62 @@ module Alchemy
|
|
166
166
|
element_definitions
|
167
167
|
end
|
168
168
|
|
169
|
+
# List all elements for page_layout
|
170
|
+
def self.all_for_page(page)
|
171
|
+
raise TypeError if page.class.name != "Alchemy::Page"
|
172
|
+
# if page_layout has cells, collect elements from cells and group them by cellname
|
173
|
+
page_layout = Alchemy::PageLayout.get(page.page_layout)
|
174
|
+
if page_layout.blank?
|
175
|
+
logger.warn "\n++++++\nWARNING! Could not find page_layout description for page: #{page.name}\n++++++++\n"
|
176
|
+
return []
|
177
|
+
end
|
178
|
+
elements_for_layout = []
|
179
|
+
elements_for_layout += all_definitions_for(page_layout['elements'])
|
180
|
+
return [] if elements_for_layout.blank?
|
181
|
+
# all unique elements from this layout
|
182
|
+
unique_elements = elements_for_layout.select{ |m| m["unique"] == true }
|
183
|
+
elements_already_on_the_page = page.elements
|
184
|
+
# delete all elements from the elements that could be placed that are unique and already and the page
|
185
|
+
unique_elements.each do |unique_element|
|
186
|
+
elements_already_on_the_page.each do |already_placed_element|
|
187
|
+
if already_placed_element.name == unique_element["name"]
|
188
|
+
elements_for_layout.delete(unique_element)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
return elements_for_layout
|
193
|
+
end
|
194
|
+
|
195
|
+
def self.all_definitions_for(element_names)
|
196
|
+
return [] if element_names.blank?
|
197
|
+
if element_names.to_s == "all"
|
198
|
+
return element_descriptions
|
199
|
+
else
|
200
|
+
return definitions.select { |e| element_names.include? e['name'] }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# This methods does a copy of source and all depending contents and all of their depending essences.
|
205
|
+
#
|
206
|
+
# == Options
|
207
|
+
#
|
208
|
+
# You can pass a differences Hash as second option to update attributes for the copy.
|
209
|
+
#
|
210
|
+
# == Example
|
211
|
+
#
|
212
|
+
# @copy = Alchemy::Element.copy(@element, {:public => false})
|
213
|
+
# @copy.public? # => false
|
214
|
+
#
|
215
|
+
def self.copy(source, differences = {})
|
216
|
+
attributes = source.attributes.except("id").merge(differences)
|
217
|
+
element = self.create!(attributes.merge(:create_contents_after_create => false, :id => nil, :position => nil))
|
218
|
+
source.contents.each do |content|
|
219
|
+
new_content = Content.copy(content, :element_id => element.id)
|
220
|
+
new_content.move_to_bottom
|
221
|
+
end
|
222
|
+
element
|
223
|
+
end
|
224
|
+
|
169
225
|
def self.definitions
|
170
226
|
self.descriptions
|
171
227
|
end
|
@@ -417,52 +473,6 @@ module Alchemy
|
|
417
473
|
|
418
474
|
private
|
419
475
|
|
420
|
-
# List all elements for page_layout
|
421
|
-
def self.all_for_page(page)
|
422
|
-
raise TypeError if page.class.name != "Alchemy::Page"
|
423
|
-
# if page_layout has cells, collect elements from cells and group them by cellname
|
424
|
-
page_layout = Alchemy::PageLayout.get(page.page_layout)
|
425
|
-
if page_layout.blank?
|
426
|
-
logger.warn "\n++++++\nWARNING! Could not find page_layout description for page: #{page.name}\n++++++++\n"
|
427
|
-
return []
|
428
|
-
end
|
429
|
-
elements_for_layout = []
|
430
|
-
elements_for_layout += all_definitions_for(page_layout['elements'])
|
431
|
-
return [] if elements_for_layout.blank?
|
432
|
-
# all unique elements from this layout
|
433
|
-
unique_elements = elements_for_layout.select{ |m| m["unique"] == true }
|
434
|
-
elements_already_on_the_page = page.elements
|
435
|
-
# delete all elements from the elements that could be placed that are unique and already and the page
|
436
|
-
unique_elements.each do |unique_element|
|
437
|
-
elements_already_on_the_page.each do |already_placed_element|
|
438
|
-
if already_placed_element.name == unique_element["name"]
|
439
|
-
elements_for_layout.delete(unique_element)
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
return elements_for_layout
|
444
|
-
end
|
445
|
-
|
446
|
-
def self.all_definitions_for(element_names)
|
447
|
-
return [] if element_names.blank?
|
448
|
-
if element_names.to_s == "all"
|
449
|
-
return element_descriptions
|
450
|
-
else
|
451
|
-
return definitions.select { |e| element_names.include? e['name'] }
|
452
|
-
end
|
453
|
-
end
|
454
|
-
|
455
|
-
# makes a copy of source and makes copies of the contents from source
|
456
|
-
def self.copy(source, differences = {})
|
457
|
-
attributes = source.attributes.except("id").merge(differences)
|
458
|
-
element = self.create!(attributes.merge(:create_contents_after_create => false, :id => nil, :position => nil))
|
459
|
-
source.contents.each do |content|
|
460
|
-
new_content = Content.copy(content, :element_id => element.id)
|
461
|
-
new_content.move_to_bottom
|
462
|
-
end
|
463
|
-
element
|
464
|
-
end
|
465
|
-
|
466
476
|
# creates the contents for this element as described in the elements.yml
|
467
477
|
def create_contents
|
468
478
|
contents = []
|
@@ -7,7 +7,7 @@
|
|
7
7
|
:partial => "alchemy/essences/essence_picture_editor",
|
8
8
|
:locals => {
|
9
9
|
:content => @content,
|
10
|
-
:options => @options
|
10
|
+
:options => @options.symbolize_keys
|
11
11
|
}
|
12
12
|
)
|
13
13
|
) -%>');
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
<%- locals = {
|
30
30
|
:content => @content,
|
31
|
-
:options => {:as => 'text_field'}.merge(@options.nil? ? {} : @options)
|
31
|
+
:options => {:as => 'text_field'}.merge(@options.nil? ? {} : @options.symbolize_keys)
|
32
32
|
} -%>
|
33
33
|
|
34
34
|
<%- if params[:was_missing] -%>
|
@@ -50,14 +50,16 @@
|
|
50
50
|
) -%>');
|
51
51
|
Alchemy.reloadPreview();
|
52
52
|
Alchemy.closeCurrentWindow();
|
53
|
-
|
53
|
+
|
54
54
|
<%- end -%>
|
55
55
|
|
56
|
+
Alchemy.SelectBox("#element_<%= @element.id %> select");
|
57
|
+
|
56
58
|
<%- elsif @content.essence_type == "Alchemy::EssenceRichtext" -%>
|
57
59
|
|
58
60
|
<%- locals = {
|
59
61
|
:content => @content,
|
60
|
-
:options => (@options.nil? ? {} : @options)
|
62
|
+
:options => (@options.nil? ? {} : @options.symbolize_keys)
|
61
63
|
} -%>
|
62
64
|
|
63
65
|
<%- if params[:was_missing] -%>
|
@@ -90,7 +92,7 @@
|
|
90
92
|
:partial => "alchemy/essences/#{@content.essence_type.underscore}_editor",
|
91
93
|
:locals => {
|
92
94
|
:content => @content,
|
93
|
-
:options => (@options.nil? ? {} : @options)
|
95
|
+
:options => (@options.nil? ? {} : @options.symbolize_keys)
|
94
96
|
}
|
95
97
|
)
|
96
98
|
) -%>');
|
@@ -98,5 +100,4 @@
|
|
98
100
|
<%- end -%>
|
99
101
|
|
100
102
|
Alchemy.growl('<%= t("Successfully added content", :content => @content.name) -%>');
|
101
|
-
|
102
103
|
})(jQuery);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div id="dashboard">
|
2
2
|
<h1><%= t('Welcome back, %{name}', :name => current_user.firstname.blank? ? current_user.login : current_user.firstname) %></h1>
|
3
|
-
<h2><%= t('
|
3
|
+
<h2><%= t('Your last login was on %{time}', :time => l(current_user.last_login_at)) unless current_user.last_login_at.blank? %></h2>
|
4
4
|
|
5
5
|
<div class="widget">
|
6
6
|
<h2><%= t('Your last updated pages') %>:</h2>
|
@@ -16,7 +16,8 @@
|
|
16
16
|
<%- elsif content.settings[:display_as] == "select" -%>
|
17
17
|
|
18
18
|
<label><%= render_content_name(content) %></label>
|
19
|
-
|
19
|
+
|
20
|
+
<%- if options[:select_values].nil? -%>
|
20
21
|
<%= warning('options[:select_values] is nil', "No select values given. Please provide :select_values as argument to render_essence_editor_by_name() helper inside this element editor view.") %>
|
21
22
|
<%- else -%>
|
22
23
|
<%- if options[:select_values].is_a?(Hash)
|
@@ -36,7 +37,7 @@
|
|
36
37
|
content.form_field_name,
|
37
38
|
options_method,
|
38
39
|
{
|
39
|
-
:class => "essence_editor_select
|
40
|
+
:class => "essence_editor_select"
|
40
41
|
}
|
41
42
|
) %>
|
42
43
|
<%- end -%>
|
@@ -66,13 +67,14 @@
|
|
66
67
|
<%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
|
67
68
|
<%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
<span class="linkable_text_essence_tools">
|
71
|
+
<a href="#" onclick="Alchemy.LinkOverlay.open(this, 420); return false;" title="<%= t('place_link') -%>" class="icon_button <%= content.linked? ? ' linked' : '' -%>" name="essence_text_<%= content.id -%>" id="edit_link_<%= content.id -%>">
|
72
|
+
<span class="icon link"></span>
|
73
|
+
</a>
|
74
|
+
<a href="#" onclick="Alchemy.LinkOverlay.removeLink(this, <%= content.id -%>); return false;" title="<%= t('unlink') %>" class="icon_button unlink<%= content.linked? ? ' linked' : ' disabled' -%>" name="essence_text_<%= content.id -%>">
|
75
|
+
<span class="icon unlink"></span>
|
76
|
+
</a>
|
77
|
+
</span>
|
76
78
|
|
77
79
|
<%- end -%>
|
78
80
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%- end -%>
|
17
17
|
</li>
|
18
18
|
<%- unless options[:spacer].empty? -%>
|
19
|
-
<%= "<li class=\"navigation_spacer\">#{options[:spacer]}</li>" unless page == pages.to_a.last -%>
|
19
|
+
<%= raw "<li class=\"navigation_spacer\">#{options[:spacer]}</li>" unless page == pages.to_a.last -%>
|
20
20
|
<%- end -%>
|
21
21
|
<%- end -%>
|
22
22
|
</ul>
|
@@ -304,7 +304,7 @@ de:
|
|
304
304
|
"You have unsaved elements. Do you really want to close the elements window?": "Sie haben ungesicherte Elemente. Möchten Sie das Elemente Fenster wirklich schließen?"
|
305
305
|
"You may upload files with following extensions": "Sie können %{file_types_description} mit folgenden Endungen hochladen: %{file_types}"
|
306
306
|
"You may upload any file": "Sie können jede Art von Datei hochladen."
|
307
|
-
"
|
307
|
+
"Your last login was on %{time}": "Sie waren zuletzt angemeldet am %{time}."
|
308
308
|
"Your Alchemy Login": "Ihre Alchemy Zugangsdaten"
|
309
309
|
"Your credentials are": "Ihre Zugangsdaten lauten"
|
310
310
|
"Your last updated pages": "Ihre zuletzt bearbeiteten Seiten"
|
@@ -162,7 +162,7 @@ en:
|
|
162
162
|
overlay: Overlay
|
163
163
|
|
164
164
|
create_tree_as_new_language: "Create %{language} as a new language tree"
|
165
|
-
"Delete image": "Remove this image
|
165
|
+
"Delete image": "Remove this image"
|
166
166
|
"Image size": "Imagesize"
|
167
167
|
"Image deleted successfully": "Image deleted successfully."
|
168
168
|
"Mandatory": "Mandatory fields"
|
@@ -176,10 +176,10 @@ en:
|
|
176
176
|
"User created": "User created"
|
177
177
|
"User deleted": "User deleted"
|
178
178
|
"User updated": "User updated"
|
179
|
-
add_image_to_element: "Add an image
|
179
|
+
add_image_to_element: "Add an image"
|
180
180
|
align_in_text: "Alignment in text"
|
181
181
|
allow_fullscreen: "Allow fullscreen"
|
182
|
-
assign_file: "Assign a file
|
182
|
+
assign_file: "Assign a file"
|
183
183
|
assign_file_from_archive: "assign a file from your archive"
|
184
184
|
assign_image: "Assign an image"
|
185
185
|
auto_play: "Play movie after load"
|
@@ -195,19 +195,19 @@ en:
|
|
195
195
|
contactform_body: "Message Template"
|
196
196
|
content_essence_not_found: "Content essence not found"
|
197
197
|
content_not_found: "Field for content not present."
|
198
|
-
copy_element: "Copy this element
|
198
|
+
copy_element: "Copy this element"
|
199
199
|
copy_page: "Copy page"
|
200
200
|
"Create language": "Create a new language"
|
201
|
-
create_page: "Create a new subpage
|
202
|
-
create_user: "Create a new user
|
201
|
+
create_page: "Create a new subpage"
|
202
|
+
create_user: "Create a new user"
|
203
203
|
created_at: "Created at"
|
204
204
|
currently_edited_by: "This page is currently locked by"
|
205
205
|
cut_element: "Cut this element."
|
206
206
|
delete_file: "Delete this file from server."
|
207
|
-
delete_image: "Remove this image
|
208
|
-
delete_language: "Delete this language
|
209
|
-
delete_page: "Delete this page
|
210
|
-
delete_user: "Delete this user
|
207
|
+
delete_image: "Remove this image"
|
208
|
+
delete_language: "Delete this language"
|
209
|
+
delete_page: "Delete this page"
|
210
|
+
delete_user: "Delete this user"
|
211
211
|
document: "File"
|
212
212
|
documents: "Files"
|
213
213
|
download_file: "Download file '%{filename}'"
|
@@ -217,8 +217,8 @@ en:
|
|
217
217
|
edit_image_properties: "Edit image properties."
|
218
218
|
edit_language: "Edit language"
|
219
219
|
edit_page: "Edit this page"
|
220
|
-
edit_page_properties: "Edit the page properties."
|
221
|
-
edit_user: "Edit
|
220
|
+
edit_page_properties: "Edit the page´s properties."
|
221
|
+
edit_user: "Edit the user´s properties."
|
222
222
|
element_editor_not_found: "Error within this Element"
|
223
223
|
element_of_type: "Element"
|
224
224
|
element_saved: "Saved element."
|
@@ -256,7 +256,7 @@ en:
|
|
256
256
|
file: "File"
|
257
257
|
internal: "Internal"
|
258
258
|
link_title: "Linktitle"
|
259
|
-
logged_out: "You logged out successfully."
|
259
|
+
logged_out: "You´re logged out successfully."
|
260
260
|
mail_to: "Recipient"
|
261
261
|
male: "Male"
|
262
262
|
medium_thumbnails: "Medium thumbnails"
|
@@ -289,7 +289,7 @@ en:
|
|
289
289
|
page_locked: "This page is locked by another user."
|
290
290
|
page_properties: "page properties"
|
291
291
|
page_public: "published"
|
292
|
-
page_published: "Published page
|
292
|
+
page_published: "Published page"
|
293
293
|
page_restricted: "restricted"
|
294
294
|
page_status: "Status"
|
295
295
|
page_status_invisible_public: "Page is invisible in navigation but public."
|
@@ -329,7 +329,7 @@ en:
|
|
329
329
|
small_thumbnails: "Small thumbnails"
|
330
330
|
successfully_added_element: "Succesfully added new element."
|
331
331
|
successfully_saved_element_position: "Element position updated succesfully."
|
332
|
-
swap_image: "Change image
|
332
|
+
swap_image: "Change image"
|
333
333
|
swfupload:
|
334
334
|
cancel_uploads: "Cancel uploads"
|
335
335
|
title: "Title"
|
@@ -339,8 +339,8 @@ en:
|
|
339
339
|
unlock_page: "Leave page"
|
340
340
|
unlocked_page: "Unlocked page %{name}."
|
341
341
|
updated_at: "Updated at"
|
342
|
-
upload_file: "Upload file(s)
|
343
|
-
upload_image: "Upload image(s)
|
342
|
+
upload_file: "Upload file(s)"
|
343
|
+
upload_image: "Upload image(s)"
|
344
344
|
url_name: "URL-Name"
|
345
345
|
urlname_to_short: "The pages urlname is too short (minimum of 3 characters)"
|
346
346
|
username: "Username"
|
@@ -350,9 +350,9 @@ en:
|
|
350
350
|
width: "Width"
|
351
351
|
"You are already logged in": "You are already logged in."
|
352
352
|
"You may upload files with following extensions": "You may upload %{file_types_description} with following extensions: %{file_types}"
|
353
|
-
zoom_image: "Zoom this image
|
354
|
-
"Nothing found": "Nothing found
|
355
|
-
"Validation failed": "Validation failed
|
353
|
+
zoom_image: "Zoom this image"
|
354
|
+
"Nothing found": "Nothing found"
|
355
|
+
"Validation failed": "Validation failed"
|
356
356
|
|
357
357
|
# END of Alchemy translation
|
358
358
|
|
@@ -504,7 +504,7 @@ en:
|
|
504
504
|
frontpage_name: "Name of frontpage"
|
505
505
|
name: "Name"
|
506
506
|
page_layout: "Pagetype of frontpage"
|
507
|
-
public: "
|
507
|
+
public: "Public"
|
508
508
|
|
509
509
|
alchemy/page:
|
510
510
|
created_at: "Created at"
|
data/lib/alchemy/capistrano.rb
CHANGED
@@ -5,47 +5,47 @@ require "alchemy/mount_point"
|
|
5
5
|
|
6
6
|
Capistrano::Configuration.instance(:must_exist).load do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
before "deploy:start", "alchemy:seed"
|
8
|
+
after "deploy:setup", "alchemy:shared_folders:create"
|
9
|
+
after "deploy:symlink", "alchemy:shared_folders:symlink"
|
10
|
+
before "deploy:start", "alchemy:db:seed"
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
12
|
+
namespace :alchemy do
|
13
|
+
|
14
|
+
namespace :shared_folders do
|
15
|
+
|
16
|
+
# This task creates the shared folders for uploads, picture cache and ferret index while setting up your server.
|
17
|
+
# Call after deploy:setup like +after "deploy:setup", "alchemy:create_shared_folders"+ in your +deploy.rb+.
|
18
|
+
desc "Creates the uploads and picture cache directory in the shared folder. Call after deploy:setup"
|
19
|
+
task :create, :roles => :app do
|
20
|
+
run "mkdir -p #{shared_path}/index"
|
21
|
+
run "mkdir -p #{shared_path}/uploads/pictures"
|
22
|
+
run "mkdir -p #{shared_path}/uploads/attachments"
|
23
|
+
run "mkdir -p #{File.join(shared_path, 'cache', Capistrano::CLI.ui.ask("Where is Alchemy CMS mounted at? (/)"), 'pictures')}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# This task sets the symlinks for uploads, picture cache and ferret index folder.
|
27
|
+
# Call after deploy:symlink like +after "deploy:symlink", "alchemy:symlink_folders"+ in your +deploy.rb+.
|
28
|
+
desc "Sets the symlinks for uploads, picture cache and ferret index folder. Call after deploy:symlink"
|
29
|
+
task :symlink, :roles => :app do
|
30
|
+
run "rm -rf #{current_path}/uploads"
|
31
|
+
run "ln -nfs #{shared_path}/uploads #{current_path}/"
|
32
32
|
run "ln -nfs #{shared_path}/cache/* #{current_path}/public/"
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
run "rm -rf #{current_path}/index"
|
34
|
+
run "ln -nfs #{shared_path}/index #{current_path}/"
|
35
|
+
end
|
36
36
|
|
37
|
-
|
37
|
+
end
|
38
38
|
|
39
39
|
desc "Upgrades production database to current Alchemy CMS version"
|
40
40
|
task :upgrade do
|
41
41
|
run "cd #{current_path} && RAILS_ENV=production #{rake} alchemy:upgrade"
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
namespace :database_yml do
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
desc "Creates the database.yml file"
|
47
|
+
task :create do
|
48
|
+
db_config = ERB.new <<-EOF
|
49
49
|
production:
|
50
50
|
adapter: mysql
|
51
51
|
encoding: utf8
|
@@ -57,29 +57,38 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
57
57
|
socket: #{ Capistrano::CLI.ui.ask("Database socket: ") }
|
58
58
|
host: #{ Capistrano::CLI.ui.ask("Database host: ") }
|
59
59
|
EOF
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
run "mkdir -p #{shared_path}/config"
|
61
|
+
put db_config.result, "#{shared_path}/config/database.yml"
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
desc "Symlinks the database.yml file from shared folder into config folder"
|
65
|
+
task :symlink, :except => { :no_release => true } do
|
66
|
+
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
67
|
+
end
|
68
68
|
|
69
|
-
|
69
|
+
end
|
70
70
|
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
namespace :db do
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
task :rebuild_index, :roles => :app do
|
80
|
-
run "cd #{current_path} && RAILS_ENV=production #{rake} ferret:rebuild_index"
|
81
|
-
end
|
75
|
+
desc "Seeds the database with essential data."
|
76
|
+
task :seed, :roles => :app do
|
77
|
+
run "cd #{current_path} && RAILS_ENV=production #{rake} alchemy:db:seed"
|
78
|
+
end
|
82
79
|
|
83
|
-
|
80
|
+
end
|
81
|
+
|
82
|
+
namespace :ferret do
|
83
|
+
|
84
|
+
# This task rebuilds the ferret index for the EssenceText and EssenceRichtext Models.
|
85
|
+
# Call it before deploy:restart like +before "deploy:restart", "alchemy:rebuild_index"+ in your +deploy.rb+.
|
86
|
+
# It uses the +alchemy:rebuild_index+ rake task found in +vendor/plugins/alchemy/lib/tasks+.
|
87
|
+
desc "Rebuild the ferret index. Call before deploy:restart"
|
88
|
+
task :rebuild_index, :roles => :app do
|
89
|
+
run "cd #{current_path} && RAILS_ENV=production #{rake} ferret:rebuild_index"
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
84
93
|
|
85
94
|
end
|