alchemy_cms 3.4.2 → 3.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +9 -3
- data/.teatro.yml +1 -0
- data/.travis.yml +14 -17
- data/CHANGELOG.md +44 -6
- data/Gemfile +7 -4
- data/README.md +60 -10
- data/Rakefile +1 -1
- data/alchemy_cms.gemspec +5 -8
- data/app/assets/javascripts/alchemy/admin.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +9 -7
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +11 -7
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +8 -3
- data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +10 -0
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +104 -73
- data/app/assets/stylesheets/alchemy/_defaults.scss +1 -4
- data/app/assets/stylesheets/alchemy/_extends.scss +13 -35
- data/app/assets/stylesheets/alchemy/_mixins.scss +82 -18
- data/app/assets/stylesheets/alchemy/_variables.scss +21 -8
- data/app/assets/stylesheets/alchemy/admin.scss +4 -0
- data/app/assets/stylesheets/alchemy/archive.scss +8 -12
- data/app/assets/stylesheets/alchemy/attachments.scss +39 -0
- data/app/assets/stylesheets/alchemy/base.scss +26 -15
- data/app/assets/stylesheets/alchemy/buttons.scss +59 -31
- data/app/assets/stylesheets/alchemy/dashboard.scss +3 -3
- data/app/assets/stylesheets/alchemy/dialogs.scss +10 -8
- data/app/assets/stylesheets/alchemy/elements.scss +65 -41
- data/app/assets/stylesheets/alchemy/errors.scss +7 -0
- data/app/assets/stylesheets/alchemy/flash.scss +1 -1
- data/app/assets/stylesheets/alchemy/form_fields.scss +0 -37
- data/app/assets/stylesheets/alchemy/forms.scss +18 -27
- data/app/assets/stylesheets/alchemy/frame.scss +104 -204
- data/app/assets/stylesheets/alchemy/hints.scss +62 -0
- data/app/assets/stylesheets/alchemy/icon-font.scss +2 -1
- data/app/assets/stylesheets/alchemy/icons.scss +9 -4
- data/app/assets/stylesheets/alchemy/image_library.scss +6 -6
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +6 -4
- data/app/assets/stylesheets/alchemy/lists.scss +0 -1
- data/app/assets/stylesheets/alchemy/menubar.scss +3 -4
- data/app/assets/stylesheets/alchemy/modules.scss +0 -6
- data/app/assets/stylesheets/alchemy/navigation.scss +242 -0
- data/app/assets/stylesheets/alchemy/pagination.scss +3 -3
- data/app/assets/stylesheets/alchemy/print.scss +1 -0
- data/app/assets/stylesheets/alchemy/resource_info.scss +45 -0
- data/app/assets/stylesheets/alchemy/search.scss +72 -1
- data/app/assets/stylesheets/alchemy/selects.scss +38 -44
- data/app/assets/stylesheets/alchemy/sitemap.scss +89 -79
- data/app/assets/stylesheets/alchemy/tables.scss +6 -10
- data/app/assets/stylesheets/alchemy/toolbar.scss +7 -36
- data/app/assets/stylesheets/alchemy/upload.scss +12 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +6 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +58 -170
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +124 -148
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +426 -144
- data/app/controllers/alchemy/admin/attachments_controller.rb +24 -16
- data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +9 -8
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +1 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
- data/app/controllers/alchemy/admin/resources_controller.rb +2 -2
- data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
- data/app/controllers/alchemy/api/pages_controller.rb +16 -0
- data/app/controllers/alchemy/messages_controller.rb +1 -1
- data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +2 -2
- data/app/helpers/alchemy/admin/attachments_helper.rb +11 -0
- data/app/helpers/alchemy/admin/base_helper.rb +37 -4
- data/app/helpers/alchemy/admin/contents_helper.rb +11 -4
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -19
- data/app/helpers/alchemy/admin/essences_helper.rb +7 -30
- data/app/helpers/alchemy/admin/navigation_helper.rb +13 -51
- data/app/helpers/alchemy/admin/pages_helper.rb +21 -16
- data/app/helpers/alchemy/admin/pictures_helper.rb +9 -0
- data/app/helpers/alchemy/deprecated_pages_helper.rb +54 -0
- data/app/helpers/alchemy/essences_helper.rb +1 -1
- data/app/helpers/alchemy/pages_helper.rb +8 -109
- data/app/helpers/alchemy/url_helper.rb +8 -13
- data/app/models/alchemy/attachment.rb +7 -4
- data/app/models/alchemy/cell.rb +2 -2
- data/app/models/alchemy/content.rb +2 -2
- data/app/models/alchemy/content/factory.rb +12 -9
- data/app/models/alchemy/element.rb +6 -3
- data/app/models/alchemy/essence_file.rb +1 -1
- data/app/models/alchemy/essence_picture.rb +37 -47
- data/app/models/alchemy/essence_picture_view.rb +8 -1
- data/app/models/alchemy/folded_page.rb +3 -2
- data/app/models/alchemy/legacy_page_url.rb +3 -3
- data/app/models/alchemy/page.rb +50 -5
- data/app/models/alchemy/page/fixed_attributes.rb +63 -0
- data/app/models/alchemy/page/page_elements.rb +10 -7
- data/app/models/alchemy/page/page_natures.rb +19 -0
- data/app/models/alchemy/picture.rb +1 -0
- data/app/models/alchemy/picture/transformations.rb +1 -1
- data/app/models/alchemy/picture/url.rb +82 -0
- data/app/serializers/alchemy/page_tree_serializer.rb +29 -8
- data/app/views/alchemy/_edit_mode.html.erb +2 -0
- data/app/views/alchemy/_menubar.html.erb +1 -1
- data/app/views/alchemy/_preview_mode_code.html.erb +6 -0
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +25 -5
- data/app/views/alchemy/admin/attachments/_replace_button.html.erb +26 -0
- data/app/views/alchemy/admin/attachments/index.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/show.html.erb +52 -0
- data/app/views/alchemy/admin/elements/_element_header.html.erb +6 -3
- data/app/views/alchemy/admin/elements/create.js.erb +0 -2
- data/app/views/alchemy/admin/elements/trash.js.erb +0 -1
- data/app/views/alchemy/admin/elements/update.js.erb +0 -2
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -4
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +1 -1
- data/app/views/alchemy/admin/languages/index.html.erb +1 -0
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +26 -27
- data/app/views/alchemy/admin/layoutpages/edit.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_form.html.erb +13 -40
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +119 -61
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +4 -2
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +12 -12
- data/app/views/alchemy/admin/pages/_page_status.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_publication_fields.html.erb +35 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +13 -2
- data/app/views/alchemy/admin/pages/index.html.erb +3 -8
- data/app/views/alchemy/admin/pages/info.html.erb +15 -2
- data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +1 -14
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -8
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +4 -4
- data/app/views/alchemy/admin/partials/_search_form.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +9 -6
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/show.html.erb +1 -6
- data/app/views/alchemy/admin/uploader/_button.html.erb +4 -4
- data/app/views/alchemy/base/500.html.erb +15 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +13 -15
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +2 -7
- data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_html_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +47 -49
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +27 -29
- data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +17 -19
- data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -2
- data/app/views/alchemy/pages/_meta_data.html.erb +9 -0
- data/app/views/layouts/alchemy/admin.html.erb +9 -11
- data/bin/alchemy +1 -2
- data/config/alchemy/config.yml +1 -1
- data/config/alchemy/modules.yml +0 -16
- data/config/initializers/dragonfly.rb +0 -18
- data/config/initializers/mini_profiler.rb +6 -0
- data/config/locales/alchemy.de.yml +9 -1
- data/config/locales/alchemy.en.yml +7 -1
- data/config/locales/alchemy.es.yml +6 -0
- data/config/locales/alchemy.fr.yml +2 -0
- data/config/locales/alchemy.it.yml +3 -1
- data/config/locales/alchemy.nl.yml +2 -0
- data/config/locales/alchemy.ru.yml +2 -0
- data/config/routes.rb +3 -8
- data/db/migrate/20160912223112_add_index_to_alchemy_pages_rgt.rb +9 -0
- data/db/migrate/20160927205604_add_foreign_key_indices_and_null_constraints.rb +20 -0
- data/db/migrate/20160928080104_add_foreign_keys.rb +27 -0
- data/lib/alchemy/admin/locale.rb +4 -3
- data/lib/alchemy/engine.rb +2 -4
- data/lib/alchemy/errors.rb +9 -2
- data/lib/alchemy/forms/builder.rb +8 -0
- data/lib/alchemy/modules.rb +20 -19
- data/lib/alchemy/permissions.rb +15 -4
- data/lib/alchemy/resources_helper.rb +4 -2
- data/lib/alchemy/sass_support.rb +9 -0
- data/lib/alchemy/seeder.rb +89 -1
- data/lib/alchemy/test_support/essence_shared_examples.rb +2 -0
- data/lib/alchemy/test_support/factories/attachment_factory.rb +1 -1
- data/lib/alchemy/test_support/factories/content_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/element_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/picture_factory.rb +1 -1
- data/lib/alchemy/test_support/fixtures/image.png +0 -0
- data/lib/alchemy/tinymce.rb +2 -6
- data/lib/alchemy/upgrader.rb +4 -55
- data/lib/alchemy/upgrader/tasks/install_dragonfly_config.rb +14 -0
- data/lib/alchemy/upgrader/three_point_five.rb +32 -0
- data/lib/alchemy/upgrader/three_point_four.rb +2 -8
- data/lib/alchemy/upgrader/three_point_one.rb +30 -30
- data/lib/alchemy/upgrader/three_point_three.rb +31 -31
- data/lib/alchemy/upgrader/three_point_two.rb +25 -25
- data/lib/alchemy/upgrader/three_point_zero.rb +59 -59
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.erb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.haml +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.slim +1 -1
- data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -3
- data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +1 -1
- data/lib/rails/generators/alchemy/install/files/application.html.erb +3 -4
- data/lib/rails/generators/alchemy/install/install_generator.rb +4 -0
- data/lib/rails/generators/alchemy/install/templates/dragonfly.rb.tt +35 -0
- data/lib/rails/generators/alchemy/module/module_generator.rb +1 -1
- data/lib/tasks/alchemy/db.rake +6 -0
- data/lib/tasks/alchemy/tidy.rake +85 -0
- data/lib/tasks/alchemy/upgrade.rake +165 -16
- data/vendor/assets/javascripts/clipboard.min.js +7 -0
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +4 -4
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +2 -2
- data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +29 -14
- data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/es.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/fr.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/it.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/nl.js +3 -3
- data/vendor/assets/javascripts/tinymce/tinymce.min.js +15 -12
- metadata +44 -88
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +0 -1
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +0 -1
- data/app/controllers/alchemy/pictures_controller.rb +0 -97
- data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +0 -8
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +0 -1
data/lib/alchemy/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<div class="<%= @element_name %>_images">
|
5
5
|
<%%- element.contents.gallery_pictures.each do |image| -%>
|
6
6
|
<div class="<%= @element_name %>_image <%%= image.essence.css_class %>">
|
7
|
-
<%%= render_essence_view(image,
|
7
|
+
<%%= render_essence_view(image, size: '160x120') %>
|
8
8
|
</div>
|
9
9
|
<%%- end -%>
|
10
10
|
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
.<%= @element_name %>_images
|
5
5
|
- element.contents.gallery_pictures.each do |image|
|
6
6
|
.<%= @element_name %>_image{class: image.essence.css_class}
|
7
|
-
= render_essence_view(image,
|
7
|
+
= render_essence_view(image, size: "160x120")
|
8
8
|
<%- end -%>
|
9
9
|
<%- @contents.each do |content| -%>
|
10
10
|
<%- if @contents.length > 1 -%>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
.<%= @element_name %>_images
|
5
5
|
- element.contents.gallery_pictures.each do |image|
|
6
6
|
.<%= @element_name %>_image class=image.essence.css_class
|
7
|
-
= render_essence_view(image,
|
7
|
+
= render_essence_view(image, size: "160x120")
|
8
8
|
<%- end -%>
|
9
9
|
<%- @contents.each do |content| -%>
|
10
10
|
<%- if @contents.length > 1 -%>
|
@@ -5,13 +5,11 @@
|
|
5
5
|
|
6
6
|
Please consult Alchemy::Content.rb docs for further methods on the content object
|
7
7
|
%>
|
8
|
-
<%% cache(content) do %>
|
9
8
|
<div class="content_editor <%= @essence_name.classify.demodulize.underscore %>" id="<%%= content.dom_id %>" data-content-id="<%%= content.id %>">
|
10
9
|
<%%= content_label(content) %>
|
11
10
|
<%%= text_field_tag(
|
12
11
|
content.form_field_name,
|
13
12
|
content.ingredient,
|
14
|
-
:
|
13
|
+
id: content.form_field_id
|
15
14
|
) %>
|
16
15
|
</div>
|
17
|
-
<%% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%- cache(element) do -%>
|
2
2
|
<%= element_view_for(element, tag: 'article') do |el| -%>
|
3
3
|
<h2><%= el.render :headline %></h2>
|
4
|
-
<%= el.render :picture,
|
4
|
+
<%= el.render :picture, size: '1200x600' %>
|
5
5
|
<%= el.render :text %>
|
6
6
|
<%- end -%>
|
7
7
|
<%- end -%>
|
@@ -1,14 +1,13 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html>
|
2
|
+
<html lang="<%= @page.language_code %>">
|
3
3
|
<head>
|
4
|
-
<%=
|
4
|
+
<%= render "alchemy/pages/meta_data" %>
|
5
5
|
<%= stylesheet_link_tag 'application', media: 'all' %>
|
6
6
|
<%= javascript_include_tag 'application' %>
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
</head>
|
9
9
|
<body>
|
10
10
|
<%= yield %>
|
11
|
-
<%=
|
12
|
-
<%= render "alchemy/menubar" %>
|
11
|
+
<%= render "alchemy/edit_mode" %>
|
13
12
|
</body>
|
14
13
|
</html>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# AlchemyCMS Dragonfly configuration.
|
2
|
+
#
|
3
|
+
# Consider using some kind of caching solution for image processing.
|
4
|
+
# For small projects, we have good experience with Rack::Cache.
|
5
|
+
#
|
6
|
+
# Larger installations should consider using a CDN, start reading
|
7
|
+
# http://markevans.github.io/dragonfly/cache/
|
8
|
+
#
|
9
|
+
# A complete reference can be found at
|
10
|
+
# http://markevans.github.io/dragonfly/configuration/
|
11
|
+
#
|
12
|
+
# Pictures
|
13
|
+
#
|
14
|
+
Dragonfly.app(:alchemy_pictures).configure do
|
15
|
+
dragonfly_url nil
|
16
|
+
plugin :imagemagick
|
17
|
+
plugin :svg
|
18
|
+
secret '<%= SecureRandom.hex(32) %>'
|
19
|
+
url_format '/pictures/:job/:name.:ext'
|
20
|
+
|
21
|
+
datastore :file,
|
22
|
+
root_path: Rails.root.join('uploads/pictures').to_s,
|
23
|
+
server_root: Rails.root.join('public'),
|
24
|
+
store_meta: false
|
25
|
+
end
|
26
|
+
|
27
|
+
# Mount as middleware
|
28
|
+
Rails.application.middleware.use Dragonfly::Middleware, :alchemy_pictures
|
29
|
+
|
30
|
+
# Attachments
|
31
|
+
Dragonfly.app(:alchemy_attachments).configure do
|
32
|
+
datastore :file,
|
33
|
+
root_path: Rails.root.join('uploads/attachments').to_s,
|
34
|
+
store_meta: false
|
35
|
+
end
|
@@ -20,7 +20,7 @@ module Alchemy
|
|
20
20
|
|
21
21
|
def copy_templates
|
22
22
|
template "controller.rb.tt", "app/controllers/admin/#{@controller_name}_controller.rb"
|
23
|
-
template "ability.rb.tt",
|
23
|
+
template "ability.rb.tt", 'app/models', "alchemy_#{@module_name}_ability.rb"
|
24
24
|
template "module_config.rb.tt", "config/initializers/alchemy_#{@module_name}.rb"
|
25
25
|
end
|
26
26
|
end
|
data/lib/tasks/alchemy/db.rake
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
require 'shellwords'
|
2
|
+
require 'alchemy/seeder'
|
2
3
|
require 'alchemy/tasks/helpers'
|
3
4
|
include Alchemy::Tasks::Helpers
|
4
5
|
|
5
6
|
namespace :alchemy do
|
6
7
|
namespace :db do
|
8
|
+
desc "Seeds the database with Alchemy defaults"
|
9
|
+
task seed: [:environment] do
|
10
|
+
Alchemy::Seeder.seed!
|
11
|
+
end
|
12
|
+
|
7
13
|
desc "Dumps the database to STDOUT (Pass DUMP_FILENAME to store the dump into a file)."
|
8
14
|
task dump: :environment do
|
9
15
|
dump_store = ENV['DUMP_FILENAME'] ? " > #{ENV['DUMP_FILENAME']}" : ""
|
data/lib/tasks/alchemy/tidy.rake
CHANGED
@@ -7,6 +7,7 @@ namespace :alchemy do
|
|
7
7
|
Rake::Task['alchemy:tidy:cells'].invoke
|
8
8
|
Rake::Task['alchemy:tidy:element_positions'].invoke
|
9
9
|
Rake::Task['alchemy:tidy:content_positions'].invoke
|
10
|
+
Rake::Task['alchemy:tidy:remove_orphaned_records'].invoke
|
10
11
|
end
|
11
12
|
|
12
13
|
desc "Creates missing cells for pages."
|
@@ -33,6 +34,28 @@ namespace :alchemy do
|
|
33
34
|
task content_positions: [:environment] do
|
34
35
|
Alchemy::Tidy.update_content_positions
|
35
36
|
end
|
37
|
+
|
38
|
+
desc "Remove orphaned records (cells, elements, contents)."
|
39
|
+
task remove_orphaned_records: [:environment] do
|
40
|
+
Rake::Task['alchemy:tidy:remove_orphaned_cells'].invoke
|
41
|
+
Rake::Task['alchemy:tidy:remove_orphaned_elements'].invoke
|
42
|
+
Rake::Task['alchemy:tidy:remove_orphaned_contents'].invoke
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Remove orphaned cells."
|
46
|
+
task remove_orphaned_cells: [:environment] do
|
47
|
+
Alchemy::Tidy.remove_orphaned_cells
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Remove orphaned elements."
|
51
|
+
task remove_orphaned_elements: [:environment] do
|
52
|
+
Alchemy::Tidy.remove_orphaned_elements
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Remove orphaned contents."
|
56
|
+
task remove_orphaned_contents: [:environment] do
|
57
|
+
Alchemy::Tidy.remove_orphaned_contents
|
58
|
+
end
|
36
59
|
end
|
37
60
|
end
|
38
61
|
|
@@ -97,5 +120,67 @@ module Alchemy
|
|
97
120
|
end
|
98
121
|
end
|
99
122
|
end
|
123
|
+
|
124
|
+
def self.remove_orphaned_cells
|
125
|
+
puts "\n## Removing orphaned cells"
|
126
|
+
cells = Alchemy::Cell.unscoped.all
|
127
|
+
if cells.any?
|
128
|
+
orphaned_cells = cells.select do |cell|
|
129
|
+
cell.page.nil? && cell.page_id.present?
|
130
|
+
end
|
131
|
+
if orphaned_cells.any?
|
132
|
+
destroy_orphaned_records(orphaned_cells, 'cell')
|
133
|
+
else
|
134
|
+
log "No orphaned cells found", :skip
|
135
|
+
end
|
136
|
+
else
|
137
|
+
log "No cells found", :skip
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def self.remove_orphaned_elements
|
142
|
+
puts "\n## Removing orphaned elements"
|
143
|
+
elements = Alchemy::Element.unscoped.all
|
144
|
+
if elements.any?
|
145
|
+
orphaned_elements = elements.select do |element|
|
146
|
+
element.page.nil? && element.page_id.present? ||
|
147
|
+
element.cell.nil? && element.cell_id.present?
|
148
|
+
end
|
149
|
+
if orphaned_elements.any?
|
150
|
+
destroy_orphaned_records(orphaned_elements, 'element')
|
151
|
+
else
|
152
|
+
log "No orphaned elements found", :skip
|
153
|
+
end
|
154
|
+
else
|
155
|
+
log "No elements found", :skip
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.remove_orphaned_contents
|
160
|
+
puts "\n## Removing orphaned contents"
|
161
|
+
contents = Alchemy::Content.unscoped.all
|
162
|
+
if contents.any?
|
163
|
+
orphaned_contents = contents.select do |content|
|
164
|
+
content.essence.nil? && content.essence_id.present? ||
|
165
|
+
content.element.nil? && content.element_id.present?
|
166
|
+
end
|
167
|
+
if orphaned_contents.any?
|
168
|
+
destroy_orphaned_records(orphaned_contents, 'content')
|
169
|
+
else
|
170
|
+
log "No orphaned contents found", :skip
|
171
|
+
end
|
172
|
+
else
|
173
|
+
log "No contents found", :skip
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
private
|
178
|
+
|
179
|
+
def self.destroy_orphaned_records(records, class_name)
|
180
|
+
records.each do |record|
|
181
|
+
log "Destroy orphaned #{class_name}: #{record.id}"
|
182
|
+
record.destroy
|
183
|
+
end
|
184
|
+
end
|
100
185
|
end
|
101
186
|
end
|
@@ -2,25 +2,36 @@ require 'alchemy/upgrader'
|
|
2
2
|
require 'alchemy/version'
|
3
3
|
|
4
4
|
namespace :alchemy do
|
5
|
-
desc "Upgrades
|
6
|
-
task upgrade:
|
7
|
-
|
5
|
+
desc "Upgrades your app to AlchemyCMS v#{Alchemy::VERSION}."
|
6
|
+
task upgrade: [
|
7
|
+
'alchemy:upgrade:prepare',
|
8
|
+
'alchemy:upgrade:3.0:run', 'alchemy:upgrade:3.0:todo',
|
9
|
+
'alchemy:upgrade:3.1:todo',
|
10
|
+
'alchemy:upgrade:3.2:run', 'alchemy:upgrade:3.2:todo',
|
11
|
+
'alchemy:upgrade:3.3:run', 'alchemy:upgrade:3.3:todo',
|
12
|
+
'alchemy:upgrade:3.4:run',
|
13
|
+
'alchemy:upgrade:3.5:run', 'alchemy:upgrade:3.5:todo'
|
14
|
+
] do
|
15
|
+
Alchemy::Upgrader.display_todos
|
8
16
|
end
|
9
17
|
|
10
18
|
namespace :upgrade do
|
11
|
-
desc
|
12
|
-
task
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
desc 'Alchemy Upgrader: Prepares the database and updates Alchemys configuration file.'
|
20
|
+
task prepare: [
|
21
|
+
'alchemy:upgrade:database',
|
22
|
+
'alchemy:upgrade:config'
|
23
|
+
]
|
24
|
+
|
25
|
+
desc "Alchemy Upgrader: Prepares the database."
|
26
|
+
task :database => [
|
27
|
+
'alchemy:install:migrations',
|
28
|
+
'db:migrate',
|
29
|
+
'alchemy:db:seed'
|
30
|
+
]
|
31
|
+
|
32
|
+
desc "Alchemy Upgrader: Copy configuration file."
|
33
|
+
task config: [:environment] do |t|
|
34
|
+
Alchemy::Upgrader.copy_new_config_file
|
24
35
|
end
|
25
36
|
|
26
37
|
task fix_picture_format: [:environment] do
|
@@ -28,5 +39,143 @@ namespace :alchemy do
|
|
28
39
|
picture.update_column(:image_file_format, picture.image_file_format.to_s.chomp)
|
29
40
|
end
|
30
41
|
end
|
42
|
+
|
43
|
+
desc 'Upgrade Alchemy to v3.0'
|
44
|
+
task '3.0' => [
|
45
|
+
'alchemy:upgrade:prepare',
|
46
|
+
'alchemy:upgrade:3.0:run',
|
47
|
+
'alchemy:upgrade:3.0:todo'
|
48
|
+
] do
|
49
|
+
Alchemy::Upgrader.display_todos
|
50
|
+
end
|
51
|
+
|
52
|
+
namespace '3.0' do
|
53
|
+
task run: [
|
54
|
+
'alchemy:upgrade:3.0:rename_registered_role_ro_member',
|
55
|
+
'alchemy:upgrade:3.0:publish_unpublished_public_pages'
|
56
|
+
]
|
57
|
+
|
58
|
+
desc 'Rename the `registered` user role to `member`'
|
59
|
+
task rename_registered_role_ro_member: [:environment] do |t|
|
60
|
+
Alchemy::Upgrader::ThreePointZero.rename_registered_role_ro_member
|
61
|
+
end
|
62
|
+
|
63
|
+
desc 'Sets `published_at` of public pages without a `published_at` date set to their `updated_at` value'
|
64
|
+
task publish_unpublished_public_pages: [:environment] do |t|
|
65
|
+
Alchemy::Upgrader::ThreePointZero.publish_unpublished_public_pages
|
66
|
+
end
|
67
|
+
|
68
|
+
task :todo do |t|
|
69
|
+
Alchemy::Upgrader::ThreePointZero.alchemy_3_0_todos
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Upgrade Alchemy to v3.1'
|
74
|
+
task '3.1' => [
|
75
|
+
'alchemy:upgrade:prepare',
|
76
|
+
'alchemy:upgrade:3.1:todo'
|
77
|
+
] do
|
78
|
+
Alchemy::Upgrader.display_todos
|
79
|
+
end
|
80
|
+
|
81
|
+
namespace '3.1' do
|
82
|
+
task :todo do |t|
|
83
|
+
Alchemy::Upgrader::ThreePointOne.alchemy_3_1_todos
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc 'Upgrade Alchemy to v3.2'
|
88
|
+
task '3.2' => [
|
89
|
+
'alchemy:upgrade:prepare',
|
90
|
+
'alchemy:upgrade:3.2:run',
|
91
|
+
'alchemy:upgrade:3.2:todo'
|
92
|
+
] do
|
93
|
+
Alchemy::Upgrader.display_todos
|
94
|
+
end
|
95
|
+
|
96
|
+
namespace '3.2' do
|
97
|
+
task run: [
|
98
|
+
'alchemy:upgrade:3.2:upgrade_acts_as_taggable_on_migrations',
|
99
|
+
'alchemy:upgrade:3.2:inject_seeder'
|
100
|
+
]
|
101
|
+
|
102
|
+
desc 'Install and patch acts_as_taggable_on migrations.'
|
103
|
+
task upgrade_acts_as_taggable_on_migrations: [:environment] do |t|
|
104
|
+
Alchemy::Upgrader::ThreePointTwo.upgrade_acts_as_taggable_on_migrations
|
105
|
+
end
|
106
|
+
|
107
|
+
desc 'Add Alchemy seeder to `db/seeds.rb` file.'
|
108
|
+
task inject_seeder: [:environment] do |t|
|
109
|
+
Alchemy::Upgrader::ThreePointTwo.inject_seeder
|
110
|
+
end
|
111
|
+
|
112
|
+
task :todo do |t|
|
113
|
+
Alchemy::Upgrader::ThreePointTwo.alchemy_3_2_todos
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
desc 'Upgrade Alchemy to v3.3'
|
118
|
+
task '3.3' => [
|
119
|
+
'alchemy:upgrade:prepare',
|
120
|
+
'alchemy:upgrade:3.3:run',
|
121
|
+
'alchemy:upgrade:3.3:todo'
|
122
|
+
] do
|
123
|
+
Alchemy::Upgrader.display_todos
|
124
|
+
end
|
125
|
+
|
126
|
+
namespace '3.3' do
|
127
|
+
task run: [
|
128
|
+
'alchemy:upgrade:3.3:convert_available_contents',
|
129
|
+
'alchemy:upgrade:3.3:migrate_existing_elements'
|
130
|
+
]
|
131
|
+
|
132
|
+
desc 'Convert `available_contents` config to `nestable_elements`.'
|
133
|
+
task convert_available_contents: [:environment] do |t|
|
134
|
+
Alchemy::Upgrader::ThreePointThree.convert_available_contents
|
135
|
+
end
|
136
|
+
|
137
|
+
desc 'Migrate existing elements to `nestable_elements`.'
|
138
|
+
task migrate_existing_elements: [:environment] do |t|
|
139
|
+
Alchemy::Upgrader::ThreePointThree.migrate_existing_elements
|
140
|
+
end
|
141
|
+
|
142
|
+
task :todo do |t|
|
143
|
+
Alchemy::Upgrader::ThreePointThree.alchemy_3_3_todos
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
desc 'Upgrade Alchemy to v3.4'
|
148
|
+
task '3.4' => ['alchemy:upgrade:prepare', 'alchemy:upgrade:3.4:run']
|
149
|
+
|
150
|
+
namespace '3.4' do
|
151
|
+
task run: ['alchemy:upgrade:3.4:install_asset_manifests']
|
152
|
+
|
153
|
+
desc 'Install asset manifests into `vendor/assets`'
|
154
|
+
task install_asset_manifests: [:environment] do |t|
|
155
|
+
Alchemy::Upgrader::ThreePointFour.install_asset_manifests
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
desc 'Upgrade Alchemy to v3.5'
|
160
|
+
task '3.5' => [
|
161
|
+
'alchemy:upgrade:prepare',
|
162
|
+
'alchemy:upgrade:3.5:run',
|
163
|
+
'alchemy:upgrade:3.5:todo'
|
164
|
+
] do
|
165
|
+
Alchemy::Upgrader.display_todos
|
166
|
+
end
|
167
|
+
|
168
|
+
namespace '3.5' do
|
169
|
+
task run: ['alchemy:upgrade:3.5:install_dragonfly_config']
|
170
|
+
|
171
|
+
desc 'Install dragonfly config into `config/initializers`'
|
172
|
+
task install_dragonfly_config: [:environment] do |t|
|
173
|
+
Alchemy::Upgrader::ThreePointFive.install_dragonfly_config
|
174
|
+
end
|
175
|
+
|
176
|
+
task :todo do |t|
|
177
|
+
Alchemy::Upgrader::ThreePointFive.alchemy_3_5_todos
|
178
|
+
end
|
179
|
+
end
|
31
180
|
end
|
32
181
|
end
|