Add attribute Diversipub::Main#pwd
This commit is contained in:
parent
fa9e28fd66
commit
6d26cc6e39
3 changed files with 16 additions and 2 deletions
|
@ -59,6 +59,7 @@ $stdout.sync = true
|
||||||
$stderr.sync = true
|
$stderr.sync = true
|
||||||
|
|
||||||
main = Diversipub::Main.new(
|
main = Diversipub::Main.new(
|
||||||
|
pwd: Pathname.pwd,
|
||||||
program_name: $PROGRAM_NAME,
|
program_name: $PROGRAM_NAME,
|
||||||
argv: ARGV,
|
argv: ARGV,
|
||||||
env: ENV,
|
env: ENV,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
####################
|
####################
|
||||||
|
|
||||||
require 'logger'
|
require 'logger'
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
########
|
########
|
||||||
# Gems #
|
# Gems #
|
||||||
|
|
|
@ -5,9 +5,16 @@ module Diversipub
|
||||||
# The whole application runner.
|
# The whole application runner.
|
||||||
#
|
#
|
||||||
class Main
|
class Main
|
||||||
attr_reader :program_name, :argv, :env, :stdin, :stdout, :stderr
|
attr_reader :pwd, :program_name, :argv, :env, :stdin, :stdout, :stderr
|
||||||
|
|
||||||
def initialize(program_name:, argv:, env:, stdin:, stdout:, stderr:)
|
def initialize(pwd:,
|
||||||
|
program_name:,
|
||||||
|
argv:,
|
||||||
|
env:,
|
||||||
|
stdin:,
|
||||||
|
stdout:,
|
||||||
|
stderr:)
|
||||||
|
self.pwd = pwd
|
||||||
self.program_name = program_name
|
self.program_name = program_name
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.env = env
|
self.env = env
|
||||||
|
@ -18,6 +25,7 @@ module Diversipub
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
p pwd
|
||||||
p program_name
|
p program_name
|
||||||
p argv
|
p argv
|
||||||
p env
|
p env
|
||||||
|
@ -40,6 +48,10 @@ module Diversipub
|
||||||
|
|
||||||
attr_writer :stdin, :stdout, :stderr
|
attr_writer :stdin, :stdout, :stderr
|
||||||
|
|
||||||
|
def pwd=(pwd)
|
||||||
|
@pwd = Pathname.new(pwd).freeze
|
||||||
|
end
|
||||||
|
|
||||||
def program_name=(program_name)
|
def program_name=(program_name)
|
||||||
@program_name = String(program_name).freeze
|
@program_name = String(program_name).freeze
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue