release: started

This commit is contained in:
rkiel
2017-09-19 21:18:37 -04:00
parent 8f3489d1ff
commit a1cc5f7cd5
5 changed files with 131 additions and 0 deletions

28
lib/release/loader.rb Normal file
View File

@@ -0,0 +1,28 @@
module Release
class Loader
attr_reader :commands, :default
def initialize commands, default
@commands = commands
@default = default
end
def create key, argv
key = default unless commands.include? key
require_relative "./#{key}"
klass = Module.const_get "Release::#{key.to_s.capitalize}"
klass.new(argv)
end
def create_all argv
commands.map { |x| create(x,argv) }
end
def search pattern
regexp = Regexp.new(pattern)
commands.select { |x| regexp.match(x.to_s) }
end
end
end