Top Level Namespace
- Includes:
- GLI::App
Defined Under Namespace
Modules: Pluto Classes: Array, SysInfo
Instance Method Summary collapse
- #expand_config_args(args) ⇒ Object
-
#FEED ⇒ Object
todo/fix: check multiple will not print typeo???.
-
#FILE ⇒ Object
todo/fix: check multiple will not print typeo???.
- #find_config_path(name) ⇒ Object
- #find_default_config_path ⇒ Object
-
#load_config(name) ⇒ Object
begin move to pluto for reuse (e.g. in rakefile).
-
#verbose ⇒ Object
todo: use -w for short form? check ruby interpreter if in use too?.
Instance Method Details
#expand_config_args(args) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/pluto/cli/main.rb', line 121 def ( args ) # 1) no args - try to find default config e.g. pluto.ini etc. if args.length == 0 new_arg = find_default_config_path return [] if new_arg.nil? return [new_arg] # create a new args w/ one item e.g. ['pluto.yml'] end # 2) expand extname if no extname and config present new_args = [] args.each do |arg| new_arg = find_config_path( arg ) if new_arg.nil? # skip for now else new_args << new_arg end end new_args end |
#FEED ⇒ Object
todo/fix: check multiple will not print typeo???
165 |
# File 'lib/pluto/cli/main.rb', line 165 arg_name 'FEED', multiple: true |
#FILE ⇒ Object
todo/fix: check multiple will not print typeo???
219 |
# File 'lib/pluto/cli/main.rb', line 219 arg_name 'FILE', multiple: true |
#find_config_path(name) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/pluto/cli/main.rb', line 99 def find_config_path( name ) extname = File.extname( name ) # return '' or '.ini' or '.yml' etc. return name if extname.present? # nothing to do; extension already present candidates = [ '.ini', '.yml' ] candidates.each do |candidate| return "#{name}#{candidate}" if File.exists?( "#{name}#{candidate}" ) end # no extensions matching; sorry puts "*** note: no configuration found w/ extensions #{candidates.join('|')} for '#{name}'" # todo/check/fix - ?? -skip; remove from arg - or just pass through ??? nil # return nil; no config found/present; sorry end |
#find_default_config_path ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pluto/cli/main.rb', line 84 def find_default_config_path candidates = [ 'pluto.ini', 'pluto.yml', 'planet.ini', 'planet.yml' ] candidates.each do |candidate| return candidate if File.exists?( candidate ) ## todo: use ./candidate -- why? why not?? end puts "*** note: no default planet configuration found, that is, no #{candidates.join('|')} found in working folder" nil # return nil; no conifg existing candidate found/present; sorry end |
#load_config(name) ⇒ Object
begin
move to pluto for reuse (e.g. in rakefile)
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/pluto/cli/main.rb', line 71 def load_config( name ) extname = File.extname( name ) # return '' or '.ini' or '.yml' etc. config = extname == '.ini' ? INI.load_file( name ) : YAML.load_file( name ) puts "dump >#{name}<:" pp config config end |
#verbose ⇒ Object
todo: use -w for short form? check ruby interpreter if in use too?
151 |
# File 'lib/pluto/cli/main.rb', line 151 switch [:verbose], negatable: false |