From 80ad6d501e34909a6cba842f8b25c7dd612078bf Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 29 Nov 2010 18:22:03 -0500 Subject: [PATCH] update rdoc and add tools.watchr --- .gitignore | 2 ++ README.rdoc | 51 ++++++++++++++++++++++++++++----------------------- tools.watchr | 22 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 tools.watchr diff --git a/.gitignore b/.gitignore index 83586a8..ca07c53 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,7 @@ tmp/* .bundle/* .DS_Store *.gem +.yardoc/* +doc/* diff --git a/README.rdoc b/README.rdoc index c72a8c1..950fa2a 100644 --- a/README.rdoc +++ b/README.rdoc @@ -27,7 +27,7 @@ Configs center around the Apache::Config.build method: server_name 'my-cool-website.cool.wow' document_root '/var/www/my-cool-website' - server_admin! "john@coswellproductions.com" + server_admin! "john@coswellproductions.com" directory '/' do options :follow_sym_links, :indexes @@ -42,12 +42,12 @@ Configs center around the Apache::Config.build method: end rewrites "My old content" do - cond "%{HTTP_REFERER}", '!^my-cool-website\.cool\.wow$' - rule %r{\.(gif|jpg|png|pdf)$}, '/lol-image-stealer.html', :last => true, :redirect => true + cond "%{HTTP_REFERER}", '!^my-cool-website\.cool\.wow$' + rule %r{\.(gif|jpg|png|pdf)$}, '/lol-image-stealer.html', :last => true, :redirect => true - rewrite_test '/index.html', '/index.html', :http_referer => 'other.site' - rewrite_test '/index.gif', '/lol-image-stealer.html', :http_referer => 'other.site' - rewrite_test '/index.gif', '/index.gif', :http_referer => 'my-cool-website.cool.wow' + rewrite_test '/index.html', '/index.html', :http_referer => 'other.site' + rewrite_test '/index.gif', '/lol-image-stealer.html', :http_referer => 'other.site' + rewrite_test '/index.gif', '/index.gif', :http_referer => 'my-cool-website.cool.wow' end end @@ -58,7 +58,7 @@ Notes on how the conversion works: * Directives that expect regular expressions take a Regexp object. * Passing a String as a parameter, by default, double-quotes it. * Passing in a Symbol does not quote the parameter. -** Some directives NerdCap Symbols, such as Options + * Some directives NerdCap Symbols, such as Options * Appending an exclamation point to the method turns off quoting. * Shortcut methods are defined as modules under the Apache module. @@ -71,23 +71,28 @@ There are also sanity checks that occur when configuration is being generated: The above config is transformed into the following: - ServerName "my-cool-website.cool.wow" - DocumentRoot "/var/www/my-cool-website" - ServerAdmin john@coswellproductions.com + ServerName "my-cool-website.cool.wow" + DocumentRoot "/var/www/my-cool-website" + ServerAdmin john@coswellproductions.com - - Options FollowSymLinks, Indexes - Allow from all - + + Options FollowSymLinks, Indexes + Allow from all + - - Deny from all + + Deny from all - AuthType Basic - AuthName "My secret" - AuthUserFile "/etc/apache2/users/global.users" - Require user john - + AuthType Basic + AuthName "My secret" + AuthUserFile "/etc/apache2/users/global.users" + Require user john + - RewriteCond "%{HTTP_REFERER}" "^!my-cool-website\.cool\.wow" - RewriteRule "\.(gif|jpg|png|pdf)$" "/lol-image-stealer.html" [L,R] + RewriteCond "%{HTTP_REFERER}" "^!my-cool-website\.cool\.wow" + RewriteRule "\.(gif|jpg|png|pdf)$" "/lol-image-stealer.html" [L,R] + +== Using Apache::Config separately + +Include the gem and access the methods on Apache::Config directly. See test/example_standalone.rb +for an example. diff --git a/tools.watchr b/tools.watchr new file mode 100644 index 0000000..d736aa7 --- /dev/null +++ b/tools.watchr @@ -0,0 +1,22 @@ +def growl(title, message) + system %{growlnotify -m "#{message}" "#{title}"} +end + +def reek(file) + output = %x{reek #{file}} + + puts output + + file, warnings = output.split("\n").first.split(" -- ") + + growl "REEK: #{file}", warnings +end + +def yard + system %{yard doc {app,lib}/**/*.rb} +end + +watch('(app|lib)/(.*)\.rb') { |match| + reek(match[0]) + yard +}