turf 1.1.0 → 1.2.0

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: d5847c2bab261109818e31ea4eb87b6ec35eed91
4
- data.tar.gz: 16d6b69aee0dd7dcfc25ce09eb76c8a041cc20c0
3
+ metadata.gz: d6f1cf7875d4d9db0778ae29ca025522bf166e3f
4
+ data.tar.gz: 9f658cf540f44dfbe624bf24d9d7ed0e4af12acd
5
5
  SHA512:
6
- metadata.gz: 78352062a284a920aa44177976e3e6ad1ec8c699fd514a5a37d438fc003723fca3d66c13074452b6e0c6ddc051bbfdd8a390f4a8d883c791e446eb93ff0b4508
7
- data.tar.gz: 3328006c0beb4721b1e1aa32ef58813119815e350f8fc7545e3bf37c963d7bd85ac44e5a529f64b5788c7624c773bb35cbb72132f8a689fd627c132ae826562b
6
+ metadata.gz: 5c87c2814e2f9722ec0bdf49b941448f16f2d835079d14df71131ba43eeb48d4ba1fc4be3c9bb986bd1514624a7474523ff482dfdccc0c79cf9930fd173fdaea
7
+ data.tar.gz: 897e6c7d35812cdf0f8cc6aaef61dea28ec6e1fe20a7b63767056e32377788c7a000d0368bd191a007992aa86791a5eb7e3214e407f9d32377d2251fd0b381f8
data/README.md CHANGED
@@ -93,6 +93,8 @@ Run the rake task to create the classes in your project:
93
93
  bundle exec rake turf:setup
94
94
  ```
95
95
 
96
+ ### Ruby Projects (see below for Rails Projects)
97
+
96
98
  Require all the files in the `/lib/#{project_name}.rb` file:
97
99
 
98
100
  ```ruby
@@ -105,6 +107,8 @@ end
105
107
  require_all("config/turf")
106
108
  ```
107
109
 
110
+ ***RAILS_ENV is used to manage the environment for compatibility with other gems***
111
+
108
112
  Set the `RAILS_ENV` to "develoment" at the top of the `/lib/#{project_name}.rb` file:
109
113
 
110
114
  ```ruby
@@ -119,6 +123,20 @@ ENV['RAILS_ENV'] = 'test'
119
123
 
120
124
  Set the `RAILS_ENV` to production on the remote host.
121
125
 
126
+ ### Rails Projects
127
+
128
+ Require all the `Turf` files in the `config/application.rb` file:
129
+
130
+ ```ruby
131
+ Dir.glob("#{Rails.root}/config/turf/**/*.rb").each { |path| require path }
132
+ ```
133
+
134
+ That's it!
135
+
136
+ ## .gitignore Turf::Local
137
+
138
+ Application secrets can be stored in `Turf::Local` and the file can be gitignored so these secrets are not exposed in source control. Add this line (`/config/turf/local.rb`) to your `.gitignore` file and `scp` the local.rb file to the remote host when changes are made.
139
+
122
140
  ## Contributing
123
141
 
124
142
  Bug reports and pull requests are welcome on GitHub at https://github.com/MrPowers/turf.
@@ -1,15 +1,23 @@
1
1
  module Turf; class Lookup
2
2
 
3
3
  def find(message)
4
+ if local_class && default_class
5
+ message = "The following methods are defined in the #{local_class} class but not the #{default_class} class: #{methods_in_local_and_not_default.join(', ')}. All methods defined in #{local_class} must also be defined in #{default_class}."
6
+ raise message unless methods_in_local_and_not_default.empty?
7
+ end
8
+ raise "No Turf classes found... these must be defined and required" if classes.empty?
4
9
  lookup_path.each do |obj|
5
10
  return obj.send(message) if obj.respond_to?(message)
6
11
  end
7
- raise "No Turf classes found... these must be defined and required" if classes.empty?
8
12
  raise NoMethodError, "The #{message} method could not be found in any of these Turf configuration classes: #{classes.join(", ")}"
9
13
  end
10
14
 
11
15
  private
12
16
 
17
+ def methods_in_local_and_not_default
18
+ local_class.instance_methods(false) - default_class.instance_methods(false)
19
+ end
20
+
13
21
  def lookup_path
14
22
  classes.map(&:new)
15
23
  end
@@ -1,3 +1,3 @@
1
1
  module Turf
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MrPowers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler