Closed andreyantipov closed 6 years ago
Not currently, but this is a good idea. The challenge will be that without a default file, you would have to tell Dory where the config file is somehow, so might need to pass a -f <config-file>
flag each time. That could easily be aliased so you don't have to type it tho.
Any suggestions on interface? Would -f config-file.yml
(plus alias dory='dory -f config-file.yml'
in ~/.bashrc
)work for you?
Would -f config-file.yml (plus alias dory='dory -f config-file.yml' in ~/.bashrc)work for you?
Yeah!
Any suggestions on interface?
What if also implement auto-search config (.dory.yml) initialiser method which recursively will search config in current working directory up to home directory (including it)?
Something like that
#!/usr/bin/env ruby
CONFIG = ".dory.yml"
# HOME PATH must be set otherwise loop search will be infinite if config file is not exist
HOME = ENV["HOME"]
config = catch (:config) do
loop do
# Check if config file exist
# Return string if config exist
throw(:config, File.absolute_path(CONFIG)) if File.exist?(CONFIG)
# Move up to HOME
# Return bool false if config not exist
HOME === Dir.pwd ? throw(:config, false) : Dir.chdir("..")
# OR
# Return empty string if config not exist
# HOME === Dir.pwd ? throw(:config, "") : Dir.chdir("..")
end #loop
end #:config
puts config
Sorry for the delay, been super busy and sick. Will work on this weekend tho. I like the idea of recursively searching upward. That's a slick way of handling multiple projects. You can just put the .dory.yml file right in the repo, or at least have an easier time juggling multiple projects.
Hello, is it possible to specify location of config file instad using default ~/.dory.yml?