postfix_admin 0.2.1 → 0.3.0

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.
@@ -24,36 +24,41 @@ module PostfixAdmin
24
24
  runner { puts PostfixAdmin::Doveadm.schemes.join(' ') }
25
25
  end
26
26
 
27
- desc "show [example.com | admin@example.com | user@example.com]", "Show domains or admins or mailboxes"
27
+ desc "show [example.com | admin@example.com | user@example.com]",
28
+ "Display details about domains, admins, or accounts"
28
29
  def show(name = nil)
29
30
  runner { @cli.show(name) }
30
31
  end
31
32
 
32
- desc "setup example.com password", "Setup a domain"
33
+ desc "setup example.com password", "Set up a domain"
33
34
  def setup(domain_name, password)
34
35
  runner { @cli.setup_domain(domain_name, password) }
35
36
  end
36
37
 
37
- desc "admin_passwd admin@example.com new_password", "Change password of admin"
38
+ desc "admin_passwd admin@example.com new_password",
39
+ "Change the password of an admin user"
38
40
  def admin_passwd(user_name, password)
39
41
  runner { @cli.change_admin_password(user_name, password) }
40
42
  end
41
43
 
42
- desc "account_passwd user@example.com new_password", "Change password of account"
44
+ desc "account_passwd user@example.com new_password",
45
+ "Change the password of an account"
43
46
  def account_passwd(user_name, password)
44
47
  runner { @cli.change_account_password(user_name, password) }
45
48
  end
46
49
 
47
- desc "add_domain example.com", "Add a domain"
50
+ desc "add_domain example.com", "Add a new domain"
51
+ method_option :description, type: :string, aliases: "-d", desc: "description"
48
52
  def add_domain(domain_name)
49
- runner { @cli.add_domain(domain_name) }
53
+ runner { @cli.add_domain(domain_name, description: options[:description]) }
50
54
  end
51
55
 
52
- desc "edit_domain example.com", "Edit a domain limitation"
56
+ desc "edit_domain example.com", "Edit a domain"
53
57
  method_option :aliases, type: :numeric, aliases: "-a", desc: "Edit aliases limitation"
54
58
  method_option :mailboxes, type: :numeric, aliases: "-m", desc: "Edit mailboxes limitation"
55
59
  method_option :maxquota, type: :numeric, aliases: "-q", desc: "Edit max quota limitation"
56
60
  method_option :active, type: :boolean, desc: "Update active status"
61
+ method_option :description, type: :string, aliases: "-d", desc: "Edit description"
57
62
  def edit_domain(domain_name)
58
63
  runner do
59
64
  if options.size == 0
@@ -70,7 +75,7 @@ module PostfixAdmin
70
75
  runner { @cli.delete_domain(domain_name) }
71
76
  end
72
77
 
73
- desc "delete_admin admin@example.com", "Delete an admin"
78
+ desc "delete_admin admin@example.com", "Delete an admin user"
74
79
  def delete_admin(user_name)
75
80
  runner { @cli.delete_admin(user_name) }
76
81
  end
@@ -80,7 +85,7 @@ module PostfixAdmin
80
85
  runner { @cli.delete_account(address) }
81
86
  end
82
87
 
83
- desc "add_account user@example.com password", "Add an account"
88
+ desc "add_account user@example.com password", "Add a new account"
84
89
  method_option :scheme, type: :string, aliases: "-s", desc: "password scheme"
85
90
  method_option :name, type: :string, aliases: "-n", desc: "full name"
86
91
  def add_account(address, password)
@@ -100,10 +105,14 @@ module PostfixAdmin
100
105
  end
101
106
 
102
107
  desc "edit_account user@example.com", "Edit an account"
103
- method_option :goto, type: :string, aliases: "-g", desc: "mailboxes, addresses e-mails are delivered to"
104
- method_option :quota, type: :numeric, aliases: "-q", desc: "quota limitation (MB)"
105
- method_option :name, type: :string, aliases: "-n", desc: "full name"
106
- method_option :active, type: :boolean, desc: "Update active status"
108
+ method_option :goto, type: :string, aliases: "-g",
109
+ desc: "mailboxes, addresses e-mails are delivered to"
110
+ method_option :quota, type: :numeric, aliases: "-q",
111
+ desc: "quota limitation (MB)"
112
+ method_option :name, type: :string, aliases: "-n",
113
+ desc: "full name"
114
+ method_option :active, type: :boolean,
115
+ desc: "Update active status"
107
116
  def edit_account(address)
108
117
  runner do
109
118
  if options.size == 0
@@ -134,7 +143,7 @@ module PostfixAdmin
134
143
  end
135
144
  end
136
145
 
137
- desc "add_admin admin@example.com password", "Add an admin user"
146
+ desc "add_admin admin@example.com password", "Add a new admin user"
138
147
  method_option :super, type: :boolean, aliases: "-S", desc: "register as a super admin"
139
148
  method_option :scheme, type: :string, aliases: "-s", desc: "password scheme"
140
149
  def add_admin(user_name, password)
@@ -148,12 +157,14 @@ module PostfixAdmin
148
157
  end
149
158
  end
150
159
 
151
- desc "add_admin_domain admin@example.com example.com", "Add admin_domain"
160
+ desc "add_admin_domain admin@example.com example.com",
161
+ "Grant an admin user access to a specific domain"
152
162
  def add_admin_domain(user_name, domain_name)
153
163
  runner { @cli.add_admin_domain(user_name, domain_name) }
154
164
  end
155
165
 
156
- desc "delete_admin_domain admin@example.com example.com", "Delete admin_domain"
166
+ desc "delete_admin_domain admin@example.com example.com",
167
+ "Revoke an admin user's access to a specific domain"
157
168
  def delete_admin_domain(user_name, domain_name)
158
169
  runner { @cli.delete_admin_domain(user_name, domain_name) }
159
170
  end
@@ -173,7 +184,7 @@ module PostfixAdmin
173
184
  end
174
185
  end
175
186
 
176
- desc "add_alias alias@example.com goto@example.net", "Add an alias"
187
+ desc "add_alias alias@example.com goto@example.net", "Add a new alias"
177
188
  def add_alias(address, goto)
178
189
  runner { @cli.add_alias(address, goto) }
179
190
  end
@@ -183,9 +194,11 @@ module PostfixAdmin
183
194
  runner { @cli.delete_alias(address) }
184
195
  end
185
196
 
186
- desc "log", "Show action logs"
197
+ desc "log", "Display action logs"
198
+ method_option :domain, type: :string, aliases: "-d", desc: "Filter by domain"
199
+ method_option :last, type: :numeric, aliases: "-l", desc: "Display the last N lines"
187
200
  def log
188
- runner { @cli.log }
201
+ runner { @cli.log(domain: options[:domain], last: options[:last]) }
189
202
  end
190
203
 
191
204
  desc "dump", "Dump all data"
@@ -193,7 +206,7 @@ module PostfixAdmin
193
206
  runner { @cli.dump }
194
207
  end
195
208
 
196
- desc "version", "Show postfix_admin version"
209
+ desc "version", "Display the version of postfix_admin"
197
210
  def version
198
211
  require 'postfix_admin/version'
199
212
  runner { say "postfix_admin #{VERSION}" }
@@ -201,9 +214,9 @@ module PostfixAdmin
201
214
 
202
215
  private
203
216
 
204
- def runner
217
+ def runner(&block)
205
218
  @cli.db_setup
206
- yield
219
+ block.call
207
220
  rescue StandardError => e
208
221
  abort "Error: #{e.message}"
209
222
  end
@@ -1,3 +1,3 @@
1
1
  module PostfixAdmin
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../lib/postfix_admin/version', __FILE__)
1
+ require File.expand_path("../lib/postfix_admin/version", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "postfix_admin"
@@ -10,19 +10,21 @@ Gem::Specification.new do |gem|
10
10
  gem.description = %q{Command Line Tools for Postfix Admin}
11
11
  gem.homepage = "https://github.com/krhitoshi/postfix_admin"
12
12
 
13
- gem.required_ruby_version = ">= 2.5.0"
13
+ gem.required_ruby_version = ">= 2.6.0"
14
14
 
15
- gem.add_dependency 'thor', '~> 1.0.1'
16
- gem.add_dependency 'activerecord', '~> 6.0.3'
17
- gem.add_dependency 'mysql2', '>= 0.5.3'
18
- gem.add_development_dependency 'pry'
19
- gem.add_development_dependency 'rake', '~> 13.0.1'
20
- gem.add_development_dependency 'rubocop'
21
- gem.add_development_dependency 'rspec', '~> 3.9.0'
15
+ gem.add_dependency "thor", "~> 1.3.1"
16
+ gem.add_dependency "activerecord", "~> 6.1.7"
17
+ gem.add_dependency "mysql2", "~> 0.5"
18
+ gem.add_dependency "terminal-table", "~> 3.0.2"
19
+ gem.add_development_dependency "pry"
20
+ gem.add_development_dependency "factory_bot", "~> 6.3.0"
21
+ gem.add_development_dependency "rake", "~> 13.2.1"
22
+ gem.add_development_dependency "rubocop"
23
+ gem.add_development_dependency "rspec", "~> 3.13.0"
22
24
 
23
25
  # Specify which files should be added to the gem when it is released.
24
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- gem.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ gem.files = Dir.chdir(File.expand_path("..", __FILE__)) do
26
28
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
29
  end
28
30
  gem.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postfix_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hitoshi Kurokawa
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-18 00:00:00.000000000 Z
11
+ date: 2024-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
19
+ version: 1.3.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.1
26
+ version: 1.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 6.0.3
33
+ version: 6.1.7
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 6.0.3
40
+ version: 6.1.7
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mysql2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.3
47
+ version: '0.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: terminal-table
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 0.5.3
68
+ version: 3.0.2
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: pry
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,20 +80,34 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: factory_bot
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 6.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 6.3.0
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rake
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: 13.0.1
103
+ version: 13.2.1
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: 13.0.1
110
+ version: 13.2.1
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rubocop
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +128,14 @@ dependencies:
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: 3.9.0
131
+ version: 3.13.0
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: 3.9.0
138
+ version: 3.13.0
111
139
  description: Command Line Tools for Postfix Admin
112
140
  email:
113
141
  - hitoshi@nextseed.jp
@@ -116,7 +144,7 @@ executables:
116
144
  extensions: []
117
145
  extra_rdoc_files: []
118
146
  files:
119
- - ".github/workflows/ruby.yml"
147
+ - ".github/workflows/ci.yml"
120
148
  - ".gitignore"
121
149
  - ".rubocop.yml"
122
150
  - CHANGELOG.md
@@ -128,9 +156,7 @@ files:
128
156
  - bin/console
129
157
  - docker-admin/Dockerfile
130
158
  - docker-admin/config.local.php
131
- - docker-app-2.5/Dockerfile
132
159
  - docker-app/Dockerfile
133
- - docker-app/docker-entrypoint.sh
134
160
  - docker-app/my.cnf
135
161
  - docker-compose.yml
136
162
  - docker-db/postfix.v1841.sql
@@ -161,7 +187,7 @@ files:
161
187
  homepage: https://github.com/krhitoshi/postfix_admin
162
188
  licenses: []
163
189
  metadata: {}
164
- post_install_message:
190
+ post_install_message:
165
191
  rdoc_options: []
166
192
  require_paths:
167
193
  - lib
@@ -169,15 +195,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
195
  requirements:
170
196
  - - ">="
171
197
  - !ruby/object:Gem::Version
172
- version: 2.5.0
198
+ version: 2.6.0
173
199
  required_rubygems_version: !ruby/object:Gem::Requirement
174
200
  requirements:
175
201
  - - ">="
176
202
  - !ruby/object:Gem::Version
177
203
  version: '0'
178
204
  requirements: []
179
- rubygems_version: 3.0.3
180
- signing_key:
205
+ rubygems_version: 3.5.3
206
+ signing_key:
181
207
  specification_version: 4
182
208
  summary: ''
183
209
  test_files: []
@@ -1,37 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on:
11
- push:
12
- branches: [ master ]
13
- pull_request:
14
- branches: [ master ]
15
-
16
- jobs:
17
- test:
18
-
19
- runs-on: ubuntu-latest
20
-
21
- steps:
22
- - uses: actions/checkout@v2
23
- - name: Set up Ruby
24
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
- # uses: ruby/setup-ruby@v1
27
- uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
- with:
29
- ruby-version: 2.6
30
- - name: docker-compose up
31
- run: docker-compose up -d
32
- - name: Run tests for Ruby 2.6
33
- run: docker-compose exec -T app /wait-for-it.sh db:3306 -- rake
34
- - name: Remove Gemfile.lock
35
- run: rm -f Gemfile.lock
36
- - name: Run tests for Ruby 2.5.0
37
- run: docker-compose exec -T app2.5 rake
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -eu
4
-
5
- exec "$@"
@@ -1,15 +0,0 @@
1
- FROM ruby:2.5.0
2
-
3
- RUN apt-get update && \
4
- apt-get install -y dovecot-core iproute2 mariadb-client && \
5
- rm -rf /var/lib/apt/lists/*
6
-
7
- WORKDIR /app
8
-
9
- COPY Gemfile postfix_admin.gemspec ./
10
- COPY ./lib/postfix_admin/version.rb ./lib/postfix_admin/version.rb
11
-
12
- RUN gem install bundler && bundle install
13
-
14
- COPY spec/postfix_admin.conf /root/.postfix_admin.conf
15
- COPY docker-app/my.cnf /root/.my.cnf