turf 0.0.5 → 1.0.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: c407eac4133da891ff7414ce6f5fc1ff5e60e5ec
4
- data.tar.gz: 9ac072d4afb236909f8840e44bd911e02ce10a10
3
+ metadata.gz: f24fe3ea52f6c21e2e9029ddc77a9d9214648afa
4
+ data.tar.gz: addb8ff880f754235e23fc6c7d59f5ea82bf2444
5
5
  SHA512:
6
- metadata.gz: aabd84c13706bce584d27a6ff4aef2413a0bda6c667604b2ecb4a74c1e619d4c199987b64fea0d5f42b3cf3db2383523a86f85ab1bdc03611ce841ada2ce2b40
7
- data.tar.gz: 8c48280d7887727846bd26228ad311e9c5928a251052d5ee27b6920eb0dac110cbeb31e931ed32c957b4215000ac18d62aba8a8c56de1f04d4d51a77156fe188
6
+ metadata.gz: fdd0fc75d5a57b3374e1979c716965bd8604e32fbbfac920fc36cf333bc191b1959b15ea12e46dca3a6e2e286bf3de7a75894b64edbd515e41764919656b6aa2
7
+ data.tar.gz: a0ce30212f98aa7be73c7a382531b1c06127a923c02222518beeeafac9508e149bb03d9339c87a91ff137dc823fb0b383ee644299e66a7dbd7b0553e3d552c57
data/README.md CHANGED
@@ -79,9 +79,45 @@ Require turf:
79
79
  require 'turf'
80
80
  ```
81
81
 
82
- Create the `Turf::Local`, `Turf::Test`, `Turf::Development`, `Turf::Production`, and `Turf::Default` classes (you don't have to create all of them, just the ones you want).
82
+ ## Suggested Setup
83
83
 
84
- Use `Turf.find()` in your project.
84
+ Include the Turf setup rake task in your project's `Rakefile`:
85
+
86
+ ```ruby
87
+ load "tasks/setup.rake"
88
+ ```
89
+
90
+ Run the rake task to create the classes in your project:
91
+
92
+ ```
93
+ bundle exec rake turf:setup
94
+ ```
95
+
96
+ Require all the files in the `/lib/#{project_name}.rb` file:
97
+
98
+ ```ruby
99
+ require_relative "../config/turf/default.rb"
100
+
101
+ def require_all(pattern)
102
+ Dir.glob("#{Turf.find(:root)}/#{pattern}/**/*.rb").sort.each { |path| require path }
103
+ end
104
+
105
+ require_all("config/turf")
106
+ ```
107
+
108
+ Set the `RAILS_ENV` to "develoment" at the top of the `/lib/#{project_name}.rb` file:
109
+
110
+ ```ruby
111
+ ENV['RAILS_ENV'] ||= "development"
112
+ ```
113
+
114
+ Set the `RAILS_ENV` to "test" in the `spec_helper.rb` file:
115
+
116
+ ```ruby
117
+ ENV['RAILS_ENV'] = 'test'
118
+ ```
119
+
120
+ Set the `RAILS_ENV` to production on the remote host.
85
121
 
86
122
  ## Contributing
87
123
 
@@ -0,0 +1,9 @@
1
+ namespace :turf do
2
+ desc "Create classes configuration classes to setup Turf"
3
+ task :setup do
4
+ root = File.expand_path("../../", File.dirname(__FILE__))
5
+ target = "#{Rake.original_dir}/config/turf/"
6
+ FileUtils.mkdir_p(target)
7
+ `cp -n #{root}/templates/*.rb #{target}`
8
+ end
9
+ end
@@ -3,8 +3,18 @@ require "turf/version"
3
3
  require_relative "./turf/lookup.rb"
4
4
 
5
5
  module Turf
6
- def self.find(message)
7
- m = Lookup.new
8
- m.find(message)
6
+
7
+ class << self
8
+
9
+ def find(message)
10
+ m = Lookup.new
11
+ m.find(message)
12
+ end
13
+
14
+ def method_missing(name, *args)
15
+ find(name)
16
+ end
17
+
9
18
  end
19
+
10
20
  end
@@ -4,7 +4,7 @@ module Turf; class Lookup
4
4
  lookup_path.each do |obj|
5
5
  return obj.send(message) if obj.respond_to?(message)
6
6
  end
7
- raise "The #{message} method could not be found in any of these Turf configuration classes: #{classes.join(", ")}"
7
+ raise NoMethodError, "The #{message} method could not be found in any of these Turf configuration classes: #{classes.join(", ")}"
8
8
  end
9
9
 
10
10
  private
@@ -1,3 +1,3 @@
1
1
  module Turf
2
- VERSION = "0.0.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,12 @@
1
+ module Turf; class Default
2
+
3
+ def env
4
+ raise "The RAILS_ENV environment variable must be set" unless ENV['RAILS_ENV']
5
+ ENV['RAILS_ENV']
6
+ end
7
+
8
+ def root
9
+ @root ||= File.expand_path("../../", File.dirname(__FILE__))
10
+ end
11
+
12
+ end; end
@@ -0,0 +1,4 @@
1
+ module Turf; class Development
2
+
3
+ end; end
4
+
@@ -0,0 +1,3 @@
1
+ module Turf; class Local
2
+
3
+ end; end
@@ -0,0 +1,3 @@
1
+ module Turf; class Production
2
+
3
+ end; end
@@ -0,0 +1,3 @@
1
+ module Turf; class Test
2
+
3
+ end; 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: 0.0.5
4
+ version: 1.0.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-08-21 00:00:00.000000000 Z
11
+ date: 2015-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,9 +86,15 @@ files:
86
86
  - bin/console
87
87
  - bin/setup
88
88
  - lib/tasks/console.rake
89
+ - lib/tasks/setup.rake
89
90
  - lib/turf.rb
90
91
  - lib/turf/lookup.rb
91
92
  - lib/turf/version.rb
93
+ - templates/default.rb
94
+ - templates/development.rb
95
+ - templates/local.rb
96
+ - templates/production.rb
97
+ - templates/test.rb
92
98
  - turf.gemspec
93
99
  homepage: https://github.com/MrPowers/turf
94
100
  licenses: