typo 3.99.3 → 3.99.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README +1 -39
  2. data/app/controllers/admin/feedback_controller.rb +71 -0
  3. data/app/controllers/articles_controller.rb +11 -0
  4. data/app/helpers/admin/feedback_helper.rb +9 -0
  5. data/app/helpers/application_helper.rb +5 -1
  6. data/app/models/article.rb +21 -1
  7. data/app/models/blog.rb +25 -1
  8. data/app/models/comment.rb +12 -2
  9. data/app/models/content.rb +63 -4
  10. data/app/models/ping.rb +3 -3
  11. data/app/models/text_filter.rb +1 -1
  12. data/app/models/trackback.rb +12 -1
  13. data/app/views/admin/content/_form.rhtml +2 -2
  14. data/app/views/admin/feedback/_item.rhtml +15 -0
  15. data/app/views/admin/feedback/list.rhtml +46 -0
  16. data/app/views/admin/general/index.rhtml +26 -0
  17. data/app/views/articles/_comment.rhtml +3 -0
  18. data/app/views/articles/read.rhtml +2 -2
  19. data/app/views/layouts/administration.rhtml +1 -0
  20. data/bin/typo +3 -23
  21. data/components/plugins/sidebars/archives_controller.rb +1 -1
  22. data/components/plugins/sidebars/xml_controller.rb +1 -1
  23. data/components/plugins/textfilters/flickr_controller.rb +1 -1
  24. data/components/plugins/textfilters/sparkline_controller.rb +3 -2
  25. data/components/plugins/textfilters/textile_controller.rb +6 -0
  26. data/config/mongrel.conf +2 -0
  27. data/db/converters/wordpress2.rb +291 -0
  28. data/db/migrate/022_superclass_trackbacks.rb +1 -0
  29. data/db/migrate/023_superclass_pages.rb +4 -3
  30. data/db/schema.rb +4 -4
  31. data/doc/Installer.txt +81 -6
  32. data/doc/typo-4.0-release-notes.txt +135 -0
  33. data/installer/rails-installer.rb +22 -3
  34. data/installer/rails-installer/commands.rb +27 -26
  35. data/installer/rails-installer/web-servers.rb +2 -0
  36. data/lib/sidebars/plugin.rb +10 -8
  37. data/lib/tasks/release.rake +1 -1
  38. data/lib/typo_version.rb +1 -1
  39. data/public/javascripts/dragdrop.js +252 -63
  40. data/public/javascripts/effects.js +15 -10
  41. data/public/javascripts/prototype.js +59 -38
  42. data/public/javascripts/typo.js +10 -0
  43. data/public/stylesheets/administration.css +111 -66
  44. data/test/functional/admin/feedback_controller_test.rb +24 -0
  45. data/test/mocks/test/http_mock.rb +2 -1
  46. data/test/unit/article_test.rb +6 -0
  47. data/test/unit/comment_test.rb +12 -9
  48. data/test/unit/ping_test.rb +1 -1
  49. data/test/unit/trackback_test.rb +3 -5
  50. data/themes/azure/stylesheets/azure.css +7 -0
  51. data/themes/scribbish/views/articles/_article.rhtml +1 -1
  52. data/themes/scribbish/views/articles/_comment_form.rhtml +1 -1
  53. data/vendor/akismet/Akismet.rb +36 -17
  54. data/vendor/plugins/expiring_action_cache/lib/actionparamcache.rb +3 -1
  55. metadata +11 -42
  56. data/installer/rails-installer/web-server.rb +0 -108
  57. data/tmp/cache/META/DATA/ACTION_PARAM/10.1.0.181/articles/index/.cache +0 -537
  58. data/tmp/cache/META/DATA/ACTION_PARAM/localhost/articles/index/.cache +0 -537
  59. data/tmp/cache/META/DATA/ACTION_PARAM/localhost/xml/feed/format=atom&type=feed.cache +0 -671
  60. data/tmp/cache/META/DATA/ACTION_PARAM/localhost/xml/feed/format=rss20&type=feed.cache +0 -401
  61. data/tmp/cache/META/META/ACTION_PARAM/10.1.0.181/articles/index/.cache +0 -2
  62. data/tmp/cache/META/META/ACTION_PARAM/localhost/articles/index/.cache +0 -2
  63. data/tmp/cache/META/META/ACTION_PARAM/localhost/xml/feed/format=atom&type=feed.cache +0 -2
  64. data/tmp/cache/META/META/ACTION_PARAM/localhost/xml/feed/format=rss20&type=feed.cache +0 -2
@@ -1,6 +1,7 @@
1
1
  class SuperclassTrackbacks < ActiveRecord::Migration
2
2
  class BareContent < ActiveRecord::Base
3
3
  include BareMigration
4
+ set_inheritance_column :bogustype # see migration #20 for why
4
5
  end
5
6
 
6
7
  class BareTrackback < ActiveRecord::Base
@@ -1,5 +1,6 @@
1
1
  class Bare23Content < ActiveRecord::Base
2
2
  include BareMigration
3
+ set_inheritance_column :bogustype # see migration #20 for why
3
4
  end
4
5
 
5
6
  class Bare23Page < ActiveRecord::Base
@@ -9,12 +10,12 @@ end
9
10
  class SuperclassPages < ActiveRecord::Migration
10
11
  def self.up
11
12
  STDERR.puts "Merging Pages into Content table"
12
- modify_tables_and_update(:add_column, :contents, :name, :string) do
13
+ modify_tables_and_update(:add_column, Bare23Content, :name, :string) do
13
14
  Bare23Content.transaction do
14
15
  if not $schema_generator
15
16
  Bare23Page.find(:all).each do |p|
16
17
  Bare23Content.create(:type => 'Page',
17
- :title => p.name,
18
+ :name => p.name,
18
19
  :user_id => p.user_id,
19
20
  :body => p.body,
20
21
  :body_html => p.body_html,
@@ -46,7 +47,7 @@ class SuperclassPages < ActiveRecord::Migration
46
47
  modify_tables_and_update(:create_table, :pages, lambda {|t| init_pages(t)}) do
47
48
  Bare23Content.transaction do
48
49
  Bare23Content.find(:all, :conditions => "type = 'Page'").each do |p|
49
- Bare23Page.create(:name => p.title,
50
+ Bare23Page.create(:name => p.name,
50
51
  :user_id => p.user_id,
51
52
  :body => p.body,
52
53
  :body_html => p.body_html,
data/db/schema.rb CHANGED
@@ -36,6 +36,7 @@ ActiveRecord::Schema.define(:version => 46) do
36
36
  add_index "categories", ["permalink"], :name => "categories_permalink_index"
37
37
 
38
38
  create_table "contents", :force => true do |t|
39
+ t.column "type", :string
39
40
  t.column "title", :string
40
41
  t.column "author", :string
41
42
  t.column "body", :text
@@ -51,15 +52,14 @@ ActiveRecord::Schema.define(:version => 46) do
51
52
  t.column "guid", :string
52
53
  t.column "text_filter_id", :integer
53
54
  t.column "whiteboard", :text
54
- t.column "comments_count", :integer
55
- t.column "trackbacks_count", :integer
56
- t.column "type", :string
57
55
  t.column "article_id", :integer
58
56
  t.column "email", :string
59
57
  t.column "url", :string
60
- t.column "ip", :string
58
+ t.column "ip", :string, :limit => 40
61
59
  t.column "blog_name", :string
62
60
  t.column "name", :string
61
+ t.column "comments_count", :integer
62
+ t.column "trackbacks_count", :integer
63
63
  t.column "published", :boolean, :default => false
64
64
  t.column "allow_pings", :boolean
65
65
  t.column "allow_comments", :boolean
data/doc/Installer.txt CHANGED
@@ -22,7 +22,8 @@ You'll need the following software installed on your system:
22
22
  3. SWIG (http://www.swig.org)
23
23
  4. SQLite 3
24
24
 
25
- Most modern Unix systems should have all four of these easily available in pre-built form.
25
+ Most modern Unix systems should have all four of these easily available in
26
+ pre-built form.
26
27
 
27
28
 
28
29
  Installing Typo
@@ -61,7 +62,12 @@ Starting and Stopping Typo
61
62
 
62
63
  To stop Typo from running, run `typo stop /path/to/typo`. To restart it, run
63
64
  `typo start /path/to/typo`. Since this Typo install uses Mongrel, not FastCGI,
64
- you can't depend on your web server restarting it automatically on reboot. You'll need to either create an init script or cron reboot entry to restart it, depending on your host and/or privilege level.
65
+ you can't depend on your web server restarting it automatically on reboot.
66
+ You'll need to either create an init script or cron reboot entry to restart
67
+ it, depending on your host and/or privilege level.
68
+
69
+ Ask your hosting provider or the Typo mailing list (typo-list@rubyforge.org)
70
+ if you need help with this.
65
71
 
66
72
 
67
73
  Configuration Variables
@@ -73,9 +79,78 @@ them via 'typo config DIRECTORY name1=value1 name2=value2...' For example:
73
79
 
74
80
  typo config /var/www/typo web-server=mongrel_cluster
75
81
 
82
+ Here's a list of available configuration variables in Typo 4.0.0:
83
+
84
+ ### bind-address
85
+
86
+ The `bind-address` controls which IP address(es) Mongrel uses. By default,
87
+ Mongrel listens for connections on all IP addresses that are in use on the
88
+ server. You can restrict this by setting `bind-address`. The most useful
89
+ setting is probably `bind-address=127.0.0.1`, which will tell Mongrel to only
90
+ listen to connections from the local server.
91
+
92
+ ### database
93
+
94
+ The `database` variable controls which Database driver Typo uses. By default,
95
+ this is `sqlite`. Setting it to any other value will supress SQLite-specific
96
+ upgrade and maintenance commands.
97
+
98
+ ### port-number
99
+
100
+ The `port-number` variable controls which TCP port Mongrel uses. By default,
101
+ it's a random number between 4000 and 5000.
102
+
103
+ ### rails-environment
104
+
105
+ This controls which Rails environment Typo uses. This defaults to
106
+ `production`; the other usable value is `development`.
107
+
108
+ ### threads
109
+
110
+ The `threads` variable controls how many copies of Mongrel are used when using
111
+ the `mongrel_cluster` web server. Each thread listens on its own port number,
112
+ so setting `threads=2` while `port-number` is 4000 will make mongrel-cluster
113
+ run two copies of Mongrel, one listening on port 4000 and one on 4001.
114
+
115
+ ### url-prefix
116
+
117
+ The `url-prefix` variable is used to tell Typo to run in a subdirectory
118
+ instead of the root of a specific URL hostname. For example, if you want Typo
119
+ to live at http://blog.example.com/blog instead of http://blog.example.com/,
120
+ then you'd need to set `url-prefix=/blog`.
121
+
122
+ ### web-server
123
+
124
+ The `web-server` variable controls which server Typo uses. By default,
125
+ `web-server` is `mongrel`, but you can change it to `mongrel-cluster` or
126
+ `external`. If you use `external`, then 'typo PATH start` won't start a web
127
+ server of its own, and you'll have to provide your own web server. This is the
128
+ easiest way to use Typo with FastCGI--just set `web-server=external` and then
129
+ tweak `.htaccess`.
130
+
131
+
132
+ Troubleshooting
133
+ ---------------
134
+
135
+ ### Tests fail with ID=0
136
+
137
+ You didn't install Swig before installing `sqlite3-ruby`. Uninstall the SQLite
138
+ driver, install Swig, and then re-install `sqlite3-ruby`.
139
+
140
+ ### MySQL fails with timeout errors
141
+
142
+ Install the MySQL GEM. It's faster then Rails' default MySQL driver, and it
143
+ works substantially better.
144
+
145
+ ### Typo crashes randomly
76
146
 
77
- TODO
78
- ----
147
+ First, try running Typo under Webrick in the foreground to see if you can
148
+ reproduce the problem. Run `RAILS_ENV=production ./script/server webrick` from
149
+ your Typo directory and then see if you can get it to crash. If it dies, then
150
+ open a Trac ticket (http://typosphere.org/trac) describing the problem and
151
+ include the crash message along with any relevant information from the logs.
152
+ Also include which version of Ruby (ruby -v), Rails, and Typo, and which OS
153
+ you're using.
79
154
 
80
- 1. Figure out how to best have Typo restart on reboot.
81
- 2. Handle the "missing swig" problem better.
155
+ Generally, if Typo suddenly exiting, it's probably caused by a bad Ruby
156
+ interpreter on your system.
@@ -0,0 +1,135 @@
1
+ Typo 4.0
2
+ ========
3
+
4
+ Welcome to Typo 4.0. Typo is a blogging platform, like Movable Typo or
5
+ Wordpress, written using Ruby on Rails.
6
+
7
+ This is the first major release since Typo 2.6. We skipped Typo 3.0 to avoid confusion with the Typo3 project.
8
+
9
+
10
+ Changes since Typo 2.6
11
+ ----------------------
12
+
13
+ * A new installer and a Typo .gem file. Run 'gem install typo' and then
14
+ 'typo install /some/path' to install Typo.
15
+
16
+ * Text filter plugins, including easy inline Flickr image support and syntax
17
+ highlighting for code.
18
+
19
+ * Enhanced feed support. Atom 1.0 and RSS 2.0 are both supported. Atom 0.3
20
+ has been removed. Both feed types have better UUIDs. There are also
21
+ per-tag, -category, and -author feeds. Most pages have their own
22
+ content-specific feeds available via feed autodiscovery.
23
+
24
+ * Tags. The 'keywords' field in the Typo admin UI (as well as many blog
25
+ editors) has been commandeered to provide tagging for Typo. Tags are
26
+ separated by spaces (just like Flickr). If you want to include a space
27
+ in a tag, then use quotes.
28
+
29
+ * Improved spam management. There's a "Feedback" tab in the admin interface
30
+ that lists all comments and trackbacks so they can be bulk-deleted. In
31
+ addition, Typo can now use Akismet for spam filtering.
32
+
33
+ * File uploads. You can now upload images and other content directly from the
34
+ admin UI.
35
+
36
+ * Podcast support (experimental).
37
+
38
+ * Email and/or Jabber notification of new content, including comments and
39
+ trackbacks.
40
+
41
+ * Support for posting articles with a future posting date. Pre-posted
42
+ articles don't appear on the blog or feeds until their posting date passes.
43
+
44
+ * A new cache system that automatically times out stale entries. Several
45
+ types of content, including the Flickr sidebar, will automatically cause the
46
+ page to be rebuilt every few hours to ensure freshness.
47
+
48
+ * Better theme support. Some of this was back-ported to Typo 2.6.0.
49
+
50
+ * A redirect table to help users migrating to Typo. You can enter new URLs
51
+ into the Redirect table and Typo will look there whenever it doesn't
52
+ recognize a URL. So you can move from Movable Type-style permalinks to
53
+ Typo-style permalinks without losing the perma- in your links.
54
+
55
+ * Cleaner migrations.
56
+
57
+ * Rails 1.1 support. Rails 1.1.4 is strongly recommended. Rails 1.0 won't
58
+ work at all.
59
+
60
+ * Improved sidebar support, with a cleaner API and more built-in sidebars.
61
+
62
+ * Google sitemap support.
63
+
64
+ * Gravatars support for comments.
65
+
66
+ * Comment previews.
67
+
68
+ * Markup help for comments, articles, and pages.
69
+
70
+
71
+ How to Install Typo
72
+ -------------------
73
+
74
+ There are two ways to install Typo: automatically, using the new Typo installer, or manually, by downloading the source and building a working Rails environment (database, etc) for it.
75
+
76
+ New users should use the installer wherever possible because it's substantially easier and less trouble-prone.
77
+
78
+
79
+ ### Installing Typo via the Typo Installer
80
+
81
+ You'll need the following software installed on your system:
82
+
83
+ 1. Ruby 1.8.4
84
+ 2. RubyGems (http://www.rubygems.org)
85
+ 3. SWIG (http://www.swig.org)
86
+ 4. SQLite 3
87
+
88
+ Most Linux distributions should have these easily available. OS X users can
89
+ probably use the 'Locomotive' Rails installer, and there is probably something
90
+ similar available for Windows users.
91
+
92
+ Once these prerequisites have been installed run these two commands:
93
+
94
+ $ gem install typo
95
+ $ typo install /some/path
96
+
97
+ The first command will download the latest Typo release, along with a bunch of
98
+ dependencies. The second command will create a new Typo install in
99
+ `/some/path` (you'll probably want to use a path like `/var/www/typo` instead,
100
+ or `/tmp/typo` if you're just testing things out). The Typo installer will
101
+ create a SQLite database, create all of the tables needed for Typo, and then
102
+ run a battery of tests to make sure that everything works successfully on your
103
+ system. When that's complete, it'll start up the Mongrel webserver on a
104
+ random TCP port. You can access Typo directly via Mongrel for testing, and
105
+ then you can use the installer's directions to set up a more permanent hosting
106
+ environment.
107
+
108
+ The same process can be used to upgrade Typo in the future--just run `gem
109
+ install typo` to upgrade the version of the Typo installer on your system,
110
+ then run `typo install /some/path` to upgrade your existing Typo install. The
111
+ installer will back up your database, apply changes, re-test your environment,
112
+ and then restart Mongrel.
113
+
114
+
115
+ ### Installing Typo Manually
116
+
117
+ The manual installation process is only recommended for experienced Rails
118
+ users, or people with an existing pre-4.0 Typo install. You'll need to
119
+ download the source for Typo, either via the .zip and .tar files on Rubyforge
120
+ or via Subversion. Then create a database for Typo by hand and populate it
121
+ using the schema files in `db/schema.*.sql`. At this point, run
122
+ `./script/server` to verify that Typo works successfully, and then set up
123
+ either Mongrel or FastCGI to connect Typo to your existing web server.
124
+
125
+ The full procedure for doing all of this is outside of the scope of this
126
+ document.
127
+
128
+
129
+ Support, or where to turn when things break
130
+ -------------------------------------------
131
+
132
+ Typo development occurs via http://typosphere.org. If you find a bug, please
133
+ file a bug report via http://typosphere.org/trac/newticket
134
+
135
+ If you have problems, please send mail to typo-list@rubyforge.org. You can also visit Typo's IRC channel, #typo on irc.freenode.net and ask for help.
@@ -72,16 +72,19 @@ class RailsInstaller
72
72
  stop
73
73
 
74
74
  backup_database
75
+ install_pre_hook
75
76
  pre_migrate_database
76
77
  copy_files
77
78
  freeze_rails
78
79
  create_default_config_files
80
+ fix_permissions
79
81
  create_directories
80
82
  create_initial_database
81
83
  set_initial_port_number
82
84
  expand_template_files
83
85
 
84
86
  migrate
87
+ install_post_hook
85
88
  save
86
89
 
87
90
  run_rails_tests
@@ -89,6 +92,11 @@ class RailsInstaller
89
92
  start
90
93
  end
91
94
 
95
+ def install_pre_hook
96
+ end
97
+
98
+ def install_post_hook
99
+ end
92
100
 
93
101
  # Start application in the background
94
102
  def start(foreground = false)
@@ -299,9 +307,19 @@ class RailsInstaller
299
307
  cp("#{database_yml}.#{config['database']}",database_yml)
300
308
  end
301
309
 
310
+ def fix_permissions
311
+ unless RUBY_PLATFORM =~ /mswin32/
312
+ message "Making scripts executable"
313
+ chmod 0555, File.join(install_directory,'public','dispatch.fcgi')
314
+ chmod 0555, File.join(install_directory,'public','dispatch.cgi')
315
+ chmod 0555, Dir[File.join(install_directory,'script','*')]
316
+ end
317
+ end
318
+
302
319
  # Create required directories, like tmp
303
320
  def create_directories
304
321
  mkdir_p(File.join(install_directory,'tmp','cache'))
322
+ chmod(755, File.join(install_directory,'tmp','cache'))
305
323
  mkdir_p(File.join(install_directory,'tmp','session'))
306
324
  mkdir_p(File.join(install_directory,'tmp','sockets'))
307
325
  mkdir_p(File.join(install_directory,'log'))
@@ -483,10 +501,11 @@ class RailsInstaller
483
501
  commands = Command.commands.keys.sort
484
502
  commands.each do |cmd|
485
503
  cmd_class = Command.commands[cmd]
486
- cmd_help = cmd_class.help(self)
504
+ flag_help = cmd_class.flag_help_text.gsub(/APPNAME/,app_name)
505
+ help = cmd_class.help_text.gsub(/APPNAME/,app_name)
487
506
 
488
- STDERR.puts " #{app_name} #{cmd} DIRECTORY #{cmd_help.first}"
489
- STDERR.puts " #{cmd_help.last}"
507
+ STDERR.puts " #{app_name} #{cmd} DIRECTORY #{flag_help}"
508
+ STDERR.puts " #{help}"
490
509
  end
491
510
  end
492
511
  end
@@ -10,7 +10,20 @@ class RailsInstaller
10
10
  raise "Not Implemented"
11
11
  end
12
12
 
13
- def self.help(installer)
13
+ def self.flag_help(text)
14
+ @flag_help = text
15
+ end
16
+
17
+ def self.flag_help_text
18
+ @flag_help || ''
19
+ end
20
+
21
+ def self.help(text)
22
+ @help = text
23
+ end
24
+
25
+ def self.help_text
26
+ @help || ''
14
27
  end
15
28
 
16
29
  def self.inherited(sub)
@@ -26,6 +39,8 @@ class RailsInstaller
26
39
  end
27
40
 
28
41
  class Install < RailsInstaller::Command
42
+ help "Install or upgrade APPNAME in PATH."
43
+
29
44
  def self.command(installer, *args)
30
45
  version = nil
31
46
  args.each do |arg|
@@ -38,13 +53,12 @@ class RailsInstaller
38
53
 
39
54
  installer.install(version)
40
55
  end
41
-
42
- def self.help(installer)
43
- ['',"Install or upgrade #{installer.app_name} in PATH."]
44
- end
45
56
  end
46
57
 
47
58
  class Config < RailsInstaller::Command
59
+ help "Read or set a configuration variable"
60
+ flag_help '[KEY=VALUE]...'
61
+
48
62
  def self.command(installer, *args)
49
63
  if args.size == 0
50
64
  installer.config.keys.sort.each do |k|
@@ -64,53 +78,40 @@ class RailsInstaller
64
78
  end
65
79
  installer.save
66
80
  end
67
-
68
- end
69
-
70
- def self.help(installer)
71
- ['[KEY=VALUE]...',"Read or set a #{installer.app_name} configuration variable"]
72
81
  end
73
82
  end
74
83
 
75
84
  class Start < RailsInstaller::Command
85
+ help "Start the web server in the background"
86
+
76
87
  def self.command(installer, *args)
77
88
  installer.start
78
89
  end
79
-
80
- def self.help(installer)
81
- ['',"Start the web server for #{installer.app_name} in the background"]
82
- end
83
90
  end
84
91
 
85
92
  class Run < RailsInstaller::Command
93
+ help "Start the web server in the foreground"
94
+
86
95
  def self.command(installer, *args)
87
96
  installer.start(true)
88
97
  end
89
-
90
- def self.help(installer)
91
- ['',"Start the web server for #{installer.app_name} in the foreground"]
92
- end
93
98
  end
94
99
 
95
100
  class Restart < RailsInstaller::Command
101
+ help "Stop and restart the web server."
102
+
96
103
  def self.command(installer, *args)
97
104
  installer.stop
98
105
  installer.start
99
106
  end
100
-
101
- def self.help(installer)
102
- ['',"Stop and restart the web server for #{installer.app_name}."]
103
- end
104
107
  end
105
108
 
106
109
  class Stop < RailsInstaller::Command
110
+ help "Stop the web server"
111
+
107
112
  def self.command(installer, *args)
108
113
  installer.stop
109
114
  end
110
-
111
- def self.help(installer)
112
- ['',"Stop the web server for #{installer.app_name}"]
113
- end
114
115
  end
115
116
  end
116
117
  end