neptune_apex 0.4 → 0.5

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: dc8ffa43bd65e6f68071b9c4c88d08b5733ff076
4
- data.tar.gz: d36aa42af0b4e5f7d3f638d1a913d065a5eef6e2
3
+ metadata.gz: f59db0922af8e08941de89c436b976366a916823
4
+ data.tar.gz: 05acb8292136d50a2edaf7d207dd8187d93eb70a
5
5
  SHA512:
6
- metadata.gz: 43318cb0eb0bd69592bf38459427cc5bf4772e9d287f7e6b67909e0c957cd7a341c6c792f46da957ad2c7a1165602e17c0c934e235ea999e548e202c05ad8680
7
- data.tar.gz: ae125a0da2674874e2c0accb60bbedcf4e3b9ae6f2424aa3d86a6c18700ec0a6e356320ee7113076fc12066d676bc8de4e07caaac3b2f83128c213e6fa61c6df
6
+ metadata.gz: 46554e8977fd5e7289713946ebc61e915d93334f137b70abccbeb42ddee4cffeac855d461e0b9c98ffabe5f5b4685e0393969364fc7abfc3ab0fbf2f73c6fa73
7
+ data.tar.gz: 18967d5eb9a0baf916bdca64164947b0ada69f5eb1fbe8969c8bdddf5727a39c481a063e5dace31cc23a2e10a16fafa3fd1b59fd77a82c3249a2aee09934343f
@@ -9,7 +9,7 @@ module NeptuneApex
9
9
  class Main < Thor
10
10
  desc "status", "Get current status of controller outlets & probes"
11
11
  def status
12
- cont = NeptuneApex::Controller.new()
12
+ cont = create_controller
13
13
  status = cont.status
14
14
 
15
15
  puts "Apex status as of #{status.date.strftime('%F %R')}"
@@ -39,6 +39,30 @@ module NeptuneApex
39
39
 
40
40
  desc "profile SUBCOMMAND", "manage profiles"
41
41
  subcommand "profile", ProfileCli
42
+
43
+
44
+ private
45
+ ##
46
+ # Look for a config file & load
47
+ def create_controller
48
+ conf_file = File.expand_path('~/.apexcli')
49
+
50
+ if ENV['APEXCONF']
51
+ conf_file = ENV['APEXCONF']
52
+ end
53
+
54
+ if File.exist?(conf_file)
55
+ controller = NeptuneApex::Controller.new()
56
+ conf = YAML.load_file(conf_file)
57
+ controller.url = conf['url']
58
+ controller.user = conf['user']
59
+ controller.password = conf['password']
60
+ return controller
61
+ else
62
+ raise Exception.new('Config file not found!')
63
+ end
64
+ end
65
+
42
66
  end
43
67
  end
44
68
  end
@@ -14,34 +14,6 @@ module NeptuneApex
14
14
  attr_accessor :password
15
15
 
16
16
 
17
- def initialize(url=nil)
18
- load_conf
19
-
20
- if url
21
- @url = url
22
- end
23
- end
24
-
25
- ##
26
- # Look for a config file & load
27
- def load_conf
28
- conf_file = File.expand_path('~/.apexcli')
29
-
30
- if ENV['APEXCONF']
31
- conf_file = ENV['APEXCONF']
32
- end
33
-
34
- if File.exist?(conf_file)
35
- conf = YAML.load_file(conf_file)
36
- @url = conf['url']
37
- @user = conf['user']
38
- @password = conf['password']
39
- else
40
- raise Exception.new('Config file not found!')
41
- end
42
- end
43
-
44
-
45
17
  ##
46
18
  # Get the current status of the controller
47
19
  def status
@@ -1,3 +1,3 @@
1
1
  module NeptuneApex
2
- VERSION = "0.4"
2
+ VERSION = "0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neptune_apex
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Peshak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-04 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri