sistero 0.7.0 → 0.7.1

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
  SHA1:
3
- metadata.gz: 3c05a40e7cbaf966250545adca8bedcaeab750a7
4
- data.tar.gz: 28d77522246e1e102e90bb25919fedd756bd8fe9
3
+ metadata.gz: e493aa279919d567e6a6eb2d0980dcd3ec412374
4
+ data.tar.gz: f222d218205101e767a903382b34928636e3a5cd
5
5
  SHA512:
6
- metadata.gz: 2eadc9dcdc499285f719f8798e6fbcb64192eb816cd778f01df49097ee11f5b4d2ce5bde18f8bfbda735268ff68ba1dfc5af5fab19186319338a18d83e08f2a6
7
- data.tar.gz: 40c4a034b59468d9dc3201f0b69abe04a0239d884749c967311bb310fe5349e0c335d3c6a390e85f03d09e78f4a40bee85d0a18297ba519ed9728027cfce7409
6
+ metadata.gz: 04e07114fafb07c5ca60ec829c9c7664cab53c6d7783bd4fecd38a8da8e79334cbf4c32569f34daad8b7f08b363cda31f1ae4b3dcb450054403381966d37dc0f
7
+ data.tar.gz: 16799fcaa0100ae937347ca44eb52d4d6cc5a76ae9a952acb04eba4711e24320a8fa891fbbe2c8ab40ebb91d6515e2b0d87e1e121ea4ddeb424397e3551da630
@@ -22,6 +22,7 @@ module Sistero::Command
22
22
  end
23
23
 
24
24
  op.on '-c', '--config file', 'override path to config file', 'cfg_file_path'
25
+ op.on '-d', '--directory dir', 'set working dir', 'directory'
25
26
 
26
27
  op.subcommand 'ssh [vm]', 'ssh to vm' do |subop|
27
28
  subop.on '-o val', 'add ssh options', 'ssh_options'
@@ -48,7 +49,10 @@ module Sistero::Command
48
49
  end
49
50
 
50
51
  command_cfg = OpenStruct.new config[command]
51
- sistero = Sistero::Instance.new({ cfg_file_path: config.cfg_file_path })
52
+ sistero = Sistero::Instance.new({
53
+ cfg_file_path: config.cfg_file_path,
54
+ directory: config.directory
55
+ })
52
56
 
53
57
  case command
54
58
  when 'ssh'
@@ -1,7 +1,9 @@
1
1
  require "yaml"
2
- APP_NAME = "sistero"
3
2
 
4
3
  module Sistero
4
+ CONFIG_FILE_NAME = 'sistero.yaml'
5
+ APP_NAME = "sistero"
6
+
5
7
  VM_KEYS = [:name, :size, :region, :image, :access_token, :user_data, :private_networking,
6
8
  :ssh_keys, :ssh_options, :ssh_user ]
7
9
 
@@ -36,8 +38,19 @@ module Sistero
36
38
  # read defaults from config file
37
39
  @cfg_file_path = opts[:cfg_file_path]
38
40
  unless @cfg_file_path
39
- @cfg_file_path = 'sistero.yaml'
40
- @cfg_file_path = "#{ENV['HOME']}/.config/#{APP_NAME}" unless File.exists? @cfg_file_path
41
+ directory = opts[:directory] || '.'
42
+
43
+ for n in 0..100
44
+ cfg_file_path = File.join(directory, CONFIG_FILE_NAME)
45
+ if File.exists? cfg_file_path
46
+ @cfg_file_path = cfg_file_path
47
+ break
48
+ end
49
+ directory = File.dirname directory
50
+ break if directory == '/'
51
+ end
52
+
53
+ @cfg_file_path ||= "#{ENV['HOME']}/.config/#{APP_NAME}"
41
54
  end
42
55
 
43
56
  @defaults = VM.new
@@ -1,3 +1,3 @@
1
1
  module Sistero
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sistero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike