alchemy_cms 4.0.0.rc2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -1
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +18 -0
  5. data/Gemfile +2 -1
  6. data/README.md +4 -11
  7. data/alchemy_cms.gemspec +3 -3
  8. data/app/assets/stylesheets/alchemy/_extends.scss +1 -2
  9. data/app/assets/stylesheets/alchemy/_mixins.scss +0 -8
  10. data/app/assets/stylesheets/alchemy/_variables.scss +2 -0
  11. data/app/assets/stylesheets/alchemy/archive.scss +23 -52
  12. data/app/assets/stylesheets/alchemy/base.scss +10 -8
  13. data/app/assets/stylesheets/alchemy/buttons.scss +3 -4
  14. data/app/assets/stylesheets/alchemy/dashboard.scss +0 -2
  15. data/app/assets/stylesheets/alchemy/dialogs.scss +13 -14
  16. data/app/assets/stylesheets/alchemy/elements.scss +41 -51
  17. data/app/assets/stylesheets/alchemy/forms.scss +0 -3
  18. data/app/assets/stylesheets/alchemy/frame.scss +0 -3
  19. data/app/assets/stylesheets/alchemy/image_library.scss +0 -3
  20. data/app/assets/stylesheets/alchemy/jquery.datetimepicker.scss +0 -2
  21. data/app/assets/stylesheets/alchemy/lists.scss +1 -0
  22. data/app/assets/stylesheets/alchemy/navigation.scss +1 -4
  23. data/app/assets/stylesheets/alchemy/pagination.scss +1 -3
  24. data/app/assets/stylesheets/alchemy/selects.scss +2 -2
  25. data/app/assets/stylesheets/alchemy/sitemap.scss +1 -1
  26. data/app/assets/stylesheets/alchemy/upload.scss +0 -1
  27. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +0 -2
  28. data/app/helpers/alchemy/elements_helper.rb +12 -2
  29. data/app/models/alchemy/essence_picture.rb +28 -10
  30. data/app/models/alchemy/essence_picture_view.rb +1 -1
  31. data/app/models/alchemy/picture/transformations.rb +2 -3
  32. data/app/models/alchemy/picture/url.rb +10 -2
  33. data/app/views/alchemy/admin/contents/create.js.erb +1 -3
  34. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +4 -3
  35. data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -1
  36. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
  37. data/config/brakeman.ignore +5 -5
  38. data/config/locales/alchemy.de.yml +2 -2
  39. data/config/locales/alchemy.en.yml +2 -2
  40. data/config/locales/alchemy.es.yml +1 -1
  41. data/config/locales/alchemy.fr.yml +1 -1
  42. data/config/locales/alchemy.it.yml +1 -1
  43. data/config/locales/alchemy.nl.yml +1 -1
  44. data/config/locales/alchemy.ru.yml +1 -1
  45. data/db/migrate/20160422195310_add_image_file_format_to_alchemy_pictures.rb +0 -12
  46. data/lib/alchemy/errors.rb +6 -1
  47. data/lib/alchemy/logger.rb +1 -1
  48. data/lib/alchemy/permissions.rb +0 -7
  49. data/lib/alchemy/tasks/tidy.rb +130 -0
  50. data/lib/alchemy/test_support/factories/attachment_factory.rb +2 -2
  51. data/lib/alchemy/test_support/factories/cell_factory.rb +3 -3
  52. data/lib/alchemy/test_support/factories/content_factory.rb +2 -2
  53. data/lib/alchemy/test_support/factories/dummy_user_factory.rb +2 -2
  54. data/lib/alchemy/test_support/factories/element_factory.rb +2 -2
  55. data/lib/alchemy/test_support/factories/essence_file_factory.rb +2 -2
  56. data/lib/alchemy/test_support/factories/essence_picture_factory.rb +2 -2
  57. data/lib/alchemy/test_support/factories/essence_text_factory.rb +2 -2
  58. data/lib/alchemy/test_support/factories/language_factory.rb +2 -2
  59. data/lib/alchemy/test_support/factories/page_factory.rb +4 -4
  60. data/lib/alchemy/test_support/factories/picture_factory.rb +2 -2
  61. data/lib/alchemy/test_support/factories/site_factory.rb +2 -2
  62. data/lib/alchemy/upgrader/three_point_four.rb +25 -0
  63. data/lib/alchemy/version.rb +1 -1
  64. data/lib/tasks/alchemy/tidy.rake +1 -129
  65. data/lib/tasks/alchemy/upgrade.rake +9 -1
  66. metadata +22 -9
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_attachment, class: 'Alchemy::Attachment' do
5
5
  file File.new(Alchemy::Engine.root.join('lib', 'alchemy', 'test_support', 'fixtures', 'image.png'))
6
6
  name 'image'
@@ -1,9 +1,9 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/page_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_cell, class: 'Alchemy::Cell' do
6
- page { Alchemy::Page.find_by(language_root: true) || FactoryGirl.create(:alchemy_page, :language_root) }
6
+ page { Alchemy::Page.find_by(language_root: true) || FactoryBot.create(:alchemy_page, :language_root) }
7
7
  name "a_cell"
8
8
  end
9
9
  end
@@ -1,7 +1,7 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/essence_text_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_content, class: 'Alchemy::Content' do
6
6
  name "text"
7
7
  essence_type "Alchemy::EssenceText"
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_dummy_user, class: 'DummyUser' do
5
5
  sequence(:email) { |n| "john.#{n}@doe.com" }
6
6
  password 's3cr3t'
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_element, class: 'Alchemy::Element' do
5
5
  name 'article'
6
6
  create_contents_after_create false
@@ -1,7 +1,7 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/attachment_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_essence_file, class: 'Alchemy::EssenceFile' do
6
6
  attachment factory: :alchemy_attachment
7
7
  end
@@ -1,7 +1,7 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/picture_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_essence_picture, class: 'Alchemy::EssencePicture' do
6
6
  picture factory: :alchemy_picture
7
7
  end
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_essence_text, class: 'Alchemy::EssenceText' do
5
5
  body 'This is a headline'
6
6
  end
@@ -1,7 +1,7 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/site_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_language, class: 'Alchemy::Language' do
6
6
  name 'Deutsch'
7
7
  code 'de'
@@ -1,15 +1,15 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
  require 'alchemy/test_support/factories/language_factory'
3
3
 
4
- FactoryGirl.define do
4
+ FactoryBot.define do
5
5
  factory :alchemy_page, class: 'Alchemy::Page' do
6
- language { Alchemy::Language.default || FactoryGirl.create(:alchemy_language) }
6
+ language { Alchemy::Language.default || FactoryBot.create(:alchemy_language) }
7
7
  sequence(:name) { |n| "A Page #{n}" }
8
8
  page_layout "standard"
9
9
 
10
10
  parent_id do
11
11
  (Alchemy::Page.find_by(language_root: true) ||
12
- FactoryGirl.create(:alchemy_page, :language_root)).id
12
+ FactoryBot.create(:alchemy_page, :language_root)).id
13
13
  end
14
14
 
15
15
  # This speeds up creating of pages dramatically.
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_picture, class: 'Alchemy::Picture' do
5
5
  image_file File.new(Alchemy::Engine.root.join('lib', 'alchemy', 'test_support', 'fixtures', 'image.png'))
6
6
  name 'image'
@@ -1,6 +1,6 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :alchemy_site, class: 'Alchemy::Site' do
5
5
  name 'A Site'
6
6
  host 'domain.com'
@@ -8,6 +8,31 @@ module Alchemy
8
8
  Alchemy::Upgrader::Tasks::InstallAssetManifests.new.install
9
9
  end
10
10
 
11
+ def store_image_file_format
12
+ desc 'Store image file format'
13
+ pictures = Alchemy::Picture.where(image_file_format: nil)
14
+ count = pictures.size
15
+ converted_pics = 0
16
+ errored_pics = 0
17
+ puts "-- Storing file format of #{count} pictures"
18
+ pictures.find_each(batch_size: 100).with_index do |pic, i|
19
+ begin
20
+ puts " -> Reading file format of #{pic.image_file_name} (#{i + 1}/#{count})"
21
+ format = pic.image_file.identify('-ping -format "%m"')
22
+ pic.update_column('image_file_format', format.to_s.chomp.downcase)
23
+ converted_pics += 1
24
+ rescue Dragonfly::Job::Fetch::NotFound => e
25
+ puts " -> #{e.message}"
26
+ errored_pics += 1
27
+ end
28
+ end
29
+ puts "-- Done! Converted #{converted_pics} images."
30
+ unless errored_pics.zero?
31
+ puts " !! But #{errored_pics} images caused errors."
32
+ puts " Please check errors above and re-run `rake alchemy:upgrade:3.4:store_image_file_format`"
33
+ end
34
+ end
35
+
11
36
  def alchemy_3_4_todos
12
37
  notice = <<-NOTE
13
38
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "4.0.0.rc2"
4
+ VERSION = "4.0.0"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -1,4 +1,4 @@
1
- require 'alchemy/shell'
1
+ require 'alchemy/tasks/tidy'
2
2
 
3
3
  namespace :alchemy do
4
4
  namespace :tidy do
@@ -58,131 +58,3 @@ namespace :alchemy do
58
58
  end
59
59
  end
60
60
  end
61
-
62
- module Alchemy
63
- class Tidy
64
- extend Shell
65
-
66
- class << self
67
- def create_missing_cells(page_layouts, cells)
68
- page_layouts.each do |layout|
69
- next if layout['cells'].blank?
70
- cells_for_layout = cells.select { |cell| layout['cells'].include? cell['name'] }
71
- Alchemy::Page.where(page_layout: layout['name']).each do |page|
72
- cells_for_layout.each do |cell_for_layout|
73
- cell = Alchemy::Cell.find_or_initialize_by(name: cell_for_layout['name'], page_id: page.id)
74
- cell.elements << page.elements.select { |element| cell_for_layout['elements'].include?(element.name) }
75
- if cell.new_record?
76
- cell.save
77
- log "Creating cell #{cell.name} for page #{page.name}"
78
- else
79
- log "Cell #{cell.name} for page #{page.name} already present", :skip
80
- end
81
- end
82
- end
83
- end
84
- end
85
-
86
- def update_element_positions
87
- Alchemy::Page.all.each do |page|
88
- if page.elements.any?
89
- puts "\n## Updating element positions of page `#{page.name}`"
90
- end
91
- page.elements.group_by(&:cell_id).each do |_cell_id, elements|
92
- elements.each_with_index do |element, idx|
93
- position = idx + 1
94
- if element.position != position
95
- log "Updating position for element ##{element.id} to #{position}"
96
- element.update_column(:position, position)
97
- else
98
- log "Position for element ##{element.id} is already correct (#{position})", :skip
99
- end
100
- end
101
- end
102
- end
103
- end
104
-
105
- def update_content_positions
106
- Alchemy::Element.all.each do |element|
107
- if element.contents.any?
108
- puts "\n## Updating content positions of element `#{element.name}`"
109
- end
110
- element.contents.group_by(&:essence_type).each do |essence_type, contents|
111
- puts "-> Contents of type `#{essence_type}`"
112
- contents.each_with_index do |content, idx|
113
- position = idx + 1
114
- if content.position != position
115
- log "Updating position for content ##{content.id} to #{position}"
116
- content.update_column(:position, position)
117
- else
118
- log "Position for content ##{content.id} is already correct (#{position})", :skip
119
- end
120
- end
121
- end
122
- end
123
- end
124
-
125
- def remove_orphaned_cells
126
- puts "\n## Removing orphaned cells"
127
- cells = Alchemy::Cell.unscoped.all
128
- if cells.any?
129
- orphaned_cells = cells.select do |cell|
130
- cell.page.nil? && cell.page_id.present?
131
- end
132
- if orphaned_cells.any?
133
- destroy_orphaned_records(orphaned_cells, 'cell')
134
- else
135
- log "No orphaned cells found", :skip
136
- end
137
- else
138
- log "No cells found", :skip
139
- end
140
- end
141
-
142
- def remove_orphaned_elements
143
- puts "\n## Removing orphaned elements"
144
- elements = Alchemy::Element.unscoped.all
145
- if elements.any?
146
- orphaned_elements = elements.select do |element|
147
- element.page.nil? && element.page_id.present? ||
148
- element.cell.nil? && element.cell_id.present?
149
- end
150
- if orphaned_elements.any?
151
- destroy_orphaned_records(orphaned_elements, 'element')
152
- else
153
- log "No orphaned elements found", :skip
154
- end
155
- else
156
- log "No elements found", :skip
157
- end
158
- end
159
-
160
- def remove_orphaned_contents
161
- puts "\n## Removing orphaned contents"
162
- contents = Alchemy::Content.unscoped.all
163
- if contents.any?
164
- orphaned_contents = contents.select do |content|
165
- content.essence.nil? && content.essence_id.present? ||
166
- content.element.nil? && content.element_id.present?
167
- end
168
- if orphaned_contents.any?
169
- destroy_orphaned_records(orphaned_contents, 'content')
170
- else
171
- log "No orphaned contents found", :skip
172
- end
173
- else
174
- log "No contents found", :skip
175
- end
176
- end
177
-
178
- private
179
-
180
- def destroy_orphaned_records(records, class_name)
181
- records.each do |record|
182
- log "Destroy orphaned #{class_name}: #{record.id}"
183
- record.destroy
184
- end
185
- end
186
- end
187
- end
188
- end
@@ -148,13 +148,21 @@ namespace :alchemy do
148
148
  task '3.4' => ['alchemy:upgrade:prepare', 'alchemy:upgrade:3.4:run']
149
149
 
150
150
  namespace '3.4' do
151
- task run: ['alchemy:upgrade:3.4:install_asset_manifests']
151
+ task run: [
152
+ 'alchemy:upgrade:3.4:install_asset_manifests',
153
+ 'alchemy:upgrade:3.4:store_image_file_format'
154
+ ]
152
155
 
153
156
  desc 'Install asset manifests into `vendor/assets`'
154
157
  task install_asset_manifests: [:environment] do
155
158
  Alchemy::Upgrader::ThreePointFour.install_asset_manifests
156
159
  end
157
160
 
161
+ desc 'Store image file format on Alchemy pictures.'
162
+ task store_image_file_format: [:environment] do
163
+ Alchemy::Upgrader::ThreePointFour.store_image_file_format
164
+ end
165
+
158
166
  task :todo do
159
167
  Alchemy::Upgrader::ThreePointFour.alchemy_3_4_todos
160
168
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.rc2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2017-08-18 00:00:00.000000000 Z
16
+ date: 2017-11-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -118,6 +118,9 @@ dependencies:
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '1.0'
123
+ - - ">="
121
124
  - !ruby/object:Gem::Version
122
125
  version: 1.0.7
123
126
  type: :runtime
@@ -125,6 +128,9 @@ dependencies:
125
128
  version_requirements: !ruby/object:Gem::Requirement
126
129
  requirements:
127
130
  - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '1.0'
133
+ - - ">="
128
134
  - !ruby/object:Gem::Version
129
135
  version: 1.0.7
130
136
  - !ruby/object:Gem::Dependency
@@ -203,14 +209,14 @@ dependencies:
203
209
  requirements:
204
210
  - - "~>"
205
211
  - !ruby/object:Gem::Version
206
- version: '3.0'
212
+ version: '3.1'
207
213
  type: :runtime
208
214
  prerelease: false
209
215
  version_requirements: !ruby/object:Gem::Requirement
210
216
  requirements:
211
217
  - - "~>"
212
218
  - !ruby/object:Gem::Version
213
- version: '3.0'
219
+ version: '3.1'
214
220
  - !ruby/object:Gem::Dependency
215
221
  name: non-stupid-digest-assets
216
222
  requirement: !ruby/object:Gem::Requirement
@@ -231,14 +237,20 @@ dependencies:
231
237
  requirements:
232
238
  - - "~>"
233
239
  - !ruby/object:Gem::Version
234
- version: 5.0.0
240
+ version: '5.0'
241
+ - - "<"
242
+ - !ruby/object:Gem::Version
243
+ version: '6.0'
235
244
  type: :runtime
236
245
  prerelease: false
237
246
  version_requirements: !ruby/object:Gem::Requirement
238
247
  requirements:
239
248
  - - "~>"
240
249
  - !ruby/object:Gem::Version
241
- version: 5.0.0
250
+ version: '5.0'
251
+ - - "<"
252
+ - !ruby/object:Gem::Version
253
+ version: '6.0'
242
254
  - !ruby/object:Gem::Dependency
243
255
  name: ransack
244
256
  requirement: !ruby/object:Gem::Requirement
@@ -842,6 +854,7 @@ files:
842
854
  - lib/alchemy/shell.rb
843
855
  - lib/alchemy/ssl_protection.rb
844
856
  - lib/alchemy/tasks/helpers.rb
857
+ - lib/alchemy/tasks/tidy.rb
845
858
  - lib/alchemy/test_support/config_stubbing.rb
846
859
  - lib/alchemy/test_support/controller_requests.rb
847
860
  - lib/alchemy/test_support/essence_shared_examples.rb
@@ -983,13 +996,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
983
996
  version: 2.2.2
984
997
  required_rubygems_version: !ruby/object:Gem::Requirement
985
998
  requirements:
986
- - - ">"
999
+ - - ">="
987
1000
  - !ruby/object:Gem::Version
988
- version: 1.3.1
1001
+ version: '0'
989
1002
  requirements:
990
1003
  - ImageMagick (libmagick), v6.6 or greater.
991
1004
  rubyforge_project:
992
- rubygems_version: 2.6.11
1005
+ rubygems_version: 2.6.13
993
1006
  signing_key:
994
1007
  specification_version: 4
995
1008
  summary: A powerful, userfriendly and flexible CMS for Rails 4