simple-pages-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,10 @@ module SimplePages
5
5
  helper ::RailsTheme::Engine.helpers
6
6
  helper SimplePages.helper_modules
7
7
 
8
- SimplePages.controller_modules.each do |module_class|
9
- include module_class
8
+ SimplePages.controller_modules.each { |module_name| include module_name }
9
+
10
+ if SimplePages.extra_page_layout.present?
11
+ has_page_layout_at SimplePages.extra_page_layout
10
12
  end
11
13
  end
12
14
  end
@@ -29,8 +29,6 @@ module SimplePages
29
29
  url
30
30
  end
31
31
 
32
- SimplePages.page_modules.each do |module_class|
33
- include module_class
34
- end
32
+ SimplePages.page_modules.each { |module_name| include module_name }
35
33
  end
36
34
  end
@@ -8,4 +8,6 @@ Example:
8
8
  lib/devise_ext.rb
9
9
  lib/cancan_ext.rb
10
10
  config/initializers/simple_pages.rb
11
+ config/routes.rb
12
+ app/controllers/application_controller.rb
11
13
  app/models/user.rb
@@ -14,6 +14,22 @@ module SimplePages
14
14
  template 'simple_pages.rb', 'config/initializers/simple_pages.rb'
15
15
  end
16
16
 
17
+ def mount_routes
18
+ insert_into_file 'config/routes.rb', after: "routes.draw do\n" do
19
+ " mount SimplePages::Engine, at: '/'\n"
20
+ end
21
+ end
22
+
23
+ def inject_application_controller
24
+ insert_into_file 'app/controllers/application_controller.rb', after: /class ApplicationController < ActionController::Base\n/ do
25
+ <<-CODE
26
+ include DeviseExt
27
+ include CanCanExt
28
+ include SimplePages::Controllers::PageLayoutAt
29
+ CODE
30
+ end
31
+ end
32
+
17
33
  def append_user_mixin
18
34
  user_model = "app/models/#{options[:user_model].downcase}.rb"
19
35
  unless File.exist? user_model
@@ -29,12 +45,6 @@ module SimplePages
29
45
  CODE
30
46
  end
31
47
  end
32
-
33
- def mount_routes
34
- insert_into_file 'config/routes.rb', after: "routes.draw do\n" do
35
- " mount SimplePages::Engine, at: '/'\n"
36
- end
37
- end
38
48
  end
39
49
  end
40
50
  end
@@ -5,6 +5,9 @@ SimplePages.configure do |config|
5
5
  # mixin controller modules.
6
6
  config.controller_modules += [DeviseExt, CanCanExt]
7
7
 
8
+ # add extra page layout location, default to %w{header footer}
9
+ # config.extra_page_layout += []
10
+
8
11
  # mixin helper modules.
9
12
  # config.helper_modules += []
10
13
 
@@ -1,3 +1,3 @@
1
1
  module SimplePagesRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
data/lib/simple_pages.rb CHANGED
@@ -11,6 +11,9 @@ module SimplePages
11
11
  SimplePages::Controllers::PageLayoutAt
12
12
  ]
13
13
 
14
+ mattr_accessor :extra_page_layout
15
+ @@extra_page_layout = []
16
+
14
17
  mattr_accessor :helper_modules
15
18
  @@helper_modules = []
16
19
 
@@ -1,3 +1,6 @@
1
1
  class ApplicationController < ActionController::Base
2
+ include DeviseExt
3
+ include CanCanExt
4
+ include SimplePages::Controllers::PageLayoutAt
2
5
  protect_from_forgery
3
6
  end
@@ -5,6 +5,9 @@ SimplePages.configure do |config|
5
5
  # mixin controller modules.
6
6
  config.controller_modules += [DeviseExt, CanCanExt]
7
7
 
8
+ # add extra page layout location, default to %w{header footer}
9
+ # config.extra_page_layout += []
10
+
8
11
  # mixin helper modules.
9
12
  # config.helper_modules += []
10
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-pages-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -320,7 +320,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
320
320
  version: '0'
321
321
  segments:
322
322
  - 0
323
- hash: -1805547192965503228
323
+ hash: -3697549356973948748
324
324
  required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  none: false
326
326
  requirements:
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  version: '0'
330
330
  segments:
331
331
  - 0
332
- hash: -1805547192965503228
332
+ hash: -3697549356973948748
333
333
  requirements: []
334
334
  rubyforge_project:
335
335
  rubygems_version: 1.8.24