visitors 0.0.4 → 0.0.5
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/config.yml +7 -0
- data/lib/visitors/config.rb +12 -2
- data/lib/visitors/helpers.rb +1 -2
- data/lib/visitors/version.rb +1 -1
- metadata +2 -4
- data/spec/visitors/models_spec.rb +0 -10
data/config.yml
CHANGED
data/lib/visitors/config.rb
CHANGED
|
@@ -5,6 +5,10 @@ class Visitors::Config
|
|
|
5
5
|
new.tap { |instance| instance.send(:define_methods_from_yaml) }
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
def fields
|
|
9
|
+
yaml['fields'] && Array(yaml['fields']).map(&:to_sym)
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
def all
|
|
9
13
|
return yaml[env] if yaml[env]
|
|
10
14
|
raise MissingEnvironmentError, "#{env.inspect} environment not configured"
|
|
@@ -16,8 +20,14 @@ class Visitors::Config
|
|
|
16
20
|
|
|
17
21
|
private
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
if defined?(RAILS_ROOT)
|
|
24
|
+
def yaml
|
|
25
|
+
@yaml ||= YAML.load_file("#{RAILS_ROOT}/config/visitors.yml")
|
|
26
|
+
end
|
|
27
|
+
else
|
|
28
|
+
def yaml
|
|
29
|
+
@yaml ||= YAML.load_file(File.expand_path('../../../config.yml', __FILE__))
|
|
30
|
+
end
|
|
21
31
|
end
|
|
22
32
|
|
|
23
33
|
def env
|
data/lib/visitors/helpers.rb
CHANGED
|
@@ -4,7 +4,6 @@ require 'redis-namespace'
|
|
|
4
4
|
module Helpers
|
|
5
5
|
class UnsupportedField < StandardError; end
|
|
6
6
|
|
|
7
|
-
FIELDS = [:show, :search, :email, :website]
|
|
8
7
|
SET_NAME = 'resource_ids'
|
|
9
8
|
|
|
10
9
|
def redis
|
|
@@ -13,7 +12,7 @@ module Helpers
|
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
def fields
|
|
16
|
-
|
|
15
|
+
Visitors.config.fields || []
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
def assert_valid_field!(name)
|
data/lib/visitors/version.rb
CHANGED
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: visitors
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.0.
|
|
5
|
+
version: 0.0.5
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- James Conroy-Finn
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-02
|
|
13
|
+
date: 2011-03-02 00:00:00 +00:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -162,7 +162,6 @@ files:
|
|
|
162
162
|
- lib/visitors/version.rb
|
|
163
163
|
- spec/spec_helper.rb
|
|
164
164
|
- spec/visitors/config_spec.rb
|
|
165
|
-
- spec/visitors/models_spec.rb
|
|
166
165
|
- spec/visitors/resource_spec.rb
|
|
167
166
|
- spec/visitors_spec.rb
|
|
168
167
|
- visitors.gemspec
|
|
@@ -197,6 +196,5 @@ summary: All-in-one fast logging system for your Rails application
|
|
|
197
196
|
test_files:
|
|
198
197
|
- spec/spec_helper.rb
|
|
199
198
|
- spec/visitors/config_spec.rb
|
|
200
|
-
- spec/visitors/models_spec.rb
|
|
201
199
|
- spec/visitors/resource_spec.rb
|
|
202
200
|
- spec/visitors_spec.rb
|