fencepost 0.1.3 → 0.1.4

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: 59a9f441ff57ded1fea4561bb26628334f2ade04
4
- data.tar.gz: aa479181da8b8a4a1d4bccd4d33902f05ffea63d
3
+ metadata.gz: 32aa88c58507d1b19b55a5f37499b9801e056f0a
4
+ data.tar.gz: cc0677ff01d5c093807e5eb60a5694dbc05ac08c
5
5
  SHA512:
6
- metadata.gz: c009a991a56e6e366df90111fecfe7e4c96d11ec287a42ce57e3187b0ee21a3add540012c23186ff6a919278b91e0e6d2ac4fc415e84bfe7259f766355872f6a
7
- data.tar.gz: 07898e64edc0b87c0c487a2b89468e023fe1955ce924a7527bf17a30d239b7c57b73f8f290f421a8be35a8715956393ccbb7a2a1973ec06b1511ff17b145121c
6
+ metadata.gz: b1e84a8cff07a1cbe154beed1fb8f5015fcec72934a6464cfa475dc0740bf47e9c374e8290d5ada8a5d04a90bc37d7c5a403037a0d27dc88fb8b45e2de4e24c5
7
+ data.tar.gz: 7682cb9853fa97d35cbc3399ae8c64fbc67261df3d69efc96c9b18a59da182e1c93ff67cbda37e62b20cc8c28e40d421d4a7385111176885f41e29d73fbe8476
@@ -2,6 +2,7 @@ require "fencepost/fencepost"
2
2
  require "fencepost/gate"
3
3
  require "fencepost/acts_as_fencepost"
4
4
  require "fencepost/configuration"
5
+ require "fencepost/railtie"
5
6
 
6
7
  module Fencepost
7
8
  class << self
@@ -35,9 +35,9 @@ module Fencepost
35
35
  end
36
36
 
37
37
  def ensure_models
38
- Rails.application.eager_load!
39
38
  klass = self.class
40
39
  if ::Fencepost.configuration.dev_mode
40
+ Rails.application.eager_load!
41
41
  klass.model_list = klass.generate_model_list
42
42
  end
43
43
  end
@@ -81,7 +81,7 @@ module Fencepost
81
81
  end
82
82
 
83
83
  def self.always_forbidden_attributes
84
- [:id, :created_at, :updated_at, :created_by, :updated_by]
84
+ [:created_at, :updated_at]
85
85
  end
86
86
 
87
87
  def self.attribute_keys(model)
@@ -0,0 +1,10 @@
1
+ require 'yaml'
2
+ module Fencepost
3
+ class Railtie < ::Rails::Railtie
4
+ config.after_initialize do
5
+ Rails.application.eager_load!
6
+ file_name = "#{Rails.root}/config/fencepost.yml"
7
+ Fencepost.model_list = YAML.load_file(file_name) if File.exists?(file_name)
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module Fencepost
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -3,12 +3,12 @@ require 'yaml'
3
3
  class FencepostConfigGenerator < Rails::Generators::Base
4
4
  def create_initializer_file
5
5
  Rails.application.eager_load!
6
- create_file "config/initializers/fencepost.rb",
7
- file_contents
6
+ create_file "config/initializers/fencepost.rb", config_contents
7
+ create_file "config/fencepost.yml", yaml_contents
8
8
  end
9
9
 
10
- def file_contents
11
- <<-yaml
10
+ def config_contents
11
+ <<-config
12
12
  Rails.application.eager_load!
13
13
  Fencepost.configure do |config|
14
14
  # dev_mode true means that the Fencepost model_list is created every time
@@ -20,11 +20,12 @@ Fencepost.configure do |config|
20
20
  # creating it from scratch every time)
21
21
  config.dev_mode = false
22
22
  end
23
- Fencepost::Fencepost.model_list = YAML.load(
24
- <<-contents
23
+ config
24
+ end
25
+
26
+ def yaml_contents
27
+ <<-yaml
25
28
  #{Fencepost::Fencepost.generate_model_list.to_yaml}
26
- contents
27
- )
28
29
  yaml
29
30
  end
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fencepost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Helm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -91,6 +91,7 @@ files:
91
91
  - lib/fencepost/configuration.rb
92
92
  - lib/fencepost/fencepost.rb
93
93
  - lib/fencepost/gate.rb
94
+ - lib/fencepost/railtie.rb
94
95
  - lib/fencepost/version.rb
95
96
  - lib/fencepost.rb
96
97
  - lib/generators/fencepost_config_generator.rb