Permalink
Browse files

tag release 1.6.8

git-svn-id: http://svn.typosphere.org/typo/tags/release_1_6_8@134 820eb932-12ee-0310-9ca8-eeb645f39767
  • Loading branch information...
1 parent 9cabcf7 commit 3353cdabd452af96557d359b82a700d8939aae22 tobi committed Apr 6, 2005
Showing with 5,021 additions and 0 deletions.
  1. +21 −0 trunk/MIT-LICENSE
  2. +55 −0 trunk/README
  3. +220 −0 trunk/Rakefile
  4. +13 −0 trunk/TODO
  5. +58 −0 trunk/app/apis/blogger_service.rb
  6. +265 −0 trunk/app/apis/meta_weblog_service.rb
  7. +156 −0 trunk/app/apis/moveable_type_service.rb
  8. +9 −0 trunk/app/controllers/application.rb
  9. +118 −0 trunk/app/controllers/articles_controller.rb
  10. +10 −0 trunk/app/controllers/backend_controller.rb
  11. +8 −0 trunk/app/controllers/live_controller.rb
  12. +28 −0 trunk/app/controllers/settings_controller.rb
  13. +20 −0 trunk/app/controllers/xml_controller.rb
  14. +66 −0 trunk/app/helpers/application_helper.rb
  15. +47 −0 trunk/app/helpers/articles_helper.rb
  16. +2 −0 trunk/app/helpers/backend_helper.rb
  17. +11 −0 trunk/app/helpers/settings_helper.rb
  18. +21 −0 trunk/app/helpers/xml_helper.rb
  19. +51 −0 trunk/app/models/aggregations/delicious.rb
  20. +70 −0 trunk/app/models/aggregations/flickr.rb
  21. +73 −0 trunk/app/models/aggregations/tada.rb
  22. +103 −0 trunk/app/models/article.rb
  23. +17 −0 trunk/app/models/blog_sweeper.rb
  24. +5 −0 trunk/app/models/category.rb
  25. +29 −0 trunk/app/models/comment.rb
  26. +41 −0 trunk/app/models/config_manager.rb
  27. +11 −0 trunk/app/models/configuration.rb
  28. +15 −0 trunk/app/models/ping.rb
  29. +2 −0 trunk/app/models/resource.rb
  30. +2 −0 trunk/app/models/setting.rb
  31. +37 −0 trunk/app/models/simple_cache.rb
  32. +21 −0 trunk/app/models/trackback.rb
  33. +21 −0 trunk/app/views/articles/_article.rhtml
  34. +5 −0 trunk/app/views/articles/_comment.rhtml
  35. +7 −0 trunk/app/views/articles/_trackback.rhtml
  36. +3 −0 trunk/app/views/articles/error.rhtml
  37. +28 −0 trunk/app/views/articles/index.rhtml
  38. +79 −0 trunk/app/views/articles/read.rhtml
  39. +11 −0 trunk/app/views/articles/search.rhtml
  40. +9 −0 trunk/app/views/articles/trackback.rxml
  41. +64 −0 trunk/app/views/layouts/articles.rhtml
  42. +15 −0 trunk/app/views/layouts/settings.rhtml
  43. +6 −0 trunk/app/views/live/search.rhtml
  44. +12 −0 trunk/app/views/settings/install.rhtml
  45. +4 −0 trunk/app/views/shared/_categories.rhtml
  46. +4 −0 trunk/app/views/shared/_delicious.rhtml
  47. +6 −0 trunk/app/views/shared/_flickr.rhtml
  48. +4 −0 trunk/app/views/shared/_links.rhtml
  49. +6 −0 trunk/app/views/shared/_search.rhtml
  50. +8 −0 trunk/app/views/shared/_tada.rhtml
  51. +8 −0 trunk/app/views/shared/_tools.rhtml
  52. +5 −0 trunk/app/views/shared/_xml.rhtml
  53. +32 −0 trunk/app/views/xml/atom.rxml
  54. +19 −0 trunk/app/views/xml/commentrss.rxml
  55. +19 −0 trunk/app/views/xml/rsd.rxml
  56. +24 −0 trunk/app/views/xml/rss.rxml
  57. +20 −0 trunk/config/database.yml
  58. +75 −0 trunk/config/environment.rb
  59. +4 −0 trunk/config/environments/development.rb
  60. +3 −0 trunk/config/environments/production.rb
  61. +4 −0 trunk/config/environments/test.rb
  62. +17 −0 trunk/config/routes.rb
  63. +91 −0 trunk/db/schema.mysql.sql
  64. +87 −0 trunk/db/schema.psql.sql
  65. +75 −0 trunk/db/schema.sqlite.sql
  66. +13 −0 trunk/lib/format.rb
  67. +13 −0 trunk/lib/html_engine.rb
  68. +404 −0 trunk/lib/pagination_helper.rb
  69. +14 −0 trunk/lib/transforms.rb
  70. +15 −0 trunk/public/.htaccess
  71. +6 −0 trunk/public/404.html
  72. +6 −0 trunk/public/500.html
  73. +10 −0 trunk/public/dispatch.cgi
  74. +27 −0 trunk/public/dispatch.fcgi
  75. +10 −0 trunk/public/dispatch.rb
  76. 0 trunk/public/favicon.ico
  77. BIN trunk/public/images/bg.jpg
  78. BIN trunk/public/images/bgcolor.jpg
  79. BIN trunk/public/images/footer.jpg
  80. BIN trunk/public/images/header.jpg
  81. +454 −0 trunk/public/javascripts/prototype.js
  82. +622 −0 trunk/public/stylesheets/base.css
  83. +20 −0 trunk/public/stylesheets/settings.css
  84. +4 −0 trunk/script/breakpointer
  85. +22 −0 trunk/script/console
  86. +7 −0 trunk/script/console_sandbox.rb
  87. +7 −0 trunk/script/destroy
  88. +7 −0 trunk/script/generate
  89. +128 −0 trunk/script/mt3.rb
  90. +4 −0 trunk/script/runner
  91. +48 −0 trunk/script/server
  92. +42 −0 trunk/test/fixtures/articles.yml
  93. +11 −0 trunk/test/fixtures/categories.yml
  94. +15 −0 trunk/test/fixtures/comments.yml
  95. +1 −0 trunk/test/fixtures/resources.yml
  96. +25 −0 trunk/test/fixtures/settings.yml
  97. +5 −0 trunk/test/fixtures/trackbacks.yml
  98. +37 −0 trunk/test/functional/articles_controller_test.rb
  99. +186 −0 trunk/test/functional/backend_controller_test.rb
  100. +19 −0 trunk/test/functional/settings_controller_test.rb
  101. +17 −0 trunk/test/functional/xml_controller_test.rb
  102. +31 −0 trunk/test/mocks/test/http_mock.rb
  103. +15 −0 trunk/test/test_helper.rb
  104. +62 −0 trunk/test/unit/article_test.rb
  105. +22 −0 trunk/test/unit/comment_test.rb
  106. +38 −0 trunk/test/unit/configuration_test.rb
  107. +96 −0 trunk/test/unit/delicious_test.rb
  108. +129 −0 trunk/test/unit/flickr_test.rb
  109. +25 −0 trunk/test/unit/ping_test.rb
  110. +10 −0 trunk/test/unit/resource_test.rb
  111. +14 −0 trunk/test/unit/setting_test.rb
View
@@ -0,0 +1,21 @@
+Copyright (c) 2005 Tobias Luetke
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
@@ -0,0 +1,55 @@
+== About
+
+Typo is a lean and mean weblog. Weblogs are cool, weblogs are in and everyone who writes
+code has an different opinion on how a weblog should be written. Typo is my take on it.
+Its meant for programmers who can extend and change the source to make it fit to their
+needs but will eventually be useful to normal users as well.
+
+== Requirements
+
+Currently you need all of those things to get typo to run:
+
+ * Ruby of version 1.8.1 or higher
+ * Rails. Most likely the latest version. If something
+ doesn't work try to run gem update
+ * Redcloth. You can get it by gem install redcloth
+== Installation
+
+Unpack the tgz or zip in some directory.
+
+The first decision you have to make is whether to use sqlite or mysql. Both are supported.
+There is no reason why postgres or others shouldn't work, I just don't have a sql file for
+them yet.
+
+If you choose sqlite you can use the rake task create_sqlite to get the database files.
+
+1) Change the config/database.yml to reflect your configuration
+2) Change the config/config.yml for your setup
+3) Run script/server -e production and see if it works
+
+If you want to deploy on fastcgi you will need to follow the setup instructions on
+www.rubyonrails.com
+
+== Customization
+
+Your first point of customization should be app/views/layout/articles.rhtml. This is the
+layout used for the weblog. You will see some commented out blocks which indicate on how
+to use the syndication helpers.
+
+== Useage
+
+Typo was made to be used from a desktop client. I personally use MarsEdit but all
+metaweblog and moveable type compatible clients will be able to talk to typo. For a short
+list of clients which are confirmed to work please visit http://typo.leetsoft.com
+
+== Client setup ==
+
+Set your desktop client to moveable type api and enter http://your.domain.com/backend/xmlrpc as endpoint address.
+
+== Tell me about your blog ==
+
+Add yourself to the list of typo blogs at http://typo.leetsoft.com
+
+
+Enjoy,
+Tobi
View
@@ -0,0 +1,220 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/gempackagetask'
+require 'rake/contrib/rubyforgepublisher'
+
+PKG_VERSION = "1.6.8"
+PKG_NAME = "typo"
+PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+
+
+$VERBOSE = nil
+TEST_CHANGES_SINCE = Time.now - 600
+
+desc "Run all the tests on a fresh test database"
+task :default => [ :test_units, :test_functional ]
+
+
+desc 'Require application environment.'
+task :environment do
+ unless defined? RAILS_ROOT
+ require File.dirname(__FILE__) + '/config/environment'
+ end
+end
+
+desc "Generate API documentatio, show coding stats"
+task :doc => [ :appdoc, :stats ]
+
+
+# Look up tests for recently modified sources.
+def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
+ FileList[source_pattern].map do |path|
+ if File.mtime(path) > touched_since
+ test = "#{test_path}/#{File.basename(path, '.rb')}_test.rb"
+ test if File.exists?(test)
+ end
+ end.compact
+end
+
+desc 'Test recent changes.'
+Rake::TestTask.new(:recent => [ :clone_structure_to_test ]) do |t|
+ since = TEST_CHANGES_SINCE
+ touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
+ recent_tests('app/models/*.rb', 'test/unit', since) +
+ recent_tests('app/controllers/*.rb', 'test/functional', since)
+
+ t.libs << 'test'
+ t.verbose = true
+ t.test_files = touched.uniq
+end
+task :test_recent => [ :clone_structure_to_test ]
+
+desc "Run the unit tests in test/unit"
+Rake::TestTask.new("test_units") { |t|
+ t.libs << "test"
+ t.pattern = 'test/unit/**/*_test.rb'
+ t.verbose = true
+}
+task :test_units => [ :clone_structure_to_test ]
+
+desc "Run the functional tests in test/functional"
+Rake::TestTask.new("test_functional") { |t|
+ t.libs << "test"
+ t.pattern = 'test/functional/**/*_test.rb'
+ t.verbose = true
+}
+task :test_functional => [ :clone_structure_to_test ]
+
+desc "Generate documentation for the application"
+Rake::RDocTask.new("appdoc") { |rdoc|
+ rdoc.rdoc_dir = 'doc/app'
+ rdoc.title = "Rails Application Documentation"
+ rdoc.options << '--line-numbers --inline-source'
+ rdoc.rdoc_files.include('doc/README_FOR_APP')
+ rdoc.rdoc_files.include('app/**/*.rb')
+}
+
+desc "Generate documentation for the Rails framework"
+Rake::RDocTask.new("apidoc") { |rdoc|
+ rdoc.rdoc_dir = 'doc/api'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.title = "Rails Framework Documentation"
+ rdoc.options << '--line-numbers --inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')
+ rdoc.rdoc_files.include('vendor/rails/activerecord/README')
+ rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb')
+ rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*')
+ rdoc.rdoc_files.include('vendor/rails/actionpack/README')
+ rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionmailer/README')
+ rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/README')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/api/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/client/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/container/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/dispatcher/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/protocol/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/support/*.rb')
+ rdoc.rdoc_files.include('vendor/rails/activesupport/README')
+ rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG')
+ rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
+}
+
+desc "Report code statistics (KLOCs, etc) from the application"
+task :stats => [ :environment ] do
+ require 'code_statistics'
+ CodeStatistics.new(
+ ["Helpers", "app/helpers"],
+ ["Controllers", "app/controllers"],
+ ["APIs", "app/apis"],
+ ["Components", "components"],
+ ["Functionals", "test/functional"],
+ ["Models", "app/models"],
+ ["Units", "test/unit"]
+ ).to_s
+end
+
+desc "Recreate the test databases from the development structure"
+task :clone_structure_to_test => [ :db_structure_dump, :purge_test_database ] do
+ abcs = ActiveRecord::Base.configurations
+ case abcs["test"]["adapter"]
+ when "mysql"
+ ActiveRecord::Base.establish_connection(:test)
+ ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
+ IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
+ ActiveRecord::Base.connection.execute(table)
+ end
+ when "postgresql"
+ ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
+ ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
+ ENV['PGPASSWORD'] = abcs["test"]["password"]
+ `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
+ when "sqlite", "sqlite3"
+ `#{abcs[RAILS_ENV]["adapter"]} #{abcs["test"]["dbfile"]} < db/#{RAILS_ENV}_structure.sql`
+ else
+ raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
+ end
+end
+
+desc "Dump the database structure to a SQL file"
+task :db_structure_dump => :environment do
+ abcs = ActiveRecord::Base.configurations
+ case abcs[RAILS_ENV]["adapter"]
+ when "mysql"
+ ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
+ File.open("db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
+ when "postgresql"
+ ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
+ ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
+ ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"]
+ `pg_dump -U "#{abcs[RAILS_ENV]["username"]}" -s -x -f db/#{RAILS_ENV}_structure.sql #{abcs[RAILS_ENV]["database"]}`
+ when "sqlite", "sqlite3"
+ `#{abcs[RAILS_ENV]["adapter"]} #{abcs[RAILS_ENV]["dbfile"]} .schema > db/#{RAILS_ENV}_structure.sql`
+ else
+ raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
+ end
+end
+
+desc "Empty the test database"
+task :purge_test_database => :environment do
+ abcs = ActiveRecord::Base.configurations
+ case abcs["test"]["adapter"]
+ when "mysql"
+ ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
+ ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"])
+ when "postgresql"
+ ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
+ ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
+ ENV['PGPASSWORD'] = abcs["test"]["password"]
+ `dropdb -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`
+ `createdb -T template0 -U "#{abcs["test"]["username"]}" #{abcs["test"]["database"]}`
+ when "sqlite","sqlite3"
+ File.delete(abcs["test"]["dbfile"]) if File.exist?(abcs["test"]["dbfile"])
+ else
+ raise "Unknown database adapter '#{abcs["test"]["adapter"]}'"
+ end
+end
+
+
+desc "Publish the zip/tgz"
+task :publish => [:package] do
+ Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.zip").upload
+ Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.tgz").upload
+ puts "tagging release"
+ `svn cp svn://leetsoft.com/typo/trunk svn://leetsoft.com/typo/tags/release_#{PKG_VERSION.gsub(/\./,'_')} -m "tag release #{PKG_VERSION}"`
+end
+
+spec = Gem::Specification.new do |s|
+ s.name = PKG_NAME
+ s.version = PKG_VERSION
+ s.summary = "Tiny minimal weblog supporting metaweblog API."
+ s.has_rdoc = false
+ s.files = Dir['**/*'].delete_if{ |f| f =~ /sqlite$/ || f =~ /\.log$/ || f =~ /^pkg/ || f =~ /\.svn/ } << "public/.htaccess"
+ s.require_path = '.'
+ s.author = "Tobias Luetke"
+ s.email = "tobi@leetsoft.com"
+ s.homepage = "http://typo.leetsoft.com"
+ s.rubyforge_project = "typo"
+end
+
+Rake::GemPackageTask.new(spec) do |p|
+ p.gem_spec = spec
+ p.need_tar = true
+ p.need_zip = true
+end
+
+desc "Publish to RubyForge"
+task :rubyforge do
+ Rake::RubyForgePublisher.new('typo', 'xal').upload
+end
View
@@ -0,0 +1,13 @@
+todo:
+
+- move uploaded files into the DB
+- add ajax comments moderation ( http://www.danga.com/demo/comment​manage.html )
+- add ajax based article posting/editing
+- add some statistics
+- add static pages
+
+done:
+
+- add ajax based comments posting
+- move to AWS
+- finish pretty urls
@@ -0,0 +1,58 @@
+module BloggerStructs
+ class Blog < ActionWebService::Struct
+ member :url, :string
+ member :blogid, :int
+ member :blogName, :string
+ end
+end
+
+
+class BloggerApi < ActionWebService::API::Base
+ inflect_names false
+
+ api_method :getUsersBlogs,
+ :expects => [ {:appkey => :string}, {:username => :string}, {:password => :string} ],
+ :returns => [[BloggerStructs::Blog]]
+
+ api_method :deletePost,
+ :expects => [ {:appkey => :string}, {:postid => :int}, {:username => :string}, {:password => :string}, {:publish => :int} ],
+ :returns => [:bool]
+end
+
+
+class BloggerService < ActionWebService::Base
+ web_service_api BloggerApi
+
+ before_invocation :authenticate
+ attr_reader :controller
+
+ def initialize(controller)
+ @controller = controller
+ end
+
+ def deletePost(appkey, postid, username, password, publish)
+ article = Article.find(postid)
+ article.destroy
+ true
+ end
+
+ def getUsersBlogs(appkey, username, password)
+ [BloggerStructs::Blog.new(
+ :url => controller.url_for("/"),
+ :blogid => 1,
+ :blogName => config['blog_name']
+ )]
+ end
+
+ private
+
+ # FIXME: This method can be rewritten using API::Method#expects_index_of and API::Method#expects_to_hash
+ # available in the next Rails release
+ def authenticate(name, args)
+ method_expects = self.class.web_service_api.api_methods[name][:expects]
+ username, password = method_expects.index(:username=>String), method_expects.index(:password=>String)
+
+ raise "Invalid login" unless args[username] == config['login'] && args[password] == config['password']
+ end
+
+end
Oops, something went wrong.

0 comments on commit 3353cda

Please sign in to comment.