app_mode 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -6
- data/app_mode.gemspec +1 -1
- metadata +3 -3
data/README
CHANGED
@@ -11,7 +11,7 @@ the state that a class, module, library, script, or application is running in.
|
|
11
11
|
|
12
12
|
2. Require the gem in your gemfile:
|
13
13
|
|
14
|
-
gem 'app_mode', '~> 0.0
|
14
|
+
gem 'app_mode', '~> 1.0.0'
|
15
15
|
|
16
16
|
3. Require the gem wherever you need state management:
|
17
17
|
|
@@ -64,8 +64,6 @@ There are two ways to use this gem.
|
|
64
64
|
2. Use the class methods:
|
65
65
|
This method is really only recommended for the end application. The initial
|
66
66
|
state will be set dynamically, so there is nothing to do except use it.
|
67
|
-
Only the default states (see "A Word on States" below) are available
|
68
|
-
using this method.
|
69
67
|
|
70
68
|
if AppMode.state == :development
|
71
69
|
# Development code.
|
@@ -79,6 +77,12 @@ There are two ways to use this gem.
|
|
79
77
|
|
80
78
|
== Usage in libraries/gems
|
81
79
|
|
80
|
+
Following these guidelines consumers of your library or gem will still have
|
81
|
+
access to the state of your gem and can control it, if need be. Otherwise,
|
82
|
+
changing AppMode.state to :development could put every gem that uses AppMode
|
83
|
+
into "development" mode, which is probably not what you want to have happen
|
84
|
+
to your gem or anyone else's.
|
85
|
+
|
82
86
|
The following method is recommended for use in libraries or gems:
|
83
87
|
|
84
88
|
module MyModule
|
@@ -105,9 +109,9 @@ or
|
|
105
109
|
|
106
110
|
* There is a fifth state (:dynamic), which will tell AppMode to determine
|
107
111
|
the state by examining the stack trace. It is only available when initializing
|
108
|
-
a new AppMode object and assumes that the first state is 'development',
|
109
|
-
second is 'test', the third is 'rake', and the last one (not the fourth)
|
110
|
-
'production'. If less than four states are specified, the last one will be
|
112
|
+
a new AppMode object and assumes that the first state is 'development',
|
113
|
+
the second is 'test', the third is 'rake', and the last one (not the fourth)
|
114
|
+
is 'production'. If less than four states are specified, the last one will be
|
111
115
|
used for multiple states. For example, if the states specified are
|
112
116
|
[:orange, :apple, :grape], :grape will be used for both rake and production.
|
113
117
|
|
@@ -142,6 +146,18 @@ or
|
|
142
146
|
# Purple code.
|
143
147
|
end
|
144
148
|
|
149
|
+
* If you are compelled to change the states for the global AppMode class,
|
150
|
+
that may be done by using the setup method, which accepts the same
|
151
|
+
arguments as AppMode.new. Passing in a state of :dynamic will allow it
|
152
|
+
to set the state as it is intended.
|
153
|
+
|
154
|
+
* Although this document explains how to do so,
|
155
|
+
it is best to leave AppMode (its valid states and its state) unaltered,
|
156
|
+
as such changes are global and could have unexpected results when other code
|
157
|
+
(such as gems) may be relying on the default settings, even though
|
158
|
+
it is recommended that they have their own object that should
|
159
|
+
be made available to your code.
|
160
|
+
|
145
161
|
== Additional Documentation
|
146
162
|
|
147
163
|
rake rdoc:app
|
data/app_mode.gemspec
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Travis Herrick
|
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
hash:
|
69
|
+
hash: 1255421514984567375
|
70
70
|
segments:
|
71
71
|
- 0
|
72
72
|
version: "0"
|