redis_wmrs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/redis_generated_conf +20 -0
- data/lib/redis_wmrs/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c9905335eeab11720ca6c1e83b668a482730222
|
4
|
+
data.tar.gz: ad959a4626ad5f4ba803912962b9b71a71bc1f69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b638235033460f03a7352d83f1974e971f9331dd43bea8f3cae201f92440fc345acc7b6c4ac9058dd3f019ca6ccbb34c28432ae8bf072adf0abaeea9174f0506
|
7
|
+
data.tar.gz: aee245f94c214cb27e68412da13f5de893b56dccaf2ca038f47ed78c40d3a63fe6d8ca0e12035ef395bea7f40014f87cc538387e1cf8d5e03fa517dc17435974
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
action, filepath, generated_mark = *ARGV
|
5
|
+
|
6
|
+
generated_mark ||= "# Generated by CONFIG REWRITE"
|
7
|
+
idx = `grep -n "#{generated_mark}" #{filepath} | cut -d : -f1`.strip
|
8
|
+
exit(0) if idx.nil? or idx.empty?
|
9
|
+
|
10
|
+
case action
|
11
|
+
when 'show' then
|
12
|
+
n = File.read(filepath).lines.length - idx.to_i + 1
|
13
|
+
cmd = "tail -n #{n} #{filepath}"
|
14
|
+
$stdout.puts `#{cmd}`
|
15
|
+
when 'remove' then
|
16
|
+
content = `head -n #{idx.to_i - 1} #{filepath}`
|
17
|
+
open(filepath, "w"){|f| f.puts(content)}
|
18
|
+
else
|
19
|
+
raise "invalid action: #{action}"
|
20
|
+
end
|
data/lib/redis_wmrs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_wmrs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -125,7 +125,8 @@ dependencies:
|
|
125
125
|
description: redis client to write to master node and read from slave node
|
126
126
|
email:
|
127
127
|
- akima@groovenauts.jp
|
128
|
-
executables:
|
128
|
+
executables:
|
129
|
+
- redis_generated_conf
|
129
130
|
extensions: []
|
130
131
|
extra_rdoc_files: []
|
131
132
|
files:
|
@@ -136,6 +137,7 @@ files:
|
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.md
|
138
139
|
- Rakefile
|
140
|
+
- bin/redis_generated_conf
|
139
141
|
- examples/test.rb
|
140
142
|
- lib/redis_wmrs.rb
|
141
143
|
- lib/redis_wmrs/dispatcher.rb
|