natural_resource 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4160dd4a90f6e97e0c23fc6a7e9b44f135e11d05
|
4
|
+
data.tar.gz: da74cd716e9e047331ea9bf69f327b4cc59b6fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b034a650597e61a9359d9838bd3bcf505621cd56c1e44a3d15b4bf9b9910e3230b933e5a9743a0c7a670c5b6011b35e1dd301d64ff9de7f93446797f76a63f95
|
7
|
+
data.tar.gz: b1d38f50be7708cf95979571eff8aeb80366f3bf392533c1e413eb6160eedc11153f31a02b30b3bb17d4058cda4b52009beb051b9168212f5fffe3e45e4368ae
|
@@ -5,6 +5,16 @@ class Natural::InstallGenerator < Rails::Generators::Base
|
|
5
5
|
|
6
6
|
def copy_application_policy
|
7
7
|
template 'application_policy.rb', 'app/policies/application_policy.rb'
|
8
|
-
|
8
|
+
helper_path = Rails.root.join('spec', 'rails_helper.rb')
|
9
|
+
if File.exists?(helper_path)
|
10
|
+
template('pundit.rb', 'spec/support/pundit.rb')
|
11
|
+
helper_content = File.read(helper_path)
|
12
|
+
support_file_loader = "Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }"
|
13
|
+
unless helper_content.include?(support_file_loader)
|
14
|
+
helper_content.gsub!("require 'rspec/rails'",
|
15
|
+
"require 'rspec/rails'\n#{support_file_loader}")
|
16
|
+
File.open(helper_path, 'w') { |f| f.puts helper_content }
|
17
|
+
end
|
18
|
+
end
|
9
19
|
end
|
10
20
|
end
|