lib/apidragon/api.rb in apidragon-1.4.3 vs lib/apidragon/api.rb in apidragon-1.4.4
- old
+ new
@@ -13,13 +13,14 @@
# Uses the configuration data in config.yaml to run a sequence of api calls.
# All variables are dumped into a variable bucket (@arg_bucket)
# so that they can be used as parameters for function calls.
def initialize(macro_name, config)
+ @config_file = config
`mkdir #{PLUGINS}` unless Dir.exist? PLUGINS
@arg_bucket = {}
- @config = load_config config
+ @config = load_config @config_file
import @config['vars']
@macro = @config['macros'][macro_name]
if @macro.nil? then fail "Command: '#{macro_name}' is not defined." end
end
@@ -46,10 +47,10 @@
end
end
def add_config_var(key,value)
@config['vars'][key] = value
- file = File.open CONFIG, 'w'
+ file = File.open @config_file, 'w'
file.write(@config.to_yaml.gsub("\n-", "\n\n-"))
file.close
end
end