etna 0.1.18 → 0.1.19

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: b1e3987a14cd4cb5eb805c4573eb09a8a64a50c2e34e1c5ae011c8efb946ab3d
4
- data.tar.gz: 611e0df9d6f931adc14442c99adad44ebf899c16695d033618c094704e538126
3
+ metadata.gz: 4e4db6a6c798917fe8a1e96d7f02a2d604d259d3e2da08f083899655b2638b55
4
+ data.tar.gz: 989a69710cad57444da6ac526fc4728e706e0b4c891b720a8307b8207949453d
5
5
  SHA512:
6
- metadata.gz: 93deb61017df46773b3449424589f7db51c65b4543c3203bf1a35fc2815bd6140bd04981e55413e0e91e47110b58d9f0a4d8f4566ab1bad99cd111e96d44bc76
7
- data.tar.gz: bda7d6c202366ddb2c5805091758aa2e978ab9bffb9fd364fdd12235567169453a7dfd97fddaf2e9a468b1ce025effa9ae79c8c0e97d46a7cf7315482ba9872c
6
+ metadata.gz: bb98337dd93af44ae0bda211a413178f25ba6ad08b39c34dde855d6288ee291f26b8c629b67f24e2be56667405a93662308dca804fcf2b70aefbd41da3c8ea13
7
+ data.tar.gz: aed1a1f77965ef30eb67bffe021547fb92ad03b836dcd940bd98c55020309bee568981f058e5365580d29462f03dd41efb645c3b3f5575682d06e9af927e51a1
data/bin/etna CHANGED
@@ -9,55 +9,10 @@ require 'yaml'
9
9
  require_relative '../lib/etna'
10
10
  require_relative '../lib/commands'
11
11
 
12
- config = (
13
- if File.exists?(EtnaApp.config_file_path)
14
- YAML.load(File.read(EtnaApp.config_file_path))
15
- else
16
- {}
17
- end).update({
18
- production: {
19
- docker: {
20
- default_tag: 'latest',
21
- },
22
- magma: {
23
- host: 'https://magma.ucsf.edu'
24
- },
25
- metis: {
26
- host: 'https://metis.ucsf.edu',
27
- },
28
- janus: {
29
- host: 'https://janus.ucsf.edu',
30
- },
31
- timur: {},
32
- polyphemus: {},
33
- auth_redirect: 'https://janus.ucsf.edu',
34
- ignore_ssl: false,
35
- },
36
- stage: {
37
- docker: {
38
- default_tag: 'latest',
39
- },
40
- magma: {
41
- host: 'https://magma-stage.ucsf.edu'
42
- },
43
- metis: {
44
- host: 'https://metis-stage.ucsf.edu',
45
- },
46
- janus: {
47
- host: 'https://janus-stage.ucsf.edu',
48
- },
49
- timur: {},
50
- polyphemus: {},
51
- auth_redirect: 'https://janus-stage.ucsf.edu',
52
- ignore_ssl: true,
53
- },
54
- })
55
-
56
- EtnaApp.instance.run_command(config, *ARGV) do |cmd, args|
57
- if cmd.class.included_modules.include?(RequireConfirmation)
58
- puts "Attempting to run #{cmd.program_name} in environment #{EtnaApp.instance.environment} with args #{args}"
59
- StrongConfirmation.confirm
60
- else
61
- true
62
- end
12
+ config = if File.exists?(EtnaApp.config_file_path)
13
+ YAML.load(File.read(EtnaApp.config_file_path))
14
+ else
15
+ {}
63
16
  end
17
+
18
+ EtnaApp.instance.run_command(config, *ARGV)
@@ -23,23 +23,6 @@ return
23
23
  fi
24
24
  COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
25
25
  return
26
- elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
27
- return
28
- elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
29
- all_flag_completion_names="${all_flag_completion_names//$1\ /}"
30
- a=$1
31
- shift
32
- if [[ "$string_flag_completion_names" =~ $a\ ]]; then
33
- if [[ "$#" == "1" ]]; then
34
- a="${a//--/}"
35
- a="${a//-/_}"
36
- i="_completions_for_$a"
37
- all_completion_names="${!i}"
38
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
39
- return
40
- fi
41
- shift
42
- fi
43
26
  elif [[ "$1" == "administrate" ]]; then
44
27
  shift
45
28
  all_flag_completion_names="$all_flag_completion_names "
@@ -53,23 +36,6 @@ return
53
36
  fi
54
37
  COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
55
38
  return
56
- elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
57
- return
58
- elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
59
- all_flag_completion_names="${all_flag_completion_names//$1\ /}"
60
- a=$1
61
- shift
62
- if [[ "$string_flag_completion_names" =~ $a\ ]]; then
63
- if [[ "$#" == "1" ]]; then
64
- a="${a//--/}"
65
- a="${a//-/_}"
66
- i="_completions_for_$a"
67
- all_completion_names="${!i}"
68
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
69
- return
70
- fi
71
- shift
72
- fi
73
39
  elif [[ "$1" == "help" ]]; then
74
40
  shift
75
41
  all_flag_completion_names="$all_flag_completion_names "
@@ -118,23 +84,6 @@ return
118
84
  fi
119
85
  COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
120
86
  return
121
- elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
122
- return
123
- elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
124
- all_flag_completion_names="${all_flag_completion_names//$1\ /}"
125
- a=$1
126
- shift
127
- if [[ "$string_flag_completion_names" =~ $a\ ]]; then
128
- if [[ "$#" == "1" ]]; then
129
- a="${a//--/}"
130
- a="${a//-/_}"
131
- i="_completions_for_$a"
132
- all_completion_names="${!i}"
133
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
134
- return
135
- fi
136
- shift
137
- fi
138
87
  elif [[ "$1" == "apply_template" ]]; then
139
88
  shift
140
89
  if [[ "$#" == "1" ]]; then
@@ -194,23 +143,6 @@ return
194
143
  fi
195
144
  COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
196
145
  return
197
- elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
198
- return
199
- elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
200
- all_flag_completion_names="${all_flag_completion_names//$1\ /}"
201
- a=$1
202
- shift
203
- if [[ "$string_flag_completion_names" =~ $a\ ]]; then
204
- if [[ "$#" == "1" ]]; then
205
- a="${a//--/}"
206
- a="${a//-/_}"
207
- i="_completions_for_$a"
208
- all_completion_names="${!i}"
209
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
210
- return
211
- fi
212
- shift
213
- fi
214
146
  elif [[ "$1" == "help" ]]; then
215
147
  shift
216
148
  all_flag_completion_names="$all_flag_completion_names "
@@ -308,6 +240,23 @@ return
308
240
  fi
309
241
  done
310
242
  return
243
+ elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
244
+ return
245
+ elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
246
+ all_flag_completion_names="${all_flag_completion_names//$1\ /}"
247
+ a=$1
248
+ shift
249
+ if [[ "$string_flag_completion_names" =~ $a\ ]]; then
250
+ if [[ "$#" == "1" ]]; then
251
+ a="${a//--/}"
252
+ a="${a//-/_}"
253
+ i="_completions_for_$a"
254
+ all_completion_names="${!i}"
255
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
256
+ return
257
+ fi
258
+ shift
259
+ fi
311
260
  else
312
261
  return
313
262
  fi
@@ -393,23 +342,6 @@ return
393
342
  fi
394
343
  done
395
344
  return
396
- else
397
- return
398
- fi
399
- done
400
- elif [[ "$1" == "project" ]]; then
401
- shift
402
- all_flag_completion_names="$all_flag_completion_names "
403
- string_flag_completion_names="$string_flag_completion_names "
404
- while [[ "$#" != "0" ]]; do
405
- if [[ "$#" == "1" ]]; then
406
- all_completion_names="create help"
407
- all_completion_names="$all_completion_names $all_flag_completion_names"
408
- if [[ -z "$(echo $all_completion_names | xargs)" ]]; then
409
- return
410
- fi
411
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
412
- return
413
345
  elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
414
346
  return
415
347
  elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
@@ -427,6 +359,23 @@ return
427
359
  fi
428
360
  shift
429
361
  fi
362
+ else
363
+ return
364
+ fi
365
+ done
366
+ elif [[ "$1" == "project" ]]; then
367
+ shift
368
+ all_flag_completion_names="$all_flag_completion_names "
369
+ string_flag_completion_names="$string_flag_completion_names "
370
+ while [[ "$#" != "0" ]]; do
371
+ if [[ "$#" == "1" ]]; then
372
+ all_completion_names="create help"
373
+ all_completion_names="$all_completion_names $all_flag_completion_names"
374
+ if [[ -z "$(echo $all_completion_names | xargs)" ]]; then
375
+ return
376
+ fi
377
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
378
+ return
430
379
  elif [[ "$1" == "create" ]]; then
431
380
  shift
432
381
  if [[ "$#" == "1" ]]; then
@@ -515,27 +464,27 @@ return
515
464
  fi
516
465
  done
517
466
  return
518
- else
519
- return
520
- fi
521
- done
522
- else
467
+ elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
523
468
  return
524
- fi
525
- done
526
- elif [[ "$1" == "config" ]]; then
469
+ elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
470
+ all_flag_completion_names="${all_flag_completion_names//$1\ /}"
471
+ a=$1
527
472
  shift
528
- all_flag_completion_names="$all_flag_completion_names "
529
- string_flag_completion_names="$string_flag_completion_names "
530
- while [[ "$#" != "0" ]]; do
473
+ if [[ "$string_flag_completion_names" =~ $a\ ]]; then
531
474
  if [[ "$#" == "1" ]]; then
532
- all_completion_names="help set show"
533
- all_completion_names="$all_completion_names $all_flag_completion_names"
534
- if [[ -z "$(echo $all_completion_names | xargs)" ]]; then
475
+ a="${a//--/}"
476
+ a="${a//-/_}"
477
+ i="_completions_for_$a"
478
+ all_completion_names="${!i}"
479
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
535
480
  return
536
481
  fi
537
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
482
+ shift
483
+ fi
484
+ else
538
485
  return
486
+ fi
487
+ done
539
488
  elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
540
489
  return
541
490
  elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
@@ -553,6 +502,23 @@ return
553
502
  fi
554
503
  shift
555
504
  fi
505
+ else
506
+ return
507
+ fi
508
+ done
509
+ elif [[ "$1" == "config" ]]; then
510
+ shift
511
+ all_flag_completion_names="$all_flag_completion_names "
512
+ string_flag_completion_names="$string_flag_completion_names "
513
+ while [[ "$#" != "0" ]]; do
514
+ if [[ "$#" == "1" ]]; then
515
+ all_completion_names="help set show"
516
+ all_completion_names="$all_completion_names $all_flag_completion_names"
517
+ if [[ -z "$(echo $all_completion_names | xargs)" ]]; then
518
+ return
519
+ fi
520
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
521
+ return
556
522
  elif [[ "$1" == "help" ]]; then
557
523
  shift
558
524
  all_flag_completion_names="$all_flag_completion_names "
@@ -634,7 +600,7 @@ done
634
600
  return
635
601
  elif [[ "$1" == "show" ]]; then
636
602
  shift
637
- all_flag_completion_names="$all_flag_completion_names --all "
603
+ all_flag_completion_names="$all_flag_completion_names "
638
604
  string_flag_completion_names="$string_flag_completion_names "
639
605
  while [[ "$#" != "0" ]]; do
640
606
  if [[ "$#" == "1" ]]; then
@@ -667,6 +633,23 @@ return
667
633
  fi
668
634
  done
669
635
  return
636
+ elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
637
+ return
638
+ elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
639
+ all_flag_completion_names="${all_flag_completion_names//$1\ /}"
640
+ a=$1
641
+ shift
642
+ if [[ "$string_flag_completion_names" =~ $a\ ]]; then
643
+ if [[ "$#" == "1" ]]; then
644
+ a="${a//--/}"
645
+ a="${a//-/_}"
646
+ i="_completions_for_$a"
647
+ all_completion_names="${!i}"
648
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
649
+ return
650
+ fi
651
+ shift
652
+ fi
670
653
  else
671
654
  return
672
655
  fi
@@ -719,23 +702,6 @@ return
719
702
  fi
720
703
  COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
721
704
  return
722
- elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
723
- return
724
- elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
725
- all_flag_completion_names="${all_flag_completion_names//$1\ /}"
726
- a=$1
727
- shift
728
- if [[ "$string_flag_completion_names" =~ $a\ ]]; then
729
- if [[ "$#" == "1" ]]; then
730
- a="${a//--/}"
731
- a="${a//-/_}"
732
- i="_completions_for_$a"
733
- all_completion_names="${!i}"
734
- COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
735
- return
736
- fi
737
- shift
738
- fi
739
705
  elif [[ "$1" == "attribute_actions" ]]; then
740
706
  shift
741
707
  all_flag_completion_names="$all_flag_completion_names "
@@ -806,6 +772,23 @@ return
806
772
  fi
807
773
  done
808
774
  return
775
+ elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
776
+ return
777
+ elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
778
+ all_flag_completion_names="${all_flag_completion_names//$1\ /}"
779
+ a=$1
780
+ shift
781
+ if [[ "$string_flag_completion_names" =~ $a\ ]]; then
782
+ if [[ "$#" == "1" ]]; then
783
+ a="${a//--/}"
784
+ a="${a//-/_}"
785
+ i="_completions_for_$a"
786
+ all_completion_names="${!i}"
787
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
788
+ return
789
+ fi
790
+ shift
791
+ fi
809
792
  else
810
793
  return
811
794
  fi
@@ -916,6 +899,23 @@ return
916
899
  fi
917
900
  done
918
901
  return
902
+ elif [[ -z "$(echo $all_flag_completion_names | xargs)" ]]; then
903
+ return
904
+ elif [[ "$all_flag_completion_names" =~ $1\ ]]; then
905
+ all_flag_completion_names="${all_flag_completion_names//$1\ /}"
906
+ a=$1
907
+ shift
908
+ if [[ "$string_flag_completion_names" =~ $a\ ]]; then
909
+ if [[ "$#" == "1" ]]; then
910
+ a="${a//--/}"
911
+ a="${a//-/_}"
912
+ i="_completions_for_$a"
913
+ all_completion_names="${!i}"
914
+ COMPREPLY=($(compgen -W "$all_completion_names" -- "$1"))
915
+ return
916
+ fi
917
+ shift
918
+ fi
919
919
  else
920
920
  return
921
921
  fi
@@ -5,10 +5,6 @@ require 'tempfile'
5
5
  require_relative 'helpers'
6
6
  require 'yaml'
7
7
 
8
- # /bin/etna will confirm execution before running any command that includes this module.
9
- module RequireConfirmation
10
- end
11
-
12
8
  class EtnaApp
13
9
  def self.config_file_path
14
10
  File.join(Dir.home, 'etna.yml')
@@ -27,9 +23,9 @@ class EtnaApp
27
23
  elsif @config && @config.is_a?(Hash) && @config.keys.length == 1
28
24
  @config.keys.last.to_sym
29
25
  elsif @config && @config.is_a?(Hash) && @config.keys.length > 1
30
- raise "You have multiple environments configured, please specify your environment by adding --environment #{@config.keys.join("|")}"
26
+ :many
31
27
  else
32
- raise "You do not have a successfully configured environment, please run #{program_name} config set https://polyphemus.ucsf.edu"
28
+ :none
33
29
  end
34
30
  end
35
31
 
@@ -41,11 +37,8 @@ class EtnaApp
41
37
  include Etna::CommandExecutor
42
38
 
43
39
  class Show < Etna::Command
44
-
45
- boolean_flags << '--all'
46
-
47
- def execute(all: false)
48
- if all
40
+ def execute
41
+ if EtnaApp.instance.environment == :many
49
42
  File.open(EtnaApp.config_file_path, 'r') { |f| puts f.read }
50
43
  else
51
44
  puts "Current environment: #{EtnaApp.instance.environment}"
@@ -253,7 +246,6 @@ class EtnaApp
253
246
  class UpdateFromCsv < Etna::Command
254
247
  include WithEtnaClients
255
248
  include WithLogger
256
- include RequireConfirmation
257
249
 
258
250
  def magma_crud
259
251
  @magma_crud ||= Etna::Clients::Magma::MagmaCrudWorkflow.new(
@@ -72,7 +72,6 @@ module Etna
72
72
  enable_flags(scope.class)
73
73
  write 'while [[ "$#" != "0" ]]; do'
74
74
  generate_start_match(scope.subcommands.keys)
75
- generate_flag_handling
76
75
 
77
76
  scope.subcommands.each do |name, command|
78
77
  write %Q(elif [[ "$1" == "#{name}" ]]; then)
@@ -84,6 +83,8 @@ module Etna
84
83
  end
85
84
  end
86
85
 
86
+ generate_flag_handling
87
+
87
88
  write "else"
88
89
  write "return"
89
90
  write "fi"
@@ -7,6 +7,12 @@ module WithEtnaClients
7
7
  end
8
8
 
9
9
  def token
10
+ if environment == :many
11
+ raise "You have multiple environments configured, please specify your environment by adding --environment #{@config.keys.join("|")}"
12
+ elsif environment == :none
13
+ raise "You do not have a successfully configured environment, please run #{program_name} config set https://polyphemus.ucsf.edu"
14
+ end
15
+
10
16
  env_token = ENV['TOKEN']
11
17
  if !env_token
12
18
  puts "No environment variable TOKEN is set. You should set your token with `export TOKEN=<your.janus.token>` before running."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saurabh Asthana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-23 00:00:00.000000000 Z
11
+ date: 2020-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -175,7 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.1.2
178
+ rubyforge_project:
179
+ rubygems_version: 2.7.6.2
179
180
  signing_key:
180
181
  specification_version: 4
181
182
  summary: Base classes for Mount Etna applications