turf 0.0.3 → 0.0.4

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +70 -18
  3. data/lib/turf.rb +0 -1
  4. data/lib/turf/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 537d868afadd91478e29bfbc4b869983647ef663
4
- data.tar.gz: 041f84e0ca6466e02ecda45e5d667b9209f9d9ef
3
+ metadata.gz: 041d3a291a6ed153c3b5f82fcd2c354c1a25113d
4
+ data.tar.gz: f4db87acd04ab1142806de020c1fbadf7a816883
5
5
  SHA512:
6
- metadata.gz: 5db00b767ed41f28cffe57361c11e2c0de06dea1baa9246295230a4c52cc74839b545f1cfd8942d2413ca73bde7b4ede146740cfbcd54f71ee91e4ea2c20eb51
7
- data.tar.gz: 9f5c21950b3047fb8c4dd57a912c4222dc5410c9bdf7592598d1f50a60a86b171f34d8bf8a8e32d590bfaac34d510fb15fc3eea12c7f9786d474870d0199b21f
6
+ metadata.gz: da5eefaa8107fcd0112d644351a97dc9424e46282569bc94356c03af080f92b24227f13ebe9b0a580852c913e024f65e442864c3d5b1a805230aafec455689a8
7
+ data.tar.gz: c86be7230bea291951c31a1640d0c554d2999e23b0bfcc017b69dfae52cc38e1964821cac07a8046f263e482ca79ddbf74c0ee9b6772e04bfc6b2734c7104a55
data/README.md CHANGED
@@ -1,41 +1,93 @@
1
1
  # Turf
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/turf`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Turf lets you control the value of variables in different environments and makes it easy to override values locally. It's easy to set `speak_in_chat` to `true` when `RAILS_ENV` equals "production" and `false` otherwise. Turf is similar to the Rails `secrets.yml` file, but more powerful because it can execute Ruby code and return arrays, hashes, etc.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
5
 
7
- ## Installation
6
+ ## How it works
8
7
 
9
- Add this line to your application's Gemfile:
8
+ Turf looks for methods in the following order:
10
9
 
11
- ```ruby
12
- gem 'turf'
13
- ```
10
+ 1. The `Turf::Local` class.
11
+ 2. The `Turf::Test`, `Turf::Development`, or `Turf::Production` class. Turf uses the development environment by default, but this can be overridden by setting `RAILS_ENV` to "production" or "test".
12
+ 3. The `Turf::Default` class.
14
13
 
15
- And then execute:
14
+ I recommend defining the Turf classes in the `/config/turf` directory.
16
15
 
17
- $ bundle
18
16
 
19
- Or install it yourself as:
17
+ ## Examples
20
18
 
21
- $ gem install turf
19
+ ```ruby
20
+ ENV["RAILS_ENV"] = "production"
21
+
22
+ class Turf::Local
23
+ def something
24
+ "something in local"
25
+ end
26
+ end
27
+
28
+ class Turf::Development
29
+ def blah
30
+ "blah in development"
31
+ end
32
+ end
33
+
34
+ class Turf::Production
35
+ def something
36
+ "something in production"
37
+ end
38
+
39
+ def blah
40
+ "blah in production"
41
+ end
42
+ end
43
+
44
+ class Turf::Default
45
+ def four
46
+ 2 + 2
47
+ end
48
+ end
49
+
50
+ # Turf::Local is the first place Turf looks for a
51
+ # matching method
52
+ Turf.find(:something) # => "something in local"
53
+
54
+ # The RAILS_ENV is set to production, so Turf looks
55
+ # in Turf::Production second if the method is not
56
+ # found in Turf::Local
57
+ # Turf::Development is ignored in production
58
+ Turf.find(:blah) # => "blah in production"
59
+
60
+ # Turf::Default is the last place to look
61
+ Turf.find(:four) # => 4
62
+
63
+ # Turf raises an exception when it can't find
64
+ # a matching method
65
+ Turf.find(:hi_there) # => raises an exception
66
+ ```
22
67
 
23
- ## Usage
68
+ ## Setup
24
69
 
25
- TODO: Write usage instructions here
70
+ Add this line to your application's Gemfile:
26
71
 
27
- ## Development
72
+ ```ruby
73
+ gem 'turf'
74
+ ```
28
75
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
76
+ Require turf:
30
77
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78
+ ```ruby
79
+ require 'turf'
80
+ ```
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).
83
+
84
+ Use `Turf.find()` in your project.
32
85
 
33
86
  ## Contributing
34
87
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/turf.
88
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MrPowers/turf.
36
89
 
37
90
 
38
91
  ## License
39
92
 
40
93
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,5 +1,4 @@
1
1
  require "turf/version"
2
- require 'pry'
3
2
 
4
3
  require_relative "./turf/lookup.rb"
5
4
 
@@ -1,3 +1,3 @@
1
1
  module Turf
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
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: 0.0.3
4
+ version: 0.0.4
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-14 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler