rails-brochure 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
1
  class HomeController < ApplicationController
2
-
2
+ def four_zero_four
3
+ render 'four_zero_four', :status=>404
4
+ end
3
5
  end
data/config/routes.rb CHANGED
@@ -2,4 +2,6 @@ Rails.application.routes.draw do
2
2
  Rails::Brochure::HomeContent.templates.each do |pg|
3
3
  match "/#{pg}" => "home##{pg}", :as => pg.gsub('/','_').to_sym
4
4
  end
5
- end
5
+ match '*a', :to => 'home#four_zero_four' unless defined?(NONBROCHURE404)
6
+ end
7
+
@@ -1,17 +1,26 @@
1
1
  module Rails
2
2
  module Brochure
3
3
  class HomeContent
4
- #TODO: replace with cattr_accessor:
5
- HOME_FOLDER_PATH = "app/views/home/"
4
+ # This feature needs more work.
5
+ # You can change the folder path and the routes are correct
6
+ # Rails::Brochure::HomeContent.home_folder_path = 'app/views/content/'
7
+ # but the home controller looks in the home folder anyway...
8
+ # So the home controller would need to use a different
9
+ # directory. If I wanted to make this configurable i'd probably
10
+ # ask for a controller name, define one (meta) and render the
11
+ # routes accordingly.
12
+ @@home_folder_path = 'app/views/home/'
13
+ cattr_accessor :home_folder_path
14
+
6
15
  def self.newest
7
16
  HomeContent.files.map { |f| File.new(f) }.sort { |a,b| a.ctime <=> b.ctime }.map { |f| f.ctime }.last
8
17
  end
9
18
  def self.files
10
- Dir.glob("#{HOME_FOLDER_PATH}**/*.html.*")
19
+ Dir.glob("#{home_folder_path}**/*.html.*")
11
20
  end
12
21
  def self.templates
13
22
  HomeContent.files.map do |f|
14
- f.gsub(/(#{HOME_FOLDER_PATH}|.html.\w+)/,"")
23
+ f.gsub(/(#{home_folder_path}|.html.\w+)/,"")
15
24
  end
16
25
  end
17
26
  end
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module Brochure
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails-brochure
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Hixon
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-04 00:00:00 -07:00
13
+ date: 2011-04-09 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -47,6 +47,7 @@ files:
47
47
  - lib/generators/USAGE
48
48
  - lib/generators/brochure_generator.rb
49
49
  - lib/generators/templates/app/views/home/about.html.erb
50
+ - lib/generators/templates/app/views/home/four_zero_four.html.erb
50
51
  - lib/generators/templates/app/views/home/index.html.erb
51
52
  - lib/rails-brochure.rb
52
53
  - lib/rails-brochure/engine.rb