Class: PostfixAdmin::Runner
- Inherits:
-
Thor
- Object
- Thor
- PostfixAdmin::Runner
- Defined in:
- lib/postfix_admin/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #account_passwd(user_name, password) ⇒ Object
- #accounts ⇒ Object
- #add_account(address, password) ⇒ Object
- #add_admin(user_name, password) ⇒ Object
- #add_admin_domain(user_name, domain_name) ⇒ Object
- #add_alias(address, goto) ⇒ Object
- #add_domain(domain_name) ⇒ Object
- #admin_passwd(user_name, password) ⇒ Object
- #admins ⇒ Object
- #aliases ⇒ Object
- #delete_account(address) ⇒ Object
- #delete_admin(user_name) ⇒ Object
- #delete_admin_domain(user_name, domain_name) ⇒ Object
- #delete_alias(address) ⇒ Object
- #delete_domain(domain_name) ⇒ Object
- #domains ⇒ Object
- #dump ⇒ Object
- #edit_account(address) ⇒ Object
- #edit_admin(user_name) ⇒ Object
- #edit_alias(address) ⇒ Object
- #edit_domain(domain_name) ⇒ Object
- #forwards ⇒ Object
-
#initialize(*args) ⇒ Runner
constructor
A new instance of Runner.
- #log ⇒ Object
- #schemes ⇒ Object
- #setup(domain_name, password) ⇒ Object
- #show(name = nil) ⇒ Object
- #summary(domain_name = nil) ⇒ Object
- #teardown(domain_name) ⇒ Object
- #version ⇒ Object
Constructor Details
Class Method Details
.exit_on_failure? ⇒ Boolean
8 9 10 |
# File 'lib/postfix_admin/runner.rb', line 8 def self.exit_on_failure? true end |
Instance Method Details
#account_passwd(user_name, password) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/postfix_admin/runner.rb', line 92 def account_passwd(user_name, password) runner do @cli.change_account_password(user_name, password, scheme: [:scheme], rounds: [:rounds]) end end |
#accounts ⇒ Object
44 45 46 |
# File 'lib/postfix_admin/runner.rb', line 44 def accounts runner { @cli.show_accounts } end |
#add_account(address, password) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/postfix_admin/runner.rb', line 141 def add_account(address, password) runner do if [:scheme] == 'scheme' warn "Specify password scheme" help('add_account') else if [:name] == 'name' warn "Specify name" help('add_account') else @cli.add_account(address, password, name: [:name], scheme: [:scheme], rounds: [:rounds]) end end end end |
#add_admin(user_name, password) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/postfix_admin/runner.rb', line 201 def add_admin(user_name, password) runner do if [:scheme] == 'scheme' warn "Specify password scheme" help('add_admin') else @cli.add_admin(user_name, password, super_admin: [:super], scheme: [:scheme], rounds: [:rounds]) end end end |
#add_admin_domain(user_name, domain_name) ⇒ Object
216 217 218 |
# File 'lib/postfix_admin/runner.rb', line 216 def add_admin_domain(user_name, domain_name) runner { @cli.add_admin_domain(user_name, domain_name) } end |
#add_alias(address, goto) ⇒ Object
242 243 244 |
# File 'lib/postfix_admin/runner.rb', line 242 def add_alias(address, goto) runner { @cli.add_alias(address, goto) } end |
#add_domain(domain_name) ⇒ Object
101 102 103 |
# File 'lib/postfix_admin/runner.rb', line 101 def add_domain(domain_name) runner { @cli.add_domain(domain_name, description: [:description]) } end |
#admin_passwd(user_name, password) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/postfix_admin/runner.rb', line 81 def admin_passwd(user_name, password) runner do @cli.change_admin_password(user_name, password, scheme: [:scheme], rounds: [:rounds]) end end |
#admins ⇒ Object
34 35 36 |
# File 'lib/postfix_admin/runner.rb', line 34 def admins runner { @cli.show_admins } end |
#aliases ⇒ Object
49 50 51 |
# File 'lib/postfix_admin/runner.rb', line 49 def aliases runner { @cli.show_aliases } end |
#delete_account(address) ⇒ Object
133 134 135 |
# File 'lib/postfix_admin/runner.rb', line 133 def delete_account(address) runner { @cli.delete_account(address) } end |
#delete_admin(user_name) ⇒ Object
128 129 130 |
# File 'lib/postfix_admin/runner.rb', line 128 def delete_admin(user_name) runner { @cli.delete_admin(user_name) } end |
#delete_admin_domain(user_name, domain_name) ⇒ Object
222 223 224 |
# File 'lib/postfix_admin/runner.rb', line 222 def delete_admin_domain(user_name, domain_name) runner { @cli.delete_admin_domain(user_name, domain_name) } end |
#delete_alias(address) ⇒ Object
247 248 249 |
# File 'lib/postfix_admin/runner.rb', line 247 def delete_alias(address) runner { @cli.delete_alias(address) } end |
#delete_domain(domain_name) ⇒ Object
123 124 125 |
# File 'lib/postfix_admin/runner.rb', line 123 def delete_domain(domain_name) runner { @cli.delete_domain(domain_name) } end |
#domains ⇒ Object
39 40 41 |
# File 'lib/postfix_admin/runner.rb', line 39 def domains runner { @cli.show_domains } end |
#dump ⇒ Object
259 260 261 |
# File 'lib/postfix_admin/runner.rb', line 259 def dump runner { @cli.dump } end |
#edit_account(address) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/postfix_admin/runner.rb', line 167 def edit_account(address) runner do if .size == 0 warn "Use one or more options." help('edit_account') else if [:name] == 'name' warn "Specify name" help('edit_account') else @cli.edit_account(address, ) end end end end |
#edit_admin(user_name) ⇒ Object
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/postfix_admin/runner.rb', line 186 def edit_admin(user_name) runner do if .size == 0 warn "Use one or more options." help('edit_admin') else @cli.edit_admin(user_name, ) end end end |
#edit_alias(address) ⇒ Object
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/postfix_admin/runner.rb', line 230 def edit_alias(address) runner do if .size == 0 warn "Use one or more options." help('edit_alias') else @cli.edit_alias(address, ) end end end |
#edit_domain(domain_name) ⇒ Object
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/postfix_admin/runner.rb', line 111 def edit_domain(domain_name) runner do if .size == 0 warn "Use one or more options." help('edit_domain') else @cli.edit_domain(domain_name, ) end end end |
#forwards ⇒ Object
54 55 56 |
# File 'lib/postfix_admin/runner.rb', line 54 def forwards runner { @cli.show_forwards } end |
#log ⇒ Object
254 255 256 |
# File 'lib/postfix_admin/runner.rb', line 254 def log runner { @cli.log(domain: [:domain], last: [:last]) } end |
#schemes ⇒ Object
23 24 25 |
# File 'lib/postfix_admin/runner.rb', line 23 def schemes runner { puts PostfixAdmin::Doveadm.schemes.join(' ') } end |
#setup(domain_name, password) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/postfix_admin/runner.rb', line 63 def setup(domain_name, password) runner do @cli.setup_domain(domain_name, password, description: [:description], scheme: [:scheme], rounds: [:rounds]) end end |
#show(name = nil) ⇒ Object
29 30 31 |
# File 'lib/postfix_admin/runner.rb', line 29 def show(name = nil) runner { @cli.show(name) } end |
#summary(domain_name = nil) ⇒ Object
18 19 20 |
# File 'lib/postfix_admin/runner.rb', line 18 def summary(domain_name = nil) runner { @cli.show_summary(domain_name) } end |
#teardown(domain_name) ⇒ Object
73 74 75 |
# File 'lib/postfix_admin/runner.rb', line 73 def teardown(domain_name) runner { @cli.teardown_domain(domain_name) } end |
#version ⇒ Object
264 265 266 267 |
# File 'lib/postfix_admin/runner.rb', line 264 def version require 'postfix_admin/version' runner { say "postfix_admin #{VERSION}" } end |