masterview_plugin_generator 0.3.2 → 0.3.3
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/masterview_plugin_generator.rb +4 -1
- data/templates/admin_auth_mixin.rb +47 -0
- data/templates/masterview.rake +15 -0
- data/templates/settings.rb +5 -0
- metadata +3 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
# Generator to generate small init.rb plugin which is used in
|
1
|
+
# Generator to generate small init.rb plugin which is used in
|
2
2
|
# conjunction with the masterview gem
|
3
3
|
class MasterviewPluginGenerator < Rails::Generator::Base
|
4
4
|
def initialize(runtime_args, runtime_options = {})
|
@@ -9,6 +9,8 @@ class MasterviewPluginGenerator < Rails::Generator::Base
|
|
9
9
|
record do |m|
|
10
10
|
m.directory 'vendor/plugins/masterview'
|
11
11
|
m.directory 'vendor/plugins/masterview/directives'
|
12
|
+
m.directory 'vendor/plugins/masterview/examples'
|
13
|
+
m.directory 'vendor/plugins/masterview/examples/rails_app_admin_auth'
|
12
14
|
m.directory 'vendor/plugins/masterview/lib'
|
13
15
|
m.directory 'vendor/plugins/masterview/lib/masterview'
|
14
16
|
m.directory 'vendor/plugins/masterview/lib/masterview/extras'
|
@@ -26,6 +28,7 @@ class MasterviewPluginGenerator < Rails::Generator::Base
|
|
26
28
|
m.file 'settings.rb', 'config/masterview/settings.rb'
|
27
29
|
m.file 'development.rb', 'config/masterview/environments/development.rb'
|
28
30
|
m.file 'production.rb', 'config/masterview/environments/production.rb'
|
31
|
+
m.file 'admin_auth_mixin.rb', 'vendor/plugins/masterview/examples/rails_app_admin_auth/admin_auth_mixin.rb'
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
# Example of a MasterView admin custom authorization mixin.
|
3
|
+
#
|
4
|
+
# This module is included into the MasterviewController, so it has access
|
5
|
+
# to all the the standard rails controller facilities as well as
|
6
|
+
# any application-specific features in your own ApplicationController.
|
7
|
+
#
|
8
|
+
# To install a custom authorization handler in your application,
|
9
|
+
# copy this file to the app/masterview directory in your rails application
|
10
|
+
# and modify the implementation of the allow_access? predicate to
|
11
|
+
# perform checking suitable in your application for determining
|
12
|
+
# whether to grant access to the MasterView admininstration pages.
|
13
|
+
#
|
14
|
+
# To change the mixin module name or to load your admin_auth module
|
15
|
+
# from a different directory or file name, set the MasterView
|
16
|
+
# admin_auth_mixin configuration setting in your config/masterview/settings.rb
|
17
|
+
# or an appropriate config/masterview/environments specification.
|
18
|
+
#
|
19
|
+
# For example, to load an alternate mixin from your app/masterview directory:
|
20
|
+
#
|
21
|
+
# config.admin_auth_mixin = {
|
22
|
+
# :file => 'alt_admin_auth_mixin',
|
23
|
+
# :module => :MasterViewAltAdminAuthMixin, # default is MasterViewAdminAuthMixin
|
24
|
+
# }
|
25
|
+
#
|
26
|
+
# To load an auth_check mixin from your rails lib directory:
|
27
|
+
#
|
28
|
+
# config.admin_auth_mixin = {
|
29
|
+
# :file => 'lib/custom_admin_auth_mixin',
|
30
|
+
# :file_loc => :RAILS_ROOT,
|
31
|
+
# }
|
32
|
+
#
|
33
|
+
module MasterViewAdminAuthMixin
|
34
|
+
|
35
|
+
MasterView::Log.debug { 'Using customized admin_auth mixin for MasterView admin (local requests only)' }
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
# Check that the current user has authorization to access admin operations.
|
40
|
+
def allow_access?
|
41
|
+
# default allows only for developer testing on local machine
|
42
|
+
local_request?
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
|
data/templates/masterview.rake
CHANGED
@@ -113,4 +113,19 @@ namespace :mv do
|
|
113
113
|
puts f.read
|
114
114
|
end
|
115
115
|
|
116
|
+
desc 'Cleanup/remove MasterView generated rhtml files - useful when generating erb to file system'
|
117
|
+
task :clean_mv_rhtml do
|
118
|
+
if MasterView::ConfigSettings.generate_rhtml_files
|
119
|
+
removed = []
|
120
|
+
MasterView::TemplateSpec.scan do |template_spec, content_hash|
|
121
|
+
removed << template_spec.remove_rhtml
|
122
|
+
end
|
123
|
+
removed.flatten.each { |f| puts "#{f} removed" }
|
124
|
+
else
|
125
|
+
puts "\nNote: config.generate_rhtml_files was false, so rails reads erb/rhtml directly from MasterView, and thus there is nothing to remove from the file system. If config.generate_rhtml_files = true (in config/masterview/settings.rb) and then this command would clean up the generated rhtml files from the file system"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
|
116
131
|
end
|
data/templates/settings.rb
CHANGED
@@ -26,6 +26,10 @@
|
|
26
26
|
#config.template_src_dir_path = 'app/views' # relative path from config.root_path
|
27
27
|
#config.template_src_dir_abs_path( '/path/to/masterview/templates' )
|
28
28
|
#config.template_filename_pattern = '*.html'
|
29
|
+
#config.auto_copy_file_entries << { :source => 'path_to_my_images', :destination => 'public/images' }
|
30
|
+
#config.auto_copy_file_entries << { :source => 'path_to_my_scripts', :destination => 'public/javascripts', :extensions => [:js, :JS] } # only copy js files
|
31
|
+
#config.auto_copy_file_entries << { :source => 'path_to_my_css', :destination => 'public/stylesheets' }
|
32
|
+
|
29
33
|
|
30
34
|
# Template Generation Options
|
31
35
|
#config.template_dst_dir_path = 'app/views' # relative path from config.root_path
|
@@ -50,6 +54,7 @@
|
|
50
54
|
#config.inline_erb_start = '{{{'
|
51
55
|
#config.inline_erb_end = '}}}'
|
52
56
|
#config.inline_erb_substitution_regex = /\{\{\{(([^}]|\}[^}]|\}\}[^}])*)\}\}\}/
|
57
|
+
#config.use_original_rexml_sax2parser = false
|
53
58
|
|
54
59
|
# Rails application options
|
55
60
|
#config.parse_masterview_templates_at_startup = true
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: masterview_plugin_generator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.3.3
|
7
|
+
date: 2007-05-28 00:00:00 -05:00
|
8
8
|
summary: A (x)html friendly template engine for rails with the power of layouts, and partials. MasterView Plugin Generator for GEM
|
9
9
|
require_paths:
|
10
10
|
- .
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- templates/settings.rb
|
35
35
|
- templates/empty.rhtml
|
36
36
|
- templates/init.rb
|
37
|
+
- templates/admin_auth_mixin.rb
|
37
38
|
- templates/masterview.rake
|
38
39
|
- templates/production.rb
|
39
40
|
- Rakefile
|