bootstrappers 0.2.1 → 0.2.2

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.
data/CHANGELOG.md CHANGED
@@ -4,6 +4,7 @@ alpha
4
4
 
5
5
  * add hipchat
6
6
  * add auto_facebook
7
+ * add admin?
7
8
 
8
9
  0.2.0.1 (Jan 25, 2013)
9
10
  * fix email_sender
data/README.md CHANGED
@@ -46,6 +46,7 @@ It includes application gems like:
46
46
  * [Turbo Sprockets for Rails 3.2.x](https://github.com/ndbroadbent/turbo-sprockets-rails3) Speeds up your Rails 3 rake assets:precompile by only recompiling changed assets
47
47
 
48
48
  ### CommandLine
49
+
49
50
  * [Magic encoding](https://github.com/m-ryan/magic_encoding)
50
51
  * [Annotate](https://github.com/ctran/annotate_models)
51
52
  * [Settingslogic](https://github.com/binarylogic/settingslogic)
data/TODO.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  * Search
4
4
  - ransack
5
- * OmniAuth
6
- - Facebook
7
5
  * Devise
8
6
  - Login Form refactor
9
7
  * Cancan
@@ -22,6 +20,4 @@
22
20
  * Caching
23
21
  - add config.cache_store to dali
24
22
  * Refactor Devise Views
25
- * add group hack to bootstrap css
26
- * add require admin to applicaiton controller
27
23
  * add admin to menu
@@ -39,6 +39,11 @@ module Bootstrappers
39
39
  generate 'auto_facebook:install'
40
40
  end
41
41
 
42
+ def insert_admin_method_to_user
43
+ inject_into_file 'app/models/user.rb',
44
+ "\n\n def admin?\n Setting.admin_emails.include?(email)\n end\n", :after => '# attr_accessible :title, :body'
45
+ end
46
+
42
47
  def replace_email_sender_for_devise
43
48
  replace_in_file 'config/initializers/devise.rb', /config\.mailer_sender = \".+\"/ , "config.mailer_sender = Setting.email_sender"
44
49
  end
@@ -99,7 +99,7 @@ module Bootstrappers
99
99
  build :setup_devise
100
100
  build :build_auto_facebook
101
101
  build :build_settings_from_config
102
-
102
+ build :build_admin_method_to_user
103
103
  end
104
104
 
105
105
  def create_initializers
@@ -116,6 +116,10 @@ module Bootstrappers
116
116
  build :generate_auto_facebook
117
117
  end
118
118
 
119
+ def build_admin_method_to_user
120
+ build :insert_admin_method_to_user
121
+ end
122
+
119
123
  def customize_error_pages
120
124
  say 'Customizing the 500/404/422 pages'
121
125
  build :customize_error_pages
@@ -1,3 +1,3 @@
1
1
  module Bootstrappers
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -19,4 +19,10 @@ class ApplicationController < ActionController::Base
19
19
  end
20
20
 
21
21
 
22
+ def require_is_admin
23
+ unless (current_user && current_user.admin?)
24
+ redirect_to root_path, :flash => { :error => "no permission" }
25
+ end
26
+ end
27
+
22
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrappers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -2734716052357034420
112
+ hash: -2784932820798105195
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -2734716052357034420
121
+ hash: -2784932820798105195
122
122
  requirements: []
123
123
  rubyforge_project:
124
124
  rubygems_version: 1.8.25