lib/erb_asterisk.rb in erb_asterisk-0.0.17 vs lib/erb_asterisk.rb in erb_asterisk-0.0.18

- old
+ new

@@ -19,15 +19,16 @@ include FileCache include SoftWrite def execute(opts) init_instance(opts) - load_project_file - root = asterisk_root + root = asterisk_root(opts) @templates_path = "#{root}templates".freeze + load_project_file + render_files(root) end private @@ -45,10 +46,15 @@ user_path = opts[:templates].nil? ? '~/.erb_asterisk' : opts[:templates] @user_templates = File.expand_path("#{user_path}/templates") end - def asterisk_root + def asterisk_root(opts) + if opts.arguments.any? + custom_root = File.expand_path("#{opts.arguments.first}/") + Dir.chdir(custom_root) + return custom_root + end return './' if File.exist?(ERB_ASTERISK_CONF) return ERB_ASTERISK_DIR if Dir.exist?(ERB_ASTERISK_DIR) raise 'Asterisk configuration not found' end