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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/arkana/models/arguments.rb', line 14

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

  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
  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