Permalink
Browse files

close enough

  • Loading branch information...
0 parents commit 931b29519bf25556f6f0965b34c8064262fd2e9d @evan committed Aug 21, 2007
Showing with 3,520 additions and 0 deletions.
  1. +21 −0 README
  2. +132 −0 Rakefile
  3. +12 −0 TODO
  4. +54 −0 httpd.conf
  5. +2 −0 public/about/body.element
  6. +1 −0 public/about/content.element
  7. +1 −0 public/about/index.html
  8. +1 −0 public/about/title.element
  9. +16 −0 public/all/content.element
  10. +1 −0 public/all/index.html
  11. +1 −0 public/all/title.element
  12. +2 −0 public/closed.element
  13. +8 −0 public/comment.element
  14. +3 −0 public/css/bax.css
  15. +1 −0 public/ellipsis.element
  16. BIN public/images/rss.gif
  17. +80 −0 public/index.html
  18. +25 −0 public/js/bax.js
  19. +11 −0 public/js/jquery.js
  20. 0 public/nothing.element
  21. +34 −0 public/open.element
  22. +31 −0 public/post_full.element
  23. +7 −0 public/post_index.element
  24. +23 −0 public/post_short.element
  25. +1 −0 public/read_more.element
  26. +17 −0 public/static.element
  27. +118 −0 public/template.html
  28. +1 −0 public/title.element
  29. +1 −0 public/url.element
  30. +15 −0 public/xml/atom.xml
  31. +1 −0 public/xml/content.element
  32. +13 −0 public/xml/post.element
  33. +5 −0 public/yui/build/base/README
  34. +7 −0 public/yui/build/base/base-min.css
  35. +76 −0 public/yui/build/base/base.css
  36. +25 −0 public/yui/build/fonts/README
  37. +7 −0 public/yui/build/fonts/fonts-min.css
  38. +16 −0 public/yui/build/fonts/fonts.css
  39. +55 −0 public/yui/build/grids/README
  40. +7 −0 public/yui/build/grids/grids-min.css
  41. +216 −0 public/yui/build/grids/grids.css
  42. +34 −0 public/yui/build/reset/README
  43. +7 −0 public/yui/build/reset/reset-min.css
  44. +19 −0 public/yui/build/reset/reset.css
  45. +65 −0 script/bax.rb
  46. +65 −0 script/html/document.rb
  47. +530 −0 script/html/node.rb
  48. +823 −0 script/html/selector.rb
  49. +105 −0 script/html/tokenizer.rb
  50. +11 −0 script/html/version.rb
  51. +80 −0 script/import.rb
  52. +123 −0 script/support.rb
  53. +8 −0 script/twitter/lib/twitter.rb
  54. +179 −0 script/twitter/lib/twitter/base.rb
  55. +185 −0 script/twitter/lib/twitter/command.rb
  56. +22 −0 script/twitter/lib/twitter/direct_message.rb
  57. +43 −0 script/twitter/lib/twitter/easy_class_maker.rb
  58. +19 −0 script/twitter/lib/twitter/status.rb
  59. +38 −0 script/twitter/lib/twitter/user.rb
  60. +9 −0 script/twitter/lib/twitter/version.rb
  61. +96 −0 script/white_list_helper.rb
  62. +6 −0 settings.rb
  63. +5 −0 slogans.txt
21 README
@@ -0,0 +1,21 @@
+
+Bax
+
+Configured your paths in httpd.conf and start apache:
+ rake start
+
+Rotate the slogan:
+ rake slogan
+
+Build a new article:
+ rake new
+
+Index your shit:
+ rake index
+
+It's been real.
+
+===
+
+Copyright 2007 Cloudburst, LLC. Unauthorized modification, use, and/or
+distribution of this software is strictly prohibited.
132 Rakefile
@@ -0,0 +1,132 @@
+
+require 'open-uri'
+require 'rubygems'
+require 'script/support'
+require 'highline/import'
+require 'cgi'
+
+namespace :apache do
+ task :start => [:stop] do
+ Dir.chdir File.dirname(__FILE__) do
+ system("ulimit -n 1000; /opt/local/apache2/bin/httpd -f #{ROOT}/../httpd.conf")
+ end
+ end
+
+ task :stop do
+ system("ps awx | grep httpd | grep -v grep | awk '{print $1}' | xargs kill -9")
+ end
+end
+
+task :start => [:'apache:start']
+task :stop => [:'apache:stop']
+
+namespace :article do
+
+ task :link do
+ link_article find_article
+ end
+
+ task :index do
+ with_dir do
+ articles = Dir['articles/**/intro.element'].sort_by do |el|
+ File.mtime el
+ end.reverse
+ puts "found #{articles.size} articles"
+
+ articles = articles.map do |el|
+ File.dirname(el)
+ end
+
+ File.open("all/body.element", 'w') do |f|
+ articles.each do |article|
+ # build the all articles index
+ f.puts "<!--#include virtual='/#{article}/post_index.element' -->"
+ end
+ end
+
+ File.open("recent.element", "w") do |recent|
+ File.open("content.element", "w") do |content|
+ File.open("xml/content.element", "w") do |xml|
+ # build the most recent lists
+ articles[0..5].each do |article|
+ title = open("#{article}/title.element").read
+ recent.puts "<li class=\"item\"><a href=\"/#{article}\">#{title}</a></li>"
+ content.puts "<!--#include virtual='/#{article}/post_short.element' -->"
+ xml.puts "<!--#include virtual='/#{article}/xml.post.element' -->"
+ end
+ end
+ end
+ end
+
+ end
+ end
+
+ task :new do
+ base = "/articles/#{Time.now.strftime('%Y/%m/%d')}/"
+ title = ask("new url: #{base} ")
+ url = base + title.gsub(' ', '-').gsub(/[^\w\-]/, '')
+ with_dir(url) do
+ File.open('title.element', 'w') {|f| f.puts title }
+ File.open('date.element', 'w') {|f| f.write Time.now }
+ File.open('url.element', 'w') {|f| f.write url }
+ File.open('body.element', 'w') {|f| f.puts ".</p>"}
+ File.open('intro.element', 'w') {|f| f.puts "<p>Intro" }
+ File.open('ellipsis.element', 'w') {|f| f.puts "...</p>" }
+ end
+ link_article url
+ index_comments url
+ puts "ok"
+ end
+
+ task :delete do
+ with_dir do
+ article = find_article
+ if agree("delete #{article}? ")
+ system("rm -rf #{article}")
+ end
+ end
+ Rake::Task[:index].invoke
+ end
+
+end
+
+task :new => [:'article:new']
+task :delete => [:'article:delete']
+task :index => [:'article:index']
+
+task :slogan do
+ with_dir do
+ slogans = open('../slogans.txt').readlines
+ File.open('slogan.element', 'w') do |f|
+ f.write slogans[rand(slogans.size)]
+ end
+ end
+end
+
+task :import do
+ load 'script/import.rb'
+end
+
+namespace :comments do
+ task :open do
+ allow_comments(find_article, true)
+ end
+
+ task :close do
+ allow_comments(find_article, false)
+ end
+
+ task :index do
+ index_comments find_article
+ end
+end
+
+task :open => [:'comments:open']
+task :close => [:'comments:close']
+
+task :dir do
+ puts find_article
+end
+
+task :default => [:dir]
+
12 TODO
@@ -0,0 +1,12 @@
+
+Definitely
+
+* task to delete/edit comments
+* task to push a local article to the server
+* pagination
+* tags
+* atom feed is still suspect
+
+Maybe
+
+* use date.elements instead of flastmod (except in atom feed)
@@ -0,0 +1,54 @@
+
+ServerRoot "/Users/eweaver/p/fauna/bax/trunk"
+
+Listen 4040
+
+LoadModule auth_digest_module /opt/local/apache2/modules/mod_auth_digest.so
+LoadModule include_module /opt/local/apache2/modules/mod_include.so
+LoadModule vhost_alias_module /opt/local/apache2/modules/mod_vhost_alias.so
+LoadModule alias_module /opt/local/apache2/modules/mod_alias.so
+LoadModule rewrite_module /opt/local/apache2/modules/mod_rewrite.so
+LoadModule mime_module /opt/local/apache2/modules/mod_mime.so
+LoadModule dir_module /opt/local/apache2/modules/mod_dir.so
+LoadModule cgi_module /opt/local/apache2/modules/mod_cgi.so
+
+#User eweaver
+#Group eweaver
+
+ServerAdmin you@example.com
+DocumentRoot "/opt/local/apache2/htdocs"
+
+<Directory />
+ Options FollowSymLinks
+ AllowOverride None
+</Directory>
+
+LogLevel debug
+
+DefaultType text/plain
+TypesConfig /opt/local/apache2/conf/mime.types
+
+<VirtualHost *:4040>
+ ServerName localhost
+ DirectoryIndex index.html
+ DocumentRoot "/Users/eweaver/p/fauna/bax/trunk/public"
+
+ SSIErrorMsg "<strong>(Bax error)</strong>"
+ SSITimeFormat '%B %d, %Y'
+ AddType text/html .element
+ AddOutputFilter INCLUDES .html
+ AddOutputFilter INCLUDES .xml
+ AddOutputFilter INCLUDES .element
+
+ <Directory "/Users/eweaver/p/fauna/bax/trunk/public">
+ AllowOverride None
+ Options +Includes
+ </Directory>
+
+ ScriptAlias /script/ "/Users/eweaver/p/fauna/bax/trunkscript/"
+ <Directory "/Users/eweaver/p/fauna/bax/trunk/script">
+ AllowOverride None
+ Options +Includes
+ </Directory>
+
+</VirtualHost>
@@ -0,0 +1,2 @@
+<h2>about</h2>
+<p>I am a static page.</p>
@@ -0,0 +1 @@
+about
@@ -0,0 +1,16 @@
+
+<div class="post">
+ <div class="top">
+ <h2>
+ <!--#include virtual='title.element' -->
+ </h2>
+ </div>
+ <div class="mid">
+ <div class="body">
+ <!--#include virtual='body.element' -->
+ </div>
+ </div>
+ <div class="bottom">
+ </div>
+</div>
+
@@ -0,0 +1 @@
+all articles
@@ -0,0 +1,2 @@
+
+<h2 id="comment-message">Comments are closed.</h2>
@@ -0,0 +1,8 @@
+<div class="comment" id="comment-<!--#include virtual='index.element' -->">
+ <p class="author">
+ <!--#include virtual='author.element' -->
+ <a class="says" href="#comment-<!--#include virtual='index.element' -->" name="comment-<!--#include virtual='index.element' -->">says
+ <span class="date">(<!--#flastmod virtual='body.element' -->)</span></a>:
+ </p>
+ <!--#include virtual='body.element' -->
+</div>
@@ -0,0 +1,3 @@
+
+
+
@@ -0,0 +1 @@
+..
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title><!--#include virtual='title.element' --> :: bax default blog</title>
+ <link rel="alternate" type="application/atom+xml" title="Atom" href="http://blog.yourhost.com/xml/atom.xml" />
+ <link rel="shortcut icon" href="/favicon.ico" >
+ <link rel="stylesheet" type="text/css" href="/yui/build/reset/reset.css">
+ <link rel="stylesheet" type="text/css" href="/yui/build/base/base.css">
+ <link rel="stylesheet" type="text/css" href="/yui/build/grids/grids.css">
+ <link rel="stylesheet" type="text/css" href="/yui/build/fonts/fonts.css">
+ <link rel="stylesheet" type="text/css" href="/css/bax.css">
+ <script src="/js/jquery.js" type="text/javascript"></script>
+ <script src="/js/bax.js" type="text/javascript"></script>
+</head>
+
+<body>
+
+ <div id="doc2">
+ <div id="bd">
+
+ <div id="hd" class="header">
+ <h1><a href="/">bax default blog</a></h1>
+ <h2><!--#include virtual='/slogan.element' --></h2>
+ </div>
+
+ <div class="yui-gf">
+ <div class="yui-u first sidebar">
+ <div class="mid">
+ <div class="content">
+
+ <ul>
+ <li><h3>sidebar 1</h3></li>
+ <li class="item"><a href="#">link 1</a></li>
+ <li class="item"><a href="#">link 2</a></li>
+ <li class="item"><a href="/about">a static page</a></li>
+ </ul>
+
+ <ul>
+ <li>
+ <h3>
+ <a href="/xml/atom.xml">
+ <img src="/images/rss.gif">
+ </a>
+ <a href="/xml/atom.xml">
+ subscribe
+ </a>
+ </h3>
+ </li>
+ </ul>
+
+ <ul>
+ <li><h3>sidebar 2</h3></li>
+ <li class="item"><a href="#">link 1</a></li>
+ <li class="item"><a href="#">link 2</a></li>
+ </ul>
+
+ <ul>
+ <li><h3>latest</h3></li>
+ <!--#include virtual='/recent.element' -->
+ <li id="all"><em><a href="/all">see all</a></em></li>
+ </ul>
+
+ </div>
+ </div>
+ </div>
+
+ <div class="yui-u content">
+ <!--#include virtual='content.element' -->
+ </div>
+ </div>
+ </div>
+
+ <div id="ft" class="footer">
+ <p>Copyright 2007 <a href="#">You</a></p>
+ </div>
+
+ </div>
+
+</body>
+</html>
@@ -0,0 +1,25 @@
+
+function Submit(e) {
+
+ var params = {};
+ $('form').find("input, textarea").each(
+ function() {params[this.name] = this.value; }
+ );
+
+ if (e.name == "submit") params['article'] = document.location.href;
+
+ $.post("/script/bax.rb", /* send request */
+ params,
+ function(d) { /* preview callback */
+ $('#preview').html(d);
+ $('#preview').fadeIn();
+ if (params['article']) {
+ if ($('#preview[p.error]').size() == 0) {
+ /* disable form */
+ $('#comment-message').html("Thanks for your comment!");
+ $('form').fadeOut();
+ }
+ }
+ }
+ )
+}

Large diffs are not rendered by default.

Oops, something went wrong.
No changes.
Oops, something went wrong.

0 comments on commit 931b295

Please sign in to comment.