alchemy_cms 2.1.beta6 → 2.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/Gemfile +10 -2
- data/Guardfile +16 -0
- data/README.md +3 -3
- data/Rakefile +0 -5
- data/alchemy_cms.gemspec +1 -9
- data/app/assets/javascripts/alchemy/alchemy.base.js +5 -4
- data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js.erb → alchemy.dragndrop.js} +0 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +96 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +48 -50
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +41 -0
- data/app/assets/javascripts/alchemy/alchemy.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +55 -0
- data/app/assets/javascripts/alchemy/alchemy.preview.js +94 -139
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +98 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +1 -174
- data/app/assets/javascripts/alchemy/menubar.js +2 -0
- data/app/assets/javascripts/alchemy/preview.js +2 -1
- data/app/assets/stylesheets/alchemy/_defaults.scss +7 -8
- data/app/assets/stylesheets/alchemy/base.css.scss +29 -33
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -4
- 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 +19 -4
- data/app/assets/stylesheets/alchemy/menubar.css.scss +85 -0
- data/app/assets/stylesheets/alchemy/standard_set.css +3 -5
- 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/attachments_controller.rb +2 -18
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
- data/app/controllers/alchemy/admin/essence_files_controller.rb +4 -2
- data/app/controllers/alchemy/admin/pictures_controller.rb +6 -20
- data/app/controllers/alchemy/admin/resources_controller.rb +7 -5
- data/app/controllers/alchemy/base_controller.rb +14 -4
- data/app/controllers/alchemy/messages_controller.rb +4 -4
- data/app/controllers/alchemy/pages_controller.rb +51 -32
- data/app/controllers/alchemy/pictures_controller.rb +0 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +6 -4
- data/app/helpers/alchemy/base_helper.rb +26 -0
- data/app/helpers/alchemy/pages_helper.rb +42 -22
- data/app/models/alchemy/attachment.rb +10 -2
- data/app/models/alchemy/cell.rb +1 -0
- data/app/models/alchemy/content.rb +8 -6
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/essence_audio.rb +1 -8
- data/app/models/alchemy/essence_date.rb +2 -9
- data/app/models/alchemy/essence_file.rb +1 -8
- data/app/models/alchemy/essence_flash.rb +0 -7
- data/app/models/alchemy/essence_html.rb +1 -8
- data/app/models/alchemy/essence_picture.rb +0 -11
- data/app/models/alchemy/essence_richtext.rb +4 -12
- data/app/models/alchemy/essence_text.rb +1 -13
- data/app/models/alchemy/essence_video.rb +1 -8
- data/app/models/alchemy/page.rb +28 -22
- data/app/models/alchemy/picture.rb +19 -0
- data/app/sweepers/alchemy/pages_sweeper.rb +17 -6
- data/app/sweepers/alchemy/pictures_sweeper.rb +1 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +13 -11
- data/app/views/alchemy/admin/attachments/create.js.erb +1 -1
- data/app/views/alchemy/admin/attachments/edit.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -2
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/essence_files/edit.html.erb +32 -32
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +29 -29
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +13 -12
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +4 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +8 -8
- data/app/views/alchemy/admin/pages/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +19 -12
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +8 -6
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +6 -1
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +13 -13
- data/app/views/alchemy/admin/users/_user.html.erb +1 -1
- data/app/views/alchemy/admin/users/index.html.erb +2 -2
- data/app/views/alchemy/elements/_contactform_view.html.erb +78 -78
- data/app/views/alchemy/elements/_download_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_download_view.html.erb +3 -0
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_file_view.html.erb +6 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +1 -2
- data/app/views/alchemy/notifications/admin_user_created.text.erb +7 -7
- data/app/views/alchemy/notifications/registered_user_created.text.erb +5 -5
- data/app/views/alchemy/user_sessions/login.html.erb +34 -35
- data/app/views/layouts/alchemy/login.html.erb +3 -8
- data/app/views/layouts/alchemy/pages.html.erb +1 -0
- data/bin/alchemy +43 -75
- data/config/alchemy/config.yml +10 -0
- data/config/alchemy/elements.yml +5 -0
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/locales/alchemy.de.yml +21 -8
- data/config/locales/alchemy.en.yml +20 -4
- data/config/routes.rb +25 -20
- data/db/migrate/{20111116125112_namespace_models.rb → 20111116125112_namespace_alchemy_models.rb} +1 -1
- data/lib/alchemy/capistrano.rb +4 -17
- data/lib/alchemy/engine.rb +2 -0
- data/lib/alchemy/essence.rb +29 -41
- data/lib/alchemy/i18n.rb +1 -1
- data/lib/alchemy/mount_point.rb +10 -0
- data/lib/alchemy/page_layout.rb +7 -7
- data/lib/alchemy/seeder.rb +85 -47
- data/lib/alchemy/upgrader.rb +115 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +4 -3
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +6 -2
- data/lib/tasks/ferret.rake +12 -0
- data/lib/tasks/install.rake +16 -105
- data/lib/tasks/routes.rake +29 -0
- data/lib/tasks/upgrade.rake +5 -67
- data/spec/controllers/admin/pages_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +31 -0
- data/spec/factories.rb +24 -15
- data/spec/helpers/admin/base_helper_spec.rb +0 -7
- data/spec/helpers/pages_helper_spec.rb +54 -29
- data/spec/helpers/url_helpers_spec.rb +40 -0
- data/spec/integration/admin/pages_controller_spec.rb +3 -3
- data/spec/integration/pages_controller_spec.rb +80 -6
- data/spec/integration/security_spec.rb +2 -2
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/page_spec.rb +174 -47
- data/spec/models/picture_spec.rb +54 -0
- data/spec/page_layout_spec.rb +2 -2
- data/spec/routing_spec.rb +205 -1
- data/spec/spec_helper.rb +53 -32
- metadata +51 -46
- data/lib/alchemy/file_utilz.rb +0 -73
@@ -0,0 +1,10 @@
|
|
1
|
+
module Alchemy
|
2
|
+
|
3
|
+
# Returns alchemys mount point in current rails app.
|
4
|
+
def self.mount_point
|
5
|
+
alchemy_routes = Rails.application.routes.named_routes[:alchemy]
|
6
|
+
raise "Alchemy not mounted! Please mount Alchemy::Engine in your config/routes.rb file." if alchemy_routes.nil?
|
7
|
+
alchemy_routes.path.gsub(/^\/$/, '')
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
data/lib/alchemy/page_layout.rb
CHANGED
@@ -17,7 +17,7 @@ module Alchemy
|
|
17
17
|
|
18
18
|
# Returns the page_layout.yml file. Tries to first load from config/alchemy and if not found from vendor/plugins/alchemy/config/alchemy.
|
19
19
|
def self.get_layouts
|
20
|
-
@@definitions
|
20
|
+
@@definitions ||= read_layouts_file
|
21
21
|
end
|
22
22
|
|
23
23
|
# Add additional pagelayout definitions. I.E. from your module.
|
@@ -25,7 +25,7 @@ module Alchemy
|
|
25
25
|
# You can pass a single layout definition as Hash, or a collection of pagelayouts as Array.
|
26
26
|
# Example Pagelayout definitions can be found in the +page_layouts.yml+ from the standard set.
|
27
27
|
def self.add(page_layout)
|
28
|
-
@@definitions
|
28
|
+
@@definitions ||= read_layouts_file
|
29
29
|
if page_layout.is_a?(Array)
|
30
30
|
@@definitions += page_layout
|
31
31
|
elsif page_layout.is_a?(Hash)
|
@@ -45,10 +45,10 @@ module Alchemy
|
|
45
45
|
def self.get_all_by_attributes(attributes)
|
46
46
|
return [] if attributes.blank?
|
47
47
|
if attributes.class.name == 'Hash'
|
48
|
-
|
48
|
+
@@definitions ||= read_layouts_file
|
49
49
|
layouts = []
|
50
|
-
attributes.each do |key, value|
|
51
|
-
result =
|
50
|
+
attributes.stringify_keys.each do |key, value|
|
51
|
+
result = @@definitions.select{ |a| a[key].to_s.downcase == value.to_s.downcase if a.has_key?(key) }
|
52
52
|
layouts += result unless result.empty?
|
53
53
|
end
|
54
54
|
return layouts
|
@@ -71,9 +71,9 @@ module Alchemy
|
|
71
71
|
@@definitions.select do |layout|
|
72
72
|
used = layout["unique"] && has_a_page_this_layout?(layout["name"], language_id)
|
73
73
|
if layoutpage
|
74
|
-
layout["layoutpage"] == true && !used
|
74
|
+
layout["layoutpage"] == true && !used
|
75
75
|
else
|
76
|
-
layout["layoutpage"] != true && !used
|
76
|
+
layout["layoutpage"] != true && !used
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/alchemy/seeder.rb
CHANGED
@@ -1,61 +1,99 @@
|
|
1
|
-
require '
|
1
|
+
require 'thor/shell/color'
|
2
2
|
|
3
3
|
module Alchemy
|
4
4
|
class Seeder
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# This seed builds the necessary page structure for alchemy in your database.
|
9
|
+
# Run the alchemy:db:seed rake task to seed your database.
|
10
|
+
def seed!
|
11
|
+
desc "Seeding your database"
|
12
|
+
errors = []
|
13
|
+
notices = []
|
14
|
+
|
15
|
+
default_language = Alchemy::Config.get(:default_language)
|
16
|
+
|
17
|
+
lang = Alchemy::Language.find_or_initialize_by_code(
|
18
|
+
:name => default_language['name'],
|
19
|
+
:code => default_language['code'],
|
20
|
+
:frontpage_name => default_language['frontpage_name'],
|
21
|
+
:page_layout => default_language['page_layout'],
|
22
|
+
:public => true,
|
23
|
+
:default => true
|
24
|
+
)
|
25
|
+
if lang.new_record?
|
26
|
+
if lang.save
|
27
|
+
log "Created language #{lang.name}."
|
28
|
+
else
|
29
|
+
errors << "Errors while creating language #{lang.name}: #{lang.errors.full_messages}"
|
30
|
+
end
|
31
|
+
else
|
32
|
+
notices << "Language #{lang.name} was already present."
|
33
|
+
end
|
34
|
+
|
35
|
+
root = Alchemy::Page.find_or_initialize_by_name(
|
36
|
+
:name => 'Root',
|
37
|
+
:do_not_sweep => true
|
38
|
+
)
|
39
|
+
if root.new_record?
|
40
|
+
if root.save
|
41
|
+
log "Created page #{root.name}."
|
42
|
+
else
|
43
|
+
errors << "Errors while creating page #{root.name}: #{root.errors.full_messages}"
|
44
|
+
end
|
25
45
|
else
|
26
|
-
|
46
|
+
notices << "Page #{root.name} was already present."
|
47
|
+
end
|
48
|
+
|
49
|
+
if errors.blank?
|
50
|
+
log "Successfully seeded your database!" if notices.blank?
|
51
|
+
notices.each do |note|
|
52
|
+
log(note, :skip)
|
53
|
+
end
|
54
|
+
else
|
55
|
+
log("Some pages could not be created:", :error)
|
56
|
+
errors.each do |error|
|
57
|
+
log(error, :error)
|
58
|
+
end
|
27
59
|
end
|
28
|
-
else
|
29
|
-
notices << "== Skipping! Language #{lang.name} was already present"
|
30
60
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def color(name)
|
65
|
+
case name
|
66
|
+
when :green
|
67
|
+
Thor::Shell::Color::GREEN
|
68
|
+
when :red
|
69
|
+
Thor::Shell::Color::RED
|
70
|
+
when :yellow
|
71
|
+
Thor::Shell::Color::YELLOW
|
72
|
+
when :black
|
73
|
+
Thor::Shell::Color::BLACK
|
74
|
+
when :clear
|
75
|
+
Thor::Shell::Color::CLEAR
|
45
76
|
else
|
46
|
-
|
77
|
+
""
|
47
78
|
end
|
48
|
-
else
|
49
|
-
notices << "== Skipping! Page #{root.name} was already present"
|
50
79
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
80
|
+
|
81
|
+
def log(message, type=nil)
|
82
|
+
case type
|
83
|
+
when :skip
|
84
|
+
puts "#{color(:yellow)}== Skipping! #{message}#{color(:clear)}"
|
85
|
+
when :error
|
86
|
+
puts "#{color(:red)}!! ERROR: #{message}#{color(:clear)}"
|
87
|
+
else
|
88
|
+
puts "#{color(:green)}== #{message}#{color(:clear)}"
|
89
|
+
end
|
58
90
|
end
|
91
|
+
|
92
|
+
def desc(message)
|
93
|
+
puts "\n#{message}"
|
94
|
+
puts "#{'-' * message.length}\n"
|
95
|
+
end
|
96
|
+
|
59
97
|
end
|
60
98
|
|
61
99
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Alchemy
|
2
|
+
class Upgrader < Alchemy::Seeder
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
# Runs all ugrades
|
7
|
+
def run!
|
8
|
+
Rake::Task['alchemy:install:migrations'].invoke
|
9
|
+
strip_alchemy_from_schema_version_table
|
10
|
+
Rake::Task['db:migrate'].invoke
|
11
|
+
upgrade_to_language
|
12
|
+
upgrade_layoutpages
|
13
|
+
upgrade_essence_link_target_default
|
14
|
+
upgrade_to_namespaced_essence_type
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# Creates Language model if it does not exist (Alchemy CMS prior v1.5)
|
20
|
+
# Also creates missing associations between pages and languages
|
21
|
+
def upgrade_to_language
|
22
|
+
desc "Creating languages for pages"
|
23
|
+
Alchemy::Page.all.each do |page|
|
24
|
+
if !page.language_code.blank? && page.language.nil?
|
25
|
+
root = page.get_language_root
|
26
|
+
lang = Alchemy::Language.find_or_create_by_code(
|
27
|
+
:name => page.language_code.capitalize,
|
28
|
+
:code => page.language_code,
|
29
|
+
:frontpage_name => root.name,
|
30
|
+
:page_layout => root.page_layout,
|
31
|
+
:public => true
|
32
|
+
)
|
33
|
+
page.language = lang
|
34
|
+
if page.save(:validate => false)
|
35
|
+
log "Set language for page #{page.name} to #{lang.name}."
|
36
|
+
end
|
37
|
+
else
|
38
|
+
log("Language for page #{page.name} already set.", :skip)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def upgrade_layoutpages
|
44
|
+
desc "Setting language of layoutpages"
|
45
|
+
default_language = Alchemy::Language.get_default
|
46
|
+
layoutpages = Alchemy::Page.layoutpages
|
47
|
+
if layoutpages.any?
|
48
|
+
layoutpages.each do |page|
|
49
|
+
if page.language.class == String || page.language.nil?
|
50
|
+
page.language = default_language
|
51
|
+
if page.save(:validate => false)
|
52
|
+
log "Set language for page #{page.name} to #{default_language.name}."
|
53
|
+
end
|
54
|
+
else
|
55
|
+
log "Language for page #{page.name} already set.", :skip
|
56
|
+
end
|
57
|
+
end
|
58
|
+
else
|
59
|
+
log "No layoutpages found.", :skip
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def upgrade_essence_link_target_default
|
64
|
+
desc "Setting new link_target default"
|
65
|
+
essences = (Alchemy::EssencePicture.all + Alchemy::EssenceText.all)
|
66
|
+
if essences.any?
|
67
|
+
essences.each do |essence|
|
68
|
+
case essence.link_target
|
69
|
+
when '1'
|
70
|
+
if essence.update_attribute(:link_target, 'blank')
|
71
|
+
log("Updated #{essence.preview_text} link target to #{essence.link_target}.")
|
72
|
+
end
|
73
|
+
when '0'
|
74
|
+
essence.update_attribute(:link_target, nil)
|
75
|
+
log("Updated #{essence.preview_text} link target to #{essence.link_target.inspect}.")
|
76
|
+
else
|
77
|
+
log("#{essence.preview_text} already upgraded.", :skip)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
else
|
81
|
+
log("No essences to upgrade found.", :skip)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Updates all essence_type of Content if not already namespaced.
|
86
|
+
def upgrade_to_namespaced_essence_type
|
87
|
+
desc "Namespacing essence_type columns"
|
88
|
+
depricated_contents = Alchemy::Content.where("essence_type LIKE ?", "Essence%")
|
89
|
+
if depricated_contents.any?
|
90
|
+
success = 0
|
91
|
+
errors = []
|
92
|
+
depricated_contents.each do |c|
|
93
|
+
if c.update_attribute(:essence_type, c.essence_type.gsub(/^Essence/, 'Alchemy::Essence'))
|
94
|
+
success += 1
|
95
|
+
else
|
96
|
+
errors << c.errors.full_messages
|
97
|
+
end
|
98
|
+
end
|
99
|
+
log("Namespaced #{success} essence_type columns.") if success > 0
|
100
|
+
log("#{errors.count} errors while namespacing essence_type columns.\n#{errors.join('\n')}", :error) if errors.count > 0
|
101
|
+
else
|
102
|
+
log "No essence_type columns to be namespaced found.", :skip
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def strip_alchemy_from_schema_version_table
|
107
|
+
database_yml = YAML.load_file(Rails.root.join("config", "database.yml"))
|
108
|
+
connection = Mysql2::Client.new(database_yml.fetch(Rails.env.to_s).symbolize_keys)
|
109
|
+
connection.query "UPDATE schema_migrations SET `schema_migrations`.`version` = REPLACE(`schema_migrations`.`version`,'-alchemy','')"
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
data/lib/alchemy/version.rb
CHANGED
data/lib/alchemy_cms.rb
CHANGED
@@ -14,6 +14,7 @@ if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
|
14
14
|
require 'extensions/hash'
|
15
15
|
require 'extensions/array'
|
16
16
|
require 'extensions/action_view'
|
17
|
+
require 'alchemy/mount_point'
|
17
18
|
require 'alchemy/version'
|
18
19
|
require 'alchemy/auth_engine'
|
19
20
|
require 'alchemy/engine'
|
@@ -22,11 +23,11 @@ if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
|
22
23
|
end
|
23
24
|
require File.join(File.dirname(__FILE__), "alchemy", "seeder")
|
24
25
|
else
|
25
|
-
raise "Alchemy 2.
|
26
|
+
raise "Alchemy 2.1 needs Rails 3.1 or higher. You are currently using Rails #{Rails::VERSION::STRING}"
|
26
27
|
end
|
27
28
|
|
28
29
|
module Alchemy
|
29
|
-
|
30
|
+
|
30
31
|
class EssenceError < StandardError; end
|
31
|
-
|
32
|
+
|
32
33
|
end
|
@@ -24,11 +24,15 @@ module Alchemy
|
|
24
24
|
def copy_files
|
25
25
|
if options['with-standard-set']
|
26
26
|
layouts_path = File.expand_path('../../../../../app/views/layouts/alchemy', File.dirname(__FILE__))
|
27
|
+
elements_path = File.expand_path('../../../../../app/views/alchemy/elements', File.dirname(__FILE__))
|
28
|
+
page_layouts_path = File.expand_path('../../../../../app/views/alchemy/page_layouts', File.dirname(__FILE__))
|
27
29
|
copy_file "#{@config_path}/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
|
28
30
|
copy_file "#{@config_path}/page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
|
29
31
|
copy_file "#{layouts_path}/pages.html.erb", "#{Rails.root}/app/views/layouts/alchemy/pages.html.erb"
|
30
|
-
|
31
|
-
|
32
|
+
Dir.glob("#{elements_path}/*").reject{|file_path| !(File.basename(file_path) =~ /(.+)_(view|editor).html.erb/) }.each do |file_path|
|
33
|
+
copy_file file_path, "#{Rails.root}/app/views/alchemy/elements/#{File.basename(file_path)}"
|
34
|
+
end
|
35
|
+
directory "#{page_layouts_path}/", "#{Rails.root}/app/views/alchemy/page_layouts/"
|
32
36
|
else
|
33
37
|
copy_file "#{File.dirname(__FILE__)}/files/elements.yml", "#{Rails.root}/config/alchemy/elements.yml"
|
34
38
|
copy_file "#{File.dirname(__FILE__)}/files/page_layouts.yml", "#{Rails.root}/config/alchemy/page_layouts.yml"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :ferret do
|
2
|
+
|
3
|
+
desc "Updates the ferret index for the application."
|
4
|
+
task :rebuild_index => :environment do
|
5
|
+
puts "Rebuilding Ferret Index for EssenceText"
|
6
|
+
Alchemy::EssenceText.rebuild_index
|
7
|
+
puts "Rebuilding Ferret Index for EssenceRichtext"
|
8
|
+
Alchemy::EssenceRichtext.rebuild_index
|
9
|
+
puts "Completed Ferret Index Rebuild"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
data/lib/tasks/install.rake
CHANGED
@@ -1,110 +1,21 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require File.join(File.dirname(__FILE__), '../alchemy/file_utilz.rb')
|
3
|
-
|
4
1
|
namespace :alchemy do
|
5
|
-
|
6
|
-
desc "Migrates the database, inserts essential data into the database and copies all assets."
|
7
|
-
task :prepare do
|
8
|
-
Rake::Task['alchemy:install:migrations'].invoke
|
9
|
-
Rake::Task['alchemy:seeder:copy'].invoke
|
10
|
-
Rake::Task['alchemy:assets:copy:all'].invoke
|
11
|
-
end
|
12
|
-
|
13
|
-
namespace 'seeder' do
|
14
|
-
desc "Copy a line of code into the seeds.rb file"
|
15
|
-
task :copy do
|
16
|
-
File.open("./db/seeds.rb", "a") do |f|
|
17
|
-
f.puts "\n# Seeding Alchemy data"
|
18
|
-
f.puts "Alchemy::Seeder.seed!\n"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
2
|
|
23
|
-
|
24
|
-
namespace 'copy' do
|
25
|
-
|
26
|
-
desc "Copy all assets for Alchemy into apps public folder"
|
27
|
-
task :all do
|
28
|
-
Rake::Task['alchemy:assets:copy:javascripts'].invoke
|
29
|
-
Rake::Task['alchemy:assets:copy:stylesheets'].invoke
|
30
|
-
Rake::Task['alchemy:assets:copy:images'].invoke
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Copy javascripts for Alchemy into apps public folder"
|
34
|
-
task :javascripts do
|
35
|
-
system "rm -rf #{Rails.root.to_s}/public/javascripts/alchemy"
|
36
|
-
system "mkdir -p #{Rails.root.to_s}/public/javascripts/alchemy"
|
37
|
-
system "rsync -r #{File.join(File.dirname(__FILE__), '..', '..', 'assets', 'javascripts', '*')} #{Rails.root.to_s}/public/javascripts/alchemy/"
|
38
|
-
end
|
39
|
-
|
40
|
-
desc "Copy stylesheets for Alchemy into apps public folder"
|
41
|
-
task :stylesheets do
|
42
|
-
system "rm -rf #{Rails.root.to_s}/public/stylesheets/alchemy"
|
43
|
-
system "mkdir -p #{Rails.root.to_s}/public/stylesheets/alchemy"
|
44
|
-
system "rsync -r #{File.join(File.dirname(__FILE__), '..', '..', 'assets', 'stylesheets', '*')} #{Rails.root.to_s}/public/stylesheets/alchemy/"
|
45
|
-
end
|
46
|
-
|
47
|
-
desc "Copy images for Alchemy into apps public folder"
|
48
|
-
task :images do
|
49
|
-
system "rm -rf #{Rails.root.to_s}/public/images/alchemy"
|
50
|
-
system "mkdir -p #{Rails.root.to_s}/public/images/alchemy"
|
51
|
-
system "rsync -r #{File.join(File.dirname(__FILE__), '..', '..', 'assets', 'images', '*')} #{Rails.root.to_s}/public/images/alchemy/"
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
namespace :standard_set do
|
58
|
-
|
59
|
-
desc "Install Alchemys standard set."
|
60
|
-
task :install do
|
61
|
-
system("rails g alchemy:scaffold --with_standard_set")
|
62
|
-
Rake::Task['alchemy:assets:copy:all'].invoke
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
3
|
+
namespace :db do
|
66
4
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
if cell.new_record?
|
83
|
-
cell.save
|
84
|
-
puts "== Creating cell '#{cell.name}' for page '#{page.name}'"
|
85
|
-
else
|
86
|
-
puts "== Skipping! Cell '#{cell.name}' for page '#{page.name}' was already present"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
5
|
+
desc "Seeds the database with essential data for Alchemy."
|
6
|
+
task :seed => :environment do
|
7
|
+
Alchemy::Seeder.seed!
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :standard_set do
|
13
|
+
|
14
|
+
desc "Install Alchemys standard set."
|
15
|
+
task :install do
|
16
|
+
system("rails g alchemy:scaffold --with-standard-set")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
98
20
|
|
99
|
-
namespace :ferret do
|
100
|
-
|
101
|
-
desc "Updates the ferret index for the application."
|
102
|
-
task :rebuild_index => :environment do
|
103
|
-
puts "Rebuilding Ferret Index for EssenceText"
|
104
|
-
Alchemy::EssenceText.rebuild_index
|
105
|
-
puts "Rebuilding Ferret Index for EssenceRichtext"
|
106
|
-
Alchemy::EssenceRichtext.rebuild_index
|
107
|
-
puts "Completed Ferret Index Rebuild"
|
108
|
-
end
|
109
|
-
|
110
21
|
end
|