camaleon_cms 0.1.8 → 0.1.9
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.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/config/initializers/rufus_cron.rb +24 -15
- data/lib/camaleon_cms/engine.rb +27 -23
- data/lib/camaleon_cms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d114547f428656d17fdf58ce3a7d1096a01e413
|
4
|
+
data.tar.gz: 3b994b5712f74b98f58942d1fa7de814a042c8ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a8b1bad326b7d06e0051a93b2962c98f0e0ee8e0ac0b7d41950c580891e11948f0cb94e09d6adbcab52c4024a604f1d951b7f9d89208fb73cfe613e436fa969
|
7
|
+
data.tar.gz: ad8f732b2820f70fc2e994eb8499d2502243c014d7eee187874166954b1b04d7d693449f8ba57e6a8f7751c16b0d8e5327ab2b1f35a701eb17483db32b6d86b7
|
@@ -6,22 +6,31 @@
|
|
6
6
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
|
-
require 'rufus-scheduler'
|
10
|
-
$scheduler = Rufus::Scheduler.singleton
|
11
|
-
$scheduler.cron '00 05 * * *' do
|
12
|
-
system("rake camaleon_cms:sitemap")
|
13
|
-
end
|
14
|
-
# cronjob for hook by site
|
15
9
|
begin
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
10
|
+
require 'rufus-scheduler'
|
11
|
+
loaded_rufus = true
|
12
|
+
rescue LoadError
|
13
|
+
loaded_rufus = false
|
14
|
+
end
|
15
|
+
|
16
|
+
if loaded_rufus
|
17
|
+
$scheduler = Rufus::Scheduler.singleton
|
18
|
+
$scheduler.cron '00 05 * * *' do
|
19
|
+
system("rake camaleon_cms:sitemap")
|
20
|
+
end
|
21
|
+
|
22
|
+
# run all custom cron jobs
|
23
|
+
begin
|
24
|
+
Site.all.each do |site|
|
25
|
+
# hooks
|
26
|
+
c = CamaleonController.new
|
27
|
+
c.instance_eval do
|
28
|
+
@current_site = site
|
29
|
+
@_hooks_skip = []
|
30
|
+
end
|
31
|
+
r = {site: site, eval: nil}; c.hooks_run("cron", r)
|
32
|
+
r[:eval].call(r) if r[:eval].present? # evaluate the cron job created by plugin or theme
|
22
33
|
end
|
23
|
-
|
24
|
-
r[:eval].call(r) if r[:eval].present? # evaluate the cron job created by plugin or theme
|
34
|
+
rescue #ActiveRecord::RecordNotFound # skipping pending migrations
|
25
35
|
end
|
26
|
-
rescue ActiveRecord::RecordNotFound # skipping sites not found
|
27
36
|
end
|
data/lib/camaleon_cms/engine.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
$camaleon_engine_dir = File.expand_path("../../../", __FILE__)
|
2
|
-
require File.join($camaleon_engine_dir, "lib", "generators", "camaleon_cms", "install_template", "plugin_routes").to_s
|
3
2
|
Dir[File.join($camaleon_engine_dir, "lib", "ext", "**", "*.rb")].each{ |f| require f }
|
4
3
|
module CamaleonCms
|
5
4
|
class Engine < ::Rails::Engine
|
@@ -14,33 +13,38 @@ module CamaleonCms
|
|
14
13
|
end
|
15
14
|
|
16
15
|
initializer :append_migrations do |app|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
unless defined?(PluginRoutes)
|
17
|
+
require File.join($camaleon_engine_dir, "lib", "generators", "camaleon_cms", "install_template", "plugin_routes").to_s
|
18
|
+
Rails.logger.info "Please copy plugin_routes.rb file in lib/"
|
19
|
+
else
|
20
|
+
engine_dir = File.expand_path("../../../", __FILE__)
|
21
|
+
app.config.i18n.load_path += Dir[File.join($camaleon_engine_dir, 'config', 'locales', '**', '*.{rb,yml}')]
|
22
|
+
app.config.i18n.enforce_available_locales = false
|
23
|
+
PluginRoutes.all_apps.each{ |info| app.config.i18n.load_path += Dir[File.join(info["path"], "config", "locales", '*.{rb,yml}')] }
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
# assets
|
26
|
+
app.config.assets.paths << Rails.root.join("app", "apps")
|
27
|
+
app.config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
|
28
|
+
app.config.assets.paths << File.join($camaleon_engine_dir, "app", "apps")
|
29
|
+
app.config.assets.paths << File.join($camaleon_engine_dir, 'app', 'assets', 'fonts')
|
30
|
+
app.config.encoding = "utf-8"
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
#multiple route files
|
33
|
+
app.routes_reloader.paths.push(File.join(engine_dir, "config", "routes", "admin.rb"))
|
34
|
+
app.routes_reloader.paths.push(File.join(engine_dir, "config", "routes", "frontend.rb"))
|
35
|
+
# Dir[File.join(engine_dir, "config", "routes", "*.rb")].each{|r| app.routes_reloader.paths.unshift(r) }
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
# extra configuration for plugins
|
38
|
+
app.config.autoload_paths += %W{#{app.config.root}/app/apps/**/}
|
39
|
+
PluginRoutes.all_plugins.each{ |plugin| app.config.paths["db/migrate"] << File.join(plugin["path"], "migrate") if Dir.exist?(File.join(plugin["path"], "migrate")) }
|
37
40
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
# migrations checking
|
42
|
+
unless app.root.to_s.match root.to_s
|
43
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
44
|
+
app.config.paths["db/migrate"] << expanded_path
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
46
|
-
end
|
50
|
+
end
|
data/lib/camaleon_cms/version.rb
CHANGED