nginx_config_parser 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +3 -0
- data/Manifest.txt +20 -0
- data/README.txt +73 -0
- data/Rakefile +21 -0
- data/lib/nginx_config_parser.rb +62 -0
- data/lib/nginx_config_parser/configuration.rb +68 -0
- data/lib/nginx_config_parser/scanner.rb +510 -0
- data/src/scanner.rl +94 -0
- data/tasks/annotations.rake +30 -0
- data/tasks/doc.rake +49 -0
- data/tasks/gem.rake +89 -0
- data/tasks/manifest.rake +41 -0
- data/tasks/ragel.rake +10 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +151 -0
- data/tasks/spec.rake +40 -0
- data/tasks/test.rake +40 -0
- data/test/fixtures/ezra/conf/nginx.conf +209 -0
- data/test/fixtures/simple/conf/nginx.conf +21 -0
- data/test/parser_test.rb +69 -0
- metadata +74 -0
data/src/scanner.rl
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
module NginxConfigParser
|
2
|
+
|
3
|
+
module Scanner
|
4
|
+
|
5
|
+
class ConfigurationError < ::SyntaxError; end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
%%{
|
10
|
+
|
11
|
+
machine nginx;
|
12
|
+
|
13
|
+
comment = '#' any* :>> '\n';
|
14
|
+
word = (any - space - ';' - '{')+;
|
15
|
+
ignore = comment | space*;
|
16
|
+
if_statement = 'if' space* '(' any* :>> (')' space* '{') any* :>> '}';
|
17
|
+
|
18
|
+
statement := |*
|
19
|
+
# At the end of a setting
|
20
|
+
';' {
|
21
|
+
name = words.shift
|
22
|
+
values = words.dup
|
23
|
+
contexts.last[name] = value_of(values)
|
24
|
+
words.clear
|
25
|
+
fret;
|
26
|
+
};
|
27
|
+
# A word to store
|
28
|
+
word { words << data[ts...te].pack('c*') };
|
29
|
+
# The beginning of a section; create it using the current
|
30
|
+
# words and go a level deeper
|
31
|
+
'{' {
|
32
|
+
name = words.shift
|
33
|
+
values = words.dup
|
34
|
+
contexts << contexts.last.section(name, value_of(values))
|
35
|
+
words.clear
|
36
|
+
fcall statement;
|
37
|
+
};
|
38
|
+
# End of a section; pop up a level
|
39
|
+
space* '}' space* {
|
40
|
+
contexts.pop
|
41
|
+
fret;
|
42
|
+
};
|
43
|
+
ignore;
|
44
|
+
*|;
|
45
|
+
|
46
|
+
main := |*
|
47
|
+
# Skip if statements
|
48
|
+
if_statement;
|
49
|
+
# Non-space means a statement; hold the letter and switch
|
50
|
+
^space { words.clear; fhold; fcall statement; };
|
51
|
+
# Everything else is ignored
|
52
|
+
ignore;
|
53
|
+
*|;
|
54
|
+
|
55
|
+
}%%
|
56
|
+
|
57
|
+
|
58
|
+
def parse(data)
|
59
|
+
# Stuff for Ragel
|
60
|
+
data = data.unpack("c*") if data.is_a?(String)
|
61
|
+
eof, stack = 0, []
|
62
|
+
# The list of words to fill for identifiers and values
|
63
|
+
words = []
|
64
|
+
# The stack of contexts, used to accumulate data at
|
65
|
+
# the appropriate level
|
66
|
+
contexts = [Configuration.new]
|
67
|
+
%% write data;
|
68
|
+
%% write init;
|
69
|
+
%% write exec;
|
70
|
+
# This is a little more forgiving than
|
71
|
+
# using <tt>pop</tt> and validating balance
|
72
|
+
contexts.first
|
73
|
+
end
|
74
|
+
|
75
|
+
#######
|
76
|
+
private
|
77
|
+
#######
|
78
|
+
|
79
|
+
# Return single values if only one word,
|
80
|
+
# and make it an integer if possible
|
81
|
+
def value_of(words)
|
82
|
+
return nil if words.empty?
|
83
|
+
return words unless words.size == 1
|
84
|
+
parsed_words = words.map do |word|
|
85
|
+
Integer(word) rescue word
|
86
|
+
end
|
87
|
+
parsed_words.size == 1 ? parsed_words.pop : parsed_words
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :notes do
|
12
|
+
desc "Enumerate all OPTIMIZE annotations"
|
13
|
+
task :optimize do
|
14
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Enumerate all FIXME annotations"
|
18
|
+
task :fixme do
|
19
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Enumerate all TODO annotations"
|
23
|
+
task :todo do
|
24
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end # if HAVE_BONES
|
29
|
+
|
30
|
+
# EOF
|
data/tasks/doc.rake
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
|
7
|
+
desc 'Generate RDoc documentation'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = PROJ.rdoc_main
|
10
|
+
rd.options << '-d' if !WIN32 and `which dot` =~ %r/\/dot/
|
11
|
+
rd.rdoc_dir = PROJ.rdoc_dir
|
12
|
+
|
13
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
14
|
+
excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
|
15
|
+
files = PROJ.files.find_all do |fn|
|
16
|
+
case fn
|
17
|
+
when excl; false
|
18
|
+
when incl; true
|
19
|
+
else false end
|
20
|
+
end
|
21
|
+
rd.rdoc_files.push(*files)
|
22
|
+
|
23
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
24
|
+
title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
|
25
|
+
|
26
|
+
rd.options << "-t #{title}"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Generate ri locally for testing'
|
30
|
+
task :ri => :clobber_ri do
|
31
|
+
sh "#{RDOC} --ri -o ri ."
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Remove ri products'
|
35
|
+
task :clobber_ri do
|
36
|
+
rm_r 'ri' rescue nil
|
37
|
+
end
|
38
|
+
|
39
|
+
end # namespace :doc
|
40
|
+
|
41
|
+
desc 'Alias to doc:rdoc'
|
42
|
+
task :doc => 'doc:rdoc'
|
43
|
+
|
44
|
+
desc 'Remove all build products'
|
45
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
46
|
+
|
47
|
+
remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
|
48
|
+
|
49
|
+
# EOF
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
|
5
|
+
namespace :gem do
|
6
|
+
|
7
|
+
PROJ.spec = Gem::Specification.new do |s|
|
8
|
+
s.name = PROJ.name
|
9
|
+
s.version = PROJ.version
|
10
|
+
s.summary = PROJ.summary
|
11
|
+
s.authors = Array(PROJ.authors)
|
12
|
+
s.email = PROJ.email
|
13
|
+
s.homepage = Array(PROJ.url).first
|
14
|
+
s.rubyforge_project = PROJ.rubyforge_name
|
15
|
+
|
16
|
+
s.description = PROJ.description
|
17
|
+
|
18
|
+
PROJ.dependencies.each do |dep|
|
19
|
+
s.add_dependency(*dep)
|
20
|
+
end
|
21
|
+
|
22
|
+
s.files = PROJ.files
|
23
|
+
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
25
|
+
|
26
|
+
s.bindir = 'bin'
|
27
|
+
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
28
|
+
s.require_paths = dirs unless dirs.empty?
|
29
|
+
|
30
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
31
|
+
excl = PROJ.rdoc_exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
32
|
+
excl = Regexp.new(excl.join('|'))
|
33
|
+
rdoc_files = PROJ.files.find_all do |fn|
|
34
|
+
case fn
|
35
|
+
when excl; false
|
36
|
+
when incl; true
|
37
|
+
else false end
|
38
|
+
end
|
39
|
+
s.rdoc_options = PROJ.rdoc_opts + ['--main', PROJ.rdoc_main]
|
40
|
+
s.extra_rdoc_files = rdoc_files
|
41
|
+
s.has_rdoc = true
|
42
|
+
|
43
|
+
if test ?f, PROJ.test_file
|
44
|
+
s.test_file = PROJ.test_file
|
45
|
+
else
|
46
|
+
s.test_files = PROJ.tests.to_a
|
47
|
+
end
|
48
|
+
|
49
|
+
# Do any extra stuff the user wants
|
50
|
+
# spec_extras.each do |msg, val|
|
51
|
+
# case val
|
52
|
+
# when Proc
|
53
|
+
# val.call(s.send(msg))
|
54
|
+
# else
|
55
|
+
# s.send "#{msg}=", val
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Show information about the gem'
|
61
|
+
task :debug do
|
62
|
+
puts PROJ.spec.to_ruby
|
63
|
+
end
|
64
|
+
|
65
|
+
Rake::GemPackageTask.new(PROJ.spec) do |pkg|
|
66
|
+
pkg.need_tar = PROJ.need_tar
|
67
|
+
pkg.need_zip = PROJ.need_zip
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Install the gem'
|
71
|
+
task :install => [:clobber, :package] do
|
72
|
+
sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.file_name}"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Uninstall the gem'
|
76
|
+
task :uninstall do
|
77
|
+
sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' #{PROJ.name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
end # namespace :gem
|
81
|
+
|
82
|
+
desc 'Alias to gem:package'
|
83
|
+
task :gem => 'gem:package'
|
84
|
+
|
85
|
+
task :clobber => 'gem:clobber_package'
|
86
|
+
|
87
|
+
remove_desc_for_task %w(gem:clobber_package)
|
88
|
+
|
89
|
+
# EOF
|
data/tasks/manifest.rake
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
namespace :manifest do
|
6
|
+
|
7
|
+
desc 'Verify the manifest'
|
8
|
+
task :check do
|
9
|
+
fn = 'Manifest.tmp'
|
10
|
+
files = []
|
11
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
12
|
+
Find.find '.' do |path|
|
13
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
14
|
+
next unless test ?f, path
|
15
|
+
next if path =~ exclude
|
16
|
+
files << path
|
17
|
+
end
|
18
|
+
|
19
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
20
|
+
system "#{DIFF} -du Manifest.txt #{fn}"
|
21
|
+
rm fn rescue nil
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Create a new manifest'
|
25
|
+
task :create do
|
26
|
+
fn = 'Manifest.txt'
|
27
|
+
files = []
|
28
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
29
|
+
Find.find '.' do |path|
|
30
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
31
|
+
next unless test ?f, path
|
32
|
+
next if path =~ exclude
|
33
|
+
files << path
|
34
|
+
end
|
35
|
+
|
36
|
+
files << fn unless test ?f, fn
|
37
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# EOF
|
data/tasks/ragel.rake
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if PROJ.rubyforge_name && HAVE_RUBYFORGE
|
4
|
+
|
5
|
+
require 'rubyforge'
|
6
|
+
require 'rake/contrib/sshpublisher'
|
7
|
+
|
8
|
+
namespace :gem do
|
9
|
+
desc 'Package and upload to RubyForge'
|
10
|
+
task :release => [:clobber, :package] do |t|
|
11
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
+
pkg = "pkg/#{PROJ.spec.full_name}"
|
14
|
+
|
15
|
+
if $DEBUG then
|
16
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
17
|
+
puts "rf.add_file #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
|
+
end
|
19
|
+
|
20
|
+
rf = RubyForge.new
|
21
|
+
puts 'Logging in'
|
22
|
+
rf.login
|
23
|
+
|
24
|
+
c = rf.userconfig
|
25
|
+
c['release_notes'] = PROJ.description if PROJ.description
|
26
|
+
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
|
+
c['preformatted'] = true
|
28
|
+
|
29
|
+
files = [(PROJ.need_tar ? "#{pkg}.tgz" : nil),
|
30
|
+
(PROJ.need_zip ? "#{pkg}.zip" : nil),
|
31
|
+
"#{pkg}.gem"].compact
|
32
|
+
|
33
|
+
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
34
|
+
rf.add_release PROJ.rubyforge_name, PROJ.name, PROJ.version, *files
|
35
|
+
end
|
36
|
+
end # namespace :gem
|
37
|
+
|
38
|
+
|
39
|
+
namespace :doc do
|
40
|
+
desc "Publish RDoc to RubyForge"
|
41
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
42
|
+
config = YAML.load(
|
43
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
44
|
+
)
|
45
|
+
|
46
|
+
host = "#{config['username']}@rubyforge.org"
|
47
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
|
48
|
+
remote_dir << PROJ.rdoc_remote_dir if PROJ.rdoc_remote_dir
|
49
|
+
local_dir = PROJ.rdoc_dir
|
50
|
+
|
51
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
52
|
+
end
|
53
|
+
end # namespace :doc
|
54
|
+
|
55
|
+
end # if HAVE_RUBYFORGE
|
56
|
+
|
57
|
+
# EOF
|
data/tasks/setup.rb
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'ostruct'
|
7
|
+
|
8
|
+
PROJ = OpenStruct.new
|
9
|
+
|
10
|
+
PROJ.name = nil
|
11
|
+
PROJ.summary = nil
|
12
|
+
PROJ.description = nil
|
13
|
+
PROJ.changes = nil
|
14
|
+
PROJ.authors = nil
|
15
|
+
PROJ.email = nil
|
16
|
+
PROJ.url = nil
|
17
|
+
PROJ.version = ENV['VERSION'] || '0.0.0'
|
18
|
+
PROJ.rubyforge_name = nil
|
19
|
+
PROJ.exclude = %w(tmp$ bak$ ~$ CVS .git .svn ^pkg/ ^doc ^\._)
|
20
|
+
|
21
|
+
# Rspec
|
22
|
+
PROJ.specs = FileList['spec/**/*_spec.rb']
|
23
|
+
PROJ.spec_opts = []
|
24
|
+
|
25
|
+
# Test::Unit
|
26
|
+
PROJ.tests = FileList['test/**/*_test.rb']
|
27
|
+
PROJ.test_file = 'test/all.rb'
|
28
|
+
PROJ.test_opts = []
|
29
|
+
|
30
|
+
# Rcov
|
31
|
+
PROJ.rcov_opts = ['--sort', 'coverage', '-T']
|
32
|
+
|
33
|
+
# Rdoc
|
34
|
+
PROJ.rdoc_opts = []
|
35
|
+
PROJ.rdoc_include = %w(^lib/ ^bin/ ^ext/ .txt$)
|
36
|
+
PROJ.rdoc_exclude = %w(extconf.rb$ ^Manifest.txt$)
|
37
|
+
PROJ.rdoc_main = 'README.txt'
|
38
|
+
PROJ.rdoc_dir = 'doc'
|
39
|
+
PROJ.rdoc_remote_dir = nil
|
40
|
+
|
41
|
+
# Extensions
|
42
|
+
PROJ.extensions = FileList['ext/**/extconf.rb']
|
43
|
+
PROJ.ruby_opts = %w(-w)
|
44
|
+
PROJ.libs = []
|
45
|
+
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
46
|
+
|
47
|
+
# Gem Packaging
|
48
|
+
PROJ.files =
|
49
|
+
if test ?f, 'Manifest.txt'
|
50
|
+
files = File.readlines('Manifest.txt').map {|fn| fn.chomp.strip}
|
51
|
+
files.delete ''
|
52
|
+
files
|
53
|
+
else [] end
|
54
|
+
PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
|
55
|
+
PROJ.dependencies = []
|
56
|
+
PROJ.need_tar = true
|
57
|
+
PROJ.need_zip = false
|
58
|
+
|
59
|
+
# File Annotations
|
60
|
+
PROJ.annotation_exclude = []
|
61
|
+
PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
|
62
|
+
|
63
|
+
# Subversion Repository
|
64
|
+
PROJ.svn = false
|
65
|
+
PROJ.svn_root = nil
|
66
|
+
PROJ.svn_trunk = 'trunk'
|
67
|
+
PROJ.svn_tags = 'tags'
|
68
|
+
PROJ.svn_branches = 'branches'
|
69
|
+
|
70
|
+
# Load the other rake files in the tasks folder
|
71
|
+
Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
|
72
|
+
|
73
|
+
# Setup some constants
|
74
|
+
WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
|
75
|
+
|
76
|
+
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
77
|
+
|
78
|
+
def quiet( &block )
|
79
|
+
io = [STDOUT.dup, STDERR.dup]
|
80
|
+
STDOUT.reopen DEV_NULL
|
81
|
+
STDERR.reopen DEV_NULL
|
82
|
+
block.call
|
83
|
+
ensure
|
84
|
+
STDOUT.reopen io.first
|
85
|
+
STDERR.reopen io.last
|
86
|
+
end
|
87
|
+
|
88
|
+
DIFF = if WIN32 then 'diff.exe'
|
89
|
+
else
|
90
|
+
if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
|
91
|
+
else 'diff' end
|
92
|
+
end unless defined? DIFF
|
93
|
+
|
94
|
+
SUDO = if WIN32 then ''
|
95
|
+
else
|
96
|
+
if quiet {system 'which sudo'} then 'sudo'
|
97
|
+
else '' end
|
98
|
+
end
|
99
|
+
|
100
|
+
RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
|
101
|
+
GEM = WIN32 ? 'gem.cmd' : 'gem'
|
102
|
+
|
103
|
+
%w(rcov spec/rake/spectask rubyforge bones).each do |lib|
|
104
|
+
begin
|
105
|
+
require lib
|
106
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
107
|
+
rescue LoadError
|
108
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
113
|
+
# specified.
|
114
|
+
#
|
115
|
+
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
116
|
+
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
117
|
+
#
|
118
|
+
def paragraphs_of(path, *paragraphs)
|
119
|
+
File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Adds the given gem _name_ to the current project's dependency list. An
|
123
|
+
# optional gem _version_ can be given. If omitted, the newest gem version
|
124
|
+
# will be used.
|
125
|
+
#
|
126
|
+
def depend_on( name, version = nil )
|
127
|
+
spec = Gem.source_index.find_name(name).last
|
128
|
+
version = spec.version.to_s if version.nil? and !spec.nil?
|
129
|
+
|
130
|
+
PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
|
131
|
+
end
|
132
|
+
|
133
|
+
# Adds the given _path_ to the include path if it is not already there
|
134
|
+
#
|
135
|
+
def ensure_in_path( path )
|
136
|
+
path = File.expand_path(path)
|
137
|
+
$:.unshift(path) if test(?d, path) and not $:.include?(path)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Find a rake task using the task name and remove any description text. This
|
141
|
+
# will prevent the task from being displayed in the list of available tasks.
|
142
|
+
#
|
143
|
+
def remove_desc_for_task( names )
|
144
|
+
Array(names).each do |task_name|
|
145
|
+
task = Rake.application.tasks.find {|t| t.name == task_name}
|
146
|
+
next if task.nil?
|
147
|
+
task.instance_variable_set :@comment, nil
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# EOF
|