Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto loading of YML config for tasks with dependencies #176

Open
nithinphilips opened this issue Oct 28, 2011 · 1 comment
Open

Auto loading of YML config for tasks with dependencies #176

nithinphilips opened this issue Oct 28, 2011 · 1 comment

Comments

@nithinphilips
Copy link

I ran into an issue with auto loading of YML config files. Here's a patch that fixes the problem.

Background:

My Rakefile had a task definition like this:

rapc :supertask => [:subtask1, :subtask2] do |r|
    ...
end

rapc is a custom task.

When I tried to put settings in the yml file, I noticed that they were never loaded. While investigating the problem I realized that the task_name parameter passed into the load_config_by_task_name method is, in case of a task definition like the one above, a Hash, rather than a Symbol. The following patch ensures that the correct yml config file will be loaded in this case.

--- yamlconfig.old.rb   2011-10-28 17:09:52.887308600 -0400
+++ yamlconfig.rb       2011-10-28 17:08:55.682036600 -0400
@@ -7,6 +7,13 @@

def load_config_by_task_name(task_name)
    task_config = "#{task_name}.yml"
+
+    if task_name.is_a? Hash
+        task_name.each_key {|key|
+            task_config = "#{key}.yml"
+        }
+    end
+
    task_config = File.join(Albacore.configure.yaml_config_folder, task_config) unless Albacore.configure.yaml_config_folder.nil?
    configure(task_config) if File.exists?(task_config)
end
@haf
Copy link
Collaborator

haf commented Jan 31, 2012

Relates to #187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants