natural_resource 0.1.5 → 0.1.6

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: 8ea31df94daa5b52a358be08a53bf9cc5dfed896
4
- data.tar.gz: 43b4befa5d781b407a5e03209b5783383a4db93f
3
+ metadata.gz: 4160dd4a90f6e97e0c23fc6a7e9b44f135e11d05
4
+ data.tar.gz: da74cd716e9e047331ea9bf69f327b4cc59b6fff
5
5
  SHA512:
6
- metadata.gz: ae3e9e9d293dbf36b1707d11c0c405beebca229254c4e635775aa4abe9e97da3b72c92693f004f65ed54ecd6545f8b20636449c1353555574cc8bd67807f821e
7
- data.tar.gz: 20c6a91a90c7275c25c7bca0357ee6353ff947aee18bea5809a98aa4fe777e247067e218b57aa041ca4a37c4a8f03aca3f67e6e9f80b142b733a2436094413b1
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
- template 'pundit.rb', 'spec/support/pundit.rb'
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
@@ -1,3 +1,3 @@
1
1
  module NaturalResource
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natural_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert White