rails-brochure 0.2 → 0.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0a9c2947337172e666e6008918e5f6d66f617e5b2ef21dbdfa542ede72ce4ca
|
4
|
+
data.tar.gz: 6a775a23cb8590cedb3a02f6f78b786e0d4e3e2fa667248cd980435ad618195f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 859aed77daa04aad517cb9a2e782255009fd1c7b7d67d727713e6b950a9cf55010cff0588752a887e7c3cba08dec3f0db0590180d86c2d1b97102cbafbcd9914
|
7
|
+
data.tar.gz: aad1049c01acb2e2e905677f4f7d9f9e797a60143e3d102ed77737c03e7974e81741ea3026e0a3dac4a2556d323dad07ed57ffd133c04e2b39a6f0b278164f40
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
Rails::Brochure::HomeContent.templates.each do |
|
3
|
-
|
2
|
+
Rails::Brochure::HomeContent.templates.each do |page_path|
|
3
|
+
action_name = page_path.gsub(/(\/|-)/,'_') # slashes and dashes become underscores
|
4
|
+
get "/#{page_path}" => "home##{action_name}", :as => action_name.to_sym
|
5
|
+
HomeController.class_eval {
|
6
|
+
define_method action_name.to_sym do
|
7
|
+
render "home/#{page_path}"
|
8
|
+
end
|
9
|
+
}
|
4
10
|
end
|
5
11
|
get '*a', :to => 'home#four_zero_four' unless defined?(NONBROCHURE404) && Rails.application.config.consider_all_requests_local
|
6
12
|
end
|
@@ -19,7 +19,7 @@ module Rails
|
|
19
19
|
def self.file_names
|
20
20
|
files = Dir.glob("#{home_folder_path}**/*.{#{Mime::EXTENSION_LOOKUP.keys.join(",")}}.*")
|
21
21
|
#puts files.inspect
|
22
|
-
files.delete_if { |f| f.end_with?(".orig") }
|
22
|
+
files.delete_if { |f| f.end_with?(".orig") || f.start_with?("_") }
|
23
23
|
files
|
24
24
|
end
|
25
25
|
|
@@ -1,26 +1,32 @@
|
|
1
1
|
module Rails
|
2
2
|
module Brochure
|
3
3
|
class RouteReloader
|
4
|
+
|
4
5
|
def initialize(app)
|
5
6
|
@app = app
|
6
7
|
end
|
8
|
+
|
7
9
|
def call(env)
|
8
10
|
reload_routes if new_content?
|
9
11
|
@app.call(env)
|
10
12
|
end
|
13
|
+
|
11
14
|
def reload_routes
|
12
15
|
# we must touch the routes file in order for it to be reloaded
|
13
16
|
FileUtils.touch("config/routes.rb")
|
14
17
|
Rails.application.reload_routes!
|
15
18
|
Rails.logger.info "ROUTES RELOADED by rails-brochure"
|
16
19
|
end
|
20
|
+
|
17
21
|
def new_content?
|
18
22
|
return true if HomeContent.newest.nil? || last_route_change.nil?
|
19
23
|
HomeContent.newest > last_route_change
|
20
24
|
end
|
25
|
+
|
21
26
|
def last_route_change
|
22
27
|
File.mtime("config/routes.rb")
|
23
28
|
end
|
29
|
+
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-brochure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Hixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|