lmcadm 0.14.0 → 0.15.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0925f20d360b3e8e6740c298a99c12b67474ae9d8d0c1ff6a426109cc9810ef7'
4
- data.tar.gz: a3be3188b433d777bce80b5807c497ca41d15c9fa65037eaec5421abd2c6490b
3
+ metadata.gz: 44c6d0a6cd45c6c772311396c13646899f7db20675004254fc70cb1821620d3c
4
+ data.tar.gz: 93484873efe2767cb5c7911d00e72be3937cc7fbed2e29dfd3cbaeeb4d634d1d
5
5
  SHA512:
6
- metadata.gz: 1958b20290dcad4adcddfbb87de3e0352f9e6efa8f5ddd8e343bf1bb3ac5b757ec6cffb61081402fdff986a7d454210ad64d1662f4ac8519e3b9c406e53b5a08
7
- data.tar.gz: 3398cb285de12bb7a2211a609fea72cd7f421827e45133c751482f072fa370509d860707c94a7ff1042d2a243ebe0553086cb09da316e24b837b4a46e3a80b15
6
+ metadata.gz: d9790f5e3e28fcd2fc3b4a8633b47019b3190e166bc15e9e926ee552620a6ad9a1edb4364f2355c9c4a0cc523db6997f042bccbcdf8f07d781611d1fdf4759ee
7
+ data.tar.gz: 92ed71b779d0bb817035a51965f4c308ce76cff89c4ddc86f8b06faf940766242e513260164eec6fb62b9c198fbb1e722072a8dc9c65e1be2f475070221d01f8
data/README.md CHANGED
@@ -8,6 +8,12 @@ Install via rubygems:
8
8
 
9
9
  $ gem install lmcadm
10
10
 
11
+ ### Requirements
12
+ Building native extensions for certain dependencies require ruby headers or source code to be present.
13
+ These can usually be installed the same way ruby was installed.
14
+
15
+ On Ubuntu for example, installing the `ruby-dev` via the package manager is sufficient.
16
+
11
17
  ## Usage
12
18
 
13
19
  The primary usage documentation is in the help output of lmcadm:
data/exe/lmcadm CHANGED
@@ -25,7 +25,7 @@ module LMCAdm
25
25
  commands_from "lmcadm/commands"
26
26
 
27
27
  desc 'Be verbose'
28
- switch [:v, :verbose]
28
+ switch :verbose, :v
29
29
 
30
30
  desc 'debug'
31
31
  switch [:debug]
@@ -33,9 +33,9 @@ module LMCAdm
33
33
  desc 'Measure time taken for operations'
34
34
  switch "take-time"
35
35
 
36
- desc 'cloud host'
36
+ desc 'LMC host, may include a port number'
37
37
  default_value "cloud.lancom.de"
38
- flag :C, :cloud_host
38
+ flag :cloud_host, :C
39
39
 
40
40
  desc 'Use encrypted connection'
41
41
  default_value true
@@ -46,13 +46,16 @@ module LMCAdm
46
46
  switch "verify-tls"
47
47
 
48
48
  desc 'username'
49
- default_value "admin"
50
- flag :U, :user
49
+ default_value ""
50
+ flag :user, :U
51
51
 
52
52
  desc 'password'
53
53
  default_value ""
54
- flag [:P, :password], :mask => true
54
+ flag [:password, :P], :mask => true
55
55
 
56
+ desc 'Use 2FA code'
57
+ default_value false
58
+ switch [:code, 'F']
56
59
 
57
60
  pre do |global, command, options, args|
58
61
  # Pre logic here
@@ -60,12 +63,23 @@ module LMCAdm
60
63
  # chosen command
61
64
  # Use skips_pre before a command to skip this block
62
65
  # on that command only
63
- if command.name != :completion && global[:password] == ""
64
- global[:password] = Helpers::read_pw "Enter password for #{global[:user]}:"
66
+ if command.name != :completion
67
+ if global[:user] == ""
68
+ print "Enter user:"
69
+ global[:user] = STDIN.gets.chomp
70
+ end
71
+ if global[:password] == ""
72
+ global[:password] = Helpers::read_pw "Enter password for #{global[:user]}:"
73
+ end
74
+ twofactor_code = nil
75
+ if global[:code]
76
+ twofactor_code = Helpers::read_pw "Enter 2FA code:"
77
+ end
65
78
  end
66
79
  ::LMC::Cloud.cloud_host = global[:cloud_host]
67
80
  ::LMC::Cloud.user = global[:user]
68
81
  ::LMC::Cloud.password = global[:password]
82
+ ::LMC::Cloud.code = twofactor_code
69
83
  ::LMC::Cloud.verbose = global[:verbose]
70
84
  ::LMC::Cloud.debug = global[:debug]
71
85
  ::LMC::Cloud.verify_tls = global["verify-tls"]
@@ -16,7 +16,7 @@ module LMCAdm
16
16
  account_list.switch :l, :long
17
17
  account_list.action do |global_options, options, args|
18
18
  t = ProgressVisualizer.new "Cloud login"
19
- lmcen = LMC::Cloud.new(global_options[:cloud_host], global_options[:user], global_options[:password])
19
+ lmcen = LMC::Cloud.instance
20
20
  t.done
21
21
  t = ProgressVisualizer.new "Getting accounts"
22
22
  accounts = lmcen.get_accounts_objects
@@ -8,13 +8,15 @@ module LMCAdm
8
8
  command :cloud do |c|
9
9
  c.desc 'Check cloud connectivity'
10
10
  c.action do |global_options|
11
- lmcen = LMC::Cloud.new(global_options[:cloud_host], global_options[:user], global_options[:password])
11
+ lmcen = LMC::Cloud.instance
12
12
  puts "Base URL: #{lmcen.build_url}"
13
13
  puts "Cloud connection OK" if lmcen.auth_ok
14
14
  if global_options[:v]
15
15
  puts "authentication token: " + lmcen.session_token
16
16
  end
17
17
  end
18
+
19
+ c.desc 'Display cloud version information'
18
20
  c.command :about do |cloud_about|
19
21
  cloud_about.action do |global_options|
20
22
  cloud = LMC::Cloud.instance
@@ -7,7 +7,7 @@ module LMCAdm #:nodoc:
7
7
  preferences.arg_name 'accounts'
8
8
  preferences.command :lastaccounts do |la|
9
9
  la.action do |g, _o, args|
10
- cloud = LMC::Cloud.new(g[:cloud_host], g[:user], g[:password])
10
+ cloud = LMC::Cloud.instance
11
11
  self_ui = cloud.preferences [:principals, :self, :ui]
12
12
  if args.empty?
13
13
  ids = self_ui.get 'lastAccountIds'
@@ -1,3 +1,3 @@
1
1
  module LMCAdm
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.0'
3
3
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "minitest", "~> 5.0"
25
25
  spec.add_development_dependency "pry-nav", "0.2.4"
26
26
 
27
- spec.add_runtime_dependency 'lmc', '~> 0.12.0'
27
+ spec.add_runtime_dependency 'lmc', '~> 0.13.0'
28
28
  spec.add_runtime_dependency 'gli', '~> 2.17'
29
29
  spec.add_runtime_dependency 'table_print', '~> 1.5'
30
30
  spec.add_runtime_dependency 'colorize', '~> 0.8'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmcadm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - erpel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-20 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.12.0
75
+ version: 0.13.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.12.0
82
+ version: 0.13.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gli
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.3.0
139
- description:
139
+ description:
140
140
  email:
141
141
  - philipp@copythat.de
142
142
  executables:
@@ -182,11 +182,11 @@ files:
182
182
  - lib/lmcadm/version.rb
183
183
  - lmcadm
184
184
  - lmcadm.gemspec
185
- homepage:
185
+ homepage:
186
186
  licenses:
187
187
  - BSD-3-Clause
188
188
  metadata: {}
189
- post_install_message:
189
+ post_install_message:
190
190
  rdoc_options: []
191
191
  require_paths:
192
192
  - lib
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubygems_version: 3.1.2
205
- signing_key:
205
+ signing_key:
206
206
  specification_version: 4
207
207
  summary: lmcadm is a command line client for LMC
208
208
  test_files: []