scaffold_plus 1.4.13 → 1.4.14
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42c2230db8f4b8c89abd5f925ff381bd7244c6b4
|
4
|
+
data.tar.gz: 1e02a4c4eb1e4b0d134abdbeffa94f09b7c51f51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077668d6fb7ef1684d222b681134525559603c6ba283617854a9305c737601e718b997771a62db2c5f716e8b1f3959a53f5598d19056de995611915c7282adcd
|
7
|
+
data.tar.gz: 38b3ece4c2f89de9e21c8fbab2df58e3965bbb6e03c96fda6aa4c4362c04912e43ae0899dd8aed7369710bb3c7ef30179618cb0a7d816c9926ba7e3eb7ddf560
|
@@ -25,7 +25,7 @@ module ScaffoldPlus
|
|
25
25
|
migration_template "ancestry_migration.rb", "db/migrate/#{migration_name}.rb"
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def update_model
|
29
29
|
inject_into_class "app/models/#{name}.rb", class_name do
|
30
30
|
text = options.before? ? "\n" : ""
|
31
31
|
text << " has_ancestry"
|
@@ -36,7 +36,7 @@ module ScaffoldPlus
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def update_controller
|
40
40
|
return unless options.permit?
|
41
41
|
text = ":ancestry"
|
42
42
|
file = "app/controllers/#{table_name}_controller.rb"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rails/generators/active_record'
|
2
|
+
|
3
|
+
module ScaffoldPlus
|
4
|
+
module Generators
|
5
|
+
class ForceSslGenerator < ActiveRecord::Generators::Base
|
6
|
+
desc "Enforce SSL for this controller in production"
|
7
|
+
argument :name, type: :string,
|
8
|
+
desc: "The resource that is SSL protected"
|
9
|
+
class_option :only, type: :array,
|
10
|
+
desc: 'Enforce for these actions'
|
11
|
+
class_option :except, type: :array,
|
12
|
+
desc: 'Do not enforce for these actions'
|
13
|
+
|
14
|
+
def update_controller
|
15
|
+
file = "app/controllers/#{table_name}_controller.rb"
|
16
|
+
inject_into_file file, after: /^class.*ApplicationController$/ do
|
17
|
+
text = "\n force_ssl if: :ssl_configured?"
|
18
|
+
text << ", only: [ #{only_list} ]", if options.only.present?
|
19
|
+
text << ", except: [ #{except_list} ]", if options.except.present?
|
20
|
+
text
|
21
|
+
end
|
22
|
+
inject_into_file file, after: /private$/ do
|
23
|
+
[
|
24
|
+
"",
|
25
|
+
" # When to enforce SSL for this controller",
|
26
|
+
" def ssl_configured?",
|
27
|
+
" Rails.env.production?",
|
28
|
+
" end",
|
29
|
+
"",
|
30
|
+
""
|
31
|
+
].join("\n")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def only_list
|
38
|
+
[ options.only ].join(", ")
|
39
|
+
end
|
40
|
+
|
41
|
+
def except_list
|
42
|
+
[ options.except ].join(", ")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffold_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Wiegand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/generators/scaffold_plus/autofocus/autofocus_generator.rb
|
85
85
|
- lib/generators/scaffold_plus/collection/collection_generator.rb
|
86
86
|
- lib/generators/scaffold_plus/collection/templates/view.html.erb
|
87
|
+
- lib/generators/scaffold_plus/force_ssl/force_ssl_generator.rb
|
87
88
|
- lib/generators/scaffold_plus/habtm/habtm_generator.rb
|
88
89
|
- lib/generators/scaffold_plus/habtm/templates/habtm_migration.rb
|
89
90
|
- lib/generators/scaffold_plus/has_many/has_many_generator.rb
|