cook 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/cook.rb +1 -1
  2. data/lib/rake/config.rb +31 -0
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  class Cook
2
- VERSION = '2.0.1'
2
+ VERSION = '2.0.2'
3
3
  end
@@ -93,6 +93,7 @@ class Conf
93
93
  @@passPhrase = nil;
94
94
  @@configFileNames = Array.new();
95
95
  @@recipePaths = Array.new();
96
+ @@globalCookbookDirectories = Array.new();
96
97
 
97
98
  def self.get_pass_phrase(check = false)
98
99
  if @@passPhrase.nil? then
@@ -236,6 +237,27 @@ class Conf
236
237
  end
237
238
  end
238
239
 
240
+ def self.add_global_cookbook_directory(globalCookbookDirectory)
241
+ Rake::Application.mesg "Adding global cookbook: [#{globalCookbookDirectory}]";
242
+ @@globalCookbookDirectories.push(globalCookbookDirectory)
243
+ end
244
+
245
+ def self.add_global_cookbooks()
246
+ if @@globalCookbookDirectories.empty?() then
247
+ if ENV.has_key?('HOME') then
248
+ if not ENV['HOME'].empty?() then
249
+ @@globalCookbookDirectories.push(ENV['HOME']+'/.cookbook');
250
+ end
251
+ end
252
+ end
253
+ @@globalCookbookDirectories.each() do | aGlobalCookbookDir |
254
+ if Dir.exists?(aGlobalCookbookDir) then
255
+ Rake::Application.mesg "Adding global cookbook #{aGlobalCookbookDir}";
256
+ Conf.add_cookbook(aGlobalCookbookDir);
257
+ end
258
+ end
259
+ end
260
+
239
261
  def self.add_cookbook(aCookbookPath)
240
262
  $LOAD_PATH.unshift(aCookbookPath+'/lib');
241
263
  Conf.add_recipes_path(aCookbookPath+'/');
@@ -335,6 +357,14 @@ module Rake
335
357
  end
336
358
  }
337
359
  ]);
360
+ options.push(
361
+ ['--global-cookbook', '-C GLOBAL-COOKBOOK-DIRECTORY', "Load global Cookbook from the GLOBAL-COOKBOOK-DIRECTORY if it exists",
362
+ lambda { |value|
363
+ confDirValues = value.split(/,/).each do | aValue |
364
+ Conf.add_global_cookbook_directory(aValue);
365
+ end
366
+ }
367
+ ]);
338
368
  return options;
339
369
  end
340
370
 
@@ -359,6 +389,7 @@ module Rake
359
389
  FileUtils.mkdir_p('logs');
360
390
  Rake::Application.openLogger('logs/'+Conf.log_file_name.gsub(/\//,'_')+'-buildLog');
361
391
  Rake::Application.logger.level = Logger::DEBUG;
392
+ Conf.add_global_cookbooks();
362
393
  Rake::Application.mesg "Building in #{myCookbookDir}";
363
394
  Conf.add_cookbook(myCookbookDir);
364
395
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cook
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-15 00:00:00.000000000 Z
12
+ date: 2014-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake