sugoi_aliases_updator 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/README.md +2 -17
- data/lib/sugoi_aliases_updator/aliases_parser.rb +15 -5
- data/lib/sugoi_aliases_updator/line_parser.rb +1 -1
- data/lib/sugoi_aliases_updator/version.rb +1 -1
- data/sugoi_aliases_updator.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 651a43af710f321e0a4a10251dc1d8aa6f34167a
|
4
|
+
data.tar.gz: d5ab8f718963783a448baf3b39ff8192734526b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277055d73fee343d2e0456334522a0c372846e8ace4818b027683528d84b57233f63c7918f393a1f00e493a2a345cf2756b08d269be0db234c779843b872799d
|
7
|
+
data.tar.gz: 2c251ec50a00f39cdd5455464cb774e6217ff9fe7c1dd038d90ebe53c21184db60fb691e3c27d52f7a0bc1919ff3de5e27cbe1f910c1389732d80feafcff1336
|
data/README.md
CHANGED
@@ -9,29 +9,19 @@ gem 'sugoi_aliases_updator'
|
|
9
9
|
```
|
10
10
|
|
11
11
|
## Requirement
|
12
|
-
'ruby'
|
12
|
+
'ruby' >= '2.1'
|
13
13
|
|
14
14
|
## Usage
|
15
|
+
add, rm, listのみ。
|
15
16
|
```
|
16
17
|
$ cat /etc/aliases
|
17
|
-
bin: root
|
18
|
-
daemon: root
|
19
|
-
named: root
|
20
|
-
nobody: root
|
21
|
-
uucp: root
|
22
18
|
www: root, n905i.1214@gmail.com
|
23
19
|
ftp-bugs: root
|
24
20
|
postfix: root, n905i.1214@gmail.com
|
25
|
-
|
26
21
|
```
|
27
22
|
|
28
23
|
```
|
29
24
|
$ sugoi_aliases_updator /etc/aliases add test@exmple.net TO=www
|
30
|
-
bin: root
|
31
|
-
daemon: root
|
32
|
-
named: root
|
33
|
-
nobody: root
|
34
|
-
uucp: root
|
35
25
|
www: root, n905i.1214@gmail.com, test@exmple.net
|
36
26
|
ftp-bugs: root
|
37
27
|
postfix: root, n905i.1214@gmail.com
|
@@ -39,11 +29,6 @@ postfix: root, n905i.1214@gmail.com
|
|
39
29
|
|
40
30
|
```
|
41
31
|
$ sugoi_aliases_updator /etc/aliases rm n905i.1214@gmail.com TO=www,postfix
|
42
|
-
bin: root
|
43
|
-
daemon: root
|
44
|
-
named: root
|
45
|
-
nobody: root
|
46
|
-
uucp: root
|
47
32
|
www: root
|
48
33
|
ftp-bugs: root
|
49
34
|
postfix: root
|
@@ -25,11 +25,21 @@ module SugoiAliasesUpdator
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def rm(target_email, from: )
|
28
|
+
if ['ALL'] == from
|
29
|
+
label_mails_hash.each do |label, emails|
|
30
|
+
if emails.include?(target_email)
|
31
|
+
label_mails_hash[label].delete(target_email)
|
32
|
+
@changed_labels << label
|
33
|
+
end
|
34
|
+
end
|
35
|
+
return render!
|
36
|
+
end
|
37
|
+
|
28
38
|
check_labels!(from)
|
29
|
-
from.each do |
|
30
|
-
if label_mails_hash[
|
31
|
-
label_mails_hash[
|
32
|
-
@changed_labels <<
|
39
|
+
from.each do |label|
|
40
|
+
if label_mails_hash[label].include?(target_email)
|
41
|
+
label_mails_hash[label].delete(target_email)
|
42
|
+
@changed_labels << label
|
33
43
|
end
|
34
44
|
end
|
35
45
|
render!
|
@@ -70,7 +80,7 @@ module SugoiAliasesUpdator
|
|
70
80
|
end
|
71
81
|
|
72
82
|
def check_labels!(inputed_labels)
|
73
|
-
unknown_labels = inputed_labels -
|
83
|
+
unknown_labels = inputed_labels - label_mails_hash.keys
|
74
84
|
if unknown_labels.size > 0
|
75
85
|
raise("unknown labels #{unknown_labels.join(', ')}")
|
76
86
|
end
|
@@ -3,7 +3,7 @@ module SugoiAliasesUpdator
|
|
3
3
|
attr_accessor :emails_line, :label, :is_aliaes_line, :margin
|
4
4
|
|
5
5
|
def initialize(line)
|
6
|
-
@is_aliaes_line = /^(.*):(\s*)([\w@\., ]*)
|
6
|
+
@is_aliaes_line = /^(.*):(\s*)([\w@\., -]*)/ === line
|
7
7
|
@label = $1
|
8
8
|
@margin = $2
|
9
9
|
@emails_line = $3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugoi_aliases_updator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: "/etc/aliases uppdator."
|
56
70
|
email:
|
57
71
|
- n905i.1214@gmail.com
|