update rdoc and add tools.watchr
This commit is contained in:
parent
e5a68259e2
commit
80ad6d501e
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,5 +9,7 @@ tmp/*
|
|||||||
.bundle/*
|
.bundle/*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.gem
|
*.gem
|
||||||
|
.yardoc/*
|
||||||
|
doc/*
|
||||||
|
|
||||||
|
|
||||||
|
51
README.rdoc
51
README.rdoc
@ -27,7 +27,7 @@ Configs center around the Apache::Config.build method:
|
|||||||
server_name 'my-cool-website.cool.wow'
|
server_name 'my-cool-website.cool.wow'
|
||||||
document_root '/var/www/my-cool-website'
|
document_root '/var/www/my-cool-website'
|
||||||
|
|
||||||
server_admin! "john@coswellproductions.com"
|
server_admin! "john@coswellproductions.com"
|
||||||
|
|
||||||
directory '/' do
|
directory '/' do
|
||||||
options :follow_sym_links, :indexes
|
options :follow_sym_links, :indexes
|
||||||
@ -42,12 +42,12 @@ Configs center around the Apache::Config.build method:
|
|||||||
end
|
end
|
||||||
|
|
||||||
rewrites "My old content" do
|
rewrites "My old content" do
|
||||||
cond "%{HTTP_REFERER}", '!^my-cool-website\.cool\.wow$'
|
cond "%{HTTP_REFERER}", '!^my-cool-website\.cool\.wow$'
|
||||||
rule %r{\.(gif|jpg|png|pdf)$}, '/lol-image-stealer.html', :last => true, :redirect => true
|
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.html', '/index.html', :http_referer => 'other.site'
|
||||||
rewrite_test '/index.gif', '/lol-image-stealer.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.gif', '/index.gif', :http_referer => 'my-cool-website.cool.wow'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Notes on how the conversion works:
|
|||||||
* Directives that expect regular expressions take a Regexp object.
|
* Directives that expect regular expressions take a Regexp object.
|
||||||
* Passing a String as a parameter, by default, double-quotes it.
|
* Passing a String as a parameter, by default, double-quotes it.
|
||||||
* Passing in a Symbol does not quote the parameter.
|
* 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.
|
* Appending an exclamation point to the method turns off quoting.
|
||||||
* Shortcut methods are defined as modules under the Apache module.
|
* 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:
|
The above config is transformed into the following:
|
||||||
|
|
||||||
ServerName "my-cool-website.cool.wow"
|
ServerName "my-cool-website.cool.wow"
|
||||||
DocumentRoot "/var/www/my-cool-website"
|
DocumentRoot "/var/www/my-cool-website"
|
||||||
ServerAdmin john@coswellproductions.com
|
ServerAdmin john@coswellproductions.com
|
||||||
|
|
||||||
<Directory "/">
|
<Directory "/">
|
||||||
Options FollowSymLinks, Indexes
|
Options FollowSymLinks, Indexes
|
||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
<LocationMatch "^/secret">
|
<LocationMatch "^/secret">
|
||||||
Deny from all
|
Deny from all
|
||||||
|
|
||||||
AuthType Basic
|
AuthType Basic
|
||||||
AuthName "My secret"
|
AuthName "My secret"
|
||||||
AuthUserFile "/etc/apache2/users/global.users"
|
AuthUserFile "/etc/apache2/users/global.users"
|
||||||
Require user john
|
Require user john
|
||||||
</LocationMatch>
|
</LocationMatch>
|
||||||
|
|
||||||
RewriteCond "%{HTTP_REFERER}" "^!my-cool-website\.cool\.wow"
|
RewriteCond "%{HTTP_REFERER}" "^!my-cool-website\.cool\.wow"
|
||||||
RewriteRule "\.(gif|jpg|png|pdf)$" "/lol-image-stealer.html" [L,R]
|
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.
|
||||||
|
22
tools.watchr
Normal file
22
tools.watchr
Normal file
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user