murlsh 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.htaccess +5 -0
  2. data/COPYING +27 -0
  3. data/README.textile +2 -2
  4. data/Rakefile +133 -66
  5. data/VERSION +1 -1
  6. data/config.ru +9 -8
  7. data/config.yaml +3 -2
  8. data/lib/murlsh/auth.rb +6 -8
  9. data/lib/murlsh/config_server.rb +4 -6
  10. data/lib/murlsh/dispatch.rb +5 -7
  11. data/lib/murlsh/doc.rb +1 -1
  12. data/lib/murlsh/etag_add_encoding.rb +1 -3
  13. data/lib/murlsh/failproof.rb +0 -1
  14. data/lib/murlsh/far_future_expires.rb +2 -4
  15. data/lib/murlsh/head_from_get.rb +2 -2
  16. data/lib/murlsh/image_list.rb +32 -0
  17. data/lib/murlsh/img_store.rb +47 -9
  18. data/lib/murlsh/markup.rb +53 -20
  19. data/lib/murlsh/must_revalidate.rb +2 -4
  20. data/lib/murlsh/plugin.rb +1 -1
  21. data/lib/murlsh/sqlite3_adapter.rb +2 -4
  22. data/lib/murlsh/time_ago.rb +6 -8
  23. data/lib/murlsh/uri.rb +1 -3
  24. data/lib/murlsh/uri_ask.rb +23 -25
  25. data/lib/murlsh/url.rb +4 -6
  26. data/lib/murlsh/url_body.rb +19 -21
  27. data/lib/murlsh/url_server.rb +8 -10
  28. data/lib/murlsh/yaml_ordered_hash.rb +2 -4
  29. data/lib/murlsh.rb +21 -4
  30. data/murlsh.gemspec +95 -90
  31. data/plugins/add_post_50_update_feed.rb +22 -10
  32. data/plugins/add_post_50_update_podcast.rb +3 -5
  33. data/plugins/add_post_50_update_rss.rb +4 -6
  34. data/plugins/add_post_60_notify_hubs.rb +3 -5
  35. data/plugins/add_pre_40_convert_mobile.rb +4 -10
  36. data/plugins/add_pre_50_lookup_content_type_title.rb +4 -6
  37. data/plugins/add_pre_60_flickr.rb +3 -14
  38. data/plugins/add_pre_60_github_title.rb +4 -6
  39. data/plugins/add_pre_60_google_code_title.rb +4 -6
  40. data/plugins/add_pre_60_imgur.rb +4 -16
  41. data/plugins/add_pre_60_s3_image.rb +7 -6
  42. data/plugins/add_pre_60_twitter.rb +3 -14
  43. data/plugins/add_pre_60_vimeo.rb +7 -6
  44. data/plugins/add_pre_60_youtube.rb +8 -7
  45. data/plugins/add_pre_65_html_thumb.rb +41 -0
  46. data/plugins/add_pre_65_img_thumb.rb +39 -0
  47. data/plugins/html_parse_50_hpricot.rb +2 -4
  48. data/plugins/url_display_add_45_audio.rb +28 -0
  49. data/plugins/url_display_add_50_hostrec.rb +15 -18
  50. data/plugins/url_display_add_55_content_type.rb +6 -8
  51. data/plugins/url_display_add_60_via.rb +12 -19
  52. data/plugins/url_display_add_65_time.rb +4 -6
  53. data/public/css/screen.css +2 -3
  54. data/public/img/thumb/.gitignore +3 -0
  55. data/public/js/jquery-1.4.4.min.js +167 -0
  56. data/public/js/js.js +6 -5
  57. data/public/js/{twitter-text-1.0.3.js → twitter-text-1.0.4.js} +3 -1
  58. data/spec/auth_spec.rb +4 -6
  59. data/spec/dispatch_spec.rb +3 -5
  60. data/spec/doc_spec.rb +2 -4
  61. data/spec/img_store_spec.rb +46 -20
  62. data/spec/markup_spec.rb +22 -24
  63. data/spec/uri_ask_spec.rb +5 -7
  64. data/spec/uri_spec.rb +2 -4
  65. data/spec/url_spec.rb +5 -9
  66. data/spec/yaml_ordered_hash_spec.rb +1 -3
  67. metadata +85 -53
  68. data/.gitignore +0 -6
  69. data/plugins/add_pre_60_imageshack.rb +0 -31
  70. data/plugins/url_display_add_45_mp3.rb +0 -30
  71. data/public/img/thumb/README +0 -0
  72. data/public/js/jquery-1.4.3.min.js +0 -166
  73. data/public/swf/player_mp3_mini.swf +0 -0
data/lib/murlsh/markup.rb CHANGED
@@ -9,8 +9,8 @@ module Murlsh
9
9
  # * :prefix - prefix to append to all script urls
10
10
  def javascript(sources, options={})
11
11
  [*sources].each do |src|
12
- script('', :type => 'text/javascript',
13
- :src => "#{options[:prefix]}#{src}")
12
+ script '', :type => 'text/javascript',
13
+ :src => "#{options[:prefix]}#{src}"
14
14
  end
15
15
  end
16
16
 
@@ -24,23 +24,24 @@ module Murlsh
24
24
  #
25
25
  # Any other options in hash will be added as attributes.
26
26
  def murlsh_img(options={})
27
- img_convert_prefix(options)
28
- img_convert_size(options)
29
- img_convert_text(options)
27
+ img_convert_prefix options
28
+ img_convert_size options
29
+ img_convert_text options
30
+ img_convert_data_uri options
30
31
 
31
32
  if options[:href]
32
33
  a(:href => options[:href]) {
33
- options.delete(:href)
34
- img(options)
34
+ options.delete :href
35
+ img options
35
36
  }
36
37
  else
37
- img(options)
38
+ img options
38
39
  end
39
40
  end
40
41
 
41
42
  # ATOM feed link builder.
42
43
  def atom(href)
43
- link(:rel => 'alternate', :type => 'application/atom+xml', :href => href)
44
+ link :rel => 'alternate', :type => 'application/atom+xml', :href => href
44
45
  end
45
46
 
46
47
  # CSS link builder.
@@ -54,14 +55,14 @@ module Murlsh
54
55
  :href => "#{options[:prefix]}#{href}",
55
56
  :rel => 'stylesheet',
56
57
  }
57
- attrs[:media] = options[:media] if options[:media]
58
- link(attrs)
58
+ attrs[:media] = options[:media] if options[:media]
59
+ link attrs
59
60
  end
60
61
  end
61
62
 
62
63
  # Meta tag builder. Takes a hash of name => content.
63
64
  def metas(tags)
64
- tags.each { |k,v| meta(:name => k, :content => v) }
65
+ tags.each { |k,v| meta :name => k, :content => v }
65
66
  end
66
67
 
67
68
  # Gravatar builder. Takes MD5 hash of email address.
@@ -76,19 +77,19 @@ module Murlsh
76
77
  (k == 'r' and %w{g pg r x}.include?(v)))
77
78
  end
78
79
 
79
- return if query['s'] and query['s'] < 1
80
+ return if query['s'] and query['s'] < 1
80
81
 
81
- options.reject! { |k,v| %w{d s r}.include?(k) }
82
+ options.reject! { |k,v| %w{d s r}.include? k }
82
83
  options[:src] = URI.join('http://www.gravatar.com/avatar/',
83
84
  email_hash + build_query(query))
84
85
 
85
- murlsh_img(options)
86
+ murlsh_img options
86
87
  end
87
88
 
88
89
  # Query string builder. Takes hash of query string variables.
89
90
  def build_query(h)
90
91
  h.empty? ? '' :
91
- '?' + h.map { |k,v| URI.escape("#{k}=#{v}") }.join('&')
92
+ '?' + h.map { |k,v| URI.escape "#{k}=#{v}" }.join('&')
92
93
  end
93
94
 
94
95
  # Form input builder.
@@ -101,7 +102,7 @@ module Murlsh
101
102
  options[:name] ||= options[:id]
102
103
  end
103
104
 
104
- options.delete(:label)
105
+ options.delete :label
105
106
 
106
107
  input({
107
108
  :type => 'text',
@@ -113,7 +114,7 @@ module Murlsh
113
114
  def img_convert_prefix(options)
114
115
  if options.has_key?(:prefix) and options.has_key?(:src)
115
116
  options[:src] = options[:prefix] + options[:src]
116
- options.delete(:prefix)
117
+ options.delete :prefix
117
118
  end
118
119
  end
119
120
 
@@ -124,14 +125,46 @@ module Murlsh
124
125
  else
125
126
  options[:width] = options[:height] = options[:size]
126
127
  end
127
- options.delete(:size)
128
+ options.delete :size
128
129
  end
129
130
  end
130
131
 
131
132
  def img_convert_text(options)
132
133
  if options.has_key?(:text)
133
134
  options[:alt] = options[:title] = options[:text]
134
- options.delete(:text)
135
+ options.delete :text
136
+ end
137
+ end
138
+
139
+ # If given options[:data_uri_prefix], render the image as a data uri with
140
+ # the base64 encoded image data directly in the src attribute.
141
+ #
142
+ # Only works if options[:src] is a relative url.
143
+ #
144
+ # Local image file path is site root (current working directory) +
145
+ # options[:data_uri_prefix] + options[:src].
146
+ #
147
+ # Options:
148
+ # * :src - image src
149
+ # * :data_uri_prefix - prefix for finding images on local filesystem
150
+ # * :max_size - images larger than this will not be converted to data uris
151
+ def img_convert_data_uri(options)
152
+ if options[:data_uri_prefix]
153
+ Murlsh::failproof do
154
+ # try to prevent getting outside current working directory
155
+ img_path = File.join(Dir.getwd, File.expand_path(
156
+ File.join(options[:data_uri_prefix], options[:src]), '/'))
157
+ img_size = File.size(img_path)
158
+
159
+ unless size == 0 or
160
+ (options[:max_size] and size > options[:max_size])
161
+ options[:src] = Magick::ImageList.new(img_path).extend(
162
+ Murlsh::ImageList).data_uri
163
+
164
+ options.delete :data_uri_prefix
165
+ options.delete :max_size
166
+ end
167
+ end
135
168
  end
136
169
  end
137
170
 
@@ -1,7 +1,5 @@
1
- %w{
2
- rack
3
- rack/utils
4
- }.each { |m| require m }
1
+ require 'rack'
2
+ require 'rack/utils'
5
3
 
6
4
  module Murlsh
7
5
 
data/lib/murlsh/plugin.rb CHANGED
@@ -21,7 +21,7 @@ module Murlsh
21
21
 
22
22
  # Get registered plugins by hook (add_pre, add_post, etc.)
23
23
  def self.hooks(name)
24
- matches = registered.select { |p| p.hook == name }.
24
+ matches = registered.find_all { |p| p.hook == name }.
25
25
  sort { |a,b| a.to_s <=> b.to_s }
26
26
 
27
27
  if block_given?
@@ -1,10 +1,8 @@
1
- %w{
2
- active_record/connection_adapters/sqlite3_adapter
3
- }.each { |m| require m }
1
+ require 'active_record/connection_adapters/sqlite3_adapter'
4
2
 
5
3
  class ActiveRecord::ConnectionAdapters::SQLite3Adapter
6
4
 
7
- # Add MATCH function for regex matching.
5
+ # Add MURLSHMATCH function for regex matching.
8
6
  def initialize(connection, logger, config)
9
7
  super
10
8
  @connection.create_function('MURLSHMATCH', 2) do |func,search_in,search_for|
@@ -1,6 +1,4 @@
1
- %w{
2
- time
3
- }.each { |m| require m }
1
+ require 'time'
4
2
 
5
3
  module Murlsh
6
4
 
@@ -13,11 +11,11 @@ module Murlsh
13
11
  days_ago = (Time.now.to_i - to_i) / 86400
14
12
 
15
13
  case days_ago
16
- when 0 then 'today'
17
- when 1 then 'yesterday'
18
- when (2..4) then "#{days_ago} days ago"
19
- when (5..7) then strftime('%a %e %b')
20
- when (8..180) then strftime('%e %b').strip
14
+ when 0; 'today'
15
+ when 1; 'yesterday'
16
+ when (2..4); "#{days_ago} days ago"
17
+ when (5..7); strftime('%a %e %b')
18
+ when (8..180); strftime('%e %b').strip
21
19
  else strftime('%e %b %Y').strip
22
20
  end
23
21
  end
data/lib/murlsh/uri.rb CHANGED
@@ -1,6 +1,4 @@
1
- %w{
2
- uri
3
- }.each { |m| require m }
1
+ require 'uri'
4
2
 
5
3
  # Extra methods added to URI class.
6
4
  class URI::Generic
@@ -1,13 +1,11 @@
1
- %w{
2
- net/http
3
- net/https
4
- open-uri
5
- uri
1
+ require 'net/http'
2
+ require 'net/https'
3
+ require 'open-uri'
4
+ require 'uri'
6
5
 
7
- hpricot
8
- htmlentities
9
- iconv
10
- }.each { |m| require m }
6
+ require 'hpricot'
7
+ require 'htmlentities'
8
+ require 'iconv'
11
9
 
12
10
  module Murlsh
13
11
 
@@ -19,14 +17,14 @@ module Murlsh
19
17
  # Options:
20
18
  # * :failproof - if true hide all exceptions and return empty string on failure
21
19
  # * :headers - hash of headers to send in request
22
- def content_length(options={}); header('content-length', options); end
20
+ def content_length(options={}); header 'content-length', options; end
23
21
 
24
22
  # Get the content type.
25
23
  #
26
24
  # Options:
27
25
  # * :failproof - if true hide all exceptions and return empty string on failure
28
26
  # * :headers - hash of headers to send in request
29
- def content_type(options={}); header('content-type', options); end
27
+ def content_type(options={}); header 'content-type', options; end
30
28
 
31
29
  # Get the HTML title.
32
30
  #
@@ -34,15 +32,13 @@ module Murlsh
34
32
  # * :failproof - if true hide all exceptions and return url on failure
35
33
  # * :headers - hash of headers to send in request
36
34
  def title(options={})
37
- return @title if defined?(@title)
35
+ return @title if defined?(@title)
38
36
 
39
37
  @title = to_s
40
38
 
41
39
  d = doc(options)
42
40
 
43
- if d and d.title and !d.title.empty?
44
- @title = decode(d.title)
45
- end
41
+ if d and d.title and not d.title.empty?; @title = decode(d.title); end
46
42
 
47
43
  @title
48
44
  end
@@ -53,13 +49,13 @@ module Murlsh
53
49
  # * :failproof - if true hide all exceptions and return empty string on failure
54
50
  # * :headers - hash of headers to send in request
55
51
  def description(options={})
56
- return @description if defined?(@description)
52
+ return @description if defined?(@description)
57
53
 
58
54
  @description = ''
59
55
 
60
56
  d = doc(options)
61
57
 
62
- if d and d.description and !d.description.empty?
58
+ if d and d.description and not d.description.empty?
63
59
  @description = decode(d.description)
64
60
  end
65
61
 
@@ -75,7 +71,7 @@ module Murlsh
75
71
  # * :failproof - if true hide all exceptions and return empty string on failure
76
72
  # * :headers - hash of headers to send in request
77
73
  def doc(options={})
78
- return @doc if defined?(@doc)
74
+ return @doc if defined?(@doc)
79
75
  options[:headers] = default_headers.merge(options.fetch(:headers, {}))
80
76
 
81
77
  @doc = nil
@@ -93,6 +89,7 @@ module Murlsh
93
89
  end
94
90
  end
95
91
  end
92
+
96
93
  @doc
97
94
  end
98
95
 
@@ -109,10 +106,10 @@ module Murlsh
109
106
  result
110
107
  end
111
108
 
109
+ HtmlContentTypePattern = %r{^text/html}i
110
+
112
111
  # Return true if the content type is HTML.
113
- def html?(options={})
114
- content_type(options)[/^text\/html/]
115
- end
112
+ def html?(options={}); content_type(options)[HtmlContentTypePattern]; end
116
113
 
117
114
  # Convert from the character set of this url to utf-8 and decode HTML
118
115
  # entities.
@@ -127,7 +124,7 @@ module Murlsh
127
124
  # * :headers - hash of headers to send in request
128
125
  def header(header_name, options={})
129
126
  result = [*head_headers(options)[header_name]][0]
130
- result = get_headers(options)[header_name] if !result or result.empty?
127
+ result = get_headers(options)[header_name] if not result or result.empty?
131
128
  result || ''
132
129
  end
133
130
 
@@ -139,7 +136,7 @@ module Murlsh
139
136
  # * :failproof - if true hide all exceptions and return empty hash on failure
140
137
  # * :headers - hash of headers to send in request
141
138
  def head_headers(options={})
142
- return @head_headers if defined?(@head_headers)
139
+ return @head_headers if defined?(@head_headers)
143
140
 
144
141
  request_headers = default_headers.merge(options.fetch(:headers, {}))
145
142
 
@@ -153,8 +150,8 @@ module Murlsh
153
150
  if Net::HTTPSuccess === resp
154
151
  response_headers = resp.to_hash
155
152
  end
156
-
157
153
  end
154
+
158
155
  @head_headers = response_headers
159
156
  end
160
157
 
@@ -166,7 +163,7 @@ module Murlsh
166
163
  # * :failproof - if true hide all exceptions and return empty hash on failure
167
164
  # * :headers - hash of headers to send in request
168
165
  def get_headers(options={})
169
- return @get_headers if defined?(@get_headers)
166
+ return @get_headers if defined?(@get_headers)
170
167
 
171
168
  request_headers = default_headers.merge(options.fetch(:headers, {}))
172
169
 
@@ -175,6 +172,7 @@ module Murlsh
175
172
  Murlsh::failproof(options) do
176
173
  response_headers = self.open(request_headers) { |f| f.meta }
177
174
  end
175
+
178
176
  @get_headers = response_headers
179
177
  end
180
178
 
data/lib/murlsh/url.rb CHANGED
@@ -1,8 +1,6 @@
1
- %w{
2
- uri
1
+ require 'uri'
3
2
 
4
- active_record
5
- }.each { |m| require m }
3
+ require 'active_record'
6
4
 
7
5
  module Murlsh
8
6
 
@@ -13,10 +11,10 @@ module Murlsh
13
11
  # Get the title of this url.
14
12
  def title
15
13
  ta = read_attribute(:title)
16
- ta = nil if ta and ta.empty?
14
+ ta = nil if ta and ta.empty?
17
15
 
18
16
  ua = read_attribute(:url)
19
- ua = nil if ua and ua.empty?
17
+ ua = nil if ua and ua.empty?
20
18
 
21
19
  ta || ua || 'title missing'
22
20
  end
@@ -1,6 +1,4 @@
1
- %w{
2
- builder
3
- }.each { |m| require m }
1
+ require 'builder'
4
2
 
5
3
  module Murlsh
6
4
 
@@ -14,7 +12,7 @@ module Murlsh
14
12
  super(:indent => @config['html_indent'] || 0)
15
13
  end
16
14
 
17
- # Fetch urls base on query string parameters.
15
+ # Fetch urls based on query string parameters.
18
16
  def urls
19
17
  Murlsh::Url.all(:conditions => search_conditions, :order => 'id DESC',
20
18
  :limit => @req.params['n'] ? @req.params['n'].to_i :
@@ -50,20 +48,20 @@ module Murlsh
50
48
  unless mu.same_author?(last)
51
49
  div(:class => 'icon') {
52
50
  gravatar(mu.email, 's' => gravatar_size, :text => mu.name)
53
- } if mu.email and gravatar_size > 0
54
- div(mu.name, :class => 'name') if
51
+ } if mu.email and gravatar_size > 0
52
+ div(mu.name, :class => 'name') if
55
53
  @config.fetch('show_names', false) and mu.name
56
54
  end
57
55
 
58
56
  if mu.thumbnail_url
59
- murlsh_img(:src => mu.thumbnail_url,
60
- :text => mu.title_stripped, :class => 'thumb')
57
+ murlsh_img :src => mu.thumbnail_url,
58
+ :text => mu.title_stripped, :class => 'thumb'
61
59
  end
62
60
 
63
- a(mu.title_stripped, :href => mu.url, :class => 'm')
61
+ a mu.title_stripped, :href => mu.url, :class => 'm'
64
62
 
65
63
  Murlsh::Plugin.hooks('url_display_add') do |p|
66
- p.run(self, mu, @config)
64
+ p.run self, mu, @config
67
65
  end
68
66
 
69
67
  last = mu
@@ -76,7 +74,7 @@ module Murlsh
76
74
  clear
77
75
  powered_by
78
76
  js
79
- div('', :id => 'bottom')
77
+ div '', :id => 'bottom'
80
78
  }
81
79
  }
82
80
  end
@@ -86,10 +84,10 @@ module Murlsh
86
84
  head {
87
85
  titlee
88
86
  meta :'http-equiv' => 'Content-Type', :content => @content_type
89
- metas(@config.select { |k,v| k =~ /^meta_tag_/ and v }.
87
+ metas(@config.find_all { |k,v| k =~ /^meta_tag_/ and v }.
90
88
  map { |k,v| [k.sub('meta_tag_', ''), v] })
91
89
  css(@config['css_compressed'] || @config['css_files'])
92
- atom(@config.fetch('feed_file'))
90
+ atom @config.fetch('feed_file')
93
91
  }
94
92
  end
95
93
 
@@ -109,8 +107,8 @@ module Murlsh
109
107
  def search_form
110
108
  form(:action => '', :method => 'get') {
111
109
  fieldset {
112
- form_input(:id => 'q', :size => 32, :value => @q)
113
- form_input(:type => 'submit', :value => 'Regex Search')
110
+ form_input :id => 'q', :size => 32, :value => @q
111
+ form_input :type => 'submit', :value => 'Regex Search'
114
112
  }
115
113
  }
116
114
  end
@@ -119,12 +117,12 @@ module Murlsh
119
117
  def add_form
120
118
  form(:action => '', :method => 'post') {
121
119
  fieldset(:id => 'add') {
122
- self.p { form_input(:id => 'url', :label => 'Add URL', :size => 32) }
123
- self.p { form_input(:id => 'via', :label => 'Via', :size => 32) }
120
+ self.p { form_input :id => 'url', :label => 'Add URL', :size => 32 }
121
+ self.p { form_input :id => 'via', :label => 'Via', :size => 32 }
124
122
  self.p {
125
- form_input(:id => 'auth', :label => 'Password', :size => 16,
126
- :type => 'password')
127
- form_input(:id => 'submit', :type => 'button', :value => 'Add')
123
+ form_input :type => 'password', :id => 'auth', :label => 'Password',
124
+ :size => 16
125
+ form_input :id => 'submit', :type => 'button', :value => 'Add'
128
126
  }
129
127
  }
130
128
  }
@@ -137,7 +135,7 @@ module Murlsh
137
135
  def powered_by
138
136
  self.p {
139
137
  text! 'powered by '
140
- a('murlsh', :href => 'http://github.com/mmb/murlsh/')
138
+ a 'murlsh', :href => 'http://github.com/mmb/murlsh/'
141
139
  }
142
140
  end
143
141
 
@@ -1,7 +1,5 @@
1
- %w{
2
- active_record
3
- rack
4
- }.each { |m| require m }
1
+ require 'active_record'
2
+ require 'rack'
5
3
 
6
4
  module Murlsh
7
5
 
@@ -39,23 +37,23 @@ module Murlsh
39
37
  auth = req.params['auth']
40
38
  if user = auth.empty? ? nil : Murlsh::Auth.new(
41
39
  @config.fetch('auth_file')).auth(auth)
42
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3',
43
- :database => @config.fetch('db_file'))
40
+ ActiveRecord::Base.establish_connection :adapter => 'sqlite3',
41
+ :database => @config.fetch('db_file')
44
42
 
45
43
  mu = Murlsh::Url.new do |u|
46
44
  u.time = Time.now.gmtime
47
45
  u.url = req.params['url']
48
46
  u.email = user[:email]
49
47
  u.name = user[:name]
50
- u.via = req.params['via'] unless (req.params['via'] || []).empty?
48
+ u.via = req.params['via'] unless (req.params['via'] || []).empty?
51
49
  end
52
50
 
53
51
  begin
54
52
  # validate before add_pre plugins have run and also after (in save!)
55
- raise ActiveRecord::RecordInvalid.new(mu) unless mu.valid?
56
- Murlsh::Plugin.hooks('add_pre') { |p| p.run(mu, @config) }
53
+ raise ActiveRecord::RecordInvalid.new(mu) unless mu.valid?
54
+ Murlsh::Plugin.hooks('add_pre') { |p| p.run mu, @config }
57
55
  mu.save!
58
- Murlsh::Plugin.hooks('add_post') { |p| p.run(mu, @config) }
56
+ Murlsh::Plugin.hooks('add_post') { |p| p.run mu, @config }
59
57
  response_body, response_code = [mu], 200
60
58
  rescue ActiveRecord::RecordInvalid => error
61
59
  response_body = {
@@ -1,6 +1,4 @@
1
- %w{
2
- yaml
3
- }.each { |m| require m }
1
+ require 'yaml'
4
2
 
5
3
  module Murlsh
6
4
 
@@ -11,7 +9,7 @@ module Murlsh
11
9
  YAML::quick_emit(self, opts) do |out|
12
10
  out.map(taguri, to_yaml_style) do |map|
13
11
  sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |k, v|
14
- map.add( k, v )
12
+ map.add k, v
15
13
  end
16
14
  end
17
15
  end
data/lib/murlsh.rb CHANGED
@@ -1,6 +1,23 @@
1
1
  require 'murlsh/head_from_get'
2
2
 
3
- Dir.glob(File.join(File.dirname(__FILE__), 'murlsh', '*.rb')).
4
- map { |f| File.join('murlsh', File.basename(f, '.rb')) }.
5
- sort.
6
- each { |m| require m }
3
+ require 'murlsh/auth'
4
+ require 'murlsh/config_server'
5
+ require 'murlsh/dispatch'
6
+ require 'murlsh/doc'
7
+ require 'murlsh/etag_add_encoding'
8
+ require 'murlsh/failproof'
9
+ require 'murlsh/far_future_expires'
10
+ require 'murlsh/image_list'
11
+ require 'murlsh/img_store'
12
+ require 'murlsh/markup'
13
+ require 'murlsh/must_revalidate'
14
+ require 'murlsh/openlock'
15
+ require 'murlsh/plugin'
16
+ require 'murlsh/sqlite3_adapter'
17
+ require 'murlsh/time_ago'
18
+ require 'murlsh/uri_ask'
19
+ require 'murlsh/uri'
20
+ require 'murlsh/url_body'
21
+ require 'murlsh/url'
22
+ require 'murlsh/url_server'
23
+ require 'murlsh/yaml_ordered_hash'