switches 0.1.2 → 0.1.3
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/README.markdown +27 -1
- data/VERSION +1 -1
- data/lib/tasks/capistrano_tasks.rb +1 -1
- data/switches.gemspec +2 -2
- metadata +2 -2
data/README.markdown
CHANGED
@@ -96,6 +96,32 @@ This is the minimum needed in the TARGET task:
|
|
96
96
|
|
97
97
|
The switches will get applied to any role that matches <tt>/app/</tt> (so :app_master, :app, etc.)
|
98
98
|
|
99
|
+
## Throwing switches before you db:migrate ##
|
100
|
+
|
101
|
+
I like to use Switches to turn off <tt>%w{memoization caching facebook campaign\_monitor delayed\_job}</tt> before running rake db:migrate, so I put this in <tt>lib/tasks/databases.rake</tt>:
|
102
|
+
|
103
|
+
namespace :db do
|
104
|
+
# what to do before db:migrate
|
105
|
+
task :before_load_config do
|
106
|
+
Rake::Task['s:backup'].execute
|
107
|
+
%w{memoization caching facebook campaign_monitor delayed_job}.each do |switch|
|
108
|
+
Rake::Task['s:off'].execute(Rake::TaskArguments.new([:name], [switch]))
|
109
|
+
end
|
110
|
+
end
|
111
|
+
# what to do after db:migrate
|
112
|
+
task :after_load_config do
|
113
|
+
Rake::Task['s:restore'].execute
|
114
|
+
Rake::Task['cache:clear'].execute
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# make it happen
|
119
|
+
Rake::Task['db:migrate'].enhance(['db:before_load_config']) do
|
120
|
+
Rake::Task['db:after_load_config'].invoke
|
121
|
+
end
|
122
|
+
|
123
|
+
Now my question is: how can I wrap that in a begin/ensure block so the switches are always restored?
|
124
|
+
|
99
125
|
## Usage ##
|
100
126
|
|
101
127
|
You can do stuff like (in <tt>app/models/user.rb</tt>):
|
@@ -142,7 +168,7 @@ Sometimes you just need an easy way to "turn off" code.
|
|
142
168
|
|
143
169
|
## Wishlist ##
|
144
170
|
|
145
|
-
+
|
171
|
+
+ ?
|
146
172
|
|
147
173
|
## Copyright ##
|
148
174
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
namespace :s do
|
24
24
|
%w{ c d on off clear reset backup restore default }.each do |cmd|
|
25
|
-
task cmd.to_sym, :roles =>
|
25
|
+
task cmd.to_sym, :roles => :app do
|
26
26
|
upload File.join(File.dirname(__FILE__), '..', '..', 'lib', 'tasks', 'switches.rake'), File.join(deploy_to, 'current', 'lib', 'tasks', 'switches.rake')
|
27
27
|
|
28
28
|
# download switches xml from servers
|
data/switches.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{switches}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Seamus Abshere"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-05}
|
13
13
|
s.description = %q{
|
14
14
|
Switches lets you turn on and off parts of your code from the commandline. There's a defaults.yml and a current.yml in the background.
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-05 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|