Class: PopulateEnv::CLI::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/populate_env/cli/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv: ARGV, output: $stdout, executable: File.basename($0)) ⇒ Runner

Returns a new instance of Runner.



6
7
8
# File 'lib/populate_env/cli/runner.rb', line 6

def initialize(argv: ARGV, output: $stdout, executable: File.basename($0))
  @argv, @output, @executable = Array(argv), output, executable
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



4
5
6
# File 'lib/populate_env/cli/runner.rb', line 4

def argv
  @argv
end

#executableObject (readonly)

Returns the value of attribute executable.



4
5
6
# File 'lib/populate_env/cli/runner.rb', line 4

def executable
  @executable
end

#outputObject (readonly)

Returns the value of attribute output.



4
5
6
# File 'lib/populate_env/cli/runner.rb', line 4

def output
  @output
end

Instance Method Details

#helpObject



14
15
16
# File 'lib/populate_env/cli/runner.rb', line 14

def help
  output.puts option_parser.to_s
end

#herokuObject



22
23
24
25
# File 'lib/populate_env/cli/runner.rb', line 22

def heroku
  options = CLI::HerokuOptions.parse(argv, command: "#{executable} heroku")
  PopulateEnv::Heroku.call(options)
end

#runObject



10
11
12
# File 'lib/populate_env/cli/runner.rb', line 10

def run
  send(subcommand)
end

#versionObject



18
19
20
# File 'lib/populate_env/cli/runner.rb', line 18

def version
  output.puts "#{executable} version #{VERSION}"
end