Class: Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/arkana/models/arguments.rb

Overview

Model that parses and documents the CLI options, using ‘OptionParser`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArguments

Returns a new instance of Arguments.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/arkana/models/arguments.rb', line 18

def initialize
  # Default values
  @config_filepath = ".arkana.yml"
  @dotenv_filepath = ".env" if File.exist?(".env")
  @flavor = nil
  @include_environments = nil
  @lang = "swift"

  OptionParser.new do |opt|
    opt.on("-c", "--config-filepath /path/to/your/.arkana.yml", "Path to your config file. Defaults to '.arkana.yml'") do |o|
      @config_filepath = o
    end
    opt.on("-e", "--dotenv-filepath /path/to/your/.env", "Path to your dotenv file. Defaults to '.env' if one exists.") do |o|
      @dotenv_filepath = o
    end
    opt.on("-f", "--flavor FrostedFlakes", "Flavors are useful, for instance, when generating secrets for white-label projects. See the README for more information") do |o|
      @flavor = o
    end
    opt.on("-i", "--include-environments debug,release", "Optionally pass the environments that you want Arkana to generate secrets for. Useful if you only want to build a certain environment, e.g. just Debug in local machines, while only building Staging and Release in CI. Separate the keys using a comma, without spaces. When omitted, Arkana generate secrets for all environments.") do |o|
      @include_environments = o.split(",")
    end
    opt.on("-l", "--lang kotlin", "Language to produce keys for, e.g. kotlin, swift. Defaults to 'swift'. See the README for more information") do |o|
      @lang = o
    end
  end.parse!
end

Instance Attribute Details

#config_filepathObject (readonly)

Returns the value of attribute config_filepath.



8
9
10
# File 'lib/arkana/models/arguments.rb', line 8

def config_filepath
  @config_filepath
end

#dotenv_filepathObject (readonly)

Returns the value of attribute dotenv_filepath.



10
11
12
# File 'lib/arkana/models/arguments.rb', line 10

def dotenv_filepath
  @dotenv_filepath
end

#flavorObject (readonly)

Returns the value of attribute flavor.



12
13
14
# File 'lib/arkana/models/arguments.rb', line 12

def flavor
  @flavor
end

#include_environmentsObject (readonly)

Returns the value of attribute include_environments.



14
15
16
# File 'lib/arkana/models/arguments.rb', line 14

def include_environments
  @include_environments
end

#langObject (readonly)

Returns the value of attribute lang.



16
17
18
# File 'lib/arkana/models/arguments.rb', line 16

def lang
  @lang
end