sugoi_aliases_updator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f022789faf53fa6a431bb0501d170606be5abb3b
4
- data.tar.gz: 2a64a3f176fa325ee6395c95e79bb97ed5f28775
3
+ metadata.gz: 651a43af710f321e0a4a10251dc1d8aa6f34167a
4
+ data.tar.gz: d5ab8f718963783a448baf3b39ff8192734526b4
5
5
  SHA512:
6
- metadata.gz: fda2dd6648ac1c19a41372dea4a26acaabe7170a1a98fb93445da06e574b0838f5ed86d89aa7e87c2182a825c4d87292e066bc6c5a76bdb7e4709217844d771e
7
- data.tar.gz: cc878a77f4af31b96c407c659eeed23f3d5730ac2a2c01afdf2867a3057c224d5e43f484f788aa185a2d8888cb0b47bbba29a273207da91a1d877bd24fa53dd8
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' ~> '2.1'
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 |x|
30
- if label_mails_hash[x].include?(target_email)
31
- label_mails_hash[x].delete(target_email)
32
- @changed_labels << x
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 - label_mails_hash.keys
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@\., ]*)$/ === line
6
+ @is_aliaes_line = /^(.*):(\s*)([\w@\., -]*)/ === line
7
7
  @label = $1
8
8
  @margin = $2
9
9
  @emails_line = $3
@@ -1,3 +1,3 @@
1
1
  module SugoiAliasesUpdator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "bundler", "~> 1.9"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "pry"
25
26
  end
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.1
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-22 00:00:00.000000000 Z
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