Skip to content

Commit

Permalink
Tebafile
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Aug 4, 2024
1 parent d612b05 commit ba12330
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/tebako/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@
# Tebako - an executable packager
# Implementation of tebako command-line interface
module Tebako
OPTIONS_FILE = ".tebako.yml"
DEFAULT_TEBAFILE = ".tebako.yml"
# Tebako packager front-end
class Cli < Thor
package_name "Tebako"
class_option :prefix, type: :string, aliases: "-p", required: false,
desc: "A path to tebako packaging environment, '~/.tebako' ('$HOME/.tebako') by default"
class_option :devmode, type: :boolean, aliases: "-D", required: false,
desc: "Developer mode, please do not use if unsure"

class_option :tebafile, type: :string, aliases: "-t", required: false,
desc: "tebako configuration file 'tebafile', '$PWD/.tebako.yml' by default"
desc "clean", "Clean tebako packaging environment"
def clean
clean_cache
Expand Down Expand Up @@ -123,10 +124,10 @@ def initialize(*args)

def options
original_options = super
tebafile = original_options["tebafile"].nil? ? DEFAULT_TEBAFILE : original_options["tebafile"]
return original_options unless File.exist?(tebafile)

return original_options unless File.exist?(OPTIONS_FILE)

defaults = ::YAML.load_file(OPTIONS_FILE) || {}
defaults = ::YAML.load_file(tebafile) || {}
Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
end
end
Expand Down

0 comments on commit ba12330

Please sign in to comment.