diff options
author | elijah <elijah@riseup.net> | 2012-11-14 14:27:35 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-11-14 14:27:35 -0800 |
commit | 54fe4bcb36959866a12509ce7d45a97c60722c11 (patch) | |
tree | 8d54bd70cc1339ba5461925779373f87aae1b388 /Rakefile | |
parent | c3730c0dd8362f0e6a4d7667d83f733d04ab59f9 (diff) | |
download | leap_cli-54fe4bcb36959866a12509ce7d45a97c60722c11.tar.gz leap_cli-54fe4bcb36959866a12509ce7d45a97c60722c11.tar.bz2 |
added requirements checking - will bail out if a configuration option is missing
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -81,6 +81,33 @@ end task :default => :test ## +## CODE GENERATION +## + +desc "Updates the list of required configuration options for this version of LEAP CLI" +task 'update-requirements' do + Dir.chdir($base_dir) do + required_configs = `find -name '*.rb' | xargs grep -R 'assert_config!'`.split("\n").collect{|line| + if line =~ /def/ + nil + else + line.sub(/.*assert_config! ["'](.*?)["'].*/,'"\1"') + end + }.compact + File.open("#{$base_dir}/lib/leap_cli/requirements.rb", 'w') do |f| + f.puts "# run 'rake update-requirements' to generate this file." + f.puts "module LeapCli" + f.puts " REQUIREMENTS = [" + f.puts " " + required_configs.join(",\n ") + f.puts " ]" + f.puts "end" + end + puts "updated #{$base_dir}/lib/leap_cli/requirements.rb" + #puts `cat '#{$base_dir}/lib/leap_cli/requirements.rb'` + end +end + +## ## DOCUMENTATION ## |