heroku-readonly 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/heroku-readonly +34 -0
- data/lib/heroku/readonly.rb +2 -0
- metadata +6 -5
data/bin/heroku-readonly
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "heroku/readonly"
|
5
|
+
|
6
|
+
options = {
|
7
|
+
:force => true,
|
8
|
+
:url => ENV['READONLY_URL'],
|
9
|
+
:cache => '/tmp/readonly'
|
10
|
+
}
|
11
|
+
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
opts.banner = "usage: heroku-readonly [options]"
|
14
|
+
|
15
|
+
opts.on("-u", "--url URL", "URL to fetch") { |u| options[:url] = u }
|
16
|
+
opts.on("-c", "--cache FILE", "enable caching") { |f| options[:cache] = f }
|
17
|
+
end.parse!
|
18
|
+
|
19
|
+
if !options[:url]
|
20
|
+
STDERR.puts "Missing url"
|
21
|
+
exit 2
|
22
|
+
end
|
23
|
+
|
24
|
+
if cache = options.delete(:cache)
|
25
|
+
options[:write_cache] = options[:read_cache] = cache
|
26
|
+
end
|
27
|
+
|
28
|
+
if Heroku::ReadOnly.new(options).poll
|
29
|
+
puts "enabled"
|
30
|
+
exit 1
|
31
|
+
else
|
32
|
+
puts "disabled"
|
33
|
+
exit 0
|
34
|
+
end
|
data/lib/heroku/readonly.rb
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
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Heroku
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-29 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -101,13 +101,14 @@ dependencies:
|
|
101
101
|
version_requirements: *id006
|
102
102
|
description:
|
103
103
|
email: support@heroku.com
|
104
|
-
executables:
|
105
|
-
|
104
|
+
executables:
|
105
|
+
- heroku-readonly
|
106
106
|
extensions: []
|
107
107
|
|
108
108
|
extra_rdoc_files: []
|
109
109
|
|
110
110
|
files:
|
111
|
+
- bin/heroku-readonly
|
111
112
|
- lib/heroku/readonly.rb
|
112
113
|
- spec/readonly_spec.rb
|
113
114
|
- spec/spec_helper.rb
|